From d9d2157d3f9f93e2e649b81cdadc658c918e1caa Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 20 May 2026 12:14:49 +0200 Subject: [PATCH 1/2] feat: update code-server to 4.117 and reduce size --- lib/ThirdPartyNotices.txt | 214 +++++- lib/code.mjs | 2 +- lib/package.json | 28 +- package.json | 12 +- pnpm-lock.yaml | 1151 ++++++++++------------------- scripts/pack.ts | 13 +- scripts/sync.ts | 32 +- shims/README.md | 4 + shims/ssh2/index.js | 39 + shims/ssh2/package.json | 7 + shims/vscode-sqlite3/index.js | 117 +++ shims/vscode-sqlite3/package.json | 7 + 12 files changed, 847 insertions(+), 779 deletions(-) create mode 100644 shims/ssh2/index.js create mode 100644 shims/ssh2/package.json create mode 100644 shims/vscode-sqlite3/index.js create mode 100644 shims/vscode-sqlite3/package.json diff --git a/lib/ThirdPartyNotices.txt b/lib/ThirdPartyNotices.txt index df52547..e4cf351 100644 --- a/lib/ThirdPartyNotices.txt +++ b/lib/ThirdPartyNotices.txt @@ -375,6 +375,214 @@ DEALINGS IN THE SOFTWARE. --------------------------------------------------------- +codex +https://github.com/openai/codex + +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2025 OpenAI + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--------------------------------------------------------- + +--------------------------------------------------------- + Colorsublime-Themes 0.1.0 https://github.com/Colorsublime/Colorsublime-Themes @@ -528,7 +736,7 @@ dompurify 3.2.7 - Apache 2.0 https://github.com/cure53/DOMPurify DOMPurify -Copyright 2025 Dr.-Ing. Mario Heiderich, Cure53 +Copyright 2025-2026 Dr.-Ing. Mario Heiderich, Cure53 DOMPurify is free software; you can redistribute it and/or modify it under the terms of either: @@ -726,7 +934,7 @@ b) the Mozilla Public License Version 2.0 same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] +Copyright 2025-2026 Dr.-Ing. Mario Heiderich, Cure53 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -1985,7 +2193,7 @@ THE SOFTWARE. marked 14.0.0 - MIT https://github.com/markedjs/marked -information +# License information ## Contribution License Agreement diff --git a/lib/code.mjs b/lib/code.mjs index bd99c33..9994079 100644 --- a/lib/code.mjs +++ b/lib/code.mjs @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import { fileURLToPath } from "node:url"; // Auto-updated by scripts/pack.ts -const codeArchiveHash = "096c26773369f84b"; +const codeArchiveHash = "1a6179c4886bac82"; const archivePath = fileURLToPath(new URL("./code.tar.zst", import.meta.url)); diff --git a/lib/package.json b/lib/package.json index ac1f21e..18406aa 100644 --- a/lib/package.json +++ b/lib/package.json @@ -29,6 +29,7 @@ "build": "obuild" }, "devDependencies": { + "code-server": "^4.117.0", "@github/copilot": "workspace:*", "@github/copilot-sdk": "workspace:*", "@microsoft/1ds-core-js": "workspace:*", @@ -41,21 +42,21 @@ "@vscode/proxy-agent": "workspace:*", "@vscode/ripgrep": "workspace:*", "@vscode/spdlog": "workspace:*", - "@vscode/tree-sitter-wasm": "^0.3.0", + "@vscode/sqlite3": "workspace:*", + "@vscode/tree-sitter-wasm": "^0.3.1", "@vscode/vscode-languagedetection": "1.0.23", "@vscode/windows-process-tree": "workspace:*", "@vscode/windows-registry": "workspace:*", - "@xterm/addon-clipboard": "^0.3.0-beta.191", - "@xterm/addon-image": "^0.10.0-beta.191", - "@xterm/addon-ligatures": "^0.11.0-beta.191", - "@xterm/addon-progress": "^0.3.0-beta.191", - "@xterm/addon-search": "^0.17.0-beta.191", - "@xterm/addon-serialize": "^0.15.0-beta.191", - "@xterm/addon-unicode11": "^0.10.0-beta.191", - "@xterm/addon-webgl": "^0.20.0-beta.190", - "@xterm/headless": "^6.1.0-beta.191", - "@xterm/xterm": "^6.1.0-beta.191", - "code-server": "^4.114.1", + "@xterm/addon-clipboard": "^0.3.0-beta.197", + "@xterm/addon-image": "^0.10.0-beta.197", + "@xterm/addon-ligatures": "^0.11.0-beta.197", + "@xterm/addon-progress": "^0.3.0-beta.197", + "@xterm/addon-search": "^0.17.0-beta.197", + "@xterm/addon-serialize": "^0.15.0-beta.197", + "@xterm/addon-unicode11": "^0.10.0-beta.197", + "@xterm/addon-webgl": "^0.20.0-beta.196", + "@xterm/headless": "^6.1.0-beta.197", + "@xterm/xterm": "^6.1.0-beta.197", "cookie": "^0.7.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.2", @@ -65,8 +66,9 @@ "kerberos": "workspace:*", "minimist": "^1.2.8", "node-pty": "workspace:*", + "ssh2": "workspace:*", "tas-client": "0.3.1", - "typescript": "^6.0.2", + "typescript": "^6.0.3", "vscode-oniguruma": "1.7.0", "vscode-regexpp": "^3.1.0", "vscode-textmate": "^9.3.2", diff --git a/package.json b/package.json index 54cc90d..a7623e3 100644 --- a/package.json +++ b/package.json @@ -19,13 +19,13 @@ "typecheck": "tsgo --noEmit --skipLibCheck" }, "devDependencies": { - "@types/node": "^25.6.0", - "@typescript/native-preview": "^7.0.0-dev.20260422.1", + "@types/node": "^25.9.1", + "@typescript/native-preview": "7.0.0-dev.20260519.1", "changelogen": "^0.6.2", - "obuild": "^0.4.33", + "obuild": "^0.4.35", "oxfmt": "^0.46.0", - "oxlint": "^1.61.0", - "vitest": "^4.1.5" + "oxlint": "^1.66.0", + "vitest": "^4.1.7" }, "overrides": { "@github/copilot": "workspace:*", @@ -39,12 +39,14 @@ "@vscode/proxy-agent": "workspace:*", "@vscode/ripgrep": "workspace:*", "@vscode/spdlog": "workspace:*", + "@vscode/sqlite3": "workspace:*", "@vscode/windows-process-tree": "workspace:*", "@vscode/windows-registry": "workspace:*", "argon2": "workspace:*", "fsevents": "workspace:*", "kerberos": "workspace:*", "node-pty": "workspace:*", + "ssh2": "workspace:*", "vsda": "workspace:*" }, "pnpm": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4b3d57f..80f6a7f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,26 +14,26 @@ importers: .: devDependencies: '@types/node': - specifier: ^25.6.0 - version: 25.6.0 + specifier: ^25.9.1 + version: 25.9.1 '@typescript/native-preview': - specifier: ^7.0.0-dev.20260422.1 - version: 7.0.0-dev.20260422.1 + specifier: 7.0.0-dev.20260519.1 + version: 7.0.0-dev.20260519.1 changelogen: specifier: ^0.6.2 version: 0.6.2 obuild: - specifier: ^0.4.33 - version: 0.4.33(@typescript/native-preview@7.0.0-dev.20260422.1)(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.6.1)(picomatch@4.0.4)(rollup@4.60.1)(typescript@6.0.2) + specifier: ^0.4.35 + version: 0.4.35(@typescript/native-preview@7.0.0-dev.20260519.1)(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.7.0)(typescript@6.0.3) oxfmt: specifier: ^0.46.0 version: 0.46.0 oxlint: - specifier: ^1.61.0 - version: 1.61.0 + specifier: ^1.66.0 + version: 1.66.0 vitest: - specifier: ^4.1.5 - version: 4.1.5(@types/node@25.6.0)(vite@8.0.7(@types/node@25.6.0)(jiti@2.6.1)) + specifier: ^4.1.7 + version: 4.1.7(@types/node@25.9.1)(vite@8.0.7(@types/node@25.9.1)(jiti@2.7.0)) lib: devDependencies: @@ -73,8 +73,11 @@ importers: '@vscode/spdlog': specifier: workspace:* version: link:../shims/spdlog + '@vscode/sqlite3': + specifier: workspace:* + version: link:../shims/vscode-sqlite3 '@vscode/tree-sitter-wasm': - specifier: ^0.3.0 + specifier: ^0.3.1 version: 0.3.1 '@vscode/vscode-languagedetection': specifier: 1.0.23 @@ -86,38 +89,38 @@ importers: specifier: workspace:* version: link:../shims/vscode-windows-registry '@xterm/addon-clipboard': - specifier: ^0.3.0-beta.191 + specifier: ^0.3.0-beta.197 version: 0.3.0-beta.197(@xterm/xterm@6.1.0-beta.197) '@xterm/addon-image': - specifier: ^0.10.0-beta.191 + specifier: ^0.10.0-beta.197 version: 0.10.0-beta.197(@xterm/xterm@6.1.0-beta.197) '@xterm/addon-ligatures': - specifier: ^0.11.0-beta.191 + specifier: ^0.11.0-beta.197 version: 0.11.0-beta.197(@xterm/xterm@6.1.0-beta.197) '@xterm/addon-progress': - specifier: ^0.3.0-beta.191 + specifier: ^0.3.0-beta.197 version: 0.3.0-beta.197(@xterm/xterm@6.1.0-beta.197) '@xterm/addon-search': - specifier: ^0.17.0-beta.191 + specifier: ^0.17.0-beta.197 version: 0.17.0-beta.197(@xterm/xterm@6.1.0-beta.197) '@xterm/addon-serialize': - specifier: ^0.15.0-beta.191 + specifier: ^0.15.0-beta.197 version: 0.15.0-beta.197(@xterm/xterm@6.1.0-beta.197) '@xterm/addon-unicode11': - specifier: ^0.10.0-beta.191 + specifier: ^0.10.0-beta.197 version: 0.10.0-beta.197(@xterm/xterm@6.1.0-beta.197) '@xterm/addon-webgl': - specifier: ^0.20.0-beta.190 + specifier: ^0.20.0-beta.196 version: 0.20.0-beta.196(@xterm/xterm@6.1.0-beta.197) '@xterm/headless': - specifier: ^6.1.0-beta.191 + specifier: ^6.1.0-beta.197 version: 6.1.0-beta.197 '@xterm/xterm': - specifier: ^6.1.0-beta.191 + specifier: ^6.1.0-beta.197 version: 6.1.0-beta.197 code-server: - specifier: ^4.114.1 - version: 4.114.1(patch_hash=f27e6f7bc69f43c9eddb7727952e605173ad828b852080c65527053e72c260e9)(typescript@6.0.2) + specifier: ^4.117.0 + version: 4.117.0(patch_hash=f27e6f7bc69f43c9eddb7727952e605173ad828b852080c65527053e72c260e9)(typescript@6.0.3) cookie: specifier: ^0.7.0 version: 0.7.2 @@ -129,7 +132,7 @@ importers: version: 7.0.6 httpxy: specifier: ^0.5.0 - version: 0.5.0 + version: 0.5.2 jschardet: specifier: 3.1.4 version: 3.1.4 @@ -145,12 +148,15 @@ importers: node-pty: specifier: workspace:* version: link:../shims/node-pty + ssh2: + specifier: workspace:* + version: link:../shims/ssh2 tas-client: specifier: 0.3.1 version: 0.3.1 typescript: - specifier: ^6.0.2 - version: 6.0.2 + specifier: ^6.0.3 + version: 6.0.3 vscode-oniguruma: specifier: 1.7.0 version: 1.7.0 @@ -194,6 +200,8 @@ importers: shims/spdlog: {} + shims/ssh2: {} + shims/vscode-deviceid: {} shims/vscode-fs-copyfile: {} @@ -208,6 +216,8 @@ importers: specifier: ^0.3.1 version: 0.3.1 + shims/vscode-sqlite3: {} + shims/vscode-windows-registry: {} shims/vsda: {} @@ -216,30 +226,35 @@ importers: packages: - '@babel/generator@8.0.0-rc.3': - resolution: {integrity: sha512-em37/13/nR320G4jab/nIIHZgc2Wz2y/D39lxnTyxB4/D/omPQncl/lSdlnJY1OhQcRGugTSIF2l/69o31C9dA==} - engines: {node: ^20.19.0 || >=22.12.0} + '@babel/generator@8.0.0-rc.5': + resolution: {integrity: sha512-nFZPWz3FHIS7y6rMIVoa/WBwjdutfIaRJIBQjzn+t3RnecZoRNlGmGcyR2wb0T/IgSd50Kz/6dG8/LvMCRunjg==} + engines: {node: ^22.18.0 || >=24.11.0} - '@babel/helper-string-parser@8.0.0-rc.3': - resolution: {integrity: sha512-AmwWFx1m8G/a5cXkxLxTiWl+YEoWuoFLUCwqMlNuWO1tqAYITQAbCRPUkyBHv1VOFgfjVOqEj6L3u15J5ZCzTA==} - engines: {node: ^20.19.0 || >=22.12.0} + '@babel/helper-string-parser@8.0.0-rc.5': + resolution: {integrity: sha512-sN7R8rBvDurfaziNfDEIjIntlazmlkCDGO4SNl2RJ3wRCn+QxspLV7hzYAE8WWVd2joVuT8sUxeePdLp2idI1A==} + engines: {node: ^22.18.0 || >=24.11.0} - '@babel/helper-validator-identifier@8.0.0-rc.3': - resolution: {integrity: sha512-8AWCJ2VJJyDFlGBep5GpaaQ9AAaE/FjAcrqI7jyssYhtL7WGV0DOKpJsQqM037xDbpRLHXsY8TwU7zDma7coOw==} - engines: {node: ^20.19.0 || >=22.12.0} + '@babel/helper-validator-identifier@8.0.0-rc.5': + resolution: {integrity: sha512-ehJDxHvtbZ85RtX/L2fi0h9AGsBNqB5Euv1EB8RMAvGYvD+2X+QbpzzOpbklnNXO+WSZJNOaetw2BBj27xsWVg==} + engines: {node: ^22.18.0 || >=24.11.0} - '@babel/parser@8.0.0-rc.3': - resolution: {integrity: sha512-B20dvP3MfNc/XS5KKCHy/oyWl5IA6Cn9YjXRdDlCjNmUFrjvLXMNUfQq/QUy9fnG2gYkKKcrto2YaF9B32ToOQ==} + '@babel/parser@8.0.0-rc.4': + resolution: {integrity: sha512-0S/1yefMa15N4i2v3t8Fw9pgMHhf2gF6Lc1UEXI96Ls6FNAjqvHHZouZ2ZS/deqLhbMFtmfVeFac6iTsvFbLwA==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true + '@babel/parser@8.0.0-rc.5': + resolution: {integrity: sha512-/Mfg83rK3+jsRbl4Vbd0jqxc6M1A1/WNFtgrowRM1unEsD3XcNnrBdMM0JWakd0/RN9lseQKwPduW1TiEwKOlQ==} + engines: {node: ^22.18.0 || >=24.11.0} + hasBin: true + '@babel/runtime@7.29.2': resolution: {integrity: sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==} engines: {node: '>=6.9.0'} - '@babel/types@8.0.0-rc.3': - resolution: {integrity: sha512-mOm5ZrYmphGfqVWoH5YYMTITb3cDXsFgmvFlvkvWDMsR9X8RFnt7a0Wb6yNIdoFsiMO9WjYLq+U/FMtqIYAF8Q==} - engines: {node: ^20.19.0 || >=22.12.0} + '@babel/types@8.0.0-rc.5': + resolution: {integrity: sha512-JeSVu/m8x/zpp4CLjYHVNXuhEyOkhPXuxM8YOXjh6L4LlvQNKuUNOTo5KdBuKAcTDHw8DquToTaEkhsBqPXOaA==} + engines: {node: ^22.18.0 || >=24.11.0} '@coder/logger@3.0.1': resolution: {integrity: sha512-G/wWSaNZW8HvQZWXlXdbZbp/MOQBPH4W1AKSEI3PBfr0qc9G+pdLrXvm3XakQpNVqmD6WFAbLfcjdG0BuoAO0g==} @@ -287,8 +302,8 @@ packages: '@oxc-project/types@0.123.0': resolution: {integrity: sha512-YtECP/y8Mj1lSHiUWGSRzy/C6teUKlS87dEfuVKT09LgQbUsBW1rNg+MiJ4buGu3yuADV60gbIvo9/HplA56Ew==} - '@oxc-project/types@0.127.0': - resolution: {integrity: sha512-aIYXQBo4lCbO4z0R3FHeucQHpF46l2LbMdxRvqvuRuW2OxdnSkcng5B8+K12spgLDj93rtN3+J2Vac/TIO+ciQ==} + '@oxc-project/types@0.132.0': + resolution: {integrity: sha512-FESMOxil5Se014ui/Eq8fT5uHJo6nIRwH0PfJrZJXs6Gek3ZVFOrpUv3YIZT20m+extU98Hg1Ym72U58rlsxUQ==} '@oxfmt/binding-android-arm-eabi@0.46.0': resolution: {integrity: sha512-b1doV4WRcJU+BESSlCvCjV+5CEr/T6h0frArAdV26Nir+gGNFNaylvDiiMPfF1pxeV0txZEs38ojzJaxBYg+ng==} @@ -412,124 +427,124 @@ packages: cpu: [x64] os: [win32] - '@oxlint/binding-android-arm-eabi@1.61.0': - resolution: {integrity: sha512-6eZBPgiigK5txqoVgRqxbaxiom4lM8AP8CyKPPvpzKnQ3iFRFOIDc+0AapF+qsUSwjOzr5SGk4SxQDpQhkSJMQ==} + '@oxlint/binding-android-arm-eabi@1.66.0': + resolution: {integrity: sha512-f7kq8N51T4phpzqfBpA2qaVTI/KrkCmNwaj3t/97I/WLTDI+UhlP5GL9eER+zVxBhtlx5rKXWByJU1/zDAvyaw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [android] - '@oxlint/binding-android-arm64@1.61.0': - resolution: {integrity: sha512-CkwLR69MUnyv5wjzebvbbtTSUwqLxM35CXE79bHqDIK+NtKmPEUpStTcLQRZMCo4MP0qRT6TXIQVpK0ZVScnMA==} + '@oxlint/binding-android-arm64@1.66.0': + resolution: {integrity: sha512-xu6QO71tdDS9mjmLZ3AqhtaVHBvdmsOKkYnReNNDgh+XiwnsipeQOIxbiYOOO0iAXycJ+GK0wdMSZP/2j/AmSg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@oxlint/binding-darwin-arm64@1.61.0': - resolution: {integrity: sha512-8JbefTkbmvqkqWjmQrHke+MdpgT2UghhD/ktM4FOQSpGeCgbMToJEKdl9zwhr/YWTl92i4QI1KiTwVExpcUN8A==} + '@oxlint/binding-darwin-arm64@1.66.0': + resolution: {integrity: sha512-HZ24VimSOC7mxuEA99e0H2FS0C1yO3+iW13jPRAk+e2njsUs3QeAXsafCDyaIrV/MirdOVez+etQNQsJE43zNQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@oxlint/binding-darwin-x64@1.61.0': - resolution: {integrity: sha512-uWpoxDT47hTnDLcdEh5jVbso8rlTTu5o0zuqa9J8E0JAKmIWn7kGFEIB03Pycn2hd2vKxybPGLhjURy/9We5FQ==} + '@oxlint/binding-darwin-x64@1.66.0': + resolution: {integrity: sha512-awhj8ZvJrrRSnXj7V++rpZvTmnl99L6mi0B7gg7Cp7BN6cKpzuI481bHNLvXGA9GB1/oEgA3ponuyoAc6Md12A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@oxlint/binding-freebsd-x64@1.61.0': - resolution: {integrity: sha512-K/o4hEyW7flfMel0iBVznmMBt7VIMHGdjADocHKpK1DUF9erpWnJ+BSSWd2W0c8K3mPtpph+CuHzRU6CI3l9jQ==} + '@oxlint/binding-freebsd-x64@1.66.0': + resolution: {integrity: sha512-KQF0oVV21/FjIqkRuL8Q1vh8ECsE5+ocdH5tcqTQ4ZnYuDVoYibQUNfqBjQaUsP6UIIda5Y75Wpm5p4RgQWiWw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@oxlint/binding-linux-arm-gnueabihf@1.61.0': - resolution: {integrity: sha512-P6040ZkcyweJ0Po9yEFqJCdvZnf3VNCGs1SIHgXDf8AAQNC6ID/heXQs9iSgo2FH7gKaKq32VWc59XZwL34C5Q==} + '@oxlint/binding-linux-arm-gnueabihf@1.66.0': + resolution: {integrity: sha512-9u1rgwZSEXWb30vbFZzQ78HVXBo0WCKNwJ3a2InRUTNMRng+PUDIoSFmA+m4HdUfBaIqftShq8J8qHc+eE/Vig==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxlint/binding-linux-arm-musleabihf@1.61.0': - resolution: {integrity: sha512-bwxrGCzTZkuB+THv2TQ1aTkVEfv5oz8sl+0XZZCpoYzErJD8OhPQOTA0ENPd1zJz8QsVdSzSrS2umKtPq4/JXg==} + '@oxlint/binding-linux-arm-musleabihf@1.66.0': + resolution: {integrity: sha512-Ynot2HR1bHxUaNWoC280MVTDfZuaWuP3XfSMRDhyuZrVjhzoaBCVFlw8h8qeZjWKVUBhPWFIxB7AQTlK8Z2WWg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxlint/binding-linux-arm64-gnu@1.61.0': - resolution: {integrity: sha512-vkhb9/wKguMkLlrm3FoJW/Xmdv31GgYAE+x8lxxQ+7HeOxXUySI0q36a3NTVIuQUdLzxCI1zzMGsk1o37FOe3w==} + '@oxlint/binding-linux-arm64-gnu@1.66.0': + resolution: {integrity: sha512-xCbgzciGgo+A4aQZEknsNrNiIwY7sU5SfRuMmRjPIvZAgdF34cIHiKvwOsS5XRLjlTVSFwitmq6YclTtHTfU+g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [glibc] - '@oxlint/binding-linux-arm64-musl@1.61.0': - resolution: {integrity: sha512-bl1dQh8LnVqsj6oOQAcxwbuOmNJkwc4p6o//HTBZhNTzJy21TLDwAviMqUFNUxDHkPGpmdKTSN4tWTjLryP8xg==} + '@oxlint/binding-linux-arm64-musl@1.66.0': + resolution: {integrity: sha512-hmo+ZB/lHkR1HdDmnziNpzSLmulnUSu10VEqX2Yex7OwvoBAbjJQLvy4gIBRV3AAwWnCvAxKp5Nv1GE6LU1QMg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] libc: [musl] - '@oxlint/binding-linux-ppc64-gnu@1.61.0': - resolution: {integrity: sha512-QoOX6KB2IiEpyOj/HKqaxi+NQHPnOgNgnr22n9N4ANJCzXkUlj1UmeAbFb4PpqdlHIzvGDM5xZ0OKtcLq9RhiQ==} + '@oxlint/binding-linux-ppc64-gnu@1.66.0': + resolution: {integrity: sha512-2Invd4Uyy81mVooQC5FBtfxSNrvcX1OxbMlVQ6M2erRrNI2awFYF26YNW2yFxdVFZ4ffNOWKghtMjhnUPsXsVA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] libc: [glibc] - '@oxlint/binding-linux-riscv64-gnu@1.61.0': - resolution: {integrity: sha512-1TGcTerjY6p152wCof3oKElccq3xHljS/Mucp04gV/4ATpP6nO7YNnp7opEg6SHkv2a57/b4b8Ndm9znJ1/qAw==} + '@oxlint/binding-linux-riscv64-gnu@1.66.0': + resolution: {integrity: sha512-s0iXPDQVdgayE3RGa/N2DZF7tjgg0TwEtD1sGoDxqPDGrIXgo45H0yHknT0f9A0yteASsweYZtDyTuVlM4aSag==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] libc: [glibc] - '@oxlint/binding-linux-riscv64-musl@1.61.0': - resolution: {integrity: sha512-65wXEmZIrX2ADwC8i/qFL4EWLSbeuBpAm3suuX1vu4IQkKd+wLT/HU/BOl84kp91u2SxPkPDyQgu4yrqp8vwVA==} + '@oxlint/binding-linux-riscv64-musl@1.66.0': + resolution: {integrity: sha512-OekL4XFiu7RPK0JIZi8VeHgtIXPREf42t8Cy/rKEsC+P3gcqDgNAAGiyuUOpdbG4wwbfue1q4CHcCO7spSve6w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] libc: [musl] - '@oxlint/binding-linux-s390x-gnu@1.61.0': - resolution: {integrity: sha512-TVvhgMvor7Qa6COeXxCJ7ENOM+lcAOGsQ0iUdPSCv2hxb9qSHLQ4XF1h50S6RE1gBOJ0WV3rNukg4JJJP1LWRA==} + '@oxlint/binding-linux-s390x-gnu@1.66.0': + resolution: {integrity: sha512-Ga1D0kj1SFslm34ThA/BdkUlyAYEnTsXyRC4pF0C5agZSwtGdHYWMTQWemUfBGp4RCG4QWXgdO+HmmmKqOtlBg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] libc: [glibc] - '@oxlint/binding-linux-x64-gnu@1.61.0': - resolution: {integrity: sha512-SjpS5uYuFoDnDdZPwZE59ndF95AsY47R5MliuneTWR1pDm2CxGJaYXbKULI71t5TVfLQUWmrHEGRL9xvuq6dnA==} + '@oxlint/binding-linux-x64-gnu@1.66.0': + resolution: {integrity: sha512-p5jfP1wUZe/IC3qpQO84n9DRnf9g3lKRtLBlQq23ykyrDglHcVx7sWmVTlPuU6SBw8mNnPzyOn022G3XZHnlww==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [glibc] - '@oxlint/binding-linux-x64-musl@1.61.0': - resolution: {integrity: sha512-gGfAeGD4sNJGILZbc/yKcIimO9wQnPMoYp9swAaKeEtwsSQAbU+rsdQze5SBtIP6j0QDzeYd4XSSUCRCF+LIeQ==} + '@oxlint/binding-linux-x64-musl@1.66.0': + resolution: {integrity: sha512-vUB/sYlYZorDL1ZD+o9mRv7zbsykrrFRtmgS6R8musZqLtrPRQn1gc1eGpuX+sfdccz42STl/AqldY6XRb2upQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] libc: [musl] - '@oxlint/binding-openharmony-arm64@1.61.0': - resolution: {integrity: sha512-OlVT0LrG/ct33EVtWRyR+B/othwmDWeRxfi13wUdPeb3lAT5TgTcFDcfLfarZtzB4W1nWF/zICMgYdkggX2WmQ==} + '@oxlint/binding-openharmony-arm64@1.66.0': + resolution: {integrity: sha512-yde+6p/F59xRkGR9H1HfngWRif1QRJjynZK349l+UI0H6w9hL3G8/AVaTHFyTtLVQ56qtNbX2/5Dc77n1ovnOg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@oxlint/binding-win32-arm64-msvc@1.61.0': - resolution: {integrity: sha512-vI//NZPJk6DToiovPtaiwD4iQ7kO1r5ReWQD0sOOyKRtP3E2f6jxin4uvwi3OvDzHA2EFfd7DcZl5dtkQh7g1w==} + '@oxlint/binding-win32-arm64-msvc@1.66.0': + resolution: {integrity: sha512-O9GLucgoTdmOrbBX+EjzNe7o/Ze5TFOvXcib6bzUOtBOmj6cV+zw18NgB+cGKAkDw1Pdqs8vGkfHbbsLuDtXWg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@oxlint/binding-win32-ia32-msvc@1.61.0': - resolution: {integrity: sha512-0ySj4/4zd2XjePs3XAQq7IigIstN4LPQZgCyigX5/ERMLjdWAJfnxcTsrtxZxuij8guJW8foXuHmhGxW0H4dDA==} + '@oxlint/binding-win32-ia32-msvc@1.66.0': + resolution: {integrity: sha512-m3Pjwc2MfTcom4E4gOv7DyuGyt7OfGNCbmqDHd+N7EzXmP+ppHuudm2NjcA3AjV5TSeGxaguVF4SbTKHe1USYA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@oxlint/binding-win32-x64-msvc@1.61.0': - resolution: {integrity: sha512-0xgSiyeqDLDZxXoe9CVJrOx3TUVsfyoOY7cNi03JbItNcC9WCZqrSNdrAbHONxhSPaVh/lzfnDcON1RqSUMhHw==} + '@oxlint/binding-win32-x64-msvc@1.66.0': + resolution: {integrity: sha512-/DbBvw8UFBhja6PqudUjV4UtfsJr0Oa7jUjWVKB0g86lj/VwnPrkngn0sFql3c9RDA0O16dh7ozsXb6GjNAzBQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] @@ -544,8 +559,8 @@ packages: cpu: [arm64] os: [android] - '@rolldown/binding-android-arm64@1.0.0-rc.17': - resolution: {integrity: sha512-s70pVGhw4zqGeFnXWvAzJDlvxhlRollagdCCKRgOsgUOH3N1l0LIxf83AtGzmb5SiVM4Hjl5HyarMRfdfj3DaQ==} + '@rolldown/binding-android-arm64@1.0.2': + resolution: {integrity: sha512-ZS4D1JPGn/MYQN/SYDWftIE/nVsM8j/AFOYEzAoOE2O3NktQOZru+/vYXGbR/qtdLdIfGCP0lcoJiYVzsEz+iQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] @@ -556,8 +571,8 @@ packages: cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-arm64@1.0.0-rc.17': - resolution: {integrity: sha512-4ksWc9n0mhlZpZ9PMZgTGjeOPRu8MB1Z3Tz0Mo02eWfWCHMW1zN82Qz/pL/rC+yQa+8ZnutMF0JjJe7PjwasYw==} + '@rolldown/binding-darwin-arm64@1.0.2': + resolution: {integrity: sha512-vdFA9+C/rekyGce7WqHs/xoT0ioZEWaOFyZLIV1mEeNFaFDUQrPIo8Vs2GvJ6eetb3rzDUtUBgzto3ExpXJB3w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] @@ -568,8 +583,8 @@ packages: cpu: [x64] os: [darwin] - '@rolldown/binding-darwin-x64@1.0.0-rc.17': - resolution: {integrity: sha512-SUSDOI6WwUVNcWxd02QEBjLdY1VPHvlEkw6T/8nYG322iYWCTxRb1vzk4E+mWWYehTp7ERibq54LSJGjmouOsw==} + '@rolldown/binding-darwin-x64@1.0.2': + resolution: {integrity: sha512-BewSOwTHazv77DTYiAZXSqqKZ4KP/KonFisDMVU7PImxoWfB2aepnPhd2E4SWz3zDzYgDNbs6jBmTdgNnF02GA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] @@ -580,8 +595,8 @@ packages: cpu: [x64] os: [freebsd] - '@rolldown/binding-freebsd-x64@1.0.0-rc.17': - resolution: {integrity: sha512-hwnz3nw9dbJ05EDO/PvcjaaewqqDy7Y1rn1UO81l8iIK1GjenME75dl16ajbvSSMfv66WXSRCYKIqfgq2KCfxw==} + '@rolldown/binding-freebsd-x64@1.0.2': + resolution: {integrity: sha512-m41o7M0YWtUdqk61Tb+jnKb2rN++iRdIASlExkUoKfIAH30DOHCB8fVLzSUpbWHHU8esmEioY62PxzexE8MBuA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] @@ -592,8 +607,8 @@ packages: cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-rc.17': - resolution: {integrity: sha512-IS+W7epTcwANmFSQFrS1SivEXHtl1JtuQA9wlxrZTcNi6mx+FDOYrakGevvvTwgj2JvWiK8B29/qD9BELZPyXQ==} + '@rolldown/binding-linux-arm-gnueabihf@1.0.2': + resolution: {integrity: sha512-jcojB9H7W/jS29pMKWAK1N+fU99vXodHDTatS3b3y/XSOCiHo0kkA74pL3jJmkoQtYpOCxDvaKs1fo2Ij/1X5w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] @@ -605,8 +620,8 @@ packages: os: [linux] libc: [glibc] - '@rolldown/binding-linux-arm64-gnu@1.0.0-rc.17': - resolution: {integrity: sha512-e6usGaHKW5BMNZOymS1UcEYGowQMWcgZ71Z17Sl/h2+ZziNJ1a9n3Zvcz6LdRyIW5572wBCTH/Z+bKuZouGk9Q==} + '@rolldown/binding-linux-arm64-gnu@1.0.2': + resolution: {integrity: sha512-1jn6qDU5iiOgFgygDzKUuKP0maTi0/f1+sBLgvij/76C77Nm3ts6ufz9Bjg5q5dduxiUIxtq86JIoBvo1xQ4Ig==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] @@ -619,8 +634,8 @@ packages: os: [linux] libc: [musl] - '@rolldown/binding-linux-arm64-musl@1.0.0-rc.17': - resolution: {integrity: sha512-b/CgbwAJpmrRLp02RPfhbudf5tZnN9nsPWK82znefso832etkem8H7FSZwxrOI9djcdTP7U6YfNhbRnh7djErg==} + '@rolldown/binding-linux-arm64-musl@1.0.2': + resolution: {integrity: sha512-QVLO/czFMdoMFSqlX3bcswcJNm/23r+qoa/jgtmFc/qEp6/jXmIkDjF/XIo8dPfGaiwy1xfQn8o77L79GeXFgw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] @@ -633,8 +648,8 @@ packages: os: [linux] libc: [glibc] - '@rolldown/binding-linux-ppc64-gnu@1.0.0-rc.17': - resolution: {integrity: sha512-4EII1iNGRUN5WwGbF/kOh/EIkoDN9HsupgLQoXfY+D1oyJm7/F4t5PYU5n8SWZgG0FEwakyM8pGgwcBYruGTlA==} + '@rolldown/binding-linux-ppc64-gnu@1.0.2': + resolution: {integrity: sha512-hgO5Abm0w5UL6FEa2iFnZqo2KlK7TQ5QhV5x09hujBf7t5KzHQ1VmfPuTpqRy/rNlSxua3eWH374xxiVrP+lcA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] @@ -647,8 +662,8 @@ packages: os: [linux] libc: [glibc] - '@rolldown/binding-linux-s390x-gnu@1.0.0-rc.17': - resolution: {integrity: sha512-AH8oq3XqQo4IibpVXvPeLDI5pzkpYn0WiZAfT05kFzoJ6tQNzwRdDYQ45M8I/gslbodRZwW8uxLhbSBbkv96rA==} + '@rolldown/binding-linux-s390x-gnu@1.0.2': + resolution: {integrity: sha512-fy8rXxuYEu602abC8MUNaPjYLIFzReOaEIEMKMUa0rFEUxNpVXhs15KSSQ4qlqSaM7B6rcj9rDZgADh/IGDzLQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] @@ -661,8 +676,8 @@ packages: os: [linux] libc: [glibc] - '@rolldown/binding-linux-x64-gnu@1.0.0-rc.17': - resolution: {integrity: sha512-cLnjV3xfo7KslbU41Z7z8BH/E1y5mzUYzAqih1d1MDaIGZRCMqTijqLv76/P7fyHuvUcfGsIpqCdddbxLLK9rA==} + '@rolldown/binding-linux-x64-gnu@1.0.2': + resolution: {integrity: sha512-0+bOkiQ779+r1WpoHOWHqncvyySci0vKph+myNDYb+im6meJAzHQXay6oEgnkHuUGouM1LKTZwqKpBow6Kj7CQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] @@ -675,8 +690,8 @@ packages: os: [linux] libc: [musl] - '@rolldown/binding-linux-x64-musl@1.0.0-rc.17': - resolution: {integrity: sha512-0phclDw1spsL7dUB37sIARuis2tAgomCJXAHZlpt8PXZ4Ba0dRP1e+66lsRqrfhISeN9bEGNjQs+T/Fbd7oYGw==} + '@rolldown/binding-linux-x64-musl@1.0.2': + resolution: {integrity: sha512-mjSkrzZK5Qsl0a9d1JgILOiuZOSDTVdKENcSXBoqbzSrspLR/4/IRVDo5wd2GgZjNss/viBFJdeq+j7qH2nypw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] @@ -688,8 +703,8 @@ packages: cpu: [arm64] os: [openharmony] - '@rolldown/binding-openharmony-arm64@1.0.0-rc.17': - resolution: {integrity: sha512-0ag/hEgXOwgw4t8QyQvUCxvEg+V0KBcA6YuOx9g0r02MprutRF5dyljgm3EmR02O292UX7UeS6HzWHAl6KgyhA==} + '@rolldown/binding-openharmony-arm64@1.0.2': + resolution: {integrity: sha512-1v5vHasdfQAZoEHakBV72LIFAC9JjnymsiKxp+GEr/ma3+NJCPSaYK+qavInOovJkgwFrs7GccX2d6IgDA3Z5w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] @@ -699,8 +714,8 @@ packages: engines: {node: '>=14.0.0'} cpu: [wasm32] - '@rolldown/binding-wasm32-wasi@1.0.0-rc.17': - resolution: {integrity: sha512-LEXei6vo0E5wTGwpkJ4KoT3OZJRnglwldt5ziLzOlc6qqb55z4tWNq2A+PFqCJuvWWdP53CVhG1Z9NtToDPJrA==} + '@rolldown/binding-wasm32-wasi@1.0.2': + resolution: {integrity: sha512-mb1VobWn6NheziTk5/WEaR6AKVbrwT5sOi6C7zk3gy/pD1qtJfU1j4PgTo2NJnOtbL9Dl3Aeei8w9jJ7qC2jZQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [wasm32] @@ -710,8 +725,8 @@ packages: cpu: [arm64] os: [win32] - '@rolldown/binding-win32-arm64-msvc@1.0.0-rc.17': - resolution: {integrity: sha512-gUmyzBl3SPMa6hrqFUth9sVfcLBlYsbMzBx5PlexMroZStgzGqlZ26pYG89rBb45Mnia+oil6YAIFeEWGWhoZA==} + '@rolldown/binding-win32-arm64-msvc@1.0.2': + resolution: {integrity: sha512-SqKonF56vA/L2yHwHYcEp2P34URpOZ7d1fS635cTkpDnUtEGdUbhI6NzsPdqeSWvAAeGDrxjWjNmibDIdFf9/A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] @@ -722,8 +737,8 @@ packages: cpu: [x64] os: [win32] - '@rolldown/binding-win32-x64-msvc@1.0.0-rc.17': - resolution: {integrity: sha512-3hkiolcUAvPB9FLb3UZdfjVVNWherN1f/skkGWJP/fgSQhYUZpSIRr0/I8ZK9TkF3F7kxvJAk0+IcKvPHk9qQg==} + '@rolldown/binding-win32-x64-msvc@1.0.2': + resolution: {integrity: sha512-v7qRI7gXLRINcOGXt+7YmAZ6iFuyZVMIoXAxhd8oP+DR9dLfL9GfNIx7PLMxmhZdvq8waUJBQiWN9EKNy+TRBQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] @@ -731,146 +746,8 @@ packages: '@rolldown/pluginutils@1.0.0-rc.13': resolution: {integrity: sha512-3ngTAv6F/Py35BsYbeeLeecvhMKdsKm4AoOETVhAA+Qc8nrA2I0kF7oa93mE9qnIurngOSpMnQ0x2nQY2FPviA==} - '@rolldown/pluginutils@1.0.0-rc.17': - resolution: {integrity: sha512-n8iosDOt6Ig1UhJ2AYqoIhHWh/isz0xpicHTzpKBeotdVsTEcxsSA/i3EVM7gQAj0rU27OLAxCjzlj15IWY7bg==} - - '@rollup/rollup-android-arm-eabi@4.60.1': - resolution: {integrity: sha512-d6FinEBLdIiK+1uACUttJKfgZREXrF0Qc2SmLII7W2AD8FfiZ9Wjd+rD/iRuf5s5dWrr1GgwXCvPqOuDquOowA==} - cpu: [arm] - os: [android] - - '@rollup/rollup-android-arm64@4.60.1': - resolution: {integrity: sha512-YjG/EwIDvvYI1YvYbHvDz/BYHtkY4ygUIXHnTdLhG+hKIQFBiosfWiACWortsKPKU/+dUwQQCKQM3qrDe8c9BA==} - cpu: [arm64] - os: [android] - - '@rollup/rollup-darwin-arm64@4.60.1': - resolution: {integrity: sha512-mjCpF7GmkRtSJwon+Rq1N8+pI+8l7w5g9Z3vWj4T7abguC4Czwi3Yu/pFaLvA3TTeMVjnu3ctigusqWUfjZzvw==} - cpu: [arm64] - os: [darwin] - - '@rollup/rollup-darwin-x64@4.60.1': - resolution: {integrity: sha512-haZ7hJ1JT4e9hqkoT9R/19XW2QKqjfJVv+i5AGg57S+nLk9lQnJ1F/eZloRO3o9Scy9CM3wQ9l+dkXtcBgN5Ew==} - cpu: [x64] - os: [darwin] - - '@rollup/rollup-freebsd-arm64@4.60.1': - resolution: {integrity: sha512-czw90wpQq3ZsAVBlinZjAYTKduOjTywlG7fEeWKUA7oCmpA8xdTkxZZlwNJKWqILlq0wehoZcJYfBvOyhPTQ6w==} - cpu: [arm64] - os: [freebsd] - - '@rollup/rollup-freebsd-x64@4.60.1': - resolution: {integrity: sha512-KVB2rqsxTHuBtfOeySEyzEOB7ltlB/ux38iu2rBQzkjbwRVlkhAGIEDiiYnO2kFOkJp+Z7pUXKyrRRFuFUKt+g==} - cpu: [x64] - os: [freebsd] - - '@rollup/rollup-linux-arm-gnueabihf@4.60.1': - resolution: {integrity: sha512-L+34Qqil+v5uC0zEubW7uByo78WOCIrBvci69E7sFASRl0X7b/MB6Cqd1lky/CtcSVTydWa2WZwFuWexjS5o6g==} - cpu: [arm] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-arm-musleabihf@4.60.1': - resolution: {integrity: sha512-n83O8rt4v34hgFzlkb1ycniJh7IR5RCIqt6mz1VRJD6pmhRi0CXdmfnLu9dIUS6buzh60IvACM842Ffb3xd6Gg==} - cpu: [arm] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-arm64-gnu@4.60.1': - resolution: {integrity: sha512-Nql7sTeAzhTAja3QXeAI48+/+GjBJ+QmAH13snn0AJSNL50JsDqotyudHyMbO2RbJkskbMbFJfIJKWA6R1LCJQ==} - cpu: [arm64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-arm64-musl@4.60.1': - resolution: {integrity: sha512-+pUymDhd0ys9GcKZPPWlFiZ67sTWV5UU6zOJat02M1+PiuSGDziyRuI/pPue3hoUwm2uGfxdL+trT6Z9rxnlMA==} - cpu: [arm64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-loong64-gnu@4.60.1': - resolution: {integrity: sha512-VSvgvQeIcsEvY4bKDHEDWcpW4Yw7BtlKG1GUT4FzBUlEKQK0rWHYBqQt6Fm2taXS+1bXvJT6kICu5ZwqKCnvlQ==} - cpu: [loong64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-loong64-musl@4.60.1': - resolution: {integrity: sha512-4LqhUomJqwe641gsPp6xLfhqWMbQV04KtPp7/dIp0nzPxAkNY1AbwL5W0MQpcalLYk07vaW9Kp1PBhdpZYYcEw==} - cpu: [loong64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-ppc64-gnu@4.60.1': - resolution: {integrity: sha512-tLQQ9aPvkBxOc/EUT6j3pyeMD6Hb8QF2BTBnCQWP/uu1lhc9AIrIjKnLYMEroIz/JvtGYgI9dF3AxHZNaEH0rw==} - cpu: [ppc64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-ppc64-musl@4.60.1': - resolution: {integrity: sha512-RMxFhJwc9fSXP6PqmAz4cbv3kAyvD1etJFjTx4ONqFP9DkTkXsAMU4v3Vyc5BgzC+anz7nS/9tp4obsKfqkDHg==} - cpu: [ppc64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-riscv64-gnu@4.60.1': - resolution: {integrity: sha512-QKgFl+Yc1eEk6MmOBfRHYF6lTxiiiV3/z/BRrbSiW2I7AFTXoBFvdMEyglohPj//2mZS4hDOqeB0H1ACh3sBbg==} - cpu: [riscv64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-riscv64-musl@4.60.1': - resolution: {integrity: sha512-RAjXjP/8c6ZtzatZcA1RaQr6O1TRhzC+adn8YZDnChliZHviqIjmvFwHcxi4JKPSDAt6Uhf/7vqcBzQJy0PDJg==} - cpu: [riscv64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-s390x-gnu@4.60.1': - resolution: {integrity: sha512-wcuocpaOlaL1COBYiA89O6yfjlp3RwKDeTIA0hM7OpmhR1Bjo9j31G1uQVpDlTvwxGn2nQs65fBFL5UFd76FcQ==} - cpu: [s390x] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-x64-gnu@4.60.1': - resolution: {integrity: sha512-77PpsFQUCOiZR9+LQEFg9GClyfkNXj1MP6wRnzYs0EeWbPcHs02AXu4xuUbM1zhwn3wqaizle3AEYg5aeoohhg==} - cpu: [x64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-x64-musl@4.60.1': - resolution: {integrity: sha512-5cIATbk5vynAjqqmyBjlciMJl1+R/CwX9oLk/EyiFXDWd95KpHdrOJT//rnUl4cUcskrd0jCCw3wpZnhIHdD9w==} - cpu: [x64] - os: [linux] - libc: [musl] - - '@rollup/rollup-openbsd-x64@4.60.1': - resolution: {integrity: sha512-cl0w09WsCi17mcmWqqglez9Gk8isgeWvoUZ3WiJFYSR3zjBQc2J5/ihSjpl+VLjPqjQ/1hJRcqBfLjssREQILw==} - cpu: [x64] - os: [openbsd] - - '@rollup/rollup-openharmony-arm64@4.60.1': - resolution: {integrity: sha512-4Cv23ZrONRbNtbZa37mLSueXUCtN7MXccChtKpUnQNgF010rjrjfHx3QxkS2PI7LqGT5xXyYs1a7LbzAwT0iCA==} - cpu: [arm64] - os: [openharmony] - - '@rollup/rollup-win32-arm64-msvc@4.60.1': - resolution: {integrity: sha512-i1okWYkA4FJICtr7KpYzFpRTHgy5jdDbZiWfvny21iIKky5YExiDXP+zbXzm3dUcFpkEeYNHgQ5fuG236JPq0g==} - cpu: [arm64] - os: [win32] - - '@rollup/rollup-win32-ia32-msvc@4.60.1': - resolution: {integrity: sha512-u09m3CuwLzShA0EYKMNiFgcjjzwqtUMLmuCJLeZWjjOYA3IT2Di09KaxGBTP9xVztWyIWjVdsB2E9goMjZvTQg==} - cpu: [ia32] - os: [win32] - - '@rollup/rollup-win32-x64-gnu@4.60.1': - resolution: {integrity: sha512-k+600V9Zl1CM7eZxJgMyTUzmrmhB/0XZnF4pRypKAlAgxmedUA+1v9R+XOFv56W4SlHEzfeMtzujLJD22Uz5zg==} - cpu: [x64] - os: [win32] - - '@rollup/rollup-win32-x64-msvc@4.60.1': - resolution: {integrity: sha512-lWMnixq/QzxyhTV6NjQJ4SFo1J6PvOX8vUx5Wb4bBPsEb+8xZ89Bz6kOXpfXj9ak9AHTQVQzlgzBEc1SyM27xQ==} - cpu: [x64] - os: [win32] + '@rolldown/pluginutils@1.0.1': + resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} @@ -878,8 +755,8 @@ packages: '@tootallnate/quickjs-emscripten@0.23.0': resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} - '@tybys/wasm-util@0.10.1': - resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} + '@tybys/wasm-util@0.10.2': + resolution: {integrity: sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==} '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} @@ -887,59 +764,67 @@ packages: '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} - '@types/estree@1.0.8': - resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + '@types/estree@1.0.9': + resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} '@types/jsesc@2.5.1': resolution: {integrity: sha512-9VN+6yxLOPLOav+7PwjZbxiID2bVaeq0ED4qSQmdQTdjnXJSaCVKTR58t15oqH1H5t8Ng2ZX1SabJVoN9Q34bw==} - '@types/node@25.6.0': - resolution: {integrity: sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==} + '@types/node@25.9.1': + resolution: {integrity: sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg==} - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-W/lGgoEfbdI/QWYqcNP0fSa4DHQKKEMLzDPsE6fA64zmfCNsTO9M7ttK0acKiLsGB16pr0lubuMDRNN5kXyQ8w==} + '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-c9zdG6sGJf25Jpz04JgE23zhYeprqFypDGuqiX94yMTvR8IWXjq3R2oMnim66YLBDon/V1nCEy6cFixeSd/4fg==} + engines: {node: '>=16.20.0'} cpu: [arm64] os: [darwin] - '@typescript/native-preview-darwin-x64@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-6tZ2yAcKLBIghwKyC74vDqb/7rB99fTpERv9f64iA1tMh6l+WHIuQb6z3mIFVOYBIl2pN9CYasURLroKYtUz1w==} + '@typescript/native-preview-darwin-x64@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-N16V3wiM0tsNmSSA7nZrxqXXt5OCJxBwiCVn35rnA7fr4WzJw6rJmwf9heNNhZ6Gh4ne3+Pexajf5akzuHR75Q==} + engines: {node: '>=16.20.0'} cpu: [x64] os: [darwin] - '@typescript/native-preview-linux-arm64@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-7HL4E7kP0ociYB8R4+QuIbzfT3pjdesNY+ax/q6fP3IMd3/QNAL/qsm/NaokjXke+I7uYxKqQ8Qo/t5MSv/r+A==} + '@typescript/native-preview-linux-arm64@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-ltf91vAwKdbu0SlRQbFgi1h5ZrLLrBn6a4qIeN2VILGbtYrCXnARHRznLBv81yUETQ7aVr/LSQcmsWo1ejCK0w==} + engines: {node: '>=16.20.0'} cpu: [arm64] os: [linux] - '@typescript/native-preview-linux-arm@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-EWP1Jq2I8MMSkoF9D6ztXgRmnUy2KcaZfL9FYcdm3Am6ZYuI6/SCR3HVIVYbaixAJXe/qUh5MN3LzJbl/4hefQ==} + '@typescript/native-preview-linux-arm@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-8v4BExeeuCTrhaSGfeIJqm3qQkTzlZix/Qd/FkPlWoz9f7d7COvXb3Z4qhbaVolL0MMnUvQ7m005Z4kYsZ645A==} + engines: {node: '>=16.20.0'} cpu: [arm] os: [linux] - '@typescript/native-preview-linux-x64@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-fDqkLf2Hv7X1Cy1B5OMcljPt/+8GpnTxFM9rDCFrYAPgOolIQJ9qwkb+xGfvAtxkkE5sZIvGPcqjP9PWQHt2qw==} + '@typescript/native-preview-linux-x64@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-AVD0tczTtFCHNa4RQRVPvu8Hnw4P3hQ+OlUAjnz/lHowvc6o1pYB46elMqfDuaoWqIpv+EAkAPP4ipFCofJ5IA==} + engines: {node: '>=16.20.0'} cpu: [x64] os: [linux] - '@typescript/native-preview-win32-arm64@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-l1tDnyNQSqxFkKz683dD8EORQtcQqZyWkTDnRtHmaPg2mTRxhxSekL/HcsHx/1/DoGTfl310O+CmXzd2mTq3pQ==} + '@typescript/native-preview-win32-arm64@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-TM+qatljyejqjHevCta3WIH53i0oGC7K8SoJ6t+mf4cGMTpZTyd7NhC1ts7e6/aydZnG53Bsta2iQi1SMIlQEw==} + engines: {node: '>=16.20.0'} cpu: [arm64] os: [win32] - '@typescript/native-preview-win32-x64@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-VQbDQlp1bjV5nnHagQLXQAhid3S48l1OToIBjvqlw18s0V0YSgoyNL6E/rE7FBdkGrTLf/rtKjo42IZnt3tvqA==} + '@typescript/native-preview-win32-x64@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-r9LEsoY7JC/82gXo8hlOmpQaUXcqmngCVOv+mUx1UeMt9f+1S6oNO0W48o75mlBqqC7jfcMHqw8YS4LfVxPRGw==} + engines: {node: '>=16.20.0'} cpu: [x64] os: [win32] - '@typescript/native-preview@7.0.0-dev.20260422.1': - resolution: {integrity: sha512-8CR8zHFlLpSL5OXY4Wbz2DmiDOoat1JBMkydZUHwQIS4cpoTN7SHjk2BN8i51XHUy0jMF5airL0TlY3GOfZmKg==} + '@typescript/native-preview@7.0.0-dev.20260519.1': + resolution: {integrity: sha512-VVER7vFUDdfm5k3jbH5765tVEJa7+0rTUkFeXyGYrXPxpw9BIjA0QDxdtdlRyaU8MCZV9IKZUo6doxeAQRAjPg==} + engines: {node: '>=16.20.0'} hasBin: true - '@vitest/expect@4.1.5': - resolution: {integrity: sha512-PWBaRY5JoKuRnHlUHfpV/KohFylaDZTupcXN1H9vYryNLOnitSw60Mw9IAE2r67NbwwzBw/Cc/8q9BK3kIX8Kw==} + '@vitest/expect@4.1.7': + resolution: {integrity: sha512-1R+tw0ortHEbZDGMymm+pN7/AFQ/RkFFdtd7EN+VBpynKmLbP8A3rpEXdshBJ7+8hQ9zBJh/i1s0yKNtxAnU7w==} - '@vitest/mocker@4.1.5': - resolution: {integrity: sha512-/x2EmFC4mT4NNzqvC3fmesuV97w5FC903KPmey4gsnJiMQ3Be1IlDKVaDaG8iqaLFHqJ2FVEkxZk5VmeLjIItw==} + '@vitest/mocker@4.1.7': + resolution: {integrity: sha512-vY7nuamKgfvpA1Koa3oYIw/k7D6kZnpGyNMZW8loow2bsBYla1TFdqTaXncWdRn4pgwNs+90RhnXhJScDwQeJA==} peerDependencies: msw: ^2.4.9 vite: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -949,20 +834,20 @@ packages: vite: optional: true - '@vitest/pretty-format@4.1.5': - resolution: {integrity: sha512-7I3q6l5qr03dVfMX2wCo9FxwSJbPdwKjy2uu/YPpU3wfHvIL4QHwVRp57OfGrDFeUJ8/8QdfBKIV12FTtLn00g==} + '@vitest/pretty-format@4.1.7': + resolution: {integrity: sha512-umgCarTOYQWIaDMvGDRZij+6b9oVeLIyJzfN+AS88e0ZOU3QTgNNSTtjQOpcvWr3np1N0j4WgZj+sb3oYBDscw==} - '@vitest/runner@4.1.5': - resolution: {integrity: sha512-2D+o7Pr82IEO46YPpoA/YU0neeyr6FTerQb5Ro7BUnBuv6NQtT/kmVnczngiMEBhzgqz2UZYl5gArejsyERDSQ==} + '@vitest/runner@4.1.7': + resolution: {integrity: sha512-BapjmAQ2aI78WdMEfeUWivnfVzB+VPGwWRQcJE0OUq7qEeEcBsCSf+0T5iREBNE5nBb4wA5Ya0W6IA+sghdEFw==} - '@vitest/snapshot@4.1.5': - resolution: {integrity: sha512-zypXEt4KH/XgKGPUz4eC2AvErYx0My5hfL8oDb1HzGFpEk1P62bxSohdyOmvz+d9UJwanI68MKwr2EquOaOgMQ==} + '@vitest/snapshot@4.1.7': + resolution: {integrity: sha512-ZacLzja+TmJeZ1h14xW2FB/WpeimUD3haBXQPyJqxvo8jQTmfeA8zv58mtjN2C7EHXZDYVcVYdYmAxjkWVvKCw==} - '@vitest/spy@4.1.5': - resolution: {integrity: sha512-2lNOsh6+R2Idnf1TCZqSwYlKN2E/iDlD8sgU59kYVl+OMDmvldO1VDk39smRfpUNwYpNRVn3w4YfuC7KfbBnkQ==} + '@vitest/spy@4.1.7': + resolution: {integrity: sha512-kbkI5LMWakyuTIvs6fUJ5qdIVb1XVKsYJAT4OJ938cHMROYMSfmoQdZy0aaAnjbbc8F61vkoTqz/Az+/HiIu5Q==} - '@vitest/utils@4.1.5': - resolution: {integrity: sha512-76wdkrmfXfqGjueGgnb45ITPyUi1ycZ4IHgC2bhPDUfWHklY/q3MdLOAB+TF1e6xfl8NxNY0ZYaPCFNWSsw3Ug==} + '@vitest/utils@4.1.7': + resolution: {integrity: sha512-T532WBu791cBxJlCl6SO+J14l81DQx6uQHm1bQbmCDY7nqlEIgkza/UFnSBNaUtSf41unldDFjdOBYEQC4b5Hw==} '@vscode/iconv-lite-umd@0.7.1': resolution: {integrity: sha512-tK6k0DXFHW7q5+GGuGZO+phpAqpxO4WXl+BLc/8/uOk3RsM2ssAL3CQUQDb1TGfwltjsauhN6S4ghYZzs4sPFw==} @@ -1036,10 +921,6 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - array-find-index@1.0.2: - resolution: {integrity: sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==} - engines: {node: '>=0.10.0'} - assertion-error@2.0.1: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} @@ -1091,8 +972,8 @@ packages: magicast: optional: true - c12@4.0.0-beta.4: - resolution: {integrity: sha512-gcWQAloC/SwGx4U7l3iQdalUQQLLXwYS1d3SqIwFj4UUrTXh8L9yGkBcA00B0gxELMwbxtsrt6VrAxtSgqZZoA==} + c12@4.0.0-beta.5: + resolution: {integrity: sha512-yWGCPCQGJeFq4R0mFg5HOhC3Rg+B0PCdM+ldXWUhughoGgeeq8/tjRmXh4/lmhKWyhf+KOFxB/JMXf0Yv1Fd5A==} peerDependencies: chokidar: ^5 dotenv: '*' @@ -1134,8 +1015,8 @@ packages: resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==} engines: {node: '>= 20.19.0'} - code-server@4.114.1: - resolution: {integrity: sha512-dtqWwVuIpo8FHmoZnIib9he/b3hqsEEyKcdTuUnpoc4ohIj3lhbx34heGV2AnNrq10g6I8i/ZV7LveWDmAxQuA==} + code-server@4.117.0: + resolution: {integrity: sha512-FIMu90X/cw9tCAR4wII5ypK4R9Xbg5Zu/2LttqJNH+MuVOP15eODFCnTZHkH44r2d9MjDdaESP8VHSlotpTyQQ==} engines: {node: '22'} hasBin: true @@ -1143,9 +1024,6 @@ packages: resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} engines: {node: '>= 12'} - commenting@1.1.0: - resolution: {integrity: sha512-YeNK4tavZwtH7jEgK1ZINXzLKm6DZdEMfsaaieOsCAN0S8vsY7UeuO3Q7d/M018EFgE+IeUAuBOKkFccBZsUZA==} - compressible@2.0.18: resolution: {integrity: sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==} engines: {node: '>= 0.6'} @@ -1253,17 +1131,13 @@ packages: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} - dotenv@17.4.1: - resolution: {integrity: sha512-k8DaKGP6r1G30Lx8V4+pCsLzKr8vLmV2paqEj1Y55GdAgJuIqpRp5FfajGF8KtwMxCz9qJc6wUIJnm053d/WCw==} - engines: {node: '>=12'} - dotenv@17.4.2: resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==} engines: {node: '>=12'} - dts-resolver@2.1.3: - resolution: {integrity: sha512-bihc7jPC90VrosXNzK0LTE2cuLP6jr0Ro8jk+kMugHReJVLIpHz/xadeq3MhuwyO4TD4OA3L1Q8pBBFRc08Tsw==} - engines: {node: '>=20.19.0'} + dts-resolver@3.0.0: + resolution: {integrity: sha512-1T1f+z+4tl9XD+m+0HBgWoL/nm0bOIffyWaUuUSBlFg/86IWvfx+wjNaO/ybU0AJzG9/Mi5hBUgGV6zCmWEN7Q==} + engines: {node: ^22.18.0 || >=24.0.0} peerDependencies: oxc-resolver: '>=11.0.0' peerDependenciesMeta: @@ -1293,8 +1167,8 @@ packages: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - es-module-lexer@2.0.0: - resolution: {integrity: sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==} + es-module-lexer@2.1.0: + resolution: {integrity: sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==} es-object-atoms@1.1.1: resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} @@ -1392,8 +1266,9 @@ packages: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} - get-tsconfig@4.14.0: - resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==} + get-tsconfig@5.0.0-beta.5: + resolution: {integrity: sha512-/6gFNr0N04nob252sTQxyFLi3eKFRqIg1I87YcqAMT1i6SQrSF6KujUEQrtrjMV0H/eejTCltLdDSTEMzHbnsQ==} + engines: {node: '>=20.20.0'} get-uri@6.0.5: resolution: {integrity: sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==} @@ -1435,8 +1310,8 @@ packages: resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} engines: {node: '>= 14'} - httpxy@0.5.0: - resolution: {integrity: sha512-qwX7QX/rK2visT10/b7bSeZWQOMlSm3svTD0pZpU+vJjNUP0YHtNv4c3z+MO+MSnGuRFWJFdCZiV+7F7dXIOzg==} + httpxy@0.5.2: + resolution: {integrity: sha512-C5OM92bmywDDdKTuYCGejdNFAb/zy0LX4srimOudYko847HvoWL2Eeik9odh9friPKu/JrlWv4z/amrJoxq2Cg==} i18next@25.10.10: resolution: {integrity: sha512-cqUW2Z3EkRx7NqSyywjkgCLK7KLCL6IFVFcONG7nVYIJ3ekZ1/N5jUsihHV6Bq37NfhgtczxJcxduELtjTwkuQ==} @@ -1484,8 +1359,8 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - jiti@2.6.1: - resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==} + jiti@2.7.0: + resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} hasBin: true js-base64@3.7.8: @@ -1588,9 +1463,6 @@ packages: limiter@2.1.0: resolution: {integrity: sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw==} - lodash@4.18.1: - resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} - lru-cache@6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} @@ -1628,9 +1500,6 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - moment@2.30.1: - resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} - mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -1641,8 +1510,8 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - nanoid@3.3.11: - resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} + nanoid@3.3.12: + resolution: {integrity: sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true @@ -1676,8 +1545,8 @@ packages: obug@2.1.1: resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==} - obuild@0.4.33: - resolution: {integrity: sha512-5wMQtNeWb4sz/O3zx+86lSH1BOXlA6mtZXvZKqOIQeLj+pxIzty+9I/B0ZPoaFP8M5tpcaxmDFDmfMJb0Z5KEw==} + obuild@0.4.35: + resolution: {integrity: sha512-TYyNiOUzhUIBipnSlsJKskPsV8JZs2QXXCQQ+VTMGJD/Ekl6HEGoECtC5T6bgSul9n6sT0vq+CN3EIl1MmuLFQ==} hasBin: true ofetch@1.5.1: @@ -1714,12 +1583,12 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} hasBin: true - oxlint@1.61.0: - resolution: {integrity: sha512-ZC0ALuhDZ6ivOFG+sy0D0pEDN49EvsId98zVlmYdkcXHsEM14m/qTNUEsUpiFiCVbpIxYtVBmmLE87nsbUHohQ==} + oxlint@1.66.0: + resolution: {integrity: sha512-N4LLxYLd94KEBqXDMDM5f+2PUpItTjDLreXe2Gn5KhjhCK4Qp2YUXaBi8Yu325ryOgKwt22m45fpD7nPOn69Yw==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true peerDependencies: - oxlint-tsgolint: '>=0.18.0' + oxlint-tsgolint: '>=0.22.1' peerDependenciesMeta: oxlint-tsgolint: optional: true @@ -1732,10 +1601,6 @@ packages: resolution: {integrity: sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==} engines: {node: '>= 14'} - package-name-regex@2.0.6: - resolution: {integrity: sha512-gFL35q7kbE/zBaPA3UKhp2vSzcPYx2ecbYuwv1ucE9Il6IIgBDweBlH8D68UFGZic2MkllKa2KHCfC1IQBQUYA==} - engines: {node: '>=12'} - parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} @@ -1767,17 +1632,13 @@ packages: resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} - pkg-types@2.3.0: - resolution: {integrity: sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==} + pkg-types@2.3.1: + resolution: {integrity: sha512-y+ichcgc2LrADuhLNAx8DFjVfgz91pRxfZdI3UDhxHvcVEZsenLO+7XaU5vOp0u/7V/wZ+plyuQxtrDlZJ+yeg==} - postcss@8.5.10: - resolution: {integrity: sha512-pMMHxBOZKFU6HgAZ4eyGnwXF/EvPGGqUr0MnZ5+99485wwW41kW91A4LOGxSHhgugZmSChL5AlElNdwlNgcnLQ==} + postcss@8.5.15: + resolution: {integrity: sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==} engines: {node: ^10 || ^12 || >=14} - pretty-bytes@7.1.0: - resolution: {integrity: sha512-nODzvTiYVRGRqAOvE84Vk5JDPyyxsVk0/fbA/bq7RqlnhksGpset09XTxbpvLTIjoaF7K8Z8DG8yHtKGTPSYRw==} - engines: {node: '>=20'} - proxy-addr@2.0.7: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} @@ -1818,13 +1679,13 @@ packages: resolution: {integrity: sha512-6bDtNIBh1qPviVIU685/4uv0Ap5t8eS4wiJhy/tR2LdIeIey9CVasENlGS+ul3HnTmGANIp7AjnfsztsRmALfQ==} hasBin: true - rolldown-plugin-dts@0.23.2: - resolution: {integrity: sha512-PbSqLawLgZBGcOGT3yqWBGn4cX+wh2nt5FuBGdcMHyOhoukmjbhYAl8NT9sE4U38Cm9tqLOIQeOrvzeayM0DLQ==} - engines: {node: '>=20.19.0'} + rolldown-plugin-dts@0.25.1: + resolution: {integrity: sha512-zK82aC/8z1iVW+g0bCnlQZq04Y5bNeL/RcRwTYBwsnU6wH0N+6vpIFkN7JC0kYRS5qKA+pxQyfIPvXJ6Q5xSpQ==} + engines: {node: ^22.18.0 || >=24.0.0} peerDependencies: '@ts-macro/tsc': ^0.3.6 '@typescript/native-preview': '>=7.0.0-dev.20260325.1' - rolldown: ^1.0.0-rc.12 + rolldown: ^1.0.0 typescript: ^5.0.0 || ^6.0.0 vue-tsc: ~3.2.0 peerDependenciesMeta: @@ -1842,22 +1703,11 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} hasBin: true - rolldown@1.0.0-rc.17: - resolution: {integrity: sha512-ZrT53oAKrtA4+YtBWPQbtPOxIbVDbxT0orcYERKd63VJTF13zPcgXTvD4843L8pcsI7M6MErt8QtON6lrB9tyA==} + rolldown@1.0.2: + resolution: {integrity: sha512-oZx5zVDtVB44AW3eaifgDml1gWRDZGvjcfdxonE4swNPG98PrrXjaO/KrnUjzlMnztCCRVlUueA1kCXhARGk6g==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true - rollup-plugin-license@3.7.1: - resolution: {integrity: sha512-FcGXUbAmPvRSLxjVdjp/r/MUtKBlttVQd+ApUyvKfREnsoAfAZA6Ic2fE1Tz4RL0f9XqEQU9UIRNUMdtQtliDw==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 - - rollup@4.60.1: - resolution: {integrity: sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==} - engines: {node: '>=18.0.0', npm: '>=8.0.0'} - hasBin: true - rotating-file-stream@3.2.9: resolution: {integrity: sha512-i9i0KkHh12ryl4xtELg+0gyoFre2PJ9RcQQLzquWsiqygyYsrZLckrqqYrthhnJZGZb4g+KUHtcoWYVq34gaug==} engines: {node: '>=14.0'} @@ -1882,8 +1732,8 @@ packages: scule@1.3.0: resolution: {integrity: sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g==} - semver@7.7.4: - resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==} + semver@7.8.0: + resolution: {integrity: sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==} engines: {node: '>=10'} hasBin: true @@ -1945,27 +1795,6 @@ packages: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} - spdx-compare@1.0.0: - resolution: {integrity: sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==} - - spdx-exceptions@2.5.0: - resolution: {integrity: sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==} - - spdx-expression-parse@3.0.1: - resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} - - spdx-expression-validate@2.0.0: - resolution: {integrity: sha512-b3wydZLM+Tc6CFvaRDBOF9d76oGIHNCLYFeHbftFXUWjnfZWganmDmvtM5sm1cRwJc/VDBMLyGGrsLFd1vOxbg==} - - spdx-license-ids@3.0.23: - resolution: {integrity: sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==} - - spdx-ranges@2.1.1: - resolution: {integrity: sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==} - - spdx-satisfies@5.0.1: - resolution: {integrity: sha512-Nwor6W6gzFp8XX4neaKQ7ChV4wmpSh2sSDemMFSzHxpTw460jxFYeOn+jq4ybnSSw/5sc3pjka9MQPouksQNpw==} - stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} @@ -1989,8 +1818,8 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} - tinyexec@1.1.1: - resolution: {integrity: sha512-VKS/ZaQhhkKFMANmAOhhXVoIfBXblQxGX1myCQ2faQrfmobMftXeJPcZGp0gS07ocvGJWDLZGyOZDadDBqYIJg==} + tinyexec@1.1.2: + resolution: {integrity: sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA==} engines: {node: '>=18'} tinyglobby@0.2.16: @@ -2016,16 +1845,16 @@ packages: resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==} engines: {node: '>= 0.6'} - typescript@6.0.2: - resolution: {integrity: sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==} + typescript@6.0.3: + resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} engines: {node: '>=14.17'} hasBin: true - ufo@1.6.3: - resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==} + ufo@1.6.4: + resolution: {integrity: sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==} - undici-types@7.19.2: - resolution: {integrity: sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==} + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} unpipe@1.0.0: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} @@ -2078,20 +1907,20 @@ packages: yaml: optional: true - vitest@4.1.5: - resolution: {integrity: sha512-9Xx1v3/ih3m9hN+SbfkUyy0JAs72ap3r7joc87XL6jwF0jGg6mFBvQ1SrwaX+h8BlkX6Hz9shdd1uo6AF+ZGpg==} + vitest@4.1.7: + resolution: {integrity: sha512-flYyaFd2CgoCoU+0UKt3pxksgC+S02iTDN0n3LtqaMeXsI9SBcdNujc2k0DeFLzUn/0k538yNjOSdwgCqcrwJA==} engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@opentelemetry/api': ^1.9.0 '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0 - '@vitest/browser-playwright': 4.1.5 - '@vitest/browser-preview': 4.1.5 - '@vitest/browser-webdriverio': 4.1.5 - '@vitest/coverage-istanbul': 4.1.5 - '@vitest/coverage-v8': 4.1.5 - '@vitest/ui': 4.1.5 + '@vitest/browser-playwright': 4.1.7 + '@vitest/browser-preview': 4.1.7 + '@vitest/browser-webdriverio': 4.1.7 + '@vitest/coverage-istanbul': 4.1.7 + '@vitest/coverage-v8': 4.1.7 + '@vitest/ui': 4.1.7 happy-dom: '*' jsdom: '*' vite: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -2177,29 +2006,33 @@ packages: snapshots: - '@babel/generator@8.0.0-rc.3': + '@babel/generator@8.0.0-rc.5': dependencies: - '@babel/parser': 8.0.0-rc.3 - '@babel/types': 8.0.0-rc.3 + '@babel/parser': 8.0.0-rc.5 + '@babel/types': 8.0.0-rc.5 '@jridgewell/gen-mapping': 0.3.13 '@jridgewell/trace-mapping': 0.3.31 '@types/jsesc': 2.5.1 jsesc: 3.1.0 - '@babel/helper-string-parser@8.0.0-rc.3': {} + '@babel/helper-string-parser@8.0.0-rc.5': {} - '@babel/helper-validator-identifier@8.0.0-rc.3': {} + '@babel/helper-validator-identifier@8.0.0-rc.5': {} - '@babel/parser@8.0.0-rc.3': + '@babel/parser@8.0.0-rc.4': dependencies: - '@babel/types': 8.0.0-rc.3 + '@babel/types': 8.0.0-rc.5 + + '@babel/parser@8.0.0-rc.5': + dependencies: + '@babel/types': 8.0.0-rc.5 '@babel/runtime@7.29.2': {} - '@babel/types@8.0.0-rc.3': + '@babel/types@8.0.0-rc.5': dependencies: - '@babel/helper-string-parser': 8.0.0-rc.3 - '@babel/helper-validator-identifier': 8.0.0-rc.3 + '@babel/helper-string-parser': 8.0.0-rc.5 + '@babel/helper-validator-identifier': 8.0.0-rc.5 '@coder/logger@3.0.1': {} @@ -2255,19 +2088,19 @@ snapshots: dependencies: '@emnapi/core': 1.10.0 '@emnapi/runtime': 1.10.0 - '@tybys/wasm-util': 0.10.1 + '@tybys/wasm-util': 0.10.2 optional: true '@napi-rs/wasm-runtime@1.1.4(@emnapi/core@1.9.1)(@emnapi/runtime@1.9.1)': dependencies: '@emnapi/core': 1.9.1 '@emnapi/runtime': 1.9.1 - '@tybys/wasm-util': 0.10.1 + '@tybys/wasm-util': 0.10.2 optional: true '@oxc-project/types@0.123.0': {} - '@oxc-project/types@0.127.0': {} + '@oxc-project/types@0.132.0': {} '@oxfmt/binding-android-arm-eabi@0.46.0': optional: true @@ -2326,61 +2159,61 @@ snapshots: '@oxfmt/binding-win32-x64-msvc@0.46.0': optional: true - '@oxlint/binding-android-arm-eabi@1.61.0': + '@oxlint/binding-android-arm-eabi@1.66.0': optional: true - '@oxlint/binding-android-arm64@1.61.0': + '@oxlint/binding-android-arm64@1.66.0': optional: true - '@oxlint/binding-darwin-arm64@1.61.0': + '@oxlint/binding-darwin-arm64@1.66.0': optional: true - '@oxlint/binding-darwin-x64@1.61.0': + '@oxlint/binding-darwin-x64@1.66.0': optional: true - '@oxlint/binding-freebsd-x64@1.61.0': + '@oxlint/binding-freebsd-x64@1.66.0': optional: true - '@oxlint/binding-linux-arm-gnueabihf@1.61.0': + '@oxlint/binding-linux-arm-gnueabihf@1.66.0': optional: true - '@oxlint/binding-linux-arm-musleabihf@1.61.0': + '@oxlint/binding-linux-arm-musleabihf@1.66.0': optional: true - '@oxlint/binding-linux-arm64-gnu@1.61.0': + '@oxlint/binding-linux-arm64-gnu@1.66.0': optional: true - '@oxlint/binding-linux-arm64-musl@1.61.0': + '@oxlint/binding-linux-arm64-musl@1.66.0': optional: true - '@oxlint/binding-linux-ppc64-gnu@1.61.0': + '@oxlint/binding-linux-ppc64-gnu@1.66.0': optional: true - '@oxlint/binding-linux-riscv64-gnu@1.61.0': + '@oxlint/binding-linux-riscv64-gnu@1.66.0': optional: true - '@oxlint/binding-linux-riscv64-musl@1.61.0': + '@oxlint/binding-linux-riscv64-musl@1.66.0': optional: true - '@oxlint/binding-linux-s390x-gnu@1.61.0': + '@oxlint/binding-linux-s390x-gnu@1.66.0': optional: true - '@oxlint/binding-linux-x64-gnu@1.61.0': + '@oxlint/binding-linux-x64-gnu@1.66.0': optional: true - '@oxlint/binding-linux-x64-musl@1.61.0': + '@oxlint/binding-linux-x64-musl@1.66.0': optional: true - '@oxlint/binding-openharmony-arm64@1.61.0': + '@oxlint/binding-openharmony-arm64@1.66.0': optional: true - '@oxlint/binding-win32-arm64-msvc@1.61.0': + '@oxlint/binding-win32-arm64-msvc@1.66.0': optional: true - '@oxlint/binding-win32-ia32-msvc@1.61.0': + '@oxlint/binding-win32-ia32-msvc@1.66.0': optional: true - '@oxlint/binding-win32-x64-msvc@1.61.0': + '@oxlint/binding-win32-x64-msvc@1.66.0': optional: true '@phc/format@1.0.0': {} @@ -2388,73 +2221,73 @@ snapshots: '@rolldown/binding-android-arm64@1.0.0-rc.13': optional: true - '@rolldown/binding-android-arm64@1.0.0-rc.17': + '@rolldown/binding-android-arm64@1.0.2': optional: true '@rolldown/binding-darwin-arm64@1.0.0-rc.13': optional: true - '@rolldown/binding-darwin-arm64@1.0.0-rc.17': + '@rolldown/binding-darwin-arm64@1.0.2': optional: true '@rolldown/binding-darwin-x64@1.0.0-rc.13': optional: true - '@rolldown/binding-darwin-x64@1.0.0-rc.17': + '@rolldown/binding-darwin-x64@1.0.2': optional: true '@rolldown/binding-freebsd-x64@1.0.0-rc.13': optional: true - '@rolldown/binding-freebsd-x64@1.0.0-rc.17': + '@rolldown/binding-freebsd-x64@1.0.2': optional: true '@rolldown/binding-linux-arm-gnueabihf@1.0.0-rc.13': optional: true - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-rc.17': + '@rolldown/binding-linux-arm-gnueabihf@1.0.2': optional: true '@rolldown/binding-linux-arm64-gnu@1.0.0-rc.13': optional: true - '@rolldown/binding-linux-arm64-gnu@1.0.0-rc.17': + '@rolldown/binding-linux-arm64-gnu@1.0.2': optional: true '@rolldown/binding-linux-arm64-musl@1.0.0-rc.13': optional: true - '@rolldown/binding-linux-arm64-musl@1.0.0-rc.17': + '@rolldown/binding-linux-arm64-musl@1.0.2': optional: true '@rolldown/binding-linux-ppc64-gnu@1.0.0-rc.13': optional: true - '@rolldown/binding-linux-ppc64-gnu@1.0.0-rc.17': + '@rolldown/binding-linux-ppc64-gnu@1.0.2': optional: true '@rolldown/binding-linux-s390x-gnu@1.0.0-rc.13': optional: true - '@rolldown/binding-linux-s390x-gnu@1.0.0-rc.17': + '@rolldown/binding-linux-s390x-gnu@1.0.2': optional: true '@rolldown/binding-linux-x64-gnu@1.0.0-rc.13': optional: true - '@rolldown/binding-linux-x64-gnu@1.0.0-rc.17': + '@rolldown/binding-linux-x64-gnu@1.0.2': optional: true '@rolldown/binding-linux-x64-musl@1.0.0-rc.13': optional: true - '@rolldown/binding-linux-x64-musl@1.0.0-rc.17': + '@rolldown/binding-linux-x64-musl@1.0.2': optional: true '@rolldown/binding-openharmony-arm64@1.0.0-rc.13': optional: true - '@rolldown/binding-openharmony-arm64@1.0.0-rc.17': + '@rolldown/binding-openharmony-arm64@1.0.2': optional: true '@rolldown/binding-wasm32-wasi@1.0.0-rc.13': @@ -2464,7 +2297,7 @@ snapshots: '@napi-rs/wasm-runtime': 1.1.4(@emnapi/core@1.9.1)(@emnapi/runtime@1.9.1) optional: true - '@rolldown/binding-wasm32-wasi@1.0.0-rc.17': + '@rolldown/binding-wasm32-wasi@1.0.2': dependencies: '@emnapi/core': 1.10.0 '@emnapi/runtime': 1.10.0 @@ -2474,99 +2307,24 @@ snapshots: '@rolldown/binding-win32-arm64-msvc@1.0.0-rc.13': optional: true - '@rolldown/binding-win32-arm64-msvc@1.0.0-rc.17': + '@rolldown/binding-win32-arm64-msvc@1.0.2': optional: true '@rolldown/binding-win32-x64-msvc@1.0.0-rc.13': optional: true - '@rolldown/binding-win32-x64-msvc@1.0.0-rc.17': + '@rolldown/binding-win32-x64-msvc@1.0.2': optional: true '@rolldown/pluginutils@1.0.0-rc.13': {} - '@rolldown/pluginutils@1.0.0-rc.17': {} - - '@rollup/rollup-android-arm-eabi@4.60.1': - optional: true - - '@rollup/rollup-android-arm64@4.60.1': - optional: true - - '@rollup/rollup-darwin-arm64@4.60.1': - optional: true - - '@rollup/rollup-darwin-x64@4.60.1': - optional: true - - '@rollup/rollup-freebsd-arm64@4.60.1': - optional: true - - '@rollup/rollup-freebsd-x64@4.60.1': - optional: true - - '@rollup/rollup-linux-arm-gnueabihf@4.60.1': - optional: true - - '@rollup/rollup-linux-arm-musleabihf@4.60.1': - optional: true - - '@rollup/rollup-linux-arm64-gnu@4.60.1': - optional: true - - '@rollup/rollup-linux-arm64-musl@4.60.1': - optional: true - - '@rollup/rollup-linux-loong64-gnu@4.60.1': - optional: true - - '@rollup/rollup-linux-loong64-musl@4.60.1': - optional: true - - '@rollup/rollup-linux-ppc64-gnu@4.60.1': - optional: true - - '@rollup/rollup-linux-ppc64-musl@4.60.1': - optional: true - - '@rollup/rollup-linux-riscv64-gnu@4.60.1': - optional: true - - '@rollup/rollup-linux-riscv64-musl@4.60.1': - optional: true - - '@rollup/rollup-linux-s390x-gnu@4.60.1': - optional: true - - '@rollup/rollup-linux-x64-gnu@4.60.1': - optional: true - - '@rollup/rollup-linux-x64-musl@4.60.1': - optional: true - - '@rollup/rollup-openbsd-x64@4.60.1': - optional: true - - '@rollup/rollup-openharmony-arm64@4.60.1': - optional: true - - '@rollup/rollup-win32-arm64-msvc@4.60.1': - optional: true - - '@rollup/rollup-win32-ia32-msvc@4.60.1': - optional: true - - '@rollup/rollup-win32-x64-gnu@4.60.1': - optional: true - - '@rollup/rollup-win32-x64-msvc@4.60.1': - optional: true + '@rolldown/pluginutils@1.0.1': {} '@standard-schema/spec@1.1.0': {} '@tootallnate/quickjs-emscripten@0.23.0': {} - '@tybys/wasm-util@0.10.1': + '@tybys/wasm-util@0.10.2': dependencies: tslib: 2.8.1 optional: true @@ -2578,83 +2336,83 @@ snapshots: '@types/deep-eql@4.0.2': {} - '@types/estree@1.0.8': {} + '@types/estree@1.0.9': {} '@types/jsesc@2.5.1': {} - '@types/node@25.6.0': + '@types/node@25.9.1': dependencies: - undici-types: 7.19.2 + undici-types: 7.24.6 - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260422.1': + '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260519.1': optional: true - '@typescript/native-preview-darwin-x64@7.0.0-dev.20260422.1': + '@typescript/native-preview-darwin-x64@7.0.0-dev.20260519.1': optional: true - '@typescript/native-preview-linux-arm64@7.0.0-dev.20260422.1': + '@typescript/native-preview-linux-arm64@7.0.0-dev.20260519.1': optional: true - '@typescript/native-preview-linux-arm@7.0.0-dev.20260422.1': + '@typescript/native-preview-linux-arm@7.0.0-dev.20260519.1': optional: true - '@typescript/native-preview-linux-x64@7.0.0-dev.20260422.1': + '@typescript/native-preview-linux-x64@7.0.0-dev.20260519.1': optional: true - '@typescript/native-preview-win32-arm64@7.0.0-dev.20260422.1': + '@typescript/native-preview-win32-arm64@7.0.0-dev.20260519.1': optional: true - '@typescript/native-preview-win32-x64@7.0.0-dev.20260422.1': + '@typescript/native-preview-win32-x64@7.0.0-dev.20260519.1': optional: true - '@typescript/native-preview@7.0.0-dev.20260422.1': + '@typescript/native-preview@7.0.0-dev.20260519.1': optionalDependencies: - '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260422.1 - '@typescript/native-preview-darwin-x64': 7.0.0-dev.20260422.1 - '@typescript/native-preview-linux-arm': 7.0.0-dev.20260422.1 - '@typescript/native-preview-linux-arm64': 7.0.0-dev.20260422.1 - '@typescript/native-preview-linux-x64': 7.0.0-dev.20260422.1 - '@typescript/native-preview-win32-arm64': 7.0.0-dev.20260422.1 - '@typescript/native-preview-win32-x64': 7.0.0-dev.20260422.1 + '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260519.1 + '@typescript/native-preview-darwin-x64': 7.0.0-dev.20260519.1 + '@typescript/native-preview-linux-arm': 7.0.0-dev.20260519.1 + '@typescript/native-preview-linux-arm64': 7.0.0-dev.20260519.1 + '@typescript/native-preview-linux-x64': 7.0.0-dev.20260519.1 + '@typescript/native-preview-win32-arm64': 7.0.0-dev.20260519.1 + '@typescript/native-preview-win32-x64': 7.0.0-dev.20260519.1 - '@vitest/expect@4.1.5': + '@vitest/expect@4.1.7': dependencies: '@standard-schema/spec': 1.1.0 '@types/chai': 5.2.3 - '@vitest/spy': 4.1.5 - '@vitest/utils': 4.1.5 + '@vitest/spy': 4.1.7 + '@vitest/utils': 4.1.7 chai: 6.2.2 tinyrainbow: 3.1.0 - '@vitest/mocker@4.1.5(vite@8.0.7(@types/node@25.6.0)(jiti@2.6.1))': + '@vitest/mocker@4.1.7(vite@8.0.7(@types/node@25.9.1)(jiti@2.7.0))': dependencies: - '@vitest/spy': 4.1.5 + '@vitest/spy': 4.1.7 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 8.0.7(@types/node@25.6.0)(jiti@2.6.1) + vite: 8.0.7(@types/node@25.9.1)(jiti@2.7.0) - '@vitest/pretty-format@4.1.5': + '@vitest/pretty-format@4.1.7': dependencies: tinyrainbow: 3.1.0 - '@vitest/runner@4.1.5': + '@vitest/runner@4.1.7': dependencies: - '@vitest/utils': 4.1.5 + '@vitest/utils': 4.1.7 pathe: 2.0.3 - '@vitest/snapshot@4.1.5': + '@vitest/snapshot@4.1.7': dependencies: - '@vitest/pretty-format': 4.1.5 - '@vitest/utils': 4.1.5 + '@vitest/pretty-format': 4.1.7 + '@vitest/utils': 4.1.7 magic-string: 0.30.21 pathe: 2.0.3 - '@vitest/spy@4.1.5': {} + '@vitest/spy@4.1.7': {} - '@vitest/utils@4.1.5': + '@vitest/utils@4.1.7': dependencies: - '@vitest/pretty-format': 4.1.5 + '@vitest/pretty-format': 4.1.7 convert-source-map: 2.0.0 tinyrainbow: 3.1.0 @@ -2719,13 +2477,11 @@ snapshots: argparse@2.0.1: {} - array-find-index@1.0.2: {} - assertion-error@2.0.1: {} ast-kit@3.0.0-beta.1: dependencies: - '@babel/parser': 8.0.0-rc.3 + '@babel/parser': 8.0.0-rc.4 estree-walker: 3.0.3 pathe: 2.0.3 @@ -2773,29 +2529,29 @@ snapshots: chokidar: 5.0.0 confbox: 0.2.4 defu: 6.1.7 - dotenv: 17.4.1 + dotenv: 17.4.2 exsolve: 1.0.8 giget: 3.2.0 - jiti: 2.6.1 + jiti: 2.7.0 ohash: 2.0.11 pathe: 2.0.3 perfect-debounce: 2.1.0 - pkg-types: 2.3.0 + pkg-types: 2.3.1 rc9: 3.0.1 - c12@4.0.0-beta.4(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.6.1): + c12@4.0.0-beta.5(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.7.0): dependencies: confbox: 0.2.4 defu: 6.1.7 exsolve: 1.0.8 pathe: 2.0.3 - pkg-types: 2.3.0 + pkg-types: 2.3.1 rc9: 3.0.1 optionalDependencies: chokidar: 5.0.0 dotenv: 17.4.2 giget: 3.2.0 - jiti: 2.6.1 + jiti: 2.7.0 call-bind-apply-helpers@1.0.2: dependencies: @@ -2820,9 +2576,9 @@ snapshots: ofetch: 1.5.1 open: 10.2.0 pathe: 2.0.3 - pkg-types: 2.3.0 + pkg-types: 2.3.1 scule: 1.3.0 - semver: 7.7.4 + semver: 7.8.0 std-env: 3.10.0 transitivePeerDependencies: - magicast @@ -2833,7 +2589,7 @@ snapshots: dependencies: readdirp: 5.0.0 - code-server@4.114.1(patch_hash=f27e6f7bc69f43c9eddb7727952e605173ad828b852080c65527053e72c260e9)(typescript@6.0.2): + code-server@4.117.0(patch_hash=f27e6f7bc69f43c9eddb7727952e605173ad828b852080c65527053e72c260e9)(typescript@6.0.3): dependencies: '@coder/logger': 3.0.1 argon2: 0.44.0 @@ -2843,7 +2599,7 @@ snapshots: express: 5.2.1 http-proxy: 1.18.1 httpolyglot: 0.1.2 - i18next: 25.10.10(typescript@6.0.2) + i18next: 25.10.10(typescript@6.0.3) js-yaml: 4.1.1 limiter: 2.1.0 pem: 1.14.8 @@ -2851,7 +2607,7 @@ snapshots: qs: 6.15.0 rotating-file-stream: 3.2.9 safe-compare: 1.1.4 - semver: 7.7.4 + semver: 7.8.0 ws: 8.20.0 xdg-basedir: 4.0.0 transitivePeerDependencies: @@ -2863,8 +2619,6 @@ snapshots: commander@8.3.0: {} - commenting@1.1.0: {} - compressible@2.0.18: dependencies: mime-db: 1.54.0 @@ -2950,12 +2704,9 @@ snapshots: detect-libc@2.1.2: {} - dotenv@17.4.1: {} - - dotenv@17.4.2: - optional: true + dotenv@17.4.2: {} - dts-resolver@2.1.3: {} + dts-resolver@3.0.0: {} dunder-proto@1.0.1: dependencies: @@ -2973,7 +2724,7 @@ snapshots: es-errors@1.3.0: {} - es-module-lexer@2.0.0: {} + es-module-lexer@2.1.0: {} es-object-atoms@1.1.1: dependencies: @@ -2997,7 +2748,7 @@ snapshots: estree-walker@3.0.3: dependencies: - '@types/estree': 1.0.8 + '@types/estree': 1.0.9 esutils@2.0.3: {} @@ -3086,7 +2837,7 @@ snapshots: dunder-proto: 1.0.1 es-object-atoms: 1.1.1 - get-tsconfig@4.14.0: + get-tsconfig@5.0.0-beta.5: dependencies: resolve-pkg-maps: 1.0.0 @@ -3140,13 +2891,13 @@ snapshots: transitivePeerDependencies: - supports-color - httpxy@0.5.0: {} + httpxy@0.5.2: {} - i18next@25.10.10(typescript@6.0.2): + i18next@25.10.10(typescript@6.0.3): dependencies: '@babel/runtime': 7.29.2 optionalDependencies: - typescript: 6.0.2 + typescript: 6.0.3 iconv-lite@0.7.2: dependencies: @@ -3174,7 +2925,7 @@ snapshots: isexe@2.0.0: {} - jiti@2.6.1: {} + jiti@2.7.0: {} js-base64@3.7.8: {} @@ -3245,8 +2996,6 @@ snapshots: dependencies: just-performance: 4.3.0 - lodash@4.18.1: {} - lru-cache@6.0.0: dependencies: yallist: 4.0.0 @@ -3277,15 +3026,13 @@ snapshots: minimist@1.2.8: {} - moment@2.30.1: {} - mri@1.2.0: {} ms@2.0.0: {} ms@2.1.3: {} - nanoid@3.3.11: {} + nanoid@3.3.12: {} negotiator@0.6.4: {} @@ -3303,18 +3050,16 @@ snapshots: obug@2.1.1: {} - obuild@0.4.33(@typescript/native-preview@7.0.0-dev.20260422.1)(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.6.1)(picomatch@4.0.4)(rollup@4.60.1)(typescript@6.0.2): + obuild@0.4.35(@typescript/native-preview@7.0.0-dev.20260519.1)(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.7.0)(typescript@6.0.3): dependencies: - c12: 4.0.0-beta.4(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.6.1) + c12: 4.0.0-beta.5(chokidar@5.0.0)(dotenv@17.4.2)(giget@3.2.0)(jiti@2.7.0) consola: 3.4.2 defu: 6.1.7 exsolve: 1.0.8 magic-string: 0.30.21 pathe: 2.0.3 - pretty-bytes: 7.1.0 - rolldown: 1.0.0-rc.17 - rolldown-plugin-dts: 0.23.2(@typescript/native-preview@7.0.0-dev.20260422.1)(rolldown@1.0.0-rc.17)(typescript@6.0.2) - rollup-plugin-license: 3.7.1(picomatch@4.0.4)(rollup@4.60.1) + rolldown: 1.0.2 + rolldown-plugin-dts: 0.25.1(@typescript/native-preview@7.0.0-dev.20260519.1)(rolldown@1.0.2)(typescript@6.0.3) tinyglobby: 0.2.16 transitivePeerDependencies: - '@ts-macro/tsc' @@ -3325,8 +3070,6 @@ snapshots: - jiti - magicast - oxc-resolver - - picomatch - - rollup - typescript - vue-tsc @@ -3334,7 +3077,7 @@ snapshots: dependencies: destr: 2.0.5 node-fetch-native: 1.6.7 - ufo: 1.6.3 + ufo: 1.6.4 ohash@2.0.11: {} @@ -3385,27 +3128,27 @@ snapshots: '@oxfmt/binding-win32-ia32-msvc': 0.46.0 '@oxfmt/binding-win32-x64-msvc': 0.46.0 - oxlint@1.61.0: + oxlint@1.66.0: optionalDependencies: - '@oxlint/binding-android-arm-eabi': 1.61.0 - '@oxlint/binding-android-arm64': 1.61.0 - '@oxlint/binding-darwin-arm64': 1.61.0 - '@oxlint/binding-darwin-x64': 1.61.0 - '@oxlint/binding-freebsd-x64': 1.61.0 - '@oxlint/binding-linux-arm-gnueabihf': 1.61.0 - '@oxlint/binding-linux-arm-musleabihf': 1.61.0 - '@oxlint/binding-linux-arm64-gnu': 1.61.0 - '@oxlint/binding-linux-arm64-musl': 1.61.0 - '@oxlint/binding-linux-ppc64-gnu': 1.61.0 - '@oxlint/binding-linux-riscv64-gnu': 1.61.0 - '@oxlint/binding-linux-riscv64-musl': 1.61.0 - '@oxlint/binding-linux-s390x-gnu': 1.61.0 - '@oxlint/binding-linux-x64-gnu': 1.61.0 - '@oxlint/binding-linux-x64-musl': 1.61.0 - '@oxlint/binding-openharmony-arm64': 1.61.0 - '@oxlint/binding-win32-arm64-msvc': 1.61.0 - '@oxlint/binding-win32-ia32-msvc': 1.61.0 - '@oxlint/binding-win32-x64-msvc': 1.61.0 + '@oxlint/binding-android-arm-eabi': 1.66.0 + '@oxlint/binding-android-arm64': 1.66.0 + '@oxlint/binding-darwin-arm64': 1.66.0 + '@oxlint/binding-darwin-x64': 1.66.0 + '@oxlint/binding-freebsd-x64': 1.66.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.66.0 + '@oxlint/binding-linux-arm-musleabihf': 1.66.0 + '@oxlint/binding-linux-arm64-gnu': 1.66.0 + '@oxlint/binding-linux-arm64-musl': 1.66.0 + '@oxlint/binding-linux-ppc64-gnu': 1.66.0 + '@oxlint/binding-linux-riscv64-gnu': 1.66.0 + '@oxlint/binding-linux-riscv64-musl': 1.66.0 + '@oxlint/binding-linux-s390x-gnu': 1.66.0 + '@oxlint/binding-linux-x64-gnu': 1.66.0 + '@oxlint/binding-linux-x64-musl': 1.66.0 + '@oxlint/binding-openharmony-arm64': 1.66.0 + '@oxlint/binding-win32-arm64-msvc': 1.66.0 + '@oxlint/binding-win32-ia32-msvc': 1.66.0 + '@oxlint/binding-win32-x64-msvc': 1.66.0 pac-proxy-agent@7.2.0: dependencies: @@ -3425,8 +3168,6 @@ snapshots: degenerator: 5.0.1 netmask: 2.1.0 - package-name-regex@2.0.6: {} - parseurl@1.3.3: {} path-key@3.1.1: {} @@ -3450,20 +3191,18 @@ snapshots: picomatch@4.0.4: {} - pkg-types@2.3.0: + pkg-types@2.3.1: dependencies: confbox: 0.2.4 exsolve: 1.0.8 pathe: 2.0.3 - postcss@8.5.10: + postcss@8.5.15: dependencies: - nanoid: 3.3.11 + nanoid: 3.3.12 picocolors: 1.1.1 source-map-js: 1.2.1 - pretty-bytes@7.1.0: {} - proxy-addr@2.0.7: dependencies: forwarded: 0.2.0 @@ -3510,22 +3249,20 @@ snapshots: ripgrep@0.3.1: {} - rolldown-plugin-dts@0.23.2(@typescript/native-preview@7.0.0-dev.20260422.1)(rolldown@1.0.0-rc.17)(typescript@6.0.2): + rolldown-plugin-dts@0.25.1(@typescript/native-preview@7.0.0-dev.20260519.1)(rolldown@1.0.2)(typescript@6.0.3): dependencies: - '@babel/generator': 8.0.0-rc.3 - '@babel/helper-validator-identifier': 8.0.0-rc.3 - '@babel/parser': 8.0.0-rc.3 - '@babel/types': 8.0.0-rc.3 + '@babel/generator': 8.0.0-rc.5 + '@babel/helper-validator-identifier': 8.0.0-rc.5 + '@babel/parser': 8.0.0-rc.4 ast-kit: 3.0.0-beta.1 birpc: 4.0.0 - dts-resolver: 2.1.3 - get-tsconfig: 4.14.0 + dts-resolver: 3.0.0 + get-tsconfig: 5.0.0-beta.5 obug: 2.1.1 - picomatch: 4.0.4 - rolldown: 1.0.0-rc.17 + rolldown: 1.0.2 optionalDependencies: - '@typescript/native-preview': 7.0.0-dev.20260422.1 - typescript: 6.0.2 + '@typescript/native-preview': 7.0.0-dev.20260519.1 + typescript: 6.0.3 transitivePeerDependencies: - oxc-resolver @@ -3550,71 +3287,26 @@ snapshots: '@rolldown/binding-win32-arm64-msvc': 1.0.0-rc.13 '@rolldown/binding-win32-x64-msvc': 1.0.0-rc.13 - rolldown@1.0.0-rc.17: + rolldown@1.0.2: dependencies: - '@oxc-project/types': 0.127.0 - '@rolldown/pluginutils': 1.0.0-rc.17 + '@oxc-project/types': 0.132.0 + '@rolldown/pluginutils': 1.0.1 optionalDependencies: - '@rolldown/binding-android-arm64': 1.0.0-rc.17 - '@rolldown/binding-darwin-arm64': 1.0.0-rc.17 - '@rolldown/binding-darwin-x64': 1.0.0-rc.17 - '@rolldown/binding-freebsd-x64': 1.0.0-rc.17 - '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-rc.17 - '@rolldown/binding-linux-arm64-gnu': 1.0.0-rc.17 - '@rolldown/binding-linux-arm64-musl': 1.0.0-rc.17 - '@rolldown/binding-linux-ppc64-gnu': 1.0.0-rc.17 - '@rolldown/binding-linux-s390x-gnu': 1.0.0-rc.17 - '@rolldown/binding-linux-x64-gnu': 1.0.0-rc.17 - '@rolldown/binding-linux-x64-musl': 1.0.0-rc.17 - '@rolldown/binding-openharmony-arm64': 1.0.0-rc.17 - '@rolldown/binding-wasm32-wasi': 1.0.0-rc.17 - '@rolldown/binding-win32-arm64-msvc': 1.0.0-rc.17 - '@rolldown/binding-win32-x64-msvc': 1.0.0-rc.17 - - rollup-plugin-license@3.7.1(picomatch@4.0.4)(rollup@4.60.1): - dependencies: - commenting: 1.1.0 - fdir: 6.5.0(picomatch@4.0.4) - lodash: 4.18.1 - magic-string: 0.30.21 - moment: 2.30.1 - package-name-regex: 2.0.6 - rollup: 4.60.1 - spdx-expression-validate: 2.0.0 - spdx-satisfies: 5.0.1 - transitivePeerDependencies: - - picomatch - - rollup@4.60.1: - dependencies: - '@types/estree': 1.0.8 - optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.60.1 - '@rollup/rollup-android-arm64': 4.60.1 - '@rollup/rollup-darwin-arm64': 4.60.1 - '@rollup/rollup-darwin-x64': 4.60.1 - '@rollup/rollup-freebsd-arm64': 4.60.1 - '@rollup/rollup-freebsd-x64': 4.60.1 - '@rollup/rollup-linux-arm-gnueabihf': 4.60.1 - '@rollup/rollup-linux-arm-musleabihf': 4.60.1 - '@rollup/rollup-linux-arm64-gnu': 4.60.1 - '@rollup/rollup-linux-arm64-musl': 4.60.1 - '@rollup/rollup-linux-loong64-gnu': 4.60.1 - '@rollup/rollup-linux-loong64-musl': 4.60.1 - '@rollup/rollup-linux-ppc64-gnu': 4.60.1 - '@rollup/rollup-linux-ppc64-musl': 4.60.1 - '@rollup/rollup-linux-riscv64-gnu': 4.60.1 - '@rollup/rollup-linux-riscv64-musl': 4.60.1 - '@rollup/rollup-linux-s390x-gnu': 4.60.1 - '@rollup/rollup-linux-x64-gnu': 4.60.1 - '@rollup/rollup-linux-x64-musl': 4.60.1 - '@rollup/rollup-openbsd-x64': 4.60.1 - '@rollup/rollup-openharmony-arm64': 4.60.1 - '@rollup/rollup-win32-arm64-msvc': 4.60.1 - '@rollup/rollup-win32-ia32-msvc': 4.60.1 - '@rollup/rollup-win32-x64-gnu': 4.60.1 - '@rollup/rollup-win32-x64-msvc': 4.60.1 - fsevents: 2.3.3 + '@rolldown/binding-android-arm64': 1.0.2 + '@rolldown/binding-darwin-arm64': 1.0.2 + '@rolldown/binding-darwin-x64': 1.0.2 + '@rolldown/binding-freebsd-x64': 1.0.2 + '@rolldown/binding-linux-arm-gnueabihf': 1.0.2 + '@rolldown/binding-linux-arm64-gnu': 1.0.2 + '@rolldown/binding-linux-arm64-musl': 1.0.2 + '@rolldown/binding-linux-ppc64-gnu': 1.0.2 + '@rolldown/binding-linux-s390x-gnu': 1.0.2 + '@rolldown/binding-linux-x64-gnu': 1.0.2 + '@rolldown/binding-linux-x64-musl': 1.0.2 + '@rolldown/binding-openharmony-arm64': 1.0.2 + '@rolldown/binding-wasm32-wasi': 1.0.2 + '@rolldown/binding-win32-arm64-msvc': 1.0.2 + '@rolldown/binding-win32-x64-msvc': 1.0.2 rotating-file-stream@3.2.9: {} @@ -3640,7 +3332,7 @@ snapshots: scule@1.3.0: {} - semver@7.7.4: {} + semver@7.8.0: {} send@1.2.1: dependencies: @@ -3725,33 +3417,6 @@ snapshots: source-map@0.6.1: optional: true - spdx-compare@1.0.0: - dependencies: - array-find-index: 1.0.2 - spdx-expression-parse: 3.0.1 - spdx-ranges: 2.1.1 - - spdx-exceptions@2.5.0: {} - - spdx-expression-parse@3.0.1: - dependencies: - spdx-exceptions: 2.5.0 - spdx-license-ids: 3.0.23 - - spdx-expression-validate@2.0.0: - dependencies: - spdx-expression-parse: 3.0.1 - - spdx-license-ids@3.0.23: {} - - spdx-ranges@2.1.1: {} - - spdx-satisfies@5.0.1: - dependencies: - spdx-compare: 1.0.0 - spdx-expression-parse: 3.0.1 - spdx-ranges: 2.1.1 - stackback@0.0.2: {} statuses@2.0.2: {} @@ -3766,7 +3431,7 @@ snapshots: tinybench@2.9.0: {} - tinyexec@1.1.1: {} + tinyexec@1.1.2: {} tinyglobby@0.2.16: dependencies: @@ -3787,38 +3452,38 @@ snapshots: media-typer: 1.1.0 mime-types: 3.0.2 - typescript@6.0.2: {} + typescript@6.0.3: {} - ufo@1.6.3: {} + ufo@1.6.4: {} - undici-types@7.19.2: {} + undici-types@7.24.6: {} unpipe@1.0.0: {} vary@1.1.2: {} - vite@8.0.7(@types/node@25.6.0)(jiti@2.6.1): + vite@8.0.7(@types/node@25.9.1)(jiti@2.7.0): dependencies: lightningcss: 1.32.0 picomatch: 4.0.4 - postcss: 8.5.10 + postcss: 8.5.15 rolldown: 1.0.0-rc.13 tinyglobby: 0.2.16 optionalDependencies: - '@types/node': 25.6.0 + '@types/node': 25.9.1 fsevents: 2.3.3 - jiti: 2.6.1 - - vitest@4.1.5(@types/node@25.6.0)(vite@8.0.7(@types/node@25.6.0)(jiti@2.6.1)): - dependencies: - '@vitest/expect': 4.1.5 - '@vitest/mocker': 4.1.5(vite@8.0.7(@types/node@25.6.0)(jiti@2.6.1)) - '@vitest/pretty-format': 4.1.5 - '@vitest/runner': 4.1.5 - '@vitest/snapshot': 4.1.5 - '@vitest/spy': 4.1.5 - '@vitest/utils': 4.1.5 - es-module-lexer: 2.0.0 + jiti: 2.7.0 + + vitest@4.1.7(@types/node@25.9.1)(vite@8.0.7(@types/node@25.9.1)(jiti@2.7.0)): + dependencies: + '@vitest/expect': 4.1.7 + '@vitest/mocker': 4.1.7(vite@8.0.7(@types/node@25.9.1)(jiti@2.7.0)) + '@vitest/pretty-format': 4.1.7 + '@vitest/runner': 4.1.7 + '@vitest/snapshot': 4.1.7 + '@vitest/spy': 4.1.7 + '@vitest/utils': 4.1.7 + es-module-lexer: 2.1.0 expect-type: 1.3.0 magic-string: 0.30.21 obug: 2.1.1 @@ -3826,13 +3491,13 @@ snapshots: picomatch: 4.0.4 std-env: 4.1.0 tinybench: 2.9.0 - tinyexec: 1.1.1 + tinyexec: 1.1.2 tinyglobby: 0.2.16 tinyrainbow: 3.1.0 - vite: 8.0.7(@types/node@25.6.0)(jiti@2.6.1) + vite: 8.0.7(@types/node@25.9.1)(jiti@2.7.0) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 25.6.0 + '@types/node': 25.9.1 transitivePeerDependencies: - msw diff --git a/scripts/pack.ts b/scripts/pack.ts index 116ee6f..40c6993 100755 --- a/scripts/pack.ts +++ b/scripts/pack.ts @@ -18,7 +18,16 @@ if (!existsSync(nodeModulesDir)) { const outFile = join(libDir, "code.tar.zst"); const excludeDirs = new Set([".bin"]); -const excludeDirPaths = new Set(["katex/src"]); +const excludeDirPaths = new Set([ + "katex/src", + // Copilot extension — large bundle (Copilot CLI ~13 MB, tree-sitter wasms, + // tokenizers). Not used in coderaft; the `@github/copilot` workspace shim + // already strips the npm package, and the bundled extension is dropped here. + "code-server/lib/vscode/extensions/copilot", + // Mermaid chat-features extension — webview bundle (~6 MB) for the Copilot + // chat panel; dead weight without the copilot extension. + "code-server/lib/vscode/extensions/mermaid-chat-features", +]); const excludeFilePaths = new Set([ "@vscode/tree-sitter-wasm/wasm/tree-sitter-c-sharp.wasm", "@vscode/tree-sitter-wasm/wasm/tree-sitter-ruby.wasm", @@ -33,6 +42,8 @@ const excludeNameRe = const tarExcludes = [ "node_modules/.bin", "node_modules/katex/src", + "node_modules/code-server/lib/vscode/extensions/copilot", + "node_modules/code-server/lib/vscode/extensions/mermaid-chat-features", "node_modules/@vscode/tree-sitter-wasm/wasm/tree-sitter-c-sharp.wasm", "node_modules/@vscode/tree-sitter-wasm/wasm/tree-sitter-ruby.wasm", "node_modules/code-server/lib/vscode/extensions/microsoft-authentication/dist/libmsalruntime.so", diff --git a/scripts/sync.ts b/scripts/sync.ts index f53067a..f70940d 100755 --- a/scripts/sync.ts +++ b/scripts/sync.ts @@ -21,12 +21,12 @@ const extraDeps: Record = { // Upstream deps that are not referenced by any bundled code path and // should never be installed (keeps the dep tree lean). -const excludedDeps = new Set([ - "@anthropic-ai/sandbox-runtime", - // Bundled into dist by obuild (see lib/dist/_chunks/libs/httpxy.mjs), - // so it must not be listed as a runtime dep. - "httpxy", -]); +const excludedDeps = new Set(["@anthropic-ai/sandbox-runtime"]); + +// Coderaft-specific deps not declared by upstream code-server but required +// by `lib/src/*` (bundled into dist by obuild). Preserved across syncs so +// the wholesale `devDependencies` replacement below does not drop them. +const preservedDeps = new Set(["httpxy"]); // Merge and sort all nested dependencies const nestedDeps: Record = Object.fromEntries( @@ -44,16 +44,22 @@ const pkgPath = join(workspacePkgDir, "package.json"); const pkg = JSON.parse(readFileSync(pkgPath, "utf8")); const prevDeps = pkg.devDependencies || {}; -// Replace all devDependencies (keep code-server and workspace:* refs) -pkg.devDependencies = { - "code-server": prevDeps["code-server"] || "^4.114.0", - ...nestedDeps, -}; +// Replace all devDependencies (keep code-server, workspace:* refs, and +// any explicitly preserved coderaft-only deps). code-server stays pinned +// to the head of the object; everything else is sorted alphabetically. +const carriedOver: Record = {}; for (const [name, version] of Object.entries(prevDeps)) { - if (version.startsWith("workspace:")) { - pkg.devDependencies[name] = version; + if (version.startsWith("workspace:") || preservedDeps.has(name)) { + carriedOver[name] = version; } } +const merged = Object.fromEntries( + Object.entries({ ...nestedDeps, ...carriedOver }).sort(([a], [b]) => a.localeCompare(b)), +); +pkg.devDependencies = { + "code-server": prevDeps["code-server"] || "^4.114.0", + ...merged, +}; writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n"); diff --git a/shims/README.md b/shims/README.md index ca24719..ec9b1a1 100644 --- a/shims/README.md +++ b/shims/README.md @@ -19,6 +19,8 @@ This directory contains workspace packages that replace native/heavy dependencie - [`vscode-windows-registry/`](./vscode-windows-registry/) — Stub for [`@vscode/windows-registry`](https://www.npmjs.com/package/@vscode/windows-registry) (native C++ registry addon with unbuilt `binding.gyp`). Only used by VS Code's telemetry/machine-id code (`GetStringRegKey("HKEY_LOCAL_MACHINE", …, "MachineId")`); callers already handle errors and fall back to defaults. - [`argon2/`](./argon2/) — Replaces [`argon2`](https://github.com/ranisalt/node-argon2) (native C binding) with Node.js `crypto.scrypt`. Encodes/decodes PHC-format hashes for compatibility with existing stored passwords. - [`vscode-proxy-agent/`](./vscode-proxy-agent/) — No-op shim for [`@vscode/proxy-agent`](https://github.com/microsoft/vscode-proxy-agent) (proxy resolver with heavy deps: `undici`, `socks-proxy-agent`, `http-proxy-agent`, etc.). Passes through Node.js native `http`/`https`/`net`/`tls` unmodified. Users behind a proxy can rely on `HTTP_PROXY`/`HTTPS_PROXY` env vars. +- [`vscode-sqlite3/`](./vscode-sqlite3/) — Replaces [`@vscode/sqlite3`](https://github.com/microsoft/vscode-node-sqlite3) (native SQLite binding, bundled C source + `node-gyp` build, ~3 MB unpacked) with a thin async wrapper around Node.js' built-in synchronous `node:sqlite` (stable in Node 24+). Loaded via dynamic `import("@vscode/sqlite3")` from `vs/platform/agentHost/node/agentHostMain.js`; only the `Database`/`exec`/`run`/`get`/`all`/`close` surface is needed. +- [`ssh2/`](./ssh2/) — Stub for [`ssh2`](https://github.com/mscdex/ssh2). Listed as a direct dep by upstream code-server but not actually loaded by the bundled VS Code server, CLI, bootstrap-fork, or any extension — the only references in the build output are embedded copies of code-server's `package.json` `overrides` block. Eliminates ssh2 itself plus its native transitive deps (`cpu-features`, `nan`, `asn1`, `bcrypt-pbkdf`, `tweetnacl`, `buildcheck`). - [`1ds-core-js/`](./1ds-core-js/) — No-op shim for [`@microsoft/1ds-core-js`](https://www.npmjs.com/package/@microsoft/1ds-core-js) (Microsoft 1DS telemetry core). Silently drops all telemetry events. Also eliminates transitive deps: `@microsoft/applicationinsights-core-js`, `@microsoft/dynamicproto-js`, `@microsoft/applicationinsights-shims`. - [`1ds-post-js/`](./1ds-post-js/) — No-op shim for [`@microsoft/1ds-post-js`](https://www.npmjs.com/package/@microsoft/1ds-post-js) (Microsoft 1DS telemetry transport). Silently drops all telemetry posts. - [`kerberos/`](./kerberos/) — Shim for [`kerberos`](https://github.com/mongodb-js/kerberos) (native GSSAPI/SSPI binding via `node-gyp`, used by VS Code's built-in Negotiate proxy authentication). Loaded via dynamic `import("kerberos")` from `server-main.js` / `extensionHostProcess.js`; since [`@vscode/proxy-agent`](./vscode-proxy-agent/) is itself a no-op shim, this path is effectively dead. The shim throws from `initializeClient` so callers surface a clear error instead of a malformed token. Users behind a proxy should set `HTTP_PROXY` / `HTTPS_PROXY`. @@ -36,7 +38,9 @@ The mappings configured in root [`package.json`](../package.json): | `@github/copilot-sdk` | `shims/github-copilot-sdk/` | | `node-pty` | `shims/node-pty/` | | `@vscode/spdlog` | `shims/spdlog/` | +| `@vscode/sqlite3` | `shims/vscode-sqlite3/` | | `@vscode/fs-copyfile` | `shims/vscode-fs-copyfile/` | +| `ssh2` | `shims/ssh2/` | | `@vscode/deviceid` | `shims/vscode-deviceid/` | | `@vscode/native-watchdog` | `shims/vscode-native-watchdog/` | | `@vscode/ripgrep` | `shims/vscode-ripgrep/` | diff --git a/shims/ssh2/index.js b/shims/ssh2/index.js new file mode 100644 index 0000000..741e609 --- /dev/null +++ b/shims/ssh2/index.js @@ -0,0 +1,39 @@ +// Shim for `ssh2` — listed as a direct dependency by upstream code-server but +// not actually required by the bundled VS Code server, CLI, bootstrap-fork, or +// any extension. The only "ssh2" references in the build output are embedded +// copies of code-server's package.json `overrides` block. +// +// Replacing it with this stub avoids shipping ssh2 + its native transitive +// deps (`cpu-features`, `nan`, `asn1`, `bcrypt-pbkdf`, `tweetnacl`, …) which +// add ~2 MB of unused weight and several MB of native build artifacts. +// +// If a future code-server bump starts loading ssh2 for real, callers will +// surface a clear error from the proxy attempting to instantiate it. + +const UNSUPPORTED = "ssh2 is not bundled in coderaft"; + +function unsupported() { + throw new Error(UNSUPPORTED); +} + +class Client { + constructor() { + unsupported(); + } +} + +class Server { + constructor() { + unsupported(); + } +} + +module.exports = { + Client, + Server, + utils: { + parseKey: unsupported, + generateKeyPair: unsupported, + generateKeyPairSync: unsupported, + }, +}; diff --git a/shims/ssh2/package.json b/shims/ssh2/package.json new file mode 100644 index 0000000..68ba9db --- /dev/null +++ b/shims/ssh2/package.json @@ -0,0 +1,7 @@ +{ + "name": "ssh2", + "version": "1.16.0", + "private": true, + "type": "commonjs", + "main": "index.js" +} diff --git a/shims/vscode-sqlite3/index.js b/shims/vscode-sqlite3/index.js new file mode 100644 index 0000000..3a4c13e --- /dev/null +++ b/shims/vscode-sqlite3/index.js @@ -0,0 +1,117 @@ +// Shim for `@vscode/sqlite3` — replaces the native SQLite binding (bundled C +// source + node-gyp build) used by VS Code's `agent-host` subcommand for its +// session database. +// +// Wraps Node.js' built-in synchronous `node:sqlite` (stable in Node 24+) in +// the async callback API expected by the bundled code. The bundle only loads +// this module via dynamic `import("@vscode/sqlite3")` from +// `vs/platform/agentHost/node/agentHostMain.js`, and only uses +// `Database`/`exec`/`run`/`get`/`all`/`close`. + +let DatabaseSync; +function loadDatabaseSync() { + return (DatabaseSync ??= globalThis.process.getBuiltinModule("node:sqlite").DatabaseSync); +} + +function normalizeParams(params) { + if (params === undefined || params === null) return []; + return Array.isArray(params) ? params : [params]; +} + +class Database { + constructor(path, callback) { + let err = null; + try { + this._db = new (loadDatabaseSync())(path); + } catch (e) { + err = e; + } + if (typeof callback === "function") { + queueMicrotask(() => callback.call(this, err)); + } + } + + exec(sql, callback) { + let err = null; + try { + this._db.exec(sql); + } catch (e) { + err = e; + } + if (typeof callback === "function") { + queueMicrotask(() => callback.call(this, err)); + } + return this; + } + + run(sql, params, callback) { + if (typeof params === "function") { + callback = params; + params = []; + } + const ctx = { changes: 0, lastID: 0 }; + let err = null; + try { + const result = this._db.prepare(sql).run(...normalizeParams(params)); + ctx.changes = Number(result.changes); + ctx.lastID = Number(result.lastInsertRowid); + } catch (e) { + err = e; + } + if (typeof callback === "function") { + queueMicrotask(() => callback.call(ctx, err)); + } + return this; + } + + get(sql, params, callback) { + if (typeof params === "function") { + callback = params; + params = []; + } + let err = null; + let row; + try { + row = this._db.prepare(sql).get(...normalizeParams(params)); + } catch (e) { + err = e; + } + if (typeof callback === "function") { + queueMicrotask(() => callback.call(this, err, row)); + } + return this; + } + + all(sql, params, callback) { + if (typeof params === "function") { + callback = params; + params = []; + } + let err = null; + let rows; + try { + rows = this._db.prepare(sql).all(...normalizeParams(params)); + } catch (e) { + err = e; + } + if (typeof callback === "function") { + queueMicrotask(() => callback.call(this, err, rows)); + } + return this; + } + + close(callback) { + let err = null; + try { + this._db?.close(); + } catch (e) { + err = e; + } + if (typeof callback === "function") { + queueMicrotask(() => callback.call(this, err)); + } + return this; + } +} + +module.exports = { Database, OPEN_READONLY: 1, OPEN_READWRITE: 2, OPEN_CREATE: 4 }; diff --git a/shims/vscode-sqlite3/package.json b/shims/vscode-sqlite3/package.json new file mode 100644 index 0000000..dd072bd --- /dev/null +++ b/shims/vscode-sqlite3/package.json @@ -0,0 +1,7 @@ +{ + "name": "@vscode/sqlite3", + "version": "5.1.12-vscode", + "private": true, + "type": "commonjs", + "main": "index.js" +} From e93294a842b379a05749e2cccf29c944c0b2a5c0 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 20 May 2026 12:17:50 +0200 Subject: [PATCH 2/2] update patch --- lib/code.mjs | 2 +- patches/code-server.patch | 65 ++++++++++++++++++--------------------- pnpm-lock.yaml | 6 ++-- 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/lib/code.mjs b/lib/code.mjs index 9994079..221387f 100644 --- a/lib/code.mjs +++ b/lib/code.mjs @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import { fileURLToPath } from "node:url"; // Auto-updated by scripts/pack.ts -const codeArchiveHash = "1a6179c4886bac82"; +const codeArchiveHash = "c433dbc9db2649ca"; const archivePath = fileURLToPath(new URL("./code.tar.zst", import.meta.url)); diff --git a/patches/code-server.patch b/patches/code-server.patch index ee97785..9a6774d 100644 --- a/patches/code-server.patch +++ b/patches/code-server.patch @@ -1,50 +1,50 @@ diff --git a/lib/vscode/out/server-main.js b/lib/vscode/out/server-main.js -index f9d7ca965bc572e8472ca9bb4e060f1d43f67ba6..305050e86ffd1706dcefb0066c7111b34b00ce75 100644 +index 99f1aed2f37ebd30635ac48ba108901db7186533..b6c9bcedf224f0a4763b9d1eb135602f42d74a57 100644 --- a/lib/vscode/out/server-main.js +++ b/lib/vscode/out/server-main.js -@@ -440,7 +440,7 @@ ${t.toString()}`}},Id=class o{constructor(t=new Fs,e=!1,n,r=fV){this._services=t - `))}}});async function Lv(o,t,e,n,r,i){let s;try{await gV(o,t,e,n,r,i)}catch(a){s=a}finally{s&&r.errorTransformer&&(s=r.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function gV(o,t,e,n,r,i){$E(i);let s=await o.open(t,{create:!1});try{$E(i);let a=0,l=0,c=r&&typeof r.length=="number"?r.length:void 0,u=A.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),p=r&&typeof r.position=="number"?r.position:0,m=0;do l=await o.read(s,p,u.buffer,m,u.byteLength-m),p+=l,m+=l,a+=l,typeof c=="number"&&(c-=l),m===u.byteLength&&(await e.write(n(u)),u=A.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),m=0);while(l>0&&(typeof c!="number"||c>0)&&$E(i)&&hV(a,r));if(m>0){let g=m;typeof c=="number"&&(g=Math.min(m,c)),e.write(n(u.slice(0,g)))}}catch(a){throw os(a)}finally{await o.close(s)}}function $E(o){if(o.isCancellationRequested)throw dp();return!0}function hV(o,t){if(typeof t?.limits?.size=="number"&&o>t.limits.size)throw Do(d(2128,null),"EntryTooLarge");return!0}var zE=y(()=>{nt();Se();ue();ot()});var Ti,qE=y(()=>{At();$e();nt();Wt();ce();rl();$o();j();$p();He();Wo();Nt();kc();ue();ot();zE();Ve();Se();Ti=class extends D{constructor(e){super();this.logService=e;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new P);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new P);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new P);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new P);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new P);this._onDidUncorrelatedFilesChange=this._register(new P);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new P);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new Tc)}registerProvider(e,n){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);Ot(`code/registerFilesystem/${e}`);let r=new se;return this.provider.set(e,n),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:n}),r.add(n.onDidChangeFile(i=>{let s=new Dh(i,!this.isPathCaseSensitive(n));this.internalOnDidFilesChange.fire(s),s.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(s)})),typeof n.onDidWatchError=="function"&&r.add(n.onDidWatchError(i=>this._onDidWatchError.fire(new Error(i)))),r.add(n.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:n,scheme:e}))),ie(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:n}),this.provider.delete(e),Jt(r)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){let n=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(r){n.push(r)}}),!this.provider.has(e)&&await rn.settled(n)}async canHandleResource(e){return await this.activateProvider(e.scheme),this.hasProvider(e)}hasProvider(e){return this.provider.has(e.scheme)}hasCapability(e,n){let r=this.provider.get(e.scheme);return!!(r&&r.capabilities&n)}listCapabilities(){return fn.map(this.provider,([e,n])=>({scheme:e,capabilities:n.capabilities}))}async withProvider(e){if(!N1(e))throw new hn(d(2117,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let n=this.provider.get(e.scheme);if(!n){let r=new ur;throw r.message=d(2119,null,e.toString()),r}return n}async withReadProvider(e){let n=await this.withProvider(e);if(rs(n)||go(n)||_h(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(e){let n=await this.withProvider(e);if(rs(n)||go(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(e,n){try{return await this.doResolveFile(e,n)}catch(r){throw zp(r)==="EntryNotFound"?new hn(d(2114,null,this.resourceForError(e)),1):os(r)}}async doResolveFile(e,n){let r=await this.withProvider(e),i=this.isPathCaseSensitive(r),s=n?.resolveTo,a=n?.resolveSingleChildDescendants,l=n?.resolveMetadata,c=await r.stat(e),u;return this.toFileStat(r,e,c,void 0,!!l,(p,m)=>(u||(u=Ko.forUris(()=>!i),u.set(e,!0),s&&u.fill(!0,s)),u.get(p.resource)||u.findSuperstr(p.resource.with({query:null,fragment:null}))?!0:p.isDirectory&&a?m===1:!1))}async toFileStat(e,n,r,i,s,a){let{providerExtUri:l}=this.getExtUri(e),c={resource:n,name:l.basename(n),isFile:(r.type&1)!==0,isDirectory:(r.type&2)!==0,isSymbolicLink:(r.type&64)!==0,mtime:r.mtime,ctime:r.ctime,size:r.size,readonly:!!((r.permissions??0)&1)||!!(e.capabilities&2048),locked:!!((r.permissions??0)&2),executable:!!((r.permissions??0)&4),etag:OS({mtime:r.mtime,size:r.size}),children:void 0};if(c.isDirectory&&a(c,i)){try{let u=await e.readdir(n),p=await rn.settled(u.map(async([m,g])=>{try{let h=l.joinPath(n,m),v=s?await e.stat(h):{type:g};return await this.toFileStat(e,h,v,u.length,s,a)}catch(h){return this.logService.trace(h),null}}));c.children=Qn(p)}catch(u){this.logService.trace(u),c.children=[]}return c}return c}async resolveAll(e){return rn.settled(e.map(async n=>{try{return{stat:await this.doResolveFile(n.resource,n.options),success:!0}}catch(r){return this.logService.trace(r),{stat:void 0,success:!1}}}))}async stat(e){let n=await this.withProvider(e),r=await n.stat(e);return this.toFileStat(n,e,r,void 0,!0,()=>!1)}async realpath(e){let n=await this.withProvider(e);if(WD(n)){let r=await n.realpath(e);return e.with({path:r})}}async exists(e){let n=await this.withProvider(e);try{return!!await n.stat(e)}catch{return!1}}async canCreateFile(e,n){try{await this.doValidateCreateFile(e,n)}catch(r){return r}return!0}async doValidateCreateFile(e,n){if(!n?.overwrite&&await this.exists(e))throw new hn(d(2110,null,this.resourceForError(e)),3,n)}async createFile(e,n=A.fromString(""),r){await this.doValidateCreateFile(e,r);let i=await this.writeFile(e,n);return this._onDidRunOperation.fire(new ns(e,0,i)),i}async writeFile(e,n,r){let i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:s}=this.getExtUri(i),a=r;if(LS(i)&&!a?.atomic){let l=i.enforceAtomicWriteFile?.(e);l&&(a={...r,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(i,e,n,a);l||await this.mkdirp(i,s.dirname(e)),c||(c=await this.peekBufferForWriting(i,n)),!rs(i)||go(i)&&c instanceof A||go(i)&&LS(i)&&a?.atomic?await this.doWriteUnbuffered(i,e,a,c):await this.doWriteBuffered(i,e,a,c instanceof A?iD(c):c),this._onDidRunOperation.fire(new ns(e,4))}catch(l){throw new hn(d(2109,null,this.resourceForError(e),os(l).toString()),Pt(l),a)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,n){let r;if(go(e)&&!(n instanceof A))if(Pp(n)){let i=await eD(n,3);i.ended?r=A.concat(i.buffer):r=i}else r=Z1(n,i=>A.concat(i),3);else r=n;return r}async validateWriteFile(e,n,r,i){let s=!!i?.unlock;if(s&&!(e.capabilities&8192))throw new Error(d(2127,null,this.resourceForError(n)));if(i?.append&&!FD(e))throw new hn(d(2106,null,this.resourceForError(n)),6);if(!!i?.atomic){if(!(e.capabilities&32768))throw new Error(d(2125,null,this.resourceForError(n)));if(!(e.capabilities&2))throw new Error(d(2126,null,this.resourceForError(n)));if(s)throw new Error(d(2124,null,this.resourceForError(n)))}let l;try{l=await e.stat(n)}catch{return Object.create(null)}if((l.type&2)!==0)throw new hn(d(2112,null,this.resourceForError(n)),0,i);this.throwIfFileIsReadonly(n,l);let c;if(typeof i?.mtime=="number"&&typeof i.etag=="string"&&i.etag!==Mh&&typeof l.mtime=="number"&&typeof l.size=="number"&&i.mtime{this.writeQueue.queueFor(n,async()=>{try{let l=await this.doReadFile(e,n,r,i);s(l)}catch(l){a(l)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,n,r,i){let s=await this.doReadFileStream(e,n,{...r,preferUnbuffered:!0},i);return{...s,value:await Hr(s.value)}}async readFileStream(e,n,r){let i=await this.withReadProvider(e);return this.doReadFileStream(i,e,n,r)}async doReadFileStream(e,n,r,i){let s=new ht(i),a=r;Lh(e)&&e.enforceAtomicReadFile?.(n)&&(a={...r,atomic:!0});let l=this.validateReadFile(n,a).then(u=>u,u=>{throw s.dispose(!0),u}),c;try{return typeof a?.etag=="string"&&a.etag!==Mh&&await l,a?.atomic&&Lh(e)||!(rs(e)||_h(e))||go(e)&&a?.preferUnbuffered?c=this.readFileUnbuffered(e,n,a):_h(e)?c=this.readFileStreamed(e,n,s.token,a):c=this.readFileBuffered(e,n,s.token,a),c.on("end",()=>s.dispose()),c.on("error",()=>s.dispose()),{...await l,value:c}}catch(u){throw c&&await dh(c),this.restoreReadError(u,n,a)}}restoreReadError(e,n,r){let i=d(2107,null,this.resourceForError(n),os(e).toString());return e instanceof Bc?new Bc(i,e.stat,r):e instanceof Wc?new Wc(i,e.fileOperationResult,e.size,e.options):new hn(i,Pt(e),r)}readFileStreamed(e,n,r,i=Object.create(null)){let s=e.readFileStream(n,i,r);return uh(s,{data:a=>a instanceof A?a:A.wrap(a),error:a=>this.restoreReadError(a,n,i)},a=>A.concat(a))}readFileBuffered(e,n,r,i=Object.create(null)){let s=lD();return Lv(e,n,s,a=>a,{...i,bufferSize:this.BUFFER_SIZE,errorTransformer:a=>this.restoreReadError(a,n,i)},r),s}readFileUnbuffered(e,n,r){let i=Vs(s=>A.concat(s));return(async()=>{try{let s;r?.atomic&&Lh(e)?s=await e.readFile(n,{atomic:!0}):s=await e.readFile(n),typeof r?.position=="number"&&(s=s.slice(r.position)),typeof r?.length=="number"&&(s=s.slice(0,r.length)),this.validateReadFileLimits(n,s.byteLength,r),i.end(A.wrap(s))}catch(s){i.error(s),i.end()}})(),i}async validateReadFile(e,n){let r=await this.resolve(e,{resolveMetadata:!0});if(r.isDirectory)throw new hn(d(2111,null,this.resourceForError(e)),0,n);if(typeof n?.etag=="string"&&n.etag!==Mh&&n.etag===r.etag)throw new Bc(d(2115,null),r,n);return this.validateReadFileLimits(e,r.size,n),r}validateReadFileLimits(e,n,r){if(typeof r?.limits?.size=="number"&&n>r.limits.size)throw new Wc(d(2116,null,this.resourceForError(e)),7,n,r)}async canMove(e,n,r){return this.doCanMoveCopy(e,n,"move",r)}async canCopy(e,n,r){return this.doCanMoveCopy(e,n,"copy",r)}async doCanMoveCopy(e,n,r,i){if(e.toString()!==n.toString())try{let s=r==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),a=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);await this.doValidateMoveCopy(s,e,a,n,r,i)}catch(s){return s}return!0}async move(e,n,r){let i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(i,e,s,n,"move",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ns(e,a==="move"?2:3,l)),l}async copy(e,n,r){let i=await this.withReadProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(i,e,s,n,"copy",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ns(e,a==="copy"?3:2,l)),l}async doMoveCopy(e,n,r,i,s,a){if(n.toString()===i.toString())return s;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(e,n,r,i,s,a);if(l&&!c&&a&&await this.del(i,{recursive:!0}),await this.mkdirp(r,this.getExtUri(r).providerExtUri.dirname(i)),s==="copy"){if(e===r&&_S(e))await e.copy(n,i,{overwrite:a});else{let u=await this.resolve(n);u.isDirectory?await this.doCopyFolder(e,u,r,i):await this.doCopyFile(e,n,r,i)}return s}else return e===r?(await e.rename(n,i,{overwrite:a}),s):(await this.doMoveCopy(e,n,r,i,"copy",a),await this.del(n,{recursive:!0}),"copy")}async doCopyFile(e,n,r,i){if(rs(e)&&rs(r))return this.doPipeBuffered(e,n,r,i);if(rs(e)&&go(r))return this.doPipeBufferedToUnbuffered(e,n,r,i);if(go(e)&&rs(r))return this.doPipeUnbufferedToBuffered(e,n,r,i);if(go(e)&&go(r))return this.doPipeUnbuffered(e,n,r,i)}async doCopyFolder(e,n,r,i){await r.mkdir(i),Array.isArray(n.children)&&await rn.settled(n.children.map(async s=>{let a=this.getExtUri(r).providerExtUri.joinPath(i,s.name);return s.isDirectory?this.doCopyFolder(e,await this.resolve(s.resource),r,a):this.doCopyFile(e,s.resource,r,a)}))}async doValidateMoveCopy(e,n,r,i,s,a){let l=!1;if(e===r){let{providerExtUri:u,isPathCaseSensitive:p}=this.getExtUri(e);if(p||(l=u.isEqual(n,i)),l&&s==="copy")throw new Error(d(2120,null,this.resourceForError(n),this.resourceForError(i)));if(!l&&u.isEqualOrParent(i,n))throw new Error(d(2121,null,this.resourceForError(n),this.resourceForError(i)))}let c=await this.exists(i);if(c&&!l){if(!a)throw new hn(d(2122,null,this.resourceForError(n),this.resourceForError(i)),4);if(e===r){let{providerExtUri:u}=this.getExtUri(e);if(u.isEqualOrParent(n,i))throw new Error(d(2123,null,this.resourceForError(n),this.resourceForError(i)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let n=this.isPathCaseSensitive(e);return{providerExtUri:n?tt:Kx,isPathCaseSensitive:n}}isPathCaseSensitive(e){return!!(e.capabilities&1024)}async createFolder(e){let n=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e);await this.mkdirp(n,e);let r=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ns(e,0,r)),r}async mkdirp(e,n){let r=[],{providerExtUri:i}=this.getExtUri(e);for(;!i.isEqual(n,i.dirname(n));)try{if(((await e.stat(n)).type&2)===0)throw new Error(d(2118,null,this.resourceForError(n)));break}catch(s){if(zp(s)!=="EntryNotFound")throw s;r.push(i.basename(n)),n=i.dirname(n)}for(let s=r.length-1;s>=0;s--){n=i.joinPath(n,r[s]);try{await e.mkdir(n)}catch(a){if(zp(a)!=="EntryExists")throw a}}}async canDelete(e,n){try{await this.doValidateDelete(e,n)}catch(r){return r}return!0}async doValidateDelete(e,n){let r=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),i=!!n?.useTrash;if(i&&!(r.capabilities&4096))throw new Error(d(2105,null,this.resourceForError(e)));let s=n?.atomic;if(s&&!(r.capabilities&65536))throw new Error(d(2101,null,this.resourceForError(e)));if(i&&s)throw new Error(d(2104,null,this.resourceForError(e)));let a;try{a=await r.stat(e)}catch{}if(a)this.throwIfFileIsReadonly(e,a);else throw new hn(d(2103,null,this.resourceForError(e)),1);if(!!!n?.recursive){let c=await this.resolve(e);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(d(2102,null,this.resourceForError(e)))}return r}async del(e,n){let r=await this.doValidateDelete(e,n),i=n;if(BD(r)&&!i?.atomic){let c=r.enforceAtomicDelete?.(e);c&&(i={...n,atomic:c})}let s=!!i?.useTrash,a=!!i?.recursive,l=i?.atomic??!1;await r.delete(e,{recursive:a,useTrash:s,atomic:l}),this._onDidRunOperation.fire(new ns(e,1))}async cloneFile(e,n){let r=await this.withProvider(e),i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);if(!(r===i&&this.getExtUri(r).providerExtUri.isEqual(e,n)))return r===i&&VD(r)?r.cloneFile(e,n):(await this.mkdirp(i,this.getExtUri(i).providerExtUri.dirname(n)),r===i&&_S(r)?this.writeQueue.queueFor(e,()=>r.copy(e,n,{overwrite:!0}),this.getExtUri(r).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(r,e,i,n),this.getExtUri(r).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,n){return this.watch(e,{...n,correlationId:Ti.WATCHER_CORRELATION_IDS++})}watch(e,n={recursive:!1,excludes:[]}){let r=new se,i=!1,s=()=>{i=!0};r.add(ie(()=>s())),(async()=>{try{let l=await this.doWatch(e,n);i?Jt(l):s=()=>Jt(l)}catch(l){this.logService.error(l)}})();let a=n.correlationId;if(typeof a=="number"){let l=r.add(new P);return r.add(this.internalOnDidFilesChange.event(u=>{u.correlates(a)&&l.fire(u)})),{onDidChange:l.event,dispose:()=>r.dispose()}}return r}async doWatch(e,n){let r=await this.withProvider(e),i=po([this.getExtUri(r).providerExtUri.getComparisonKey(e),n]),s=this.activeWatchers.get(i);return s||(s={count:0,disposable:r.watch(e,n)},this.activeWatchers.set(i,s)),s.count+=1,ie(()=>{s&&(s.count--,s.count===0&&(Jt(s.disposable),this.activeWatchers.delete(i)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)Jt(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,n,r,i){return this.writeQueue.queueFor(n,async()=>{let s=await e.open(n,{create:!0,unlock:r?.unlock??!1,append:r?.append??!1});try{Pp(i)||ch(i)?await this.doWriteStreamBufferedQueued(e,s,i):await this.doWriteReadableBufferedQueued(e,s,i)}catch(a){throw os(a)}finally{await e.close(s)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,n,r){let i=0,s;if(ch(r)){if(r.buffer.length>0){let a=A.concat(r.buffer);await this.doWriteBuffer(e,n,a,a.byteLength,i,0),i+=a.byteLength}if(r.ended)return;s=r.stream}else s=r;return new Promise((a,l)=>{Rc(s,{onData:async c=>{s.pause();try{await this.doWriteBuffer(e,n,c,c.byteLength,i,0)}catch(u){return l(u)}i+=c.byteLength,setTimeout(()=>s.resume())},onError:c=>l(c),onEnd:()=>a()})})}async doWriteReadableBufferedQueued(e,n,r){let i=0,s;for(;(s=r.read())!==null;)await this.doWriteBuffer(e,n,s,s.byteLength,i,0),i+=s.byteLength}async doWriteBuffer(e,n,r,i,s,a){let l=0;for(;lthis.doWriteUnbufferedQueued(e,n,r,i),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,n,r,i){let s;i instanceof A?s=i:Pp(i)?s=await Hr(i):ch(i)?s=await sD(i):s=oD(i),await e.writeFile(n,s.buffer,{create:!0,overwrite:!0,unlock:r?.unlock??!1,atomic:r?.atomic??!1,append:r?.append??!1})}async doPipeBuffered(e,n,r,i){return this.writeQueue.queueFor(i,()=>this.doPipeBufferedQueued(e,n,r,i),this.getExtUri(r).providerExtUri)}async doPipeBufferedQueued(e,n,r,i){let s,a;try{s=await e.open(n,{create:!1}),a=await r.open(i,{create:!0,unlock:!1});let l=A.alloc(this.BUFFER_SIZE),c=0,u=0,p=0;do p=await e.read(s,c,l.buffer,u,l.byteLength-u),await this.doWriteBuffer(r,a,l,p,c,u),c+=p,u+=p,u===l.byteLength&&(u=0);while(p>0)}catch(l){throw os(l)}finally{await rn.settled([typeof s=="number"?e.close(s):Promise.resolve(),typeof a=="number"?r.close(a):Promise.resolve()])}}async doPipeUnbuffered(e,n,r,i){return this.writeQueue.queueFor(i,()=>this.doPipeUnbufferedQueued(e,n,r,i),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedQueued(e,n,r,i){return r.writeFile(i,await e.readFile(n),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,n,r,i){return this.writeQueue.queueFor(i,()=>this.doPipeUnbufferedToBufferedQueued(e,n,r,i),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,n,r,i){let s=await r.open(i,{create:!0,unlock:!1});try{let a=await e.readFile(n);await this.doWriteBuffer(r,s,A.wrap(a),a.byteLength,0,0)}catch(a){throw os(a)}finally{await r.close(s)}}async doPipeBufferedToUnbuffered(e,n,r,i){let s=await Hr(this.readFileBuffered(e,n,Ee.None));await this.doWriteUnbuffered(r,i,void 0,s)}throwIfFileSystemIsReadonly(e,n){if(e.capabilities&2048)throw new hn(d(2108,null,this.resourceForError(n)),6);return e}throwIfFileIsReadonly(e,n){if((n.permissions??0)&1)throw new hn(d(2108,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===z.file?e.fsPath:e.toString(!0)}};Ti=E([b(0,Q)],Ti)});function Y_(o,t){switch(o){case 0:return"";case 1:return`${Ov}*?`;default:return`(?:${Mv}|${Ov}+${Mv}${t?`|${Mv}${Ov}+`:""})*?`}}function Z_(o,t){if(!o)return[];let e=[],n=!1,r=!1,i="";for(let s of o){switch(s){case t:if(!n&&!r){e.push(i),i="";continue}break;case"{":n=!0;break;case"}":n=!1;break;case"[":r=!0;break;case"]":r=!1;break}i+=s}return i&&e.push(i),e}function oL(o){if(!o)return"";let t="",e=Z_(o,X_);if(e.every(n=>n===xd))t=".*";else{let n=!1;e.forEach((r,i)=>{if(r===xd){if(n)return;t+=Y_(2,i===e.length-1)}else{let s=!1,a="",l=!1,c="";for(let u of r){if(u!=="}"&&s){a+=u;continue}if(l&&(u!=="]"||!c)){let p;u==="-"?p=u:(u==="^"||u==="!")&&!c?p="^":u===X_?p="":p=ao(u),c+=p;continue}switch(u){case"{":s=!0;continue;case"[":l=!0;continue;case"}":{let m=`(?:${Z_(a,",").map(g=>oL(g)).join("|")})`;t+=m,s=!1,a="";break}case"]":{t+="["+c+"]",l=!1,c="";break}case"?":t+=Ov;continue;case"*":t+=Y_(1);continue;default:t+=ao(u)}}il===c,endsWith:n?v1:(l,c)=>l.endsWith(c),isEqualOrParent:(l,c)=>Wr(l,c,t.ignoreCase??!Me)},i=`${n?e.toLowerCase():e}_${!!t.trimForExclusions}_${n}`,s=eL.get(i);if(s)return nL(s,o,r);let a;return bV.test(e)?s=CV(e.substring(4),e,r):(a=IV.exec(KE(e,r)))?s=TV(a[1],e,r):(t.trimForExclusions?SV:xV).test(e)?s=PV(e,r):(a=EV.exec(KE(e,r)))?s=rL(a[1].substring(1),e,!0,r):(a=wV.exec(KE(e,r)))?s=rL(a[1],e,!1,r):s=RV(e,r),eL.set(i,s),nL(s,o,r)}function nL(o,t,e){if(typeof t=="string")return o;let n=function(r,i){return e.isEqualOrParent(r,t.base)?o(Ax(r.substring(t.base.length),en),i):null};return n.allBasenames=o.allBasenames,n.allPaths=o.allPaths,n.basenames=o.basenames,n.patterns=o.patterns,n}function KE(o,t){return t.trimForExclusions&&o.endsWith("/**")?o.substring(0,o.length-2):o}function CV(o,t,e){return function(n,r){return typeof n=="string"&&e.endsWith(n,o)?t:null}}function TV(o,t,e){let n=`/${o}`,r=`\\${o}`,i=function(a,l){return typeof a!="string"?null:l?e.equals(l,o)?t:null:e.equals(a,o)||e.endsWith(a,n)||e.endsWith(a,r)?t:null},s=[o];return i.basenames=s,i.patterns=[t],i.allBasenames=s,i}function PV(o,t){let e=sL(o.slice(1,-1).split(",").map(a=>jE(a,t)).filter(a=>a!==Pi),o),n=e.length;if(!n)return Pi;if(n===1)return e[0];let r=function(a,l){for(let c=0,u=e.length;c!!a.allBasenames);i&&(r.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(r.allPaths=s),r}function rL(o,t,e,n){let r=en===Be.sep,i=r?o:o.replace(yV,en),s=en+i,a=Be.sep+o,l;return e?l=function(c,u){return typeof c=="string"&&(n.equals(c,i)||n.endsWith(c,s)||!r&&(n.equals(c,o)||n.endsWith(c,a)))?t:null}:l=function(c,u){return typeof c=="string"&&(n.equals(c,i)||!r&&n.equals(c,o))?t:null},l.allPaths=[(e?"*/":"./")+o],l}function RV(o,t){try{let e=new RegExp(`^${oL(o)}$`,t.ignoreCase?"i":void 0);return function(n){return e.lastIndex=0,typeof n=="string"&&e.test(n)?o:null}}catch{return Pi}}function QE(o,t={}){if(!o)return tL;if(typeof o=="string"||iL(o)){let e=jE(o,t);if(e===Pi)return tL;let n=function(r,i){return!!e(r,i)};return e.allBasenames&&(n.allBasenames=e.allBasenames),e.allPaths&&(n.allPaths=e.allPaths),n}return kV(o,t)}function iL(o){let t=o;return t?typeof t.base=="string"&&typeof t.pattern=="string":!1}function kV(o,t){let e=sL(Object.getOwnPropertyNames(o).map(a=>DV(a,o[a],t)).filter(a=>a!==Pi)),n=e.length;if(!n)return Pi;if(!e.some(a=>!!a.requiresSiblings)){if(n===1)return e[0];let a=function(u,p){let m;for(let g=0,h=e.length;g{for(let g of m){let h=await g;if(typeof h=="string")return h}return null})():null},l=e.find(u=>!!u.allBasenames);l&&(a.allBasenames=l.allBasenames);let c=e.reduce((u,p)=>p.allPaths?u.concat(p.allPaths):u,[]);return c.length&&(a.allPaths=c),a}let r=function(a,l,c){let u,p;for(let m=0,g=e.length;m{for(let m of p){let g=await m;if(typeof g=="string")return g}return null})():null},i=e.find(a=>!!a.allBasenames);i&&(r.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(r.allPaths=s),r}function DV(o,t,e){if(t===!1)return Pi;let n=jE(o,e);if(n===Pi)return Pi;if(typeof t=="boolean")return n;if(t){let r=t.when;if(typeof r=="string"){let i=(s,a,l,c)=>{if(!c||!n(s,a))return null;let u=r.replace("$(basename)",()=>l),p=c(u);return Sp(p)?p.then(m=>m?o:null):p?o:null};return i.requiresSiblings=!0,i}}return n}function sL(o,t){let e=o.filter(a=>!!a.basenames);if(e.length<2)return o;let n=e.reduce((a,l)=>{let c=l.basenames;return c?a.concat(c):a},[]),r;if(t){r=[];for(let a=0,l=n.length;a{let c=l.patterns;return c?a.concat(c):a},[]);let i=function(a,l){if(typeof a!="string")return null;if(!l){let u;for(u=a.length;u>0;u--){let p=a.charCodeAt(u-1);if(p===47||p===92)break}l=a.substring(u)}let c=n.indexOf(l);return c!==-1?r[c]:null};i.basenames=n,i.patterns=r,i.allBasenames=n;let s=o.filter(a=>!a.basenames);return s.push(i),s}function JE(o,t){return mn(o,t,(e,n)=>typeof e=="string"&&typeof n=="string"?e===n:typeof e!="string"&&typeof n!="string"?e.base===n.base&&e.pattern===n.pattern:!1)}var xd,X_,Mv,Ov,yV,bV,IV,xV,SV,EV,wV,eL,tL,Pi,Av=y(()=>{At();$e();Po();gi();Hn();Oe();pe();Xt();xd="**",X_="/",Mv="[/\\\\]",Ov="[^/\\\\]",yV=/\//g;bV=/^\*\*\/\*\.[\w\.-]+$/,IV=/^\*\*\/([\w\.-]+)\/?$/,xV=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,SV=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,EV=/^\*\*((\/[\w\.-]+)+)\/?$/,wV=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,eL=new pi(1e4),tL=function(){return!1},Pi=function(){return null}});function Vv(o){return typeof o.correlationId=="number"}function aL(o){return o.recursive===!0}function Wv(o){return o.map(t=>({type:t.type,resource:I.revive(t.resource),cId:t.cId}))}function lL(o){let t=new XE;for(let e of o)t.processEvent(e);return t.coalesce()}function LV(o,t){return typeof t=="string"&&!t.startsWith(xd)&&!ro(t)?{base:o,pattern:t}:t}function YE(o,t,e){let n=[];for(let r of t)n.push(QE(LV(o,r),{ignoreCase:e}));return n}function cL(o,t){if(typeof t=="number")switch(o.type){case 1:return(t&4)===0;case 2:return(t&8)===0;case 0:return(t&2)===0}return!1}function dL(o){if(typeof o=="number"){let t=[];return o&4&&t.push("Added"),o&8&&t.push("Deleted"),o&2&&t.push("Updated"),t.length===0?"":`[${t.join(", ")}]`}return""}var Nv,Uv,Fv,XE,wl=y(()=>{Av();j();Oe();pe();le();ot();Nv=class o extends D{constructor(e,n,r,i){super();this.onFileChanges=e;this.onLogMessage=n;this.verboseLogging=r;this.options=i;this.watcherDisposables=this._register(new mr);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new se;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),e.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),e.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(e,n){this.canRestart(e,n)?this.restartCountern.type!==2?(t.push(n),!1):!0).sort((n,r)=>n.resource.fsPath.length-r.resource.fsPath.length).filter(n=>e.some(r=>HD(n.resource.fsPath,r,!Me))?!1:(e.push(n.resource.fsPath),!0)).concat(t)}}});var Bv,uL=y(()=>{At();$e();Se();ce();gi();j();Oe();wl();Ve();Bv=class extends D{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new P);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new P);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new Rr(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new Rr(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let r=this.toWatchRequest(e,n),i=Sx(this.universalWatchRequests,r);return this.refreshUniversalWatchers(),ie(()=>{i(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(aL(r)){let i=this.options?.watcher?.recursive?.usePolling;i===!0?r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(i)&&i.includes(r.path)&&(r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return r}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>Ke(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(Wv(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},i=Sx(this.nonRecursiveWatchRequests,r);return this.refreshNonRecursiveWatchers(),ie(()=>{i(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>Ke(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(Wv(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return In(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return S1(n)}}});var pL=y(()=>{Ae();j();Wt()});function je(o,t,e){let n=null,r=null;if(typeof e.value=="function"?(n="value",r=e.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(n="get",r=e.get),!r)throw new Error("not supported");let i=`$memoize$${t}`;e[n]=function(...s){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,s)}),this[i]}}var Hv=y(()=>{pL()});function wd(o){switch(o){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function $v(o){switch(o){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function Sd(o){let t=0;for(let e=0;;e+=7){let n=o.read(1);if(t|=(n.buffer[0]&127)<>>7)e++;let n=A.alloc(e);for(let r=0;t!==0;r++)n.buffer[r]=t&127,t=t>>>7,t>0&&(n.buffer[r]|=128);o.write(n)}function ia(o){let t=A.alloc(1);return t.writeUInt8(o,0),t}function Tm(o,t){if(typeof t>"u")o.write(Cl.Undefined);else if(typeof t=="string"){let e=A.fromString(t);o.write(Cl.String),Ed(o,e.byteLength),o.write(e)}else if(A.isNativeBuffer(t)){let e=A.wrap(t);o.write(Cl.Buffer),Ed(o,e.byteLength),o.write(e)}else if(t instanceof A)o.write(Cl.VSBuffer),Ed(o,t.byteLength),o.write(t);else if(Array.isArray(t)){o.write(Cl.Array),Ed(o,t.length);for(let e of t)Tm(o,e)}else if(typeof t=="number"&&(t|0)===t)o.write(Cl.Uint),Ed(o,t);else{let e=A.fromString(JSON.stringify(t));o.write(Cl.Object),Ed(o,e.byteLength),o.write(e)}}function Td(o){switch(o.read(1).readUInt8(0)){case 0:return;case 1:return o.read(Sd(o)).toString();case 2:return o.read(Sd(o)).buffer;case 3:return o.read(Sd(o));case 4:{let e=Sd(o),n=[];for(let r=0;rr.call(t,e,n))},listen(t,e){let n=new fp;return o.then(r=>n.input=r.listen(t,e)),n.event}}}function fL(o){let t=!1;return{call(e,n,r){return t?o.call(e,n,r):uo(0).then(()=>t=!0).then(()=>o.call(e,n,r))},listen(e,n){if(t)return o.listen(e,n);let r=new fp;return uo(0).then(()=>t=!0).then(()=>r.input=o.listen(e,n)),r.event}}}var MV,Cm,zv,Cl,Gv,Cd,Pm,qv,Yo,sa=y(()=>{At();$e();nt();Wt();Hv();Se();ce();up();j();ed();Xt();Ae();MV=ia(0);Cm=class{constructor(t){this.buffer=t;this.pos=0}read(t){let e=this.buffer.slice(this.pos,this.pos+t);return this.pos+=e.byteLength,e}},zv=class{constructor(){this.buffers=[]}get buffer(){return A.concat(this.buffers)}write(t){this.buffers.push(t)}};Cl={Undefined:ia(0),String:ia(1),Buffer:ia(2),VSBuffer:ia(3),Array:ia(4),Object:ia(5),Uint:ia(6)};Gv=class{constructor(t,e,n=null,r=1e3){this.protocol=t;this.ctx=e;this.logger=n;this.timeoutDelay=r;this.channels=new Map;this.activeRequests=new Map;this.pendingRequests=new Map;this.protocolListener=this.protocol.onMessage(i=>this.onRawMessage(i)),this.sendResponse({type:200})}registerChannel(t,e){this.channels.set(t,e),setTimeout(()=>this.flushPendingRequests(t),0)}sendResponse(t){switch(t.type){case 200:{let e=this.send([t.type]);this.logger?.logOutgoing(e,0,1,$v(t.type));return}case 201:case 202:case 204:case 203:{let e=this.send([t.type,t.id],t.data);this.logger?.logOutgoing(e,t.id,1,$v(t.type),t.data);return}}}send(t,e=void 0){let n=new zv;return Tm(n,t),Tm(n,e),this.sendBuffer(n.buffer)}sendBuffer(t){try{return this.protocol.send(t),t.byteLength}catch{return 0}}onRawMessage(t){let e=new Cm(t),n=Td(e),r=Td(e),i=n[0];switch(i){case 100:return this.logger?.logIncoming(t.byteLength,n[1],1,`${wd(i)}: ${n[2]}.${n[3]}`,r),this.onPromise({type:i,id:n[1],channelName:n[2],name:n[3],arg:r});case 102:return this.logger?.logIncoming(t.byteLength,n[1],1,`${wd(i)}: ${n[2]}.${n[3]}`,r),this.onEventListen({type:i,id:n[1],channelName:n[2],name:n[3],arg:r});case 101:return this.logger?.logIncoming(t.byteLength,n[1],1,`${wd(i)}`),this.disposeActiveRequest({type:i,id:n[1]});case 103:return this.logger?.logIncoming(t.byteLength,n[1],1,`${wd(i)}`),this.disposeActiveRequest({type:i,id:n[1]})}}onPromise(t){let e=this.channels.get(t.channelName);if(!e){this.collectPendingRequest(t);return}let n=new ht,r;try{r=e.call(this.ctx,t.name,t.arg,n.token)}catch(a){r=Promise.reject(a)}let i=t.id;r.then(a=>{this.sendResponse({id:i,data:a,type:201})},a=>{a instanceof Error?this.sendResponse({id:i,data:{message:a.message,name:a.name,stack:a.stack?a.stack.split(` - `):void 0},type:202}):this.sendResponse({id:i,data:a,type:203})}).finally(()=>{s.dispose(),this.activeRequests.delete(t.id)});let s=ie(()=>n.cancel());this.activeRequests.set(t.id,s)}onEventListen(t){let e=this.channels.get(t.channelName);if(!e){this.collectPendingRequest(t);return}let n=t.id,i=e.listen(this.ctx,t.name,t.arg)(s=>this.sendResponse({id:n,data:s,type:204}));this.activeRequests.set(t.id,i)}disposeActiveRequest(t){let e=this.activeRequests.get(t.id);e&&(e.dispose(),this.activeRequests.delete(t.id))}collectPendingRequest(t){let e=this.pendingRequests.get(t.channelName);e||(e=[],this.pendingRequests.set(t.channelName,e));let n=setTimeout(()=>{console.error(`Unknown channel: ${t.channelName}`),t.type===100&&this.sendResponse({id:t.id,data:{name:"Unknown channel",message:`Channel name '${t.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);e.push({request:t,timeoutTimer:n})}flushPendingRequests(t){let e=this.pendingRequests.get(t);if(e){for(let n of e)switch(clearTimeout(n.timeoutTimer),n.request.type){case 100:this.onPromise(n.request);break;case 102:this.onEventListen(n.request);break}this.pendingRequests.delete(t)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Jt(this.activeRequests.values()),this.activeRequests.clear()}},Cd=class{constructor(t,e=null){this.protocol=t;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new P;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(n=>this.onBuffer(n)),this.logger=e}getChannel(t){let e=this;return{call(n,r,i){return e.isDisposed?Promise.reject(new et):e.requestPromise(t,n,r,i)},listen(n,r){return e.isDisposed?F.None:e.requestEvent(t,n,r)}}}requestPromise(t,e,n,r=Ee.None){let i=this.lastRequestId++,a={id:i,type:100,channelName:t,name:e,arg:n};if(r.isCancellationRequested)return Promise.reject(new et);let l,c;return new Promise((p,m)=>{if(r.isCancellationRequested)return m(new et);let g=()=>{let x=T=>{switch(T.type){case 201:this.handlers.delete(i),p(T.data);break;case 202:{this.handlers.delete(i);let C=new Error(T.data.message);C.stack=Array.isArray(T.data.stack)?T.data.stack.join(` - `):T.data.stack,C.name=T.data.name,m(C);break}case 203:this.handlers.delete(i),m(T.data);break}};this.handlers.set(i,x),this.sendRequest(a)},h=null;this.state===1?g():(h=kr(x=>this.whenInitialized()),h.then(()=>{h=null,g()}));let v=()=>{h?(h.cancel(),h=null):this.sendRequest({id:i,type:101}),m(new et)};l=r.onCancellationRequested(v),c={dispose:Ga(()=>{v(),l.dispose()})},this.activeRequests.add(c)}).finally(()=>{l?.dispose(),this.activeRequests.delete(c)})}requestEvent(t,e,n){let r=this.lastRequestId++,s={id:r,type:102,channelName:t,name:e,arg:n},a=null,l=new P({onWillAddFirstListener:()=>{let u=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?u():(a=kr(p=>this.whenInitialized()),a.then(()=>{a=null,u()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:r,type:103})),this.handlers.delete(r)}}),c=u=>l.fire(u.data);return this.handlers.set(r,c),l.event}sendRequest(t){switch(t.type){case 100:case 102:{let e=this.send([t.type,t.id,t.channelName,t.name],t.arg);this.logger?.logOutgoing(e,t.id,0,`${wd(t.type)}: ${t.channelName}.${t.name}`,t.arg);return}case 101:case 103:{let e=this.send([t.type,t.id]);this.logger?.logOutgoing(e,t.id,0,wd(t.type));return}}}send(t,e=void 0){let n=new zv;return Tm(n,t),Tm(n,e),this.sendBuffer(n.buffer)}sendBuffer(t){try{return this.protocol.send(t),t.byteLength}catch{return 0}}onBuffer(t){let e=new Cm(t),n=Td(e),r=Td(e),i=n[0];switch(i){case 200:return this.logger?.logIncoming(t.byteLength,0,0,$v(i)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(t.byteLength,n[1],0,$v(i),r),this.onResponse({type:n[0],id:n[1],data:r})}}onResponse(t){if(t.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(t.id)?.(t)}get onDidInitializePromise(){return F.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Jt(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};E([je],Cd.prototype,"onDidInitializePromise",1);Pm=class{constructor(t,e,n){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new P;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new P;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new se;this.disposables.add(t(({protocol:r,onDidClientDisconnect:i})=>{let s=F.once(r.onMessage);this.disposables.add(s(a=>{let l=new Cm(a),c=Td(l),u=new Gv(r,c,e,n),p=new Cd(r,e);this.channels.forEach((g,h)=>u.registerChannel(h,g));let m={channelServer:u,channelClient:p,ctx:c};this._connections.add(m),this._onDidAddConnection.fire(m),this.disposables.add(i(()=>{u.dispose(),p.dispose(),this._connections.delete(m),this._onDidRemoveConnection.fire(m)}))}))}))}get connections(){let t=[];return this._connections.forEach(e=>t.push(e)),t}getChannel(t,e){let n=this;return{call(r,i,s){let a;if(gc(e)){let c=qk(n.connections.filter(e));a=c?Promise.resolve(c):F.toPromise(F.filter(n.onDidAddConnection,e))}else a=e.routeCall(n,r,i);let l=a.then(c=>c.channelClient.getChannel(t));return mL(l).call(r,i,s)},listen(r,i){if(gc(e))return n.getMulticastEvent(t,e,r,i);let s=e.routeEvent(n,r,i).then(a=>a.channelClient.getChannel(t));return mL(s).listen(r,i)}}}getMulticastEvent(t,e,n,r){let i=this,s,a=new P({onWillAddFirstListener:()=>{s=new se;let l=new Kg,c=new Map,u=m=>{let h=m.channelClient.getChannel(t).listen(n,r),v=l.add(h);c.set(m,v)},p=m=>{let g=c.get(m);g&&(g.dispose(),c.delete(m))};i.connections.filter(e).forEach(u),F.filter(i.onDidAddConnection,e)(u,void 0,s),i.onDidRemoveConnection(p,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return i.disposables.add(a),a.event}registerChannel(t,e){this.channels.set(t,e);for(let n of this._connections)n.channelServer.registerChannel(t,e)}dispose(){this.disposables.dispose();for(let t of this._connections)t.channelClient.dispose(),t.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}};qv=class{constructor(t){this.fn=t}routeCall(t){return this.route(t)}routeEvent(t){return this.route(t)}async route(t){for(let e of t.connections)if(await Promise.resolve(this.fn(e.ctx)))return Promise.resolve(e);return await F.toPromise(t.onDidAddConnection),await this.route(t)}};(r=>{function o(i,s,a){let l=i,c=a?.disableMarshalling,u=new Map;for(let p in l)e(p)&&u.set(p,F.buffer(l[p],p,!0,void 0,s));return new class{listen(p,m,g){let h=u.get(m);if(h)return h;let v=l[m];if(typeof v=="function"){if(n(m))return v.call(l,g);if(e(m))return u.set(m,F.buffer(l[m],m,!0,void 0,s)),u.get(m)}throw new ur(`Event not found: ${m}`)}call(p,m,g){let h=l[m];if(typeof h=="function"){if(!c&&Array.isArray(g))for(let x=0;x{le()});import{fork as NV}from"child_process";var aa,Kv=y(()=>{$e();nt();Wt();vL();Se();ce();j();on();Yp();Jp();sa();aa=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new P;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new bp(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,r,i){return e.requestPromise(t,n,r,i)},listen(n,r){return e.requestEvent(t,n,r)}}}requestPromise(t,e,n,r=Ee.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(r.isCancellationRequested)return Promise.reject(dp());this.disposeDelayer.cancel();let i=this.getCachedChannel(t),s=kr(c=>i.call(e,n,c)),a=r.onCancellationRequested(()=>s.cancel()),l=ie(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(t,e,n){if(!this.disposeDelayer)return F.None;this.disposeDelayer.cancel();let r,i=new P({onWillAddFirstListener:()=>{r=this.getCachedChannel(t).listen(e,n)(i.fire,i),this.activeRequests.add(r)},onDidRemoveLastListener:()=>{this.activeRequests.delete(r),r.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return i.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...fo(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(p=>!/^--inspect(-brk)?=/.test(p)).filter(p=>!p.startsWith("--vscode-"))),Hh(e.env),this.child=NV(this.modulePath,t,e);let n=new P,i=F.fromNodeEventEmitter(this.child,"message",p=>p)(p=>{if(gL(p)){hL(p,`IPC Library: ${this.options.serverName}`);return}n.fire(A.wrap(Buffer.from(p,"base64")))}),s=this.options.useQueue?s0(this.child):this.child,a=p=>this.child?.connected&&s.send(p.buffer.toString("base64")),l=n.event,c={send:a,onMessage:l};this._client=new Cd(c);let u=()=>this.disposeClient();process.once("exit",u),this.child.on("error",p=>console.warn('IPC "'+this.options.serverName+'" errored with '+p)),this.child.on("exit",(p,m)=>{process.removeListener("exit",u),i.dispose(),this.activeRequests.forEach(g=>Jt(g)),this.activeRequests.clear(),p!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+p+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:p,signal:m})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}}});var jv,yL=y(()=>{He();sa();Kv();wl();jv=class extends Fv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new aa(bt.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:r})=>this.onError(`terminated by itself with code ${n}, signal: ${r} (ETERM)`))),Yo.toService(fL(e.getChannel("watcher")))}}});import{watchFile as UV,unwatchFile as FV}from"fs";var Qv,bL=y(()=>{j();wl();ce();ot();le();$e();rl();Se();Qv=class extends D{constructor(){super();this._onDidChangeFile=this._register(new P);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new P);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new P);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Fr);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Rr(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Br;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return Vv(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:po(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Br;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[r,i]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(r)||n.push(i);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(r=>Ke(r))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new se;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let r=this.recursiveWatcher?.subscribe(e.path,(i,s)=>{n.isDisposed||(i?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return r?(n.add(r),!0):!1}doMonitorWithNodeJS(e,n){let r=!1,i=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),c=this.isPathNotFound(a),u=r;r=l,!l&&(c||u)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{UV(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},i)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(ie(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{FV(e.path,i)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:I.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let r=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(r,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${dL(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}}});import{watch as VV,promises as WV}from"fs";var Jv,IL=y(()=>{$e();Wt();gi();j();ih();Oe();pe();Nt();le();fr();ot();wl();ji();Jv=class o extends D{constructor(e,n,r,i,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=r;this.onDidWatchFail=i;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new Pc({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new rh(e=>this.handleFileChanges(e),o.FILE_CHANGES_HANDLER_DELAY));this.cts=new ht;this.realPath=new gn(async()=>{let e=this.request.path;try{e=await Te.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Me;this.excludes=YE(this.request.path,this.request.excludes,l),this.includes=this.request.includes?YE(this.request.path,this.request.includes,l):void 0,this.filter=Vv(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await WV.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new se;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let r=I.file(this.request.path),i=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await r1(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:a.type,cId:this.request.correlationId},!0))});return i?(n.add(i),!0):!1}async doWatchWithNodeJS(e,n){let r=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(it&&Wr(r,"/Volumes/",!0)){this.error(`Refusing to watch ${r} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let i=new ht(this.cts.token);n.add(ie(()=>i.dispose(!0)));let s=new se;n.add(s);try{let a=I.file(this.request.path),l=dt(r),c=VV(r);s.add(ie(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${r}'`);let u=new Set;if(e)try{for(let m of await Te.readdir(r))u.add(m)}catch(m){this.error(m)}if(i.token.isCancellationRequested)return;let p=new Map;s.add(ie(()=>{for(let[,m]of p)m.dispose();p.clear()})),c.on("error",(m,g)=>{i.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${m}, ${g})`),this.notifyWatchFailed())}),c.on("change",(m,g)=>{if(i.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${m}"] ${g}`);let h="";if(g&&(h=g.toString(),it&&(h=Ep(h))),!(!h||m!=="change"&&m!=="rename"))if(e)if(m==="rename"){p.get(h)?.dispose();let v=setTimeout(async()=>{if(p.delete(h),Sc(h,l,!Me)&&!await Te.exists(r)){this.onWatchedPathDeleted(a);return}if(i.token.isCancellationRequested)return;let x=await this.existsChildStrictCase(H(r,h));if(i.token.isCancellationRequested)return;let T;x?u.has(h)?T=0:(T=1,u.add(h)):(u.delete(h),T=2),this.onFileChange({resource:he(a,h),type:T,cId:this.request.correlationId})},o.FILE_DELETE_HANDLER_DELAY);p.set(h,ie(()=>clearTimeout(v)))}else{let v;u.has(h)?v=0:(v=1,u.add(h)),this.onFileChange({resource:he(a,h),type:v,cId:this.request.correlationId})}else if(m==="rename"||!Sc(h,l,!Me)){let v=setTimeout(async()=>{let x=await Te.exists(r);i.token.isCancellationRequested||(x?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},o.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(ie(()=>clearTimeout(v)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(i.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=lL(e),r=[];for(let s of n){if(cL(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}r.push(s)}if(r.length===0)return;if(this.verboseLogging)for(let s of r)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(r)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${r.length}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Me)return Te.exists(e);try{let n=dt(e);return(await Te.readdir(wt(e))).some(i=>i===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}}});var Xv,xL=y(()=>{ce();Av();bL();pe();IL();$e();j();Xv=class extends Qv{constructor(e){super();this.recursiveWatcher=e;this.onDidError=F.None;this._watchers=new Map;this.worker=this._register(new mr)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],r=new Set(Array.from(this.watchers));for(let i of e){let s=this._watchers.get(this.requestToWatcherKey(i));s&&JE(s.request.excludes,i.excludes)&&JE(s.request.includes,i.includes)?r.delete(s):n.push(i)}n.length&&this.trace(`Request to start watching: ${n.map(i=>this.requestToString(i)).join(",")}`),r.size&&this.trace(`Request to stop watching: ${Array.from(r).map(i=>this.requestToString(i.request)).join(",")}`),this.worker.clear();for(let i of r)this.stopWatching(i);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new Pc({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Me?e:e.toLowerCase()}startWatching(e){let n=new Jv(e,this.recursiveWatcher,i=>this._onDidChangeFile.fire(i),()=>this._onDidWatchFail.fire(e),i=>this._onDidLogMessage.fire(i),this.verboseLogging),r={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),r)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let r of e){let i=n.get(r.correlationId);i||(i=new Map,n.set(r.correlationId,i));let s=this.pathToWatcherKey(r.path);i.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(r)}`),i.set(s,r)}return Array.from(n.values()).flatMap(r=>Array.from(r.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}}});var Yv,SL=y(()=>{wl();xL();Yv=class extends Uv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new Xv(void 0))}}});import{constants as ZE,promises as Tl}from"fs";var Ri,Rm=y(()=>{$e();Hn();nt();ce();gi();j();Oe();pe();Nt();kc();fr();ue();ot();zE();uL();yL();SL();Ri=class o extends Bv{constructor(){super(...arguments);this.onDidChangeCapabilities=F.None;this.resourceLocks=new ut(e=>el.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Me&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:r}=await er.stat(this.toFilePath(e)),i;return(n.mode&128)===0&&(i=2),(n.mode&ZE.S_IXUSR||n.mode&ZE.S_IXGRP||n.mode&ZE.S_IXOTH)&&(i=(i??0)|4),{type:this.toType(n,r),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:i}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return Te.realpath(n)}async readdir(e){try{let n=await Te.readdir(this.toFilePath(e),{withFileTypes:!0}),r=[];return await Promise.all(n.map(async i=>{try{let s;i.isSymbolicLink()?s=(await this.stat(he(e,i.name))).type:s=this.toType(i),r.push([i.name,s])}catch(s){this.logService.trace(s)}})),r}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let r;return n?.dangling?r=0:e.isFile()?r=1:e.isDirectory()?r=2:r=0,n&&(r|=64),r}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let r;for(;r=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await r.wait();let i=new lo;return this.resourceLocks.set(e,i),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),ie(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),i.open()})}async readFile(e,n){let r;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),r=await this.createResourceLock(e));let i=this.toFilePath(e);return await Tl.readFile(i)}catch(i){throw this.toFileSystemProviderError(i)}finally{r?.dispose()}}traceLock(e){o.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,r){let i=Vs(s=>A.concat(s.map(a=>A.wrap(a))).buffer);return Lv(this,e,i,s=>s.buffer,{...n,bufferSize:256*1024},r),i}async writeFile(e,n,r){return r?.atomic!==!1&&r?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,he(eh(e),`${Zn(e)}${r.atomic.postfix}`),n,r):this.doWriteFile(e,n,r)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:r}=await er.stat(n);if(r)return!1}catch{}return!0}async doWriteFileAtomic(e,n,r,i){let s=new se;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,r,{...i,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,r,i){let s;try{let a=this.toFilePath(e);if(!r.create||!r.overwrite){if(await Te.exists(a)){if(!r.overwrite)throw Do(d(2131,null),"EntryExists")}else if(!r.create)throw Do(d(2134,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:r.append,unlock:r.unlock},i),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){o.canFlush=e}async open(e,n,r){let i=this.toFilePath(e),s;dl(n)&&!r&&(s=await this.createResourceLock(e));let a;try{if(dl(n)&&n.unlock)try{let{stat:l}=await er.stat(i);l.mode&128||await Tl.chmod(i,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(te&&dl(n)&&!n.append)try{a=await Te.open(i,"r+"),await Te.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await Te.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await Te.open(i,dl(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),dl(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),dl(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${i})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${i})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&o.canFlush)try{await Te.fdatasync(e)}catch(r){o.configureFlushOnWrite(!1),this.logService.error(r)}return await Te.close(e)}catch(r){throw this.toFileSystemProviderError(r)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.read(e,r,i,s,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,r){let i=this.mapHandleToPos.get(e);typeof i=="number"&&(typeof n=="number"||(typeof r=="number"?this.mapHandleToPos.set(e,i+r):this.mapHandleToPos.delete(e)))}async write(e,n,r,i,s){return B1(()=>this.doWrite(e,n,r,i,s),100,3)}async doWrite(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.write(e,r,i,s,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),c)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Tl.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let r=this.toFilePath(e);if(n.recursive){let i;n?.atomic!==!1&&n.atomic.postfix&&(i=H(wt(r),`${dt(r)}${n.atomic.postfix}`)),await Te.rm(r,1,i)}else try{await Tl.unlink(r)}catch(i){if(i.code==="EPERM"||i.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await er.stat(r);s=a.isDirectory()&&!l}catch{}if(s)await Tl.rmdir(r);else throw i}else throw i}}catch(r){throw this.toFileSystemProviderError(r)}}async rename(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"move",r.overwrite),await Te.rename(i,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2135,null,dt(i),dt(wt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"copy",r.overwrite),await Te.copy(i,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2129,null,dt(i),dt(wt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,r,i){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=Sc(s,a,!0)),l){if(r==="copy")throw Do(d(2130,null),"EntryExists");if(r==="move")return}let u=await this.statIgnoreError(e);if(!u)throw Do(d(2133,null),"EntryNotFound");let p=await this.statIgnoreError(n);if(p){if(!i)throw Do(d(2132,null),"EntryExists");(u.type&1)!==0&&(p.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(Sc(i,s,!a))return;let l=new se;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),r&&await Tl.mkdir(wt(s),{recursive:!0}),await Tl.copyFile(i,s)}catch(c){if(c.code==="ENOENT"&&!r)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(e,n,r){return new jv(i=>e(i),i=>n(i),r)}createNonRecursiveWatcher(e,n,r){return new Yv(i=>e(i),i=>n(i),r)}toFileSystemProviderError(e){if(e instanceof Vc)return e;let n=e,r;switch(e.code){case"ENOENT":r="EntryNotFound";break;case"EISDIR":r="EntryIsADirectory";break;case"ENOTDIR":r="EntryNotADirectory";break;case"EEXIST":r="EntryExists";break;case"EPERM":case"EACCES":r="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,r="Unknown";break;default:r="Unknown"}return Do(n,r)}async toFileSystemProviderWriteError(e,n){let r=this.toFileSystemProviderError(n);if(e&&r.code==="NoPermissions")try{let{stat:i}=await er.stat(this.toFilePath(e));i.mode&128||(r=Do(n,"EntryWriteLocked"))}catch(i){this.logService.trace(i)}return r}}});function EL(o){return o.getFullYear()+"-"+String(o.getMonth()+1).padStart(2,"0")+"-"+String(o.getDate()).padStart(2,"0")+"T"+String(o.getHours()).padStart(2,"0")+":"+String(o.getMinutes()).padStart(2,"0")+":"+String(o.getSeconds()).padStart(2,"0")+"."+(o.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var BV,HV,ew,Vde,Wde,Bde,wL=y(()=>{ue();ji();pe();BV=60,HV=BV*60,ew=HV*24,Vde=ew*7,Wde=ew*30,Bde=ew*365});function $V(o,t){return Zv(o["inspect-extensions"],o["inspect-brk-extensions"],5870,t,o.debugId,o.extensionEnvironment)}function Zv(o,t,e,n,r,i){let a=Number(t||o)||(n?null:e),l=a?!!t:!1,c;if(i)try{c=JSON.parse(i)}catch{}return{port:a,break:l,debugId:r,env:c}}var CL,at,TL=y(()=>{wL();Hv();He();Oe();no();Nt();le();CL=/^([^.]+\..+)[:=](.+)$/,at=class{constructor(t,e,n){this._args=t;this.paths=e;this.productService=n}get appRoot(){return wt(bt.asFileUri("").fsPath)}get userHome(){return I.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return I.file(H(this.userDataPath,"User"))}get tmpDir(){return I.file(this.paths.tmpDir)}get cacheHome(){return I.file(this.userDataPath)}get stateResource(){return he(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:z.vscodeUserData})}get userDataSyncHome(){return he(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let t=EL(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=H(this.userDataPath,"logs",t)}return I.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return he(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return he(this.appSettingsHome,"History")}get keyboardLayoutResource(){return he(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let t=Qt.VSCODE_PORTABLE;return t?I.file(H(t,"argv.json")):he(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return I.file(H(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let t=this.args["builtin-extensions-dir"];return t?Bn(t):In(H(bt.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let t=this.args["extensions-download-dir"];return t?I.file(Bn(t)):I.file(H(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let t=this.args["extensions-dir"];if(t)return Bn(t);let e=Qt.VSCODE_EXTENSIONS;if(e)return e;let n=Qt.VSCODE_PORTABLE;return n?H(n,"extensions"):he(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let t=this.args["agent-plugins-dir"];if(t)return Bn(t);let e=Qt.VSCODE_AGENT_PLUGINS;if(e)return e;let n=Qt.VSCODE_PORTABLE;return n?H(n,"agent-plugins"):he(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let t=this.args.extensionDevelopmentPath;if(Array.isArray(t))return t.map(e=>/^[^:/?#]+?:\/\//.test(e)?I.parse(e):I.file(In(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(t=>t==="ui"||t==="workspace"||t==="web"?t:"workspace")}get extensionTestsLocationURI(){let t=this.args.extensionTestsPath;if(t)return/^[^:/?#]+?:\/\//.test(t)?I.parse(t):I.file(In(t))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let t=this.args["disable-extension"];if(t){if(typeof t=="string")return[t];if(Array.isArray(t)&&t.length>0)return t}return!1}get debugExtensionHost(){return $V(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!Qt.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(t=>!CL.test(t))}get extensionLogLevel(){let t=[];for(let e of this.args.log||[]){let n=CL.exec(e);n?.[1]&&n[2]&&t.push([n[1],n[2]])}return t.length?t:void 0}get serviceMachineIdResource(){return he(I.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let t=Qt.VSCODE_PORTABLE;return t?I.file(H(t,"policy.json")):he(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return he(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(t){this.args.continueOn=t}get args(){return this._args}};E([je],at.prototype,"appRoot",1),E([je],at.prototype,"userHome",1),E([je],at.prototype,"userDataPath",1),E([je],at.prototype,"appSettingsHome",1),E([je],at.prototype,"tmpDir",1),E([je],at.prototype,"cacheHome",1),E([je],at.prototype,"stateResource",1),E([je],at.prototype,"userRoamingDataHome",1),E([je],at.prototype,"userDataSyncHome",1),E([je],at.prototype,"sync",1),E([je],at.prototype,"workspaceStorageHome",1),E([je],at.prototype,"localHistoryHome",1),E([je],at.prototype,"keyboardLayoutResource",1),E([je],at.prototype,"argvResource",1),E([je],at.prototype,"isExtensionDevelopment",1),E([je],at.prototype,"untitledWorkspacesHome",1),E([je],at.prototype,"builtinExtensionsPath",1),E([je],at.prototype,"extensionsDownloadLocation",1),E([je],at.prototype,"extensionsPath",1),E([je],at.prototype,"agentPluginsPath",1),E([je],at.prototype,"extensionDevelopmentLocationURI",1),E([je],at.prototype,"extensionDevelopmentKind",1),E([je],at.prototype,"extensionTestsLocationURI",1),E([je],at.prototype,"debugExtensionHost",1),E([je],at.prototype,"logLevel",1),E([je],at.prototype,"extensionLogLevel",1),E([je],at.prototype,"serviceMachineIdResource",1),E([je],at.prototype,"disableTelemetry",1),E([je],at.prototype,"disableExperiments",1),E([je],at.prototype,"disableWorkspaceTrust",1),E([je],at.prototype,"useInMemorySecretStorage",1),E([je],at.prototype,"policyFile",1),E([je],at.prototype,"agentSessionsWorkspace",1)});import{homedir as PL}from"os";import{resolve as zV,isAbsolute as GV,join as Rd}from"path";function RL(o,t){let e=KV(o,t),n=[e];return GV(e)||n.unshift(qV),zV(...n)}function KV(o,t){process.env.VSCODE_DEV&&(process.isEmbeddedApp?t="sessions-oss-dev":t="code-oss-dev");let e=process.env.VSCODE_PORTABLE;if(e)return Rd(e,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Rd(n,t);let r=o["user-data-dir"];if(r)return r;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let i=process.env.USERPROFILE;if(typeof i!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Rd(i,"AppData","Roaming")}break;case"darwin":n=Rd(PL(),"Library","Application Support");break;case"linux":n=process.env.XDG_CONFIG_HOME||Rd(PL(),".config");break;default:throw new Error("Platform not supported")}return Rd(n,t)}var qV,kL=y(()=>{qV=process.env.VSCODE_CWD||process.cwd()});import{homedir as jV,tmpdir as QV}from"os";function DL(o,t){return Zv(o["inspect-ptyhost"],o["inspect-brk-ptyhost"],5877,t,o.extensionEnvironment)}function _L(o,t){return Zv(o["inspect-agenthost"],o["inspect-brk-agenthost"],5878,t,o.extensionEnvironment)}var ey,ty=y(()=>{TL();kL();ey=class extends at{constructor(t,e){super(t,{homeDir:jV(),tmpDir:QV(),userDataDir:RL(t,e.nameShort)},e)}}});function la(){return tw||(tw=A.alloc(0)),tw}function LL(o){switch(o){case 0:return"None";case 1:return"Regular";case 2:return"Control";case 3:return"Ack";case 5:return"Disconnect";case 6:return"ReplayRequest";case 7:return"PauseWriting";case 8:return"ResumeWriting";case 9:return"KeepAlive"}}var iw,tw,km,Mo,ny,ry,Pl,nw,rw,ow,Dm,Rl=y(()=>{nt();ce();j();sa();(s=>{s.enableDiagnostics=!1,s.records=[];let e=new WeakMap,n=0;function r(a,l){if(!e.has(a)){let c=String(++n);e.set(a,c)}return e.get(a)}function i(a,l,c,u){}s.traceSocketEvent=i})(iw||={});tw=null;km=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(t){this._chunks.push(t),this._totalLength+=t.byteLength}read(t){return this._read(t,!0)}peek(t){return this._read(t,!1)}_read(t,e){if(t===0)return la();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=t),s}if(this._chunks[0].byteLength>t){let s=this._chunks[0].slice(0,t);return e&&(this._chunks[0]=this._chunks[0].slice(t),this._totalLength-=t),s}let n=A.alloc(t),r=0,i=0;for(;t>0;){let s=this._chunks[i];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,r),r+=t,e&&(this._chunks[i]=s.slice(t),this._totalLength-=t),t-=t}else n.set(s,r),r+=s.byteLength,e?(this._chunks.shift(),this._totalLength-=s.byteLength):i++,t-=s.byteLength}return n}};Mo=class{constructor(t,e,n,r){this.type=t;this.id=e;this.ack=n;this.data=r;this.writtenTime=0}get size(){return this.data.byteLength}},ny=class extends D{constructor(e){super();this._onMessage=this._register(new P);this.onMessage=this._onMessage.event;this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0};this._socket=e,this._isDisposed=!1,this._incomingData=new km,this._register(this._socket.onData(n=>this.acceptChunk(n))),this.lastReadTime=Date.now()}acceptChunk(e){if(!(!e||e.byteLength===0))for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){let n=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=n.readUInt32BE(9),this._state.messageType=n.readUInt8(0),this._state.id=n.readUInt32BE(1),this._state.ack=n.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:LL(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let r=this._state.messageType,i=this._state.id,s=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",n),this._onMessage.fire(new Mo(r,i,s,n)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},ry=class{constructor(t){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=t,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){try{this.flush()}catch{}this._isDisposed=!0}drain(){return this.flush(),this._socket.drain()}flush(){this._writeNow()}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this._scheduleWriting()}write(t){if(this._isDisposed)return;t.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=A.alloc(13);e.writeUInt8(t.type,0),e.writeUInt32BE(t.id,1),e.writeUInt32BE(t.ack,5),e.writeUInt32BE(t.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:LL(t.type),id:t.id,ack:t.ack,messageSize:t.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",t.data),this._writeSoon(e,t.data)}_bufferAdd(t,e){let n=this._totalLength===0;return this._data.push(t,e),this._totalLength+=t.byteLength+e.byteLength,n}_bufferTake(){let t=A.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,t}_writeSoon(t,e){this._bufferAdd(t,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let t=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:t.byteLength}),this._socket.write(t)}},Pl=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new P({onWillAddFirstListener:()=>{this._hasListeners=!0,queueMicrotask(()=>this._deliverMessages())},onDidRemoveLastListener:()=>{this._hasListeners=!1}}),this.event=this._emitter.event}_deliverMessages(){if(!this._isDeliveringMessages){for(this._isDeliveringMessages=!0;this._hasListeners&&this._bufferedMessages.length>0;)this._emitter.fire(this._bufferedMessages.shift());this._isDeliveringMessages=!1}}fire(t){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(t):this._emitter.fire(t):this._bufferedMessages.push(t)}flushBuffer(){this._bufferedMessages=[]}},nw=class{constructor(t){this.data=t,this.next=null}},rw=class{constructor(){this._first=null,this._last=null}length(){let t=0,e=this._first;for(;e;)e=e.next,t++;return t}peek(){return this._first?this._first.data:null}toArray(){let t=[],e=0,n=this._first;for(;n;)t[e++]=n.data,n=n.next;return t}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(t){let e=new nw(t);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},ow=class o{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return o._INSTANCE||(o._INSTANCE=new o),o._INSTANCE}constructor(){this.lastRuns=[];let t=Date.now();for(let e=0;e{for(let e=o._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let t=Date.now(),e=(1+o._HISTORY_LENGTH)*1e3,n=0;for(let r=0;r=.5}},Dm=class{constructor(t){this._onControlMessage=new Pl;this.onControlMessage=this._onControlMessage.event;this._onMessage=new Pl;this.onMessage=this._onMessage.event;this._onDidDispose=new Pl;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new Pl;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new Pl;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=t.loadEstimator??ow.getInstance(),this._shouldSendKeepAlive=t.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new rw,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socketDisposables=new se,this._socket=t.socket,this._socketWriter=this._socketDisposables.add(new ry(this._socket)),this._socketReader=this._socketDisposables.add(new ny(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),t.initialChunk&&this._socketReader.acceptChunk(t.initialChunk),this._shouldSendKeepAlive?this._keepAliveInterval=setInterval(()=>{this._sendKeepAlive()},5e3):this._keepAliveInterval=null}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._keepAliveInterval&&(clearInterval(this._keepAliveInterval),this._keepAliveInterval=null),this._socketDisposables.dispose()}drain(){return this._socketWriter.drain()}sendDisconnect(){if(!this._didSendDisconnect){this._didSendDisconnect=!0;let t=new Mo(5,0,0,la());this._socketWriter.write(t),this._socketWriter.flush()}}sendPause(){let t=new Mo(7,0,0,la());this._socketWriter.write(t)}sendResume(){let t=new Mo(8,0,0,la());this._socketWriter.write(t)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(t,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new se,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=t,this._socketWriter=this._socketDisposables.add(new ry(this._socket)),this._socketReader=this._socketDisposables.add(new ny(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(n=>this._receiveMessage(n))),this._socketDisposables.add(this._socket.onClose(n=>this._onSocketClose.fire(n))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let t=new Mo(3,0,this._incomingAckId,la());this._socketWriter.write(t);let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;nthis._outgoingAckId){this._outgoingAckId=t.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=t.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(t.type){case 0:break;case 1:{if(t.id>this._incomingMsgId)if(t.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new Mo(6,0,0,la())))}else this._incomingMsgId=t.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(t.data);break}case 2:{this._onControlMessage.fire(t.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;n=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-t+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let t=this._outgoingUnackMsg.peek(),e=Date.now()-t.writtenTime,n=Date.now()-this._socketReader.lastReadTime,r=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&n>=2e4&&r>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:n});return}let i=Math.max(2e4-e,2e4-n,2e4-r,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},i)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let t=new Mo(3,0,this._incomingAckId,la());this._socketWriter.write(t)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let t=new Mo(9,0,this._incomingAckId,la());this._socketWriter.write(t)}}});function JV(o,t){if(typeof o!="string"||o.trim().length===0)return console.log(`[reconnection-grace-time] No CLI argument provided, using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let e=Number(o);if(!isFinite(e)||e<0)return console.log(`[reconnection-grace-time] Invalid value '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let n=Math.floor(e*1e3);return!isFinite(n)||n>Number.MAX_SAFE_INTEGER?(console.log(`[reconnection-grace-time] Value too large '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t):(console.log(`[reconnection-grace-time] Parsed CLI argument: ${e}s -> ${n}ms`),n)}var aw,ca,ki,kl=y(()=>{ue();ty();Zp();re();vn();Hv();le();Nt();Oe();Rl();aw={"disable-update-check":{type:"boolean"},auth:{type:"string"},"disable-file-downloads":{type:"boolean"},"disable-file-uploads":{type:"boolean"},"disable-getting-started-override":{type:"boolean"},locale:{type:"string"},"link-protection-trusted-domains":{type:"string[]"},host:{type:"string",cat:"o",args:"ip-address",description:d(2697,null)},port:{type:"string",cat:"o",args:"port | port range",description:d(2698,null)},"socket-path":{type:"string",cat:"o",args:"path",description:d(2702,null)},"server-base-path":{type:"string",cat:"o",args:"path",description:d(2700,null)},"connection-token":{type:"string",cat:"o",args:"token",deprecates:["connectionToken"],description:d(2693,null)},"connection-token-file":{type:"string",cat:"o",args:"path",deprecates:["connection-secret","connectionTokenFile"],description:d(2694,null)},"without-connection-token":{type:"boolean",cat:"o",description:d(2705,null)},"disable-websocket-compression":{type:"boolean"},"print-startup-performance":{type:"boolean"},"print-ip-address":{type:"boolean"},"accept-server-license-terms":{type:"boolean",cat:"o",description:d(2690,null)},"server-data-dir":{type:"string",cat:"o",description:d(2701,null)},"telemetry-level":{type:"string",cat:"o",args:"level",description:d(2704,null)},"user-data-dir":Rt["user-data-dir"],"enable-smoke-test-driver":Rt["enable-smoke-test-driver"],"disable-telemetry":Rt["disable-telemetry"],"disable-experiments":Rt["disable-experiments"],"disable-workspace-trust":Rt["disable-workspace-trust"],"file-watcher-polling":{type:"string",deprecates:["fileWatcherPolling"]},log:Rt.log,logsPath:Rt.logsPath,"force-disable-user-env":Rt["force-disable-user-env"],"enable-proposed-api":Rt["enable-proposed-api"],folder:{type:"string",deprecationMessage:"No longer supported. Folder needs to be provided in the browser URL or with `default-folder`."},workspace:{type:"string",deprecationMessage:"No longer supported. Workspace needs to be provided in the browser URL or with `default-workspace`."},"default-folder":{type:"string",description:d(2695,null)},"default-workspace":{type:"string",description:d(2696,null)},"enable-sync":{type:"boolean"},"github-auth":{type:"string"},"use-test-resolver":{type:"boolean"},"extensions-dir":Rt["extensions-dir"],"extensions-download-dir":Rt["extensions-download-dir"],"builtin-extensions-dir":Rt["builtin-extensions-dir"],"install-extension":Rt["install-extension"],"install-builtin-extension":Rt["install-builtin-extension"],"update-extensions":Rt["update-extensions"],"uninstall-extension":Rt["uninstall-extension"],"list-extensions":Rt["list-extensions"],"locate-extension":Rt["locate-extension"],"show-versions":Rt["show-versions"],category:Rt.category,force:Rt.force,"do-not-sync":Rt["do-not-sync"],"do-not-include-pack-dependencies":Rt["do-not-include-pack-dependencies"],"pre-release":Rt["pre-release"],"start-server":{type:"boolean",cat:"e",description:d(2703,null)},"enable-remote-auto-shutdown":{type:"boolean"},"remote-auto-shutdown-without-delay":{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"agent-host-port":{type:"string",cat:"o",args:"port",description:d(2692,null)},"agent-host-path":{type:"string",cat:"o",args:"path",description:d(2691,null)},"use-host-proxy":{type:"boolean"},"without-browser-env-var":{type:"boolean"},"reconnection-grace-time":{type:"string",cat:"o",args:"seconds",description:d(2699,null)},help:Rt.help,version:Rt.version,"locate-shell-integration-path":Rt["locate-shell-integration-path"],compatibility:{type:"string"},_:Rt._},ca=Ct,ki=class extends ey{get userRoamingDataHome(){return this.appSettingsHome}get machineSettingsResource(){return he(I.file(H(this.userDataPath,"Machine")),"settings.json")}get mcpResource(){return he(I.file(H(this.userDataPath,"User")),"mcp.json")}get args(){return super.args}get reconnectionGraceTime(){return JV(this.args["reconnection-grace-time"],108e5)}};E([je],ki.prototype,"userRoamingDataHome",1),E([je],ki.prototype,"machineSettingsResource",1),E([je],ki.prototype,"mcpResource",1),E([je],ki.prototype,"reconnectionGraceTime",1)});var XV,ML,da,lw=y(()=>{Wt();Se();He();Nt();Zs();le();ue();or();Lo();_n();yn();XV=o=>d(2032,null,o),ML=d(2045,null,"ms-dotnettools.csharp"),da=class{constructor(t,e,n,r,i){this.extensionsForceVersionByQuality=t;this.logger=e;this.extensionManagementService=n;this.extensionGalleryService=r;this.productService=i;this.extensionsForceVersionByQuality=this.extensionsForceVersionByQuality.map(s=>s.toLowerCase())}get location(){}async listExtensions(t,e,n){let r=await this.extensionManagementService.getInstalled(1,n),i=ev.map(a=>a.toLowerCase());if(e&&e!==""){if(i.indexOf(e.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}r=r.filter(a=>a.manifest.categories?a.manifest.categories.map(c=>c.toLowerCase()).indexOf(e.toLowerCase())>-1:!1)}else if(e===""){this.logger.info("Possible Categories: "),i.forEach(a=>{this.logger.info(a)});return}this.location&&this.logger.info(d(2031,null,this.location)),r=r.sort((a,l)=>a.identifier.id.localeCompare(l.identifier.id));let s;for(let a of r)s!==a.identifier.id&&(s=a.identifier.id,this.logger.info(t?`${s}@${a.manifest.version}`:s))}async installExtensions(t,e,n,r){let i=[];try{t.length&&this.logger.info(this.location?d(2030,null,this.location):d(2029,null));let s=[],a=[],l=(u,p,m)=>{this.extensionsForceVersionByQuality?.some(g=>g===u.toLowerCase())&&(p=this.productService.quality!=="stable"?"prerelease":void 0),a.push({id:u,version:p!=="prerelease"?p:void 0,installOptions:{...n,isBuiltin:m,installPreReleaseVersion:p==="prerelease"||n.installPreReleaseVersion}})};for(let u of t)if(u instanceof I)s.push({vsix:u,installOptions:n});else{let[p,m]=cm(u);l(p,m,!1)}for(let u of e)if(u instanceof I)s.push({vsix:u,installOptions:{...n,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{let[p,m]=cm(u);l(p,m,!0)}let c=await this.extensionManagementService.getInstalled(void 0,n.profileLocation);if(s.length&&await Promise.all(s.map(async({vsix:u,installOptions:p})=>{try{await this.installVSIX(u,p,r,c)}catch(m){this.logger.error(m),i.push(u.toString())}})),a.length){let u=await this.installGalleryExtensions(a,c,r);i.push(...u)}}catch(s){throw this.logger.error(d(2019,null,fe(s))),s}if(i.length)throw new Error(d(2024,null,i.join(", ")))}async updateExtensions(t){let e=await this.extensionManagementService.getInstalled(1,t),n=[];for(let a of e)a.identifier.uuid&&n.push({...a.identifier,preRelease:a.preRelease});this.logger.trace(d(2043,null,n.length));let r=await this.extensionGalleryService.getExtensions(n,{compatible:!0},Ee.None),i=[];for(let a of r)for(let l of e)Ce(l.identifier,a.identifier)&&Ys(a.version,l.manifest.version)&&i.push({extension:a,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:t,isApplicationScoped:l.isApplicationScoped}});if(!i.length){this.logger.info(d(2042,null));return}this.logger.info(d(2041,null,i.map(a=>a.extension.identifier.id).join(", ")));let s=await this.extensionManagementService.installGalleryExtensions(i);for(let a of s)a.error?this.logger.error(d(2021,null,a.identifier.id,fe(a.error))):this.logger.info(d(2038,null,a.identifier.id,a.local?.manifest.version))}async installGalleryExtensions(t,e,n){if(t=t.filter(a=>{let{id:l,version:c,installOptions:u}=a,p=e.find(m=>Ce(m.identifier,{id:l}));if(p){if(!n&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(2016,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(2015,null,`${l}@${c}`)),!1;p.preRelease&&c!=="prerelease"&&(u.preRelease=!1)}return!0}),!t.length)return[];let r=[],i=[],s=await this.getGalleryExtensions(t);if(await Promise.all(t.map(async({id:a,version:l,installOptions:c})=>{let u=s.get(a.toLowerCase());if(!u){this.logger.error(`${XV(l?`${a}@${l}`:a)} -+`);return t===-1?o:o.substring(0,t)}function hL(o,t){let{args:e,stack:n}=OV(o),r=typeof e[0]=="string"&&e.length===1,i=AV(n);i&&(i=`(${i.trim()})`);let s=[];if(typeof e[0]=="string"?i&&r?s=[`%c[${t}] %c${e[0]} %c${i}`,Pd("blue"),Pd(""),Pd("grey")]:s=[`%c[${t}] %c${e[0]}`,Pd("blue"),Pd(""),...e.slice(1)]:s=[`%c[${t}]%`,Pd("blue"),...e],i&&!r&&s.push(i),typeof console[o.severity]!="function")throw new Error("Unknown console method");console[o.severity].apply(console,s)}function Pd(o){return`color: ${o}`}var vL=y(()=>{le()});import{fork as NV}from"child_process";var aa,Kv=y(()=>{$e();nt();Wt();vL();Se();ce();j();on();Yp();Jp();sa();aa=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new P;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new bp(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,r,i){return e.requestPromise(t,n,r,i)},listen(n,r){return e.requestEvent(t,n,r)}}}requestPromise(t,e,n,r=Ee.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(r.isCancellationRequested)return Promise.reject(dp());this.disposeDelayer.cancel();let i=this.getCachedChannel(t),s=kr(c=>i.call(e,n,c)),a=r.onCancellationRequested(()=>s.cancel()),l=ie(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(t,e,n){if(!this.disposeDelayer)return F.None;this.disposeDelayer.cancel();let r,i=new P({onWillAddFirstListener:()=>{r=this.getCachedChannel(t).listen(e,n)(i.fire,i),this.activeRequests.add(r)},onDidRemoveLastListener:()=>{this.activeRequests.delete(r),r.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return i.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...fo(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(p=>!/^--inspect(-brk)?=/.test(p)).filter(p=>!p.startsWith("--vscode-"))),Hh(e.env),this.child=NV(this.modulePath,t,e);let n=new P,i=F.fromNodeEventEmitter(this.child,"message",p=>p)(p=>{if(gL(p)){hL(p,`IPC Library: ${this.options.serverName}`);return}n.fire(A.wrap(Buffer.from(p,"base64")))}),s=this.options.useQueue?s0(this.child):this.child,a=p=>this.child?.connected&&s.send(p.buffer.toString("base64")),l=n.event,c={send:a,onMessage:l};this._client=new Cd(c);let u=()=>this.disposeClient();process.once("exit",u),this.child.on("error",p=>console.warn('IPC "'+this.options.serverName+'" errored with '+p)),this.child.on("exit",(p,m)=>{process.removeListener("exit",u),i.dispose(),this.activeRequests.forEach(g=>Jt(g)),this.activeRequests.clear(),p!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+p+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:p,signal:m})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}}});var jv,yL=y(()=>{He();sa();Kv();wl();jv=class extends Fv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new aa(bt.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:r})=>this.onError(`terminated by itself with code ${n}, signal: ${r} (ETERM)`))),Yo.toService(fL(e.getChannel("watcher")))}}});import{watchFile as UV,unwatchFile as FV}from"fs";var Qv,bL=y(()=>{j();wl();ce();ot();le();$e();rl();Se();Qv=class extends D{constructor(){super();this._onDidChangeFile=this._register(new P);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new P);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new P);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Fr);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Rr(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Br;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return Vv(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:po(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Br;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[r,i]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(r)||n.push(i);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(r=>Ke(r))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new se;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let r=this.recursiveWatcher?.subscribe(e.path,(i,s)=>{n.isDisposed||(i?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return r?(n.add(r),!0):!1}doMonitorWithNodeJS(e,n){let r=!1,i=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),c=this.isPathNotFound(a),u=r;r=l,!l&&(c||u)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{UV(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},i)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(ie(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{FV(e.path,i)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:I.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let r=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(r,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${dL(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}}});import{watch as VV,promises as WV}from"fs";var Jv,IL=y(()=>{$e();Wt();gi();j();ih();Oe();pe();Nt();le();fr();ot();wl();ji();Jv=class o extends D{constructor(e,n,r,i,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=r;this.onDidWatchFail=i;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new Pc({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new rh(e=>this.handleFileChanges(e),o.FILE_CHANGES_HANDLER_DELAY));this.cts=new ht;this.realPath=new gn(async()=>{let e=this.request.path;try{e=await Te.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Me;this.excludes=YE(this.request.path,this.request.excludes,l),this.includes=this.request.includes?YE(this.request.path,this.request.includes,l):void 0,this.filter=Vv(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await WV.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new se;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let r=I.file(this.request.path),i=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await r1(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:a.type,cId:this.request.correlationId},!0))});return i?(n.add(i),!0):!1}async doWatchWithNodeJS(e,n){let r=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(it&&Wr(r,"/Volumes/",!0)){this.error(`Refusing to watch ${r} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let i=new ht(this.cts.token);n.add(ie(()=>i.dispose(!0)));let s=new se;n.add(s);try{let a=I.file(this.request.path),l=dt(r),c=VV(r);s.add(ie(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${r}'`);let u=new Set;if(e)try{for(let m of await Te.readdir(r))u.add(m)}catch(m){this.error(m)}if(i.token.isCancellationRequested)return;let p=new Map;s.add(ie(()=>{for(let[,m]of p)m.dispose();p.clear()})),c.on("error",(m,g)=>{i.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${m}, ${g})`),this.notifyWatchFailed())}),c.on("change",(m,g)=>{if(i.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${m}"] ${g}`);let h="";if(g&&(h=g.toString(),it&&(h=Ep(h))),!(!h||m!=="change"&&m!=="rename"))if(e)if(m==="rename"){p.get(h)?.dispose();let v=setTimeout(async()=>{if(p.delete(h),Sc(h,l,!Me)&&!await Te.exists(r)){this.onWatchedPathDeleted(a);return}if(i.token.isCancellationRequested)return;let x=await this.existsChildStrictCase(H(r,h));if(i.token.isCancellationRequested)return;let T;x?u.has(h)?T=0:(T=1,u.add(h)):(u.delete(h),T=2),this.onFileChange({resource:he(a,h),type:T,cId:this.request.correlationId})},o.FILE_DELETE_HANDLER_DELAY);p.set(h,ie(()=>clearTimeout(v)))}else{let v;u.has(h)?v=0:(v=1,u.add(h)),this.onFileChange({resource:he(a,h),type:v,cId:this.request.correlationId})}else if(m==="rename"||!Sc(h,l,!Me)){let v=setTimeout(async()=>{let x=await Te.exists(r);i.token.isCancellationRequested||(x?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},o.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(ie(()=>clearTimeout(v)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(i.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=lL(e),r=[];for(let s of n){if(cL(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}r.push(s)}if(r.length===0)return;if(this.verboseLogging)for(let s of r)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(r)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${r.length}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Me)return Te.exists(e);try{let n=dt(e);return(await Te.readdir(wt(e))).some(i=>i===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}}});var Xv,xL=y(()=>{ce();Av();bL();pe();IL();$e();j();Xv=class extends Qv{constructor(e){super();this.recursiveWatcher=e;this.onDidError=F.None;this._watchers=new Map;this.worker=this._register(new mr)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],r=new Set(Array.from(this.watchers));for(let i of e){let s=this._watchers.get(this.requestToWatcherKey(i));s&&JE(s.request.excludes,i.excludes)&&JE(s.request.includes,i.includes)?r.delete(s):n.push(i)}n.length&&this.trace(`Request to start watching: ${n.map(i=>this.requestToString(i)).join(",")}`),r.size&&this.trace(`Request to stop watching: ${Array.from(r).map(i=>this.requestToString(i.request)).join(",")}`),this.worker.clear();for(let i of r)this.stopWatching(i);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new Pc({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Me?e:e.toLowerCase()}startWatching(e){let n=new Jv(e,this.recursiveWatcher,i=>this._onDidChangeFile.fire(i),()=>this._onDidWatchFail.fire(e),i=>this._onDidLogMessage.fire(i),this.verboseLogging),r={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),r)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let r of e){let i=n.get(r.correlationId);i||(i=new Map,n.set(r.correlationId,i));let s=this.pathToWatcherKey(r.path);i.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(r)}`),i.set(s,r)}return Array.from(n.values()).flatMap(r=>Array.from(r.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}}});var Yv,SL=y(()=>{wl();xL();Yv=class extends Uv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new Xv(void 0))}}});import{constants as ZE,promises as Tl}from"fs";var Ri,Rm=y(()=>{$e();Hn();nt();ce();gi();j();Oe();pe();Nt();kc();fr();ue();ot();zE();uL();yL();SL();Ri=class o extends Bv{constructor(){super(...arguments);this.onDidChangeCapabilities=F.None;this.resourceLocks=new ut(e=>el.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Me&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:r}=await er.stat(this.toFilePath(e)),i;return(n.mode&128)===0&&(i=2),(n.mode&ZE.S_IXUSR||n.mode&ZE.S_IXGRP||n.mode&ZE.S_IXOTH)&&(i=(i??0)|4),{type:this.toType(n,r),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:i}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return Te.realpath(n)}async readdir(e){try{let n=await Te.readdir(this.toFilePath(e),{withFileTypes:!0}),r=[];return await Promise.all(n.map(async i=>{try{let s;i.isSymbolicLink()?s=(await this.stat(he(e,i.name))).type:s=this.toType(i),r.push([i.name,s])}catch(s){this.logService.trace(s)}})),r}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let r;return n?.dangling?r=0:e.isFile()?r=1:e.isDirectory()?r=2:r=0,n&&(r|=64),r}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let r;for(;r=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await r.wait();let i=new lo;return this.resourceLocks.set(e,i),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),ie(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),i.open()})}async readFile(e,n){let r;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),r=await this.createResourceLock(e));let i=this.toFilePath(e);return await Tl.readFile(i)}catch(i){throw this.toFileSystemProviderError(i)}finally{r?.dispose()}}traceLock(e){o.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,r){let i=Vs(s=>A.concat(s.map(a=>A.wrap(a))).buffer);return Lv(this,e,i,s=>s.buffer,{...n,bufferSize:256*1024},r),i}async writeFile(e,n,r){return r?.atomic!==!1&&r?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,he(eh(e),`${Zn(e)}${r.atomic.postfix}`),n,r):this.doWriteFile(e,n,r)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:r}=await er.stat(n);if(r)return!1}catch{}return!0}async doWriteFileAtomic(e,n,r,i){let s=new se;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,r,{...i,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,r,i){let s;try{let a=this.toFilePath(e);if(!r.create||!r.overwrite){if(await Te.exists(a)){if(!r.overwrite)throw Do(d(2131,null),"EntryExists")}else if(!r.create)throw Do(d(2134,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:r.append,unlock:r.unlock},i),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){o.canFlush=e}async open(e,n,r){let i=this.toFilePath(e),s;dl(n)&&!r&&(s=await this.createResourceLock(e));let a;try{if(dl(n)&&n.unlock)try{let{stat:l}=await er.stat(i);l.mode&128||await Tl.chmod(i,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(te&&dl(n)&&!n.append)try{a=await Te.open(i,"r+"),await Te.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await Te.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await Te.open(i,dl(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),dl(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),dl(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${i})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${i})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&o.canFlush)try{await Te.fdatasync(e)}catch(r){o.configureFlushOnWrite(!1),this.logService.error(r)}return await Te.close(e)}catch(r){throw this.toFileSystemProviderError(r)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.read(e,r,i,s,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,r){let i=this.mapHandleToPos.get(e);typeof i=="number"&&(typeof n=="number"||(typeof r=="number"?this.mapHandleToPos.set(e,i+r):this.mapHandleToPos.delete(e)))}async write(e,n,r,i,s){return B1(()=>this.doWrite(e,n,r,i,s),100,3)}async doWrite(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.write(e,r,i,s,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),c)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Tl.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let r=this.toFilePath(e);if(n.recursive){let i;n?.atomic!==!1&&n.atomic.postfix&&(i=H(wt(r),`${dt(r)}${n.atomic.postfix}`)),await Te.rm(r,1,i)}else try{await Tl.unlink(r)}catch(i){if(i.code==="EPERM"||i.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await er.stat(r);s=a.isDirectory()&&!l}catch{}if(s)await Tl.rmdir(r);else throw i}else throw i}}catch(r){throw this.toFileSystemProviderError(r)}}async rename(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"move",r.overwrite),await Te.rename(i,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2135,null,dt(i),dt(wt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"copy",r.overwrite),await Te.copy(i,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2129,null,dt(i),dt(wt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,r,i){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=Sc(s,a,!0)),l){if(r==="copy")throw Do(d(2130,null),"EntryExists");if(r==="move")return}let u=await this.statIgnoreError(e);if(!u)throw Do(d(2133,null),"EntryNotFound");let p=await this.statIgnoreError(n);if(p){if(!i)throw Do(d(2132,null),"EntryExists");(u.type&1)!==0&&(p.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(Sc(i,s,!a))return;let l=new se;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),r&&await Tl.mkdir(wt(s),{recursive:!0}),await Tl.copyFile(i,s)}catch(c){if(c.code==="ENOENT"&&!r)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(e,n,r){return new jv(i=>e(i),i=>n(i),r)}createNonRecursiveWatcher(e,n,r){return new Yv(i=>e(i),i=>n(i),r)}toFileSystemProviderError(e){if(e instanceof Vc)return e;let n=e,r;switch(e.code){case"ENOENT":r="EntryNotFound";break;case"EISDIR":r="EntryIsADirectory";break;case"ENOTDIR":r="EntryNotADirectory";break;case"EEXIST":r="EntryExists";break;case"EPERM":case"EACCES":r="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,r="Unknown";break;default:r="Unknown"}return Do(n,r)}async toFileSystemProviderWriteError(e,n){let r=this.toFileSystemProviderError(n);if(e&&r.code==="NoPermissions")try{let{stat:i}=await er.stat(this.toFilePath(e));i.mode&128||(r=Do(n,"EntryWriteLocked"))}catch(i){this.logService.trace(i)}return r}}});function EL(o){return o.getFullYear()+"-"+String(o.getMonth()+1).padStart(2,"0")+"-"+String(o.getDate()).padStart(2,"0")+"T"+String(o.getHours()).padStart(2,"0")+":"+String(o.getMinutes()).padStart(2,"0")+":"+String(o.getSeconds()).padStart(2,"0")+"."+(o.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var BV,HV,ew,Vde,Wde,Bde,wL=y(()=>{ue();ji();pe();BV=60,HV=BV*60,ew=HV*24,Vde=ew*7,Wde=ew*30,Bde=ew*365});function $V(o,t){return Zv(o["inspect-extensions"],o["inspect-brk-extensions"],5870,t,o.debugId,o.extensionEnvironment)}function Zv(o,t,e,n,r,i){let a=Number(t||o)||(n?null:e),l=a?!!t:!1,c;if(i)try{c=JSON.parse(i)}catch{}return{port:a,break:l,debugId:r,env:c}}var CL,at,TL=y(()=>{wL();Hv();He();Oe();no();Nt();le();CL=/^([^.]+\..+)[:=](.+)$/,at=class{constructor(t,e,n){this._args=t;this.paths=e;this.productService=n}get appRoot(){return wt(bt.asFileUri("").fsPath)}get userHome(){return I.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return I.file(H(this.userDataPath,"User"))}get tmpDir(){return I.file(this.paths.tmpDir)}get cacheHome(){return I.file(this.userDataPath)}get stateResource(){return he(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:z.vscodeUserData})}get userDataSyncHome(){return he(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let t=EL(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=H(this.userDataPath,"logs",t)}return I.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return he(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return he(this.appSettingsHome,"History")}get keyboardLayoutResource(){return he(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let t=Qt.VSCODE_PORTABLE;return t?I.file(H(t,"argv.json")):he(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return I.file(H(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let t=this.args["builtin-extensions-dir"];return t?Bn(t):In(H(bt.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let t=this.args["extensions-download-dir"];return t?I.file(Bn(t)):I.file(H(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let t=this.args["extensions-dir"];if(t)return Bn(t);let e=Qt.VSCODE_EXTENSIONS;if(e)return e;let n=Qt.VSCODE_PORTABLE;return n?H(n,"extensions"):he(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let t=this.args["agent-plugins-dir"];if(t)return Bn(t);let e=Qt.VSCODE_AGENT_PLUGINS;if(e)return e;let n=Qt.VSCODE_PORTABLE;return n?H(n,"agent-plugins"):he(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let t=this.args.extensionDevelopmentPath;if(Array.isArray(t))return t.map(e=>/^[^:/?#]+?:\/\//.test(e)?I.parse(e):I.file(In(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(t=>t==="ui"||t==="workspace"||t==="web"?t:"workspace")}get extensionTestsLocationURI(){let t=this.args.extensionTestsPath;if(t)return/^[^:/?#]+?:\/\//.test(t)?I.parse(t):I.file(In(t))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let t=this.args["disable-extension"];if(t){if(typeof t=="string")return[t];if(Array.isArray(t)&&t.length>0)return t}return!1}get debugExtensionHost(){return $V(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!Qt.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(t=>!CL.test(t))}get extensionLogLevel(){let t=[];for(let e of this.args.log||[]){let n=CL.exec(e);n?.[1]&&n[2]&&t.push([n[1],n[2]])}return t.length?t:void 0}get serviceMachineIdResource(){return he(I.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let t=Qt.VSCODE_PORTABLE;return t?I.file(H(t,"policy.json")):he(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return he(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(t){this.args.continueOn=t}get args(){return this._args}};E([je],at.prototype,"appRoot",1),E([je],at.prototype,"userHome",1),E([je],at.prototype,"userDataPath",1),E([je],at.prototype,"appSettingsHome",1),E([je],at.prototype,"tmpDir",1),E([je],at.prototype,"cacheHome",1),E([je],at.prototype,"stateResource",1),E([je],at.prototype,"userRoamingDataHome",1),E([je],at.prototype,"userDataSyncHome",1),E([je],at.prototype,"sync",1),E([je],at.prototype,"workspaceStorageHome",1),E([je],at.prototype,"localHistoryHome",1),E([je],at.prototype,"keyboardLayoutResource",1),E([je],at.prototype,"argvResource",1),E([je],at.prototype,"isExtensionDevelopment",1),E([je],at.prototype,"untitledWorkspacesHome",1),E([je],at.prototype,"builtinExtensionsPath",1),E([je],at.prototype,"extensionsDownloadLocation",1),E([je],at.prototype,"extensionsPath",1),E([je],at.prototype,"agentPluginsPath",1),E([je],at.prototype,"extensionDevelopmentLocationURI",1),E([je],at.prototype,"extensionDevelopmentKind",1),E([je],at.prototype,"extensionTestsLocationURI",1),E([je],at.prototype,"debugExtensionHost",1),E([je],at.prototype,"logLevel",1),E([je],at.prototype,"extensionLogLevel",1),E([je],at.prototype,"serviceMachineIdResource",1),E([je],at.prototype,"disableTelemetry",1),E([je],at.prototype,"disableExperiments",1),E([je],at.prototype,"disableWorkspaceTrust",1),E([je],at.prototype,"useInMemorySecretStorage",1),E([je],at.prototype,"policyFile",1),E([je],at.prototype,"agentSessionsWorkspace",1)});import{homedir as PL}from"os";import{resolve as zV,isAbsolute as GV,join as Rd}from"path";function RL(o,t){let e=KV(o,t),n=[e];return GV(e)||n.unshift(qV),zV(...n)}function KV(o,t){process.env.VSCODE_DEV&&(process.isEmbeddedApp?t="sessions-oss-dev":t="code-oss-dev");let e=process.env.VSCODE_PORTABLE;if(e)return Rd(e,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Rd(n,t);let r=o["user-data-dir"];if(r)return r;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let i=process.env.USERPROFILE;if(typeof i!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Rd(i,"AppData","Roaming")}break;case"darwin":n=Rd(PL(),"Library","Application Support");break;case"linux":default:n=process.env.XDG_CONFIG_HOME||Rd(PL(),".config");break}return Rd(n,t)}var qV,kL=y(()=>{qV=process.env.VSCODE_CWD||process.cwd()});import{homedir as jV,tmpdir as QV}from"os";function DL(o,t){return Zv(o["inspect-ptyhost"],o["inspect-brk-ptyhost"],5877,t,o.extensionEnvironment)}function _L(o,t){return Zv(o["inspect-agenthost"],o["inspect-brk-agenthost"],5878,t,o.extensionEnvironment)}var ey,ty=y(()=>{TL();kL();ey=class extends at{constructor(t,e){super(t,{homeDir:jV(),tmpDir:QV(),userDataDir:RL(t,e.nameShort)},e)}}});function la(){return tw||(tw=A.alloc(0)),tw}function LL(o){switch(o){case 0:return"None";case 1:return"Regular";case 2:return"Control";case 3:return"Ack";case 5:return"Disconnect";case 6:return"ReplayRequest";case 7:return"PauseWriting";case 8:return"ResumeWriting";case 9:return"KeepAlive"}}var iw,tw,km,Mo,ny,ry,Pl,nw,rw,ow,Dm,Rl=y(()=>{nt();ce();j();sa();(s=>{s.enableDiagnostics=!1,s.records=[];let e=new WeakMap,n=0;function r(a,l){if(!e.has(a)){let c=String(++n);e.set(a,c)}return e.get(a)}function i(a,l,c,u){}s.traceSocketEvent=i})(iw||={});tw=null;km=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(t){this._chunks.push(t),this._totalLength+=t.byteLength}read(t){return this._read(t,!0)}peek(t){return this._read(t,!1)}_read(t,e){if(t===0)return la();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=t),s}if(this._chunks[0].byteLength>t){let s=this._chunks[0].slice(0,t);return e&&(this._chunks[0]=this._chunks[0].slice(t),this._totalLength-=t),s}let n=A.alloc(t),r=0,i=0;for(;t>0;){let s=this._chunks[i];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,r),r+=t,e&&(this._chunks[i]=s.slice(t),this._totalLength-=t),t-=t}else n.set(s,r),r+=s.byteLength,e?(this._chunks.shift(),this._totalLength-=s.byteLength):i++,t-=s.byteLength}return n}};Mo=class{constructor(t,e,n,r){this.type=t;this.id=e;this.ack=n;this.data=r;this.writtenTime=0}get size(){return this.data.byteLength}},ny=class extends D{constructor(e){super();this._onMessage=this._register(new P);this.onMessage=this._onMessage.event;this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0};this._socket=e,this._isDisposed=!1,this._incomingData=new km,this._register(this._socket.onData(n=>this.acceptChunk(n))),this.lastReadTime=Date.now()}acceptChunk(e){if(!(!e||e.byteLength===0))for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){let n=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=n.readUInt32BE(9),this._state.messageType=n.readUInt8(0),this._state.id=n.readUInt32BE(1),this._state.ack=n.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:LL(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let r=this._state.messageType,i=this._state.id,s=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",n),this._onMessage.fire(new Mo(r,i,s,n)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},ry=class{constructor(t){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=t,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){try{this.flush()}catch{}this._isDisposed=!0}drain(){return this.flush(),this._socket.drain()}flush(){this._writeNow()}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this._scheduleWriting()}write(t){if(this._isDisposed)return;t.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=A.alloc(13);e.writeUInt8(t.type,0),e.writeUInt32BE(t.id,1),e.writeUInt32BE(t.ack,5),e.writeUInt32BE(t.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:LL(t.type),id:t.id,ack:t.ack,messageSize:t.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",t.data),this._writeSoon(e,t.data)}_bufferAdd(t,e){let n=this._totalLength===0;return this._data.push(t,e),this._totalLength+=t.byteLength+e.byteLength,n}_bufferTake(){let t=A.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,t}_writeSoon(t,e){this._bufferAdd(t,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let t=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:t.byteLength}),this._socket.write(t)}},Pl=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new P({onWillAddFirstListener:()=>{this._hasListeners=!0,queueMicrotask(()=>this._deliverMessages())},onDidRemoveLastListener:()=>{this._hasListeners=!1}}),this.event=this._emitter.event}_deliverMessages(){if(!this._isDeliveringMessages){for(this._isDeliveringMessages=!0;this._hasListeners&&this._bufferedMessages.length>0;)this._emitter.fire(this._bufferedMessages.shift());this._isDeliveringMessages=!1}}fire(t){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(t):this._emitter.fire(t):this._bufferedMessages.push(t)}flushBuffer(){this._bufferedMessages=[]}},nw=class{constructor(t){this.data=t,this.next=null}},rw=class{constructor(){this._first=null,this._last=null}length(){let t=0,e=this._first;for(;e;)e=e.next,t++;return t}peek(){return this._first?this._first.data:null}toArray(){let t=[],e=0,n=this._first;for(;n;)t[e++]=n.data,n=n.next;return t}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(t){let e=new nw(t);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},ow=class o{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return o._INSTANCE||(o._INSTANCE=new o),o._INSTANCE}constructor(){this.lastRuns=[];let t=Date.now();for(let e=0;e{for(let e=o._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let t=Date.now(),e=(1+o._HISTORY_LENGTH)*1e3,n=0;for(let r=0;r=.5}},Dm=class{constructor(t){this._onControlMessage=new Pl;this.onControlMessage=this._onControlMessage.event;this._onMessage=new Pl;this.onMessage=this._onMessage.event;this._onDidDispose=new Pl;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new Pl;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new Pl;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=t.loadEstimator??ow.getInstance(),this._shouldSendKeepAlive=t.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new rw,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socketDisposables=new se,this._socket=t.socket,this._socketWriter=this._socketDisposables.add(new ry(this._socket)),this._socketReader=this._socketDisposables.add(new ny(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),t.initialChunk&&this._socketReader.acceptChunk(t.initialChunk),this._shouldSendKeepAlive?this._keepAliveInterval=setInterval(()=>{this._sendKeepAlive()},5e3):this._keepAliveInterval=null}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._keepAliveInterval&&(clearInterval(this._keepAliveInterval),this._keepAliveInterval=null),this._socketDisposables.dispose()}drain(){return this._socketWriter.drain()}sendDisconnect(){if(!this._didSendDisconnect){this._didSendDisconnect=!0;let t=new Mo(5,0,0,la());this._socketWriter.write(t),this._socketWriter.flush()}}sendPause(){let t=new Mo(7,0,0,la());this._socketWriter.write(t)}sendResume(){let t=new Mo(8,0,0,la());this._socketWriter.write(t)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(t,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new se,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=t,this._socketWriter=this._socketDisposables.add(new ry(this._socket)),this._socketReader=this._socketDisposables.add(new ny(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(n=>this._receiveMessage(n))),this._socketDisposables.add(this._socket.onClose(n=>this._onSocketClose.fire(n))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let t=new Mo(3,0,this._incomingAckId,la());this._socketWriter.write(t);let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;nthis._outgoingAckId){this._outgoingAckId=t.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=t.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(t.type){case 0:break;case 1:{if(t.id>this._incomingMsgId)if(t.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new Mo(6,0,0,la())))}else this._incomingMsgId=t.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(t.data);break}case 2:{this._onControlMessage.fire(t.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;n=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-t+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let t=this._outgoingUnackMsg.peek(),e=Date.now()-t.writtenTime,n=Date.now()-this._socketReader.lastReadTime,r=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&n>=2e4&&r>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:n});return}let i=Math.max(2e4-e,2e4-n,2e4-r,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},i)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let t=new Mo(3,0,this._incomingAckId,la());this._socketWriter.write(t)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let t=new Mo(9,0,this._incomingAckId,la());this._socketWriter.write(t)}}});function JV(o,t){if(typeof o!="string"||o.trim().length===0)return console.log(`[reconnection-grace-time] No CLI argument provided, using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let e=Number(o);if(!isFinite(e)||e<0)return console.log(`[reconnection-grace-time] Invalid value '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let n=Math.floor(e*1e3);return!isFinite(n)||n>Number.MAX_SAFE_INTEGER?(console.log(`[reconnection-grace-time] Value too large '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t):(console.log(`[reconnection-grace-time] Parsed CLI argument: ${e}s -> ${n}ms`),n)}var aw,ca,ki,kl=y(()=>{ue();ty();Zp();re();vn();Hv();le();Nt();Oe();Rl();aw={"disable-update-check":{type:"boolean"},auth:{type:"string"},"disable-file-downloads":{type:"boolean"},"disable-file-uploads":{type:"boolean"},"disable-getting-started-override":{type:"boolean"},locale:{type:"string"},"link-protection-trusted-domains":{type:"string[]"},host:{type:"string",cat:"o",args:"ip-address",description:d(2697,null)},port:{type:"string",cat:"o",args:"port | port range",description:d(2698,null)},"socket-path":{type:"string",cat:"o",args:"path",description:d(2702,null)},"server-base-path":{type:"string",cat:"o",args:"path",description:d(2700,null)},"connection-token":{type:"string",cat:"o",args:"token",deprecates:["connectionToken"],description:d(2693,null)},"connection-token-file":{type:"string",cat:"o",args:"path",deprecates:["connection-secret","connectionTokenFile"],description:d(2694,null)},"without-connection-token":{type:"boolean",cat:"o",description:d(2705,null)},"disable-websocket-compression":{type:"boolean"},"print-startup-performance":{type:"boolean"},"print-ip-address":{type:"boolean"},"accept-server-license-terms":{type:"boolean",cat:"o",description:d(2690,null)},"server-data-dir":{type:"string",cat:"o",description:d(2701,null)},"telemetry-level":{type:"string",cat:"o",args:"level",description:d(2704,null)},"user-data-dir":Rt["user-data-dir"],"enable-smoke-test-driver":Rt["enable-smoke-test-driver"],"disable-telemetry":Rt["disable-telemetry"],"disable-experiments":Rt["disable-experiments"],"disable-workspace-trust":Rt["disable-workspace-trust"],"file-watcher-polling":{type:"string",deprecates:["fileWatcherPolling"]},log:Rt.log,logsPath:Rt.logsPath,"force-disable-user-env":Rt["force-disable-user-env"],"enable-proposed-api":Rt["enable-proposed-api"],folder:{type:"string",deprecationMessage:"No longer supported. Folder needs to be provided in the browser URL or with `default-folder`."},workspace:{type:"string",deprecationMessage:"No longer supported. Workspace needs to be provided in the browser URL or with `default-workspace`."},"default-folder":{type:"string",description:d(2695,null)},"default-workspace":{type:"string",description:d(2696,null)},"enable-sync":{type:"boolean"},"github-auth":{type:"string"},"use-test-resolver":{type:"boolean"},"extensions-dir":Rt["extensions-dir"],"extensions-download-dir":Rt["extensions-download-dir"],"builtin-extensions-dir":Rt["builtin-extensions-dir"],"install-extension":Rt["install-extension"],"install-builtin-extension":Rt["install-builtin-extension"],"update-extensions":Rt["update-extensions"],"uninstall-extension":Rt["uninstall-extension"],"list-extensions":Rt["list-extensions"],"locate-extension":Rt["locate-extension"],"show-versions":Rt["show-versions"],category:Rt.category,force:Rt.force,"do-not-sync":Rt["do-not-sync"],"do-not-include-pack-dependencies":Rt["do-not-include-pack-dependencies"],"pre-release":Rt["pre-release"],"start-server":{type:"boolean",cat:"e",description:d(2703,null)},"enable-remote-auto-shutdown":{type:"boolean"},"remote-auto-shutdown-without-delay":{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"agent-host-port":{type:"string",cat:"o",args:"port",description:d(2692,null)},"agent-host-path":{type:"string",cat:"o",args:"path",description:d(2691,null)},"use-host-proxy":{type:"boolean"},"without-browser-env-var":{type:"boolean"},"reconnection-grace-time":{type:"string",cat:"o",args:"seconds",description:d(2699,null)},help:Rt.help,version:Rt.version,"locate-shell-integration-path":Rt["locate-shell-integration-path"],compatibility:{type:"string"},_:Rt._},ca=Ct,ki=class extends ey{get userRoamingDataHome(){return this.appSettingsHome}get machineSettingsResource(){return he(I.file(H(this.userDataPath,"Machine")),"settings.json")}get mcpResource(){return he(I.file(H(this.userDataPath,"User")),"mcp.json")}get args(){return super.args}get reconnectionGraceTime(){return JV(this.args["reconnection-grace-time"],108e5)}};E([je],ki.prototype,"userRoamingDataHome",1),E([je],ki.prototype,"machineSettingsResource",1),E([je],ki.prototype,"mcpResource",1),E([je],ki.prototype,"reconnectionGraceTime",1)});var XV,ML,da,lw=y(()=>{Wt();Se();He();Nt();Zs();le();ue();or();Lo();_n();yn();XV=o=>d(2032,null,o),ML=d(2045,null,"ms-dotnettools.csharp"),da=class{constructor(t,e,n,r,i){this.extensionsForceVersionByQuality=t;this.logger=e;this.extensionManagementService=n;this.extensionGalleryService=r;this.productService=i;this.extensionsForceVersionByQuality=this.extensionsForceVersionByQuality.map(s=>s.toLowerCase())}get location(){}async listExtensions(t,e,n){let r=await this.extensionManagementService.getInstalled(1,n),i=ev.map(a=>a.toLowerCase());if(e&&e!==""){if(i.indexOf(e.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}r=r.filter(a=>a.manifest.categories?a.manifest.categories.map(c=>c.toLowerCase()).indexOf(e.toLowerCase())>-1:!1)}else if(e===""){this.logger.info("Possible Categories: "),i.forEach(a=>{this.logger.info(a)});return}this.location&&this.logger.info(d(2031,null,this.location)),r=r.sort((a,l)=>a.identifier.id.localeCompare(l.identifier.id));let s;for(let a of r)s!==a.identifier.id&&(s=a.identifier.id,this.logger.info(t?`${s}@${a.manifest.version}`:s))}async installExtensions(t,e,n,r){let i=[];try{t.length&&this.logger.info(this.location?d(2030,null,this.location):d(2029,null));let s=[],a=[],l=(u,p,m)=>{this.extensionsForceVersionByQuality?.some(g=>g===u.toLowerCase())&&(p=this.productService.quality!=="stable"?"prerelease":void 0),a.push({id:u,version:p!=="prerelease"?p:void 0,installOptions:{...n,isBuiltin:m,installPreReleaseVersion:p==="prerelease"||n.installPreReleaseVersion}})};for(let u of t)if(u instanceof I)s.push({vsix:u,installOptions:n});else{let[p,m]=cm(u);l(p,m,!1)}for(let u of e)if(u instanceof I)s.push({vsix:u,installOptions:{...n,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{let[p,m]=cm(u);l(p,m,!0)}let c=await this.extensionManagementService.getInstalled(void 0,n.profileLocation);if(s.length&&await Promise.all(s.map(async({vsix:u,installOptions:p})=>{try{await this.installVSIX(u,p,r,c)}catch(m){this.logger.error(m),i.push(u.toString())}})),a.length){let u=await this.installGalleryExtensions(a,c,r);i.push(...u)}}catch(s){throw this.logger.error(d(2019,null,fe(s))),s}if(i.length)throw new Error(d(2024,null,i.join(", ")))}async updateExtensions(t){let e=await this.extensionManagementService.getInstalled(1,t),n=[];for(let a of e)a.identifier.uuid&&n.push({...a.identifier,preRelease:a.preRelease});this.logger.trace(d(2043,null,n.length));let r=await this.extensionGalleryService.getExtensions(n,{compatible:!0},Ee.None),i=[];for(let a of r)for(let l of e)Ce(l.identifier,a.identifier)&&Ys(a.version,l.manifest.version)&&i.push({extension:a,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:t,isApplicationScoped:l.isApplicationScoped}});if(!i.length){this.logger.info(d(2042,null));return}this.logger.info(d(2041,null,i.map(a=>a.extension.identifier.id).join(", ")));let s=await this.extensionManagementService.installGalleryExtensions(i);for(let a of s)a.error?this.logger.error(d(2021,null,a.identifier.id,fe(a.error))):this.logger.info(d(2038,null,a.identifier.id,a.local?.manifest.version))}async installGalleryExtensions(t,e,n){if(t=t.filter(a=>{let{id:l,version:c,installOptions:u}=a,p=e.find(m=>Ce(m.identifier,{id:l}));if(p){if(!n&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(2016,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(2015,null,`${l}@${c}`)),!1;p.preRelease&&c!=="prerelease"&&(u.preRelease=!1)}return!0}),!t.length)return[];let r=[],i=[],s=await this.getGalleryExtensions(t);if(await Promise.all(t.map(async({id:a,version:l,installOptions:c})=>{let u=s.get(a.toLowerCase());if(!u){this.logger.error(`${XV(l?`${a}@${l}`:a)} - ${ML}`),r.push(a);return}try{let m=await this.extensionGalleryService.getManifest(u,Ee.None);if(m&&!this.validateExtensionKind(m))return}catch(m){this.logger.error(m.message||m.stack||m),r.push(a);return}let p=e.find(m=>Ce(m.identifier,u.identifier));if(p){if(u.version===p.manifest.version){this.logger.info(d(2015,null,l?`${a}@${l}`:a));return}this.logger.info(d(2044,null,a,u.version))}c.isBuiltin?this.logger.info(l?d(2027,null,a,l):d(2026,null,a)):this.logger.info(l?d(2028,null,a,l):d(2025,null,a)),i.push({extension:u,options:{...c,installGivenVersion:!!l,isApplicationScoped:c.isApplicationScoped||p?.isApplicationScoped}})})),i.length){let a=await this.extensionManagementService.installGalleryExtensions(i);for(let l of a)l.error?(this.logger.error(d(2020,null,l.identifier.id,fe(l.error))),r.push(l.identifier.id)):this.logger.info(d(2035,null,l.identifier.id,l.local?.manifest.version))}return r}async installVSIX(t,e,n,r){let i=await this.extensionManagementService.getManifest(t);if(!i)throw new Error("Invalid vsix");if(await this.validateVSIX(i,n,e.profileLocation,r))try{await this.extensionManagementService.install(t,{...e,installGivenVersion:!0}),this.logger.info(d(2039,null,Zn(t)))}catch(a){if(Tn(a))this.logger.info(d(2018,null,Zn(t)));else throw a}}async getGalleryExtensions(t){let e=new Map,n=t.some(s=>s.installOptions.installPreReleaseVersion),r=await this.extensionManagementService.getTargetPlatform(),i=[];for(let s of t)im.test(s.id)&&i.push({...s,preRelease:n});if(i.length){let s=await this.extensionGalleryService.getExtensions(i,{targetPlatform:r},Ee.None);for(let a of s)e.set(a.identifier.id.toLowerCase(),a)}return e}validateExtensionKind(t){return!0}async validateVSIX(t,e,n,r){if(!e){let i={id:br(t.publisher,t.name)},s=r.find(a=>Ce(i,a.identifier)&&Ys(a.manifest.version,t.version));if(s)return this.logger.info(d(2022,null,s.identifier.id,s.manifest.version,t.version)),!1}return this.validateExtensionKind(t)}async uninstallExtensions(t,e,n){let r=async s=>{if(s instanceof I){let a=await this.extensionManagementService.getManifest(s);return Zc(a.publisher,a.name)}return s},i=[];for(let s of t){let a=await r(s),c=(await this.extensionManagementService.getInstalled(void 0,n)).filter(u=>Ce(u.identifier,{id:a}));if(!c.length)throw new Error(`${this.notInstalled(a)} - ${ML}`);if(c.some(u=>u.type===0)){this.logger.info(d(2017,null,a));return}if(!e&&c.some(u=>u.isBuiltin)){this.logger.info(d(2023,null,a));return}this.logger.info(d(2040,null,a));for(let u of c)await this.extensionManagementService.uninstall(u,{profileLocation:n}),i.push(u);this.location?this.logger.info(d(2037,null,a,this.location)):this.logger.info(d(2036,null,a))}}async locateExtension(t){let e=await this.extensionManagementService.getInstalled();t.forEach(n=>{e.forEach(r=>{if(r.identifier.id===n&&r.location.scheme===z.file){this.logger.info(r.location.fsPath);return}})})}notInstalled(t){return this.location?d(2034,null,t,this.location):d(2033,null,t)}};da=E([b(2,Xc),b(3,$n),b(4,ze)],da)});function YV(o){return o.tags.find(t=>t.startsWith("lp-"))?.split("lp-")[1]}var Dd,kd,oy=y(()=>{Wt();j();pe();ue();or();re();Dd=_("languagePackService"),kd=class extends D{constructor(e){super();this.extensionGalleryService=e}async getAvailableLanguages(){let e=new ht;setTimeout(()=>e.cancel(),1e3);let n;try{n=await this.extensionGalleryService.query({text:'category:"language packs"',pageSize:20},e.token)}catch{return[]}let i=n.firstPage.filter(s=>s.properties.localizedLanguages?.length&&s.tags.some(a=>a.startsWith("lp-"))).map(s=>{let a=s.properties.localizedLanguages?.[0],l=YV(s);return{...this.createQuickPickItem(l,a,s),extensionId:s.identifier.id,galleryExtension:s}});return i.push(this.createQuickPickItem("en","English")),i}createQuickPickItem(e,n,r){let i=n??e,s;if(i!==e&&(s=`(${e})`),e.toLowerCase()===Cn.toLowerCase()&&(s??="",s+=d(2146,null)),r?.installCount){s??="";let a=r.installCount,l;a>1e6?l=`${Math.floor(a/1e5)/10}M`:a>1e3?l=`${Math.floor(a/1e3)}K`:l=String(a),s+=` $(cloud-download) ${l}`}return{id:e,label:i,description:s}}};kd=E([b(0,$n)],kd)});import*as OL from"fs";import{createHash as ZV}from"crypto";function eW(o){if(typeof o.languageId!="string"||!Array.isArray(o.translations)||o.translations.length===0)return!1;for(let t of o.translations)if(typeof t.id!="string"||typeof t.path!="string")return!1;return!(o.languageName&&typeof o.languageName!="string"||o.localizedLanguageName&&typeof o.localizedLanguageName!="string")}var ua,_m,cw=y(()=>{At();$e();j();He();Oe();fr();vn();or();Lo();Ve();oy();le();ua=class extends kd{constructor(e,n,r,i){super(r);this.extensionManagementService=e;this.logService=i;this.cache=this._register(new _m(n,i)),this.extensionManagementService.registerParticipant({postInstall:async s=>this.postInstallExtension(s),postUninstall:async s=>this.postUninstallExtension(s)})}async getBuiltInExtensionTranslationsUri(e,n){let i=(await this.cache.getLanguagePacks())[n];if(!i){this.logService.warn(`No language pack found for ${n}`);return}let s=i.translations[e];return s?I.file(s):void 0}async getInstalledLanguages(){let e=await this.cache.getLanguagePacks(),n=Object.keys(e).map(r=>{let i=e[r];return{...this.createQuickPickItem(r,i.label),extensionId:i.extensions[0].extensionIdentifier.id}});return n.push(this.createQuickPickItem("en","English")),n.sort((r,i)=>r.label.localeCompare(i.label)),n}async postInstallExtension(e){e&&e.manifest&&e.manifest.contributes&&e.manifest.contributes.localizations&&e.manifest.contributes.localizations.length&&(this.logService.info("Adding language packs from the extension",e.identifier.id),await this.update())}async postUninstallExtension(e){let n=await this.cache.getLanguagePacks();Object.keys(n).some(r=>n[r]&&n[r].extensions.some(i=>Ce(i.extensionIdentifier,e.identifier)))&&(this.logService.info("Removing language packs from the extension",e.identifier.id),await this.update())}async update(){let[e,n]=await Promise.all([this.cache.getLanguagePacks(),this.extensionManagementService.getInstalled()]),r=await this.cache.update(n);return!mn(Object.keys(e),Object.keys(r))}};ua=E([b(0,Xc),b(1,Dn),b(2,$n),b(3,Q)],ua);_m=class extends D{constructor(e,n){super();this.logService=n;this.languagePacks={};this.languagePacksFilePath=H(e.userDataPath,"languagepacks.json"),this.languagePacksFileLimiter=new co}getLanguagePacks(){return this.languagePacksFileLimiter.size||!this.initializedCache?this.withLanguagePacks().then(()=>this.languagePacks):Promise.resolve(this.languagePacks)}update(e){return this.withLanguagePacks(n=>{Object.keys(n).forEach(r=>delete n[r]),this.createLanguagePacksFromExtensions(n,...e)}).then(()=>this.languagePacks)}createLanguagePacksFromExtensions(e,...n){for(let r of n)r&&r.manifest&&r.manifest.contributes&&r.manifest.contributes.localizations&&r.manifest.contributes.localizations.length&&this.createLanguagePacksFromExtension(e,r);Object.keys(e).forEach(r=>this.updateHash(e[r]))}createLanguagePacksFromExtension(e,n){let r=n.identifier,i=n.manifest.contributes&&n.manifest.contributes.localizations?n.manifest.contributes.localizations:[];for(let s of i)if(n.location.scheme===z.file&&eW(s)){let a=e[s.languageId];a||(a={hash:"",extensions:[],translations:{},label:s.localizedLanguageName??s.languageName},e[s.languageId]=a);let l=a.extensions.filter(c=>Ce(c.extensionIdentifier,r))[0];l?l.version=n.manifest.version:a.extensions.push({extensionIdentifier:r,version:n.manifest.version});for(let c of s.translations)a.translations[c.id]=H(n.location.fsPath,c.path)}}updateHash(e){if(e){let n=ZV("md5");for(let r of e.extensions)n.update(r.extensionIdentifier.uuid||r.extensionIdentifier.id).update(r.version);e.hash=n.digest("hex")}}withLanguagePacks(e=()=>null){return this.languagePacksFileLimiter.queue(()=>{let n=null;return OL.promises.readFile(this.languagePacksFilePath,"utf8").then(void 0,r=>r.code==="ENOENT"?Promise.resolve("{}"):Promise.reject(r)).then(r=>{try{return JSON.parse(r)}catch{return{}}}).then(r=>(n=e(r),r)).then(r=>{for(let s of Object.keys(r))r[s]||delete r[s];this.languagePacks=r,this.initializedCache=!0;let i=JSON.stringify(this.languagePacks);return this.logService.debug("Writing language packs",i),Te.writeFile(this.languagePacksFilePath,i)}).then(()=>n,r=>this.logService.error(r))})}};_m=E([b(0,Dn),b(1,Q)],_m)});var _d,AL=y(()=>{Wt();He();ot();Qo();_d=class{constructor(t,e){this.requestService=t;this.fileService=e}async download(t,e,n,r=Ee.None){if(t.scheme===z.file||t.scheme===z.vscodeRemote){await this.fileService.copy(t,e);return}let i={type:"GET",url:t.toString(!0),callSite:n},s=await this.requestService.request(i,r);if(s.res.statusCode===200)await this.fileService.writeFile(e,s.stream);else{let a=await Si(s);throw new Error(`Expected 200, got back ${s.res.statusCode} instead. +@@ -440,7 +440,7 @@ ${t.toString()}`}},Ed=class o{constructor(t=new Bs,e=!1,n,r=I9){this._services=t + `))}}});async function Nv(o,t,e,n,r,i){let s;try{await x9(o,t,e,n,r,i)}catch(a){s=a}finally{s&&r.errorTransformer&&(s=r.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function x9(o,t,e,n,r,i){qE(i);let s=await o.open(t,{create:!1});try{qE(i);let a=0,l=0,c=r&&typeof r.length=="number"?r.length:void 0,u=A.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),p=r&&typeof r.position=="number"?r.position:0,m=0;do l=await o.read(s,p,u.buffer,m,u.byteLength-m),p+=l,m+=l,a+=l,typeof c=="number"&&(c-=l),m===u.byteLength&&(await e.write(n(u)),u=A.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),m=0);while(l>0&&(typeof c!="number"||c>0)&&qE(i)&&S9(a,r));if(m>0){let g=m;typeof c=="number"&&(g=Math.min(m,c)),e.write(n(u.slice(0,g)))}}catch(a){throw as(a)}finally{await o.close(s)}}function qE(o){if(o.isCancellationRequested)throw mp();return!0}function S9(o,t){if(typeof t?.limits?.size=="number"&&o>t.limits.size)throw Lo(d(2152,null),"EntryTooLarge");return!0}var KE=y(()=>{nt();Se();ue();ot()});var ki,QE=y(()=>{Nt();ze();nt();Bt();le();rl();Ko();K();Gp();$e();zo();Ut();_c();ue();ot();KE();Ve();Se();ki=class extends D{constructor(e){super();this.logService=e;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new P);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new P);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new P);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new P);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new P);this._onDidUncorrelatedFilesChange=this._register(new P);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new P);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new Rc)}registerProvider(e,n){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);At(`code/registerFilesystem/${e}`);let r=new se;return this.provider.set(e,n),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:n}),r.add(n.onDidChangeFile(i=>{let s=new Mh(i,!this.isPathCaseSensitive(n));this.internalOnDidFilesChange.fire(s),s.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(s)})),typeof n.onDidWatchError=="function"&&r.add(n.onDidWatchError(i=>this._onDidWatchError.fire(new Error(i)))),r.add(n.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:n,scheme:e}))),ie(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:n}),this.provider.delete(e),Jt(r)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){let n=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(r){n.push(r)}}),!this.provider.has(e)&&await rn.settled(n)}async canHandleResource(e){return await this.activateProvider(e.scheme),this.hasProvider(e)}hasProvider(e){return this.provider.has(e.scheme)}hasCapability(e,n){let r=this.provider.get(e.scheme);return!!(r&&r.capabilities&n)}listCapabilities(){return fn.map(this.provider,([e,n])=>({scheme:e,capabilities:n.capabilities}))}async withProvider(e){if(!B1(e))throw new hn(d(2141,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let n=this.provider.get(e.scheme);if(!n){let r=new pr;throw r.message=d(2143,null,e.toString()),r}return n}async withReadProvider(e){let n=await this.withProvider(e);if(ss(n)||go(n)||Oh(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(e){let n=await this.withProvider(e);if(ss(n)||go(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(e,n){try{return await this.doResolveFile(e,n)}catch(r){throw qp(r)==="EntryNotFound"?new hn(d(2138,null,this.resourceForError(e)),1):as(r)}}async doResolveFile(e,n){let r=await this.withProvider(e),i=this.isPathCaseSensitive(r),s=n?.resolveTo,a=n?.resolveSingleChildDescendants,l=n?.resolveMetadata,c=await r.stat(e),u;return this.toFileStat(r,e,c,void 0,!!l,(p,m)=>(u||(u=Xo.forUris(()=>!i),u.set(e,!0),s&&u.fill(!0,s)),u.get(p.resource)||u.findSuperstr(p.resource.with({query:null,fragment:null}))?!0:p.isDirectory&&a?m===1:!1))}async toFileStat(e,n,r,i,s,a){let{providerExtUri:l}=this.getExtUri(e),c={resource:n,name:l.basename(n),isFile:(r.type&1)!==0,isDirectory:(r.type&2)!==0,isSymbolicLink:(r.type&64)!==0,mtime:r.mtime,ctime:r.ctime,size:r.size,readonly:!!((r.permissions??0)&1)||!!(e.capabilities&2048),locked:!!((r.permissions??0)&2),executable:!!((r.permissions??0)&4),etag:US({mtime:r.mtime,size:r.size}),children:void 0};if(c.isDirectory&&a(c,i)){try{let u=await e.readdir(n),p=await rn.settled(u.map(async([m,g])=>{try{let h=l.joinPath(n,m),v=s?await e.stat(h):{type:g};return await this.toFileStat(e,h,v,u.length,s,a)}catch(h){return this.logService.trace(h),null}}));c.children=Qn(p)}catch(u){this.logService.trace(u),c.children=[]}return c}return c}async resolveAll(e){return rn.settled(e.map(async n=>{try{return{stat:await this.doResolveFile(n.resource,n.options),success:!0}}catch(r){return this.logService.trace(r),{stat:void 0,success:!1}}}))}async stat(e){let n=await this.withProvider(e),r=await n.stat(e);return this.toFileStat(n,e,r,void 0,!0,()=>!1)}async realpath(e){let n=await this.withProvider(e);if(GD(n)){let r=await n.realpath(e);return e.with({path:r})}}async exists(e){let n=await this.withProvider(e);try{return!!await n.stat(e)}catch{return!1}}async canCreateFile(e,n){try{await this.doValidateCreateFile(e,n)}catch(r){return r}return!0}async doValidateCreateFile(e,n){if(!n?.overwrite&&await this.exists(e))throw new hn(d(2134,null,this.resourceForError(e)),3,n)}async createFile(e,n=A.fromString(""),r){await this.doValidateCreateFile(e,r);let i=await this.writeFile(e,n);return this._onDidRunOperation.fire(new is(e,0,i)),i}async writeFile(e,n,r){let i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:s}=this.getExtUri(i),a=r;if(AS(i)&&!a?.atomic){let l=i.enforceAtomicWriteFile?.(e);l&&(a={...r,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(i,e,n,a);l||await this.mkdirp(i,s.dirname(e)),c||(c=await this.peekBufferForWriting(i,n)),!ss(i)||go(i)&&c instanceof A||go(i)&&AS(i)&&a?.atomic?await this.doWriteUnbuffered(i,e,a,c):await this.doWriteBuffered(i,e,a,c instanceof A?dD(c):c),this._onDidRunOperation.fire(new is(e,4))}catch(l){throw new hn(d(2133,null,this.resourceForError(e),as(l).toString()),Rt(l),a)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,n){let r;if(go(e)&&!(n instanceof A))if(Dp(n)){let i=await iD(n,3);i.ended?r=A.concat(i.buffer):r=i}else r=oD(n,i=>A.concat(i),3);else r=n;return r}async validateWriteFile(e,n,r,i){let s=!!i?.unlock;if(s&&!(e.capabilities&8192))throw new Error(d(2151,null,this.resourceForError(n)));if(i?.append&&!$D(e))throw new hn(d(2130,null,this.resourceForError(n)),6);if(!!i?.atomic){if(!(e.capabilities&32768))throw new Error(d(2149,null,this.resourceForError(n)));if(!(e.capabilities&2))throw new Error(d(2150,null,this.resourceForError(n)));if(s)throw new Error(d(2148,null,this.resourceForError(n)))}let l;try{l=await e.stat(n)}catch{return Object.create(null)}if((l.type&2)!==0)throw new hn(d(2136,null,this.resourceForError(n)),0,i);this.throwIfFileIsReadonly(n,l);let c;if(typeof i?.mtime=="number"&&typeof i.etag=="string"&&i.etag!==Nh&&typeof l.mtime=="number"&&typeof l.size=="number"&&i.mtime{this.writeQueue.queueFor(n,async()=>{try{let l=await this.doReadFile(e,n,r,i);s(l)}catch(l){a(l)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,n,r,i){let s=await this.doReadFileStream(e,n,{...r,preferUnbuffered:!0},i);return{...s,value:await Hr(s.value)}}async readFileStream(e,n,r){let i=await this.withReadProvider(e);return this.doReadFileStream(i,e,n,r)}async doReadFileStream(e,n,r,i){let s=new ht(i),a=r;Ah(e)&&e.enforceAtomicReadFile?.(n)&&(a={...r,atomic:!0});let l=this.validateReadFile(n,a).then(u=>u,u=>{throw s.dispose(!0),u}),c;try{return typeof a?.etag=="string"&&a.etag!==Nh&&await l,a?.atomic&&Ah(e)||!(ss(e)||Oh(e))||go(e)&&a?.preferUnbuffered?c=this.readFileUnbuffered(e,n,a):Oh(e)?c=this.readFileStreamed(e,n,s.token,a):c=this.readFileBuffered(e,n,s.token,a),c.on("end",()=>s.dispose()),c.on("error",()=>s.dispose()),{...await l,value:c}}catch(u){throw c&&await mh(c),this.restoreReadError(u,n,a)}}restoreReadError(e,n,r){let i=d(2131,null,this.resourceForError(n),as(e).toString());return e instanceof zc?new zc(i,e.stat,r):e instanceof $c?new $c(i,e.fileOperationResult,e.size,e.options):new hn(i,Rt(e),r)}readFileStreamed(e,n,r,i=Object.create(null)){let s=e.readFileStream(n,i,r);return fh(s,{data:a=>a instanceof A?a:A.wrap(a),error:a=>this.restoreReadError(a,n,i)},a=>A.concat(a))}readFileBuffered(e,n,r,i=Object.create(null)){let s=mD();return Nv(e,n,s,a=>a,{...i,bufferSize:this.BUFFER_SIZE,errorTransformer:a=>this.restoreReadError(a,n,i)},r),s}readFileUnbuffered(e,n,r){let i=Hs(s=>A.concat(s));return(async()=>{try{let s;r?.atomic&&Ah(e)?s=await e.readFile(n,{atomic:!0}):s=await e.readFile(n),typeof r?.position=="number"&&(s=s.slice(r.position)),typeof r?.length=="number"&&(s=s.slice(0,r.length)),this.validateReadFileLimits(n,s.byteLength,r),i.end(A.wrap(s))}catch(s){i.error(s),i.end()}})(),i}async validateReadFile(e,n){let r=await this.resolve(e,{resolveMetadata:!0});if(r.isDirectory)throw new hn(d(2135,null,this.resourceForError(e)),0,n);if(typeof n?.etag=="string"&&n.etag!==Nh&&n.etag===r.etag)throw new zc(d(2139,null),r,n);return this.validateReadFileLimits(e,r.size,n),r}validateReadFileLimits(e,n,r){if(typeof r?.limits?.size=="number"&&n>r.limits.size)throw new $c(d(2140,null,this.resourceForError(e)),7,n,r)}async canMove(e,n,r){return this.doCanMoveCopy(e,n,"move",r)}async canCopy(e,n,r){return this.doCanMoveCopy(e,n,"copy",r)}async doCanMoveCopy(e,n,r,i){if(e.toString()!==n.toString())try{let s=r==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),a=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);await this.doValidateMoveCopy(s,e,a,n,r,i)}catch(s){return s}return!0}async move(e,n,r){let i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(i,e,s,n,"move",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new is(e,a==="move"?2:3,l)),l}async copy(e,n,r){let i=await this.withReadProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(i,e,s,n,"copy",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new is(e,a==="copy"?3:2,l)),l}async doMoveCopy(e,n,r,i,s,a){if(n.toString()===i.toString())return s;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(e,n,r,i,s,a);if(l&&!c&&a&&await this.del(i,{recursive:!0}),await this.mkdirp(r,this.getExtUri(r).providerExtUri.dirname(i)),s==="copy"){if(e===r&&OS(e))await e.copy(n,i,{overwrite:a});else{let u=await this.resolve(n);u.isDirectory?await this.doCopyFolder(e,u,r,i):await this.doCopyFile(e,n,r,i)}return s}else return e===r?(await e.rename(n,i,{overwrite:a}),s):(await this.doMoveCopy(e,n,r,i,"copy",a),await this.del(n,{recursive:!0}),"copy")}async doCopyFile(e,n,r,i){if(ss(e)&&ss(r))return this.doPipeBuffered(e,n,r,i);if(ss(e)&&go(r))return this.doPipeBufferedToUnbuffered(e,n,r,i);if(go(e)&&ss(r))return this.doPipeUnbufferedToBuffered(e,n,r,i);if(go(e)&&go(r))return this.doPipeUnbuffered(e,n,r,i)}async doCopyFolder(e,n,r,i){await r.mkdir(i),Array.isArray(n.children)&&await rn.settled(n.children.map(async s=>{let a=this.getExtUri(r).providerExtUri.joinPath(i,s.name);return s.isDirectory?this.doCopyFolder(e,await this.resolve(s.resource),r,a):this.doCopyFile(e,s.resource,r,a)}))}async doValidateMoveCopy(e,n,r,i,s,a){let l=!1;if(e===r){let{providerExtUri:u,isPathCaseSensitive:p}=this.getExtUri(e);if(p||(l=u.isEqual(n,i)),l&&s==="copy")throw new Error(d(2144,null,this.resourceForError(n),this.resourceForError(i)));if(!l&&u.isEqualOrParent(i,n))throw new Error(d(2145,null,this.resourceForError(n),this.resourceForError(i)))}let c=await this.exists(i);if(c&&!l){if(!a)throw new hn(d(2146,null,this.resourceForError(n),this.resourceForError(i)),4);if(e===r){let{providerExtUri:u}=this.getExtUri(e);if(u.isEqualOrParent(n,i))throw new Error(d(2147,null,this.resourceForError(n),this.resourceForError(i)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let n=this.isPathCaseSensitive(e);return{providerExtUri:n?tt:Jx,isPathCaseSensitive:n}}isPathCaseSensitive(e){return!!(e.capabilities&1024)}async createFolder(e){let n=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e);await this.mkdirp(n,e);let r=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new is(e,0,r)),r}async mkdirp(e,n){let r=[],{providerExtUri:i}=this.getExtUri(e);for(;!i.isEqual(n,i.dirname(n));)try{if(((await e.stat(n)).type&2)===0)throw new Error(d(2142,null,this.resourceForError(n)));break}catch(s){if(qp(s)!=="EntryNotFound")throw s;r.push(i.basename(n)),n=i.dirname(n)}for(let s=r.length-1;s>=0;s--){n=i.joinPath(n,r[s]);try{await e.mkdir(n)}catch(a){if(qp(a)!=="EntryExists")throw a}}}async canDelete(e,n){try{await this.doValidateDelete(e,n)}catch(r){return r}return!0}async doValidateDelete(e,n){let r=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),i=!!n?.useTrash;if(i&&!(r.capabilities&4096))throw new Error(d(2129,null,this.resourceForError(e)));let s=n?.atomic;if(s&&!(r.capabilities&65536))throw new Error(d(2125,null,this.resourceForError(e)));if(i&&s)throw new Error(d(2128,null,this.resourceForError(e)));let a;try{a=await r.stat(e)}catch{}if(a)this.throwIfFileIsReadonly(e,a);else throw new hn(d(2127,null,this.resourceForError(e)),1);if(!!!n?.recursive){let c=await this.resolve(e);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(d(2126,null,this.resourceForError(e)))}return r}async del(e,n){let r=await this.doValidateDelete(e,n),i=n;if(qD(r)&&!i?.atomic){let c=r.enforceAtomicDelete?.(e);c&&(i={...n,atomic:c})}let s=!!i?.useTrash,a=!!i?.recursive,l=i?.atomic??!1;await r.delete(e,{recursive:a,useTrash:s,atomic:l}),this._onDidRunOperation.fire(new is(e,1))}async cloneFile(e,n){let r=await this.withProvider(e),i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);if(!(r===i&&this.getExtUri(r).providerExtUri.isEqual(e,n)))return r===i&&zD(r)?r.cloneFile(e,n):(await this.mkdirp(i,this.getExtUri(i).providerExtUri.dirname(n)),r===i&&OS(r)?this.writeQueue.queueFor(e,()=>r.copy(e,n,{overwrite:!0}),this.getExtUri(r).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(r,e,i,n),this.getExtUri(r).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,n){return this.watch(e,{...n,correlationId:ki.WATCHER_CORRELATION_IDS++})}watch(e,n={recursive:!1,excludes:[]}){let r=new se,i=!1,s=()=>{i=!0};r.add(ie(()=>s())),(async()=>{try{let l=await this.doWatch(e,n);i?Jt(l):s=()=>Jt(l)}catch(l){this.logService.error(l)}})();let a=n.correlationId;if(typeof a=="number"){let l=r.add(new P);return r.add(this.internalOnDidFilesChange.event(u=>{u.correlates(a)&&l.fire(u)})),{onDidChange:l.event,dispose:()=>r.dispose()}}return r}async doWatch(e,n){let r=await this.withProvider(e),i=po([this.getExtUri(r).providerExtUri.getComparisonKey(e),n]),s=this.activeWatchers.get(i);return s||(s={count:0,disposable:r.watch(e,n)},this.activeWatchers.set(i,s)),s.count+=1,ie(()=>{s&&(s.count--,s.count===0&&(Jt(s.disposable),this.activeWatchers.delete(i)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)Jt(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,n,r,i){return this.writeQueue.queueFor(n,async()=>{let s=await e.open(n,{create:!0,unlock:r?.unlock??!1,append:r?.append??!1});try{Dp(i)||ph(i)?await this.doWriteStreamBufferedQueued(e,s,i):await this.doWriteReadableBufferedQueued(e,s,i)}catch(a){throw as(a)}finally{await e.close(s)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,n,r){let i=0,s;if(ph(r)){if(r.buffer.length>0){let a=A.concat(r.buffer);await this.doWriteBuffer(e,n,a,a.byteLength,i,0),i+=a.byteLength}if(r.ended)return;s=r.stream}else s=r;return new Promise((a,l)=>{Dc(s,{onData:async c=>{s.pause();try{await this.doWriteBuffer(e,n,c,c.byteLength,i,0)}catch(u){return l(u)}i+=c.byteLength,setTimeout(()=>s.resume())},onError:c=>l(c),onEnd:()=>a()})})}async doWriteReadableBufferedQueued(e,n,r){let i=0,s;for(;(s=r.read())!==null;)await this.doWriteBuffer(e,n,s,s.byteLength,i,0),i+=s.byteLength}async doWriteBuffer(e,n,r,i,s,a){let l=0;for(;lthis.doWriteUnbufferedQueued(e,n,r,i),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,n,r,i){let s;i instanceof A?s=i:Dp(i)?s=await Hr(i):ph(i)?s=await uD(i):s=cD(i),await e.writeFile(n,s.buffer,{create:!0,overwrite:!0,unlock:r?.unlock??!1,atomic:r?.atomic??!1,append:r?.append??!1})}async doPipeBuffered(e,n,r,i){return this.writeQueue.queueFor(i,()=>this.doPipeBufferedQueued(e,n,r,i),this.getExtUri(r).providerExtUri)}async doPipeBufferedQueued(e,n,r,i){let s,a;try{s=await e.open(n,{create:!1}),a=await r.open(i,{create:!0,unlock:!1});let l=A.alloc(this.BUFFER_SIZE),c=0,u=0,p=0;do p=await e.read(s,c,l.buffer,u,l.byteLength-u),await this.doWriteBuffer(r,a,l,p,c,u),c+=p,u+=p,u===l.byteLength&&(u=0);while(p>0)}catch(l){throw as(l)}finally{await rn.settled([typeof s=="number"?e.close(s):Promise.resolve(),typeof a=="number"?r.close(a):Promise.resolve()])}}async doPipeUnbuffered(e,n,r,i){return this.writeQueue.queueFor(i,()=>this.doPipeUnbufferedQueued(e,n,r,i),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedQueued(e,n,r,i){return r.writeFile(i,await e.readFile(n),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,n,r,i){return this.writeQueue.queueFor(i,()=>this.doPipeUnbufferedToBufferedQueued(e,n,r,i),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,n,r,i){let s=await r.open(i,{create:!0,unlock:!1});try{let a=await e.readFile(n);await this.doWriteBuffer(r,s,A.wrap(a),a.byteLength,0,0)}catch(a){throw as(a)}finally{await r.close(s)}}async doPipeBufferedToUnbuffered(e,n,r,i){let s=await Hr(this.readFileBuffered(e,n,Ee.None));await this.doWriteUnbuffered(r,i,void 0,s)}throwIfFileSystemIsReadonly(e,n){if(e.capabilities&2048)throw new hn(d(2132,null,this.resourceForError(n)),6);return e}throwIfFileIsReadonly(e,n){if((n.permissions??0)&1)throw new hn(d(2132,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===z.file?e.fsPath:e.toString(!0)}};ki=E([b(0,Q)],ki)});function oL(o,t){switch(o){case 0:return"";case 1:return`${Fv}*?`;default:return`(?:${Uv}|${Fv}+${Uv}${t?`|${Uv}${Fv}+`:""})*?`}}function iL(o,t){if(!o)return[];let e=[],n=!1,r=!1,i="";for(let s of o){switch(s){case t:if(!n&&!r){e.push(i),i="";continue}break;case"{":n=!0;break;case"}":n=!1;break;case"[":r=!0;break;case"]":r=!1;break}i+=s}return i&&e.push(i),e}function dL(o){if(!o)return"";let t="",e=iL(o,rL);if(e.every(n=>n===Cd))t=".*";else{let n=!1;e.forEach((r,i)=>{if(r===Cd){if(n)return;t+=oL(2,i===e.length-1)}else{let s=!1,a="",l=!1,c="";for(let u of r){if(u!=="}"&&s){a+=u;continue}if(l&&(u!=="]"||!c)){let p;u==="-"?p=u:(u==="^"||u==="!")&&!c?p="^":u===rL?p="":p=ao(u),c+=p;continue}switch(u){case"{":s=!0;continue;case"[":l=!0;continue;case"}":{let m=`(?:${iL(a,",").map(g=>dL(g)).join("|")})`;t+=m,s=!1,a="";break}case"]":{t+="["+c+"]",l=!1,c="";break}case"?":t+=Fv;continue;case"*":t+=oL(1);continue;default:t+=ao(u)}}il===c,endsWith:n?S1:(l,c)=>l.endsWith(c),isEqualOrParent:(l,c)=>Wr(l,c,t.ignoreCase??!Me)},i=`${n?e.toLowerCase():e}_${!!t.trimForExclusions}_${n}`,s=sL.get(i);if(s)return lL(s,o,r);let a;return w9.test(e)?s=_9(e.substring(4),e,r):(a=T9.exec(JE(e,r)))?s=L9(a[1],e,r):(t.trimForExclusions?R9:P9).test(e)?s=M9(e,r):(a=k9.exec(JE(e,r)))?s=cL(a[1].substring(1),e,!0,r):(a=D9.exec(JE(e,r)))?s=cL(a[1],e,!1,r):s=O9(e,r),sL.set(i,s),lL(s,o,r)}function lL(o,t,e){if(typeof t=="string")return o;let n=function(r,i){return e.isEqualOrParent(r,t.base)?o(Fx(r.substring(t.base.length),en),i):null};return n.allBasenames=o.allBasenames,n.allPaths=o.allPaths,n.basenames=o.basenames,n.patterns=o.patterns,n}function JE(o,t){return t.trimForExclusions&&o.endsWith("/**")?o.substring(0,o.length-2):o}function _9(o,t,e){return function(n,r){return typeof n=="string"&&e.endsWith(n,o)?t:null}}function L9(o,t,e){let n=`/${o}`,r=`\\${o}`,i=function(a,l){return typeof a!="string"?null:l?e.equals(l,o)?t:null:e.equals(a,o)||e.endsWith(a,n)||e.endsWith(a,r)?t:null},s=[o];return i.basenames=s,i.patterns=[t],i.allBasenames=s,i}function M9(o,t){let e=pL(o.slice(1,-1).split(",").map(a=>XE(a,t)).filter(a=>a!==Di),o),n=e.length;if(!n)return Di;if(n===1)return e[0];let r=function(a,l){for(let c=0,u=e.length;c!!a.allBasenames);i&&(r.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(r.allPaths=s),r}function cL(o,t,e,n){let r=en===He.sep,i=r?o:o.replace(C9,en),s=en+i,a=He.sep+o,l;return e?l=function(c,u){return typeof c=="string"&&(n.equals(c,i)||n.endsWith(c,s)||!r&&(n.equals(c,o)||n.endsWith(c,a)))?t:null}:l=function(c,u){return typeof c=="string"&&(n.equals(c,i)||!r&&n.equals(c,o))?t:null},l.allPaths=[(e?"*/":"./")+o],l}function O9(o,t){try{let e=new RegExp(`^${dL(o)}$`,t.ignoreCase?"i":void 0);return function(n){return e.lastIndex=0,typeof n=="string"&&e.test(n)?o:null}}catch{return Di}}function YE(o,t={}){if(!o)return aL;if(typeof o=="string"||uL(o)){let e=XE(o,t);if(e===Di)return aL;let n=function(r,i){return!!e(r,i)};return e.allBasenames&&(n.allBasenames=e.allBasenames),e.allPaths&&(n.allPaths=e.allPaths),n}return A9(o,t)}function uL(o){let t=o;return t?typeof t.base=="string"&&typeof t.pattern=="string":!1}function A9(o,t){let e=pL(Object.getOwnPropertyNames(o).map(a=>N9(a,o[a],t)).filter(a=>a!==Di)),n=e.length;if(!n)return Di;if(!e.some(a=>!!a.requiresSiblings)){if(n===1)return e[0];let a=function(u,p){let m;for(let g=0,h=e.length;g{for(let g of m){let h=await g;if(typeof h=="string")return h}return null})():null},l=e.find(u=>!!u.allBasenames);l&&(a.allBasenames=l.allBasenames);let c=e.reduce((u,p)=>p.allPaths?u.concat(p.allPaths):u,[]);return c.length&&(a.allPaths=c),a}let r=function(a,l,c){let u,p;for(let m=0,g=e.length;m{for(let m of p){let g=await m;if(typeof g=="string")return g}return null})():null},i=e.find(a=>!!a.allBasenames);i&&(r.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(r.allPaths=s),r}function N9(o,t,e){if(t===!1)return Di;let n=XE(o,e);if(n===Di)return Di;if(typeof t=="boolean")return n;if(t){let r=t.when;if(typeof r=="string"){let i=(s,a,l,c)=>{if(!c||!n(s,a))return null;let u=r.replace("$(basename)",()=>l),p=c(u);return wp(p)?p.then(m=>m?o:null):p?o:null};return i.requiresSiblings=!0,i}}return n}function pL(o,t){let e=o.filter(a=>!!a.basenames);if(e.length<2)return o;let n=e.reduce((a,l)=>{let c=l.basenames;return c?a.concat(c):a},[]),r;if(t){r=[];for(let a=0,l=n.length;a{let c=l.patterns;return c?a.concat(c):a},[]);let i=function(a,l){if(typeof a!="string")return null;if(!l){let u;for(u=a.length;u>0;u--){let p=a.charCodeAt(u-1);if(p===47||p===92)break}l=a.substring(u)}let c=n.indexOf(l);return c!==-1?r[c]:null};i.basenames=n,i.patterns=r,i.allBasenames=n;let s=o.filter(a=>!a.basenames);return s.push(i),s}function ZE(o,t){return mn(o,t,(e,n)=>typeof e=="string"&&typeof n=="string"?e===n:typeof e!="string"&&typeof n!="string"?e.base===n.base&&e.pattern===n.pattern:!1)}var Cd,rL,Uv,Fv,C9,w9,T9,P9,R9,k9,D9,sL,aL,Di,Vv=y(()=>{Nt();ze();Ro();bi();Hn();Oe();pe();Xt();Cd="**",rL="/",Uv="[/\\\\]",Fv="[^/\\\\]",C9=/\//g;w9=/^\*\*\/\*\.[\w\.-]+$/,T9=/^\*\*\/([\w\.-]+)\/?$/,P9=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,R9=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,k9=/^\*\*((\/[\w\.-]+)+)\/?$/,D9=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,sL=new hi(1e4),aL=function(){return!1},Di=function(){return null}});function $v(o){return typeof o.correlationId=="number"}function mL(o){return o.recursive===!0}function zv(o){return o.map(t=>({type:t.type,resource:x.revive(t.resource),cId:t.cId}))}function fL(o){let t=new eC;for(let e of o)t.processEvent(e);return t.coalesce()}function F9(o,t){return typeof t=="string"&&!t.startsWith(Cd)&&!ro(t)?{base:o,pattern:t}:t}function tC(o,t,e){let n=[];for(let r of t)n.push(YE(F9(o,r),{ignoreCase:e}));return n}function gL(o,t){if(typeof t=="number")switch(o.type){case 1:return(t&4)===0;case 2:return(t&8)===0;case 0:return(t&2)===0}return!1}function hL(o){if(typeof o=="number"){let t=[];return o&4&&t.push("Added"),o&8&&t.push("Deleted"),o&2&&t.push("Updated"),t.length===0?"":`[${t.join(", ")}]`}return""}var Wv,Bv,Hv,eC,Cl=y(()=>{Vv();K();Oe();pe();ce();ot();Wv=class o extends D{constructor(e,n,r,i){super();this.onFileChanges=e;this.onLogMessage=n;this.verboseLogging=r;this.options=i;this.watcherDisposables=this._register(new fr);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new se;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),e.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),e.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(e,n){this.canRestart(e,n)?this.restartCountern.type!==2?(t.push(n),!1):!0).sort((n,r)=>n.resource.fsPath.length-r.resource.fsPath.length).filter(n=>e.some(r=>KD(n.resource.fsPath,r,!Me))?!1:(e.push(n.resource.fsPath),!0)).concat(t)}}});var Gv,vL=y(()=>{Nt();ze();Se();le();bi();K();Oe();Cl();Ve();Gv=class extends D{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new P);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new P);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new Rr(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new Rr(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let r=this.toWatchRequest(e,n),i=Tx(this.universalWatchRequests,r);return this.refreshUniversalWatchers(),ie(()=>{i(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(mL(r)){let i=this.options?.watcher?.recursive?.usePolling;i===!0?r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(i)&&i.includes(r.path)&&(r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return r}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>Ke(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(zv(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},i=Tx(this.nonRecursiveWatchRequests,r);return this.refreshNonRecursiveWatchers(),ie(()=>{i(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>Ke(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(zv(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return In(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return P1(n)}}});var yL=y(()=>{Ae();K();Bt()});function je(o,t,e){let n=null,r=null;if(typeof e.value=="function"?(n="value",r=e.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(n="get",r=e.get),!r)throw new Error("not supported");let i=`$memoize$${t}`;e[n]=function(...s){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,s)}),this[i]}}var qv=y(()=>{yL()});function Pd(o){switch(o){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function Kv(o){switch(o){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function wd(o){let t=0;for(let e=0;;e+=7){let n=o.read(1);if(t|=(n.buffer[0]&127)<>>7)e++;let n=A.alloc(e);for(let r=0;t!==0;r++)n.buffer[r]=t&127,t=t>>>7,t>0&&(n.buffer[r]|=128);o.write(n)}function aa(o){let t=A.alloc(1);return t.writeUInt8(o,0),t}function Rm(o,t){if(typeof t>"u")o.write(wl.Undefined);else if(typeof t=="string"){let e=A.fromString(t);o.write(wl.String),Td(o,e.byteLength),o.write(e)}else if(A.isNativeBuffer(t)){let e=A.wrap(t);o.write(wl.Buffer),Td(o,e.byteLength),o.write(e)}else if(t instanceof A)o.write(wl.VSBuffer),Td(o,t.byteLength),o.write(t);else if(Array.isArray(t)){o.write(wl.Array),Td(o,t.length);for(let e of t)Rm(o,e)}else if(typeof t=="number"&&(t|0)===t)o.write(wl.Uint),Td(o,t);else{let e=A.fromString(JSON.stringify(t));o.write(wl.Object),Td(o,e.byteLength),o.write(e)}}function kd(o){switch(o.read(1).readUInt8(0)){case 0:return;case 1:return o.read(wd(o)).toString();case 2:return o.read(wd(o)).buffer;case 3:return o.read(wd(o));case 4:{let e=wd(o),n=[];for(let r=0;rr.call(t,e,n))},listen(t,e){let n=new vp;return o.then(r=>n.input=r.listen(t,e)),n.event}}}function IL(o){let t=!1;return{call(e,n,r){return t?o.call(e,n,r):uo(0).then(()=>t=!0).then(()=>o.call(e,n,r))},listen(e,n){if(t)return o.listen(e,n);let r=new vp;return uo(0).then(()=>t=!0).then(()=>r.input=o.listen(e,n)),r.event}}}var V9,Pm,jv,wl,Qv,Rd,km,Jv,ni,la=y(()=>{Nt();ze();nt();Bt();qv();Se();le();fp();K();rd();Xt();Ae();V9=aa(0);Pm=class{constructor(t){this.buffer=t;this.pos=0}read(t){let e=this.buffer.slice(this.pos,this.pos+t);return this.pos+=e.byteLength,e}},jv=class{constructor(){this.buffers=[]}get buffer(){return A.concat(this.buffers)}write(t){this.buffers.push(t)}};wl={Undefined:aa(0),String:aa(1),Buffer:aa(2),VSBuffer:aa(3),Array:aa(4),Object:aa(5),Uint:aa(6)};Qv=class{constructor(t,e,n=null,r=1e3){this.protocol=t;this.ctx=e;this.logger=n;this.timeoutDelay=r;this.channels=new Map;this.activeRequests=new Map;this.pendingRequests=new Map;this.protocolListener=this.protocol.onMessage(i=>this.onRawMessage(i)),this.sendResponse({type:200})}registerChannel(t,e){this.channels.set(t,e),setTimeout(()=>this.flushPendingRequests(t),0)}sendResponse(t){switch(t.type){case 200:{let e=this.send([t.type]);this.logger?.logOutgoing(e,0,1,Kv(t.type));return}case 201:case 202:case 204:case 203:{let e=this.send([t.type,t.id],t.data);this.logger?.logOutgoing(e,t.id,1,Kv(t.type),t.data);return}}}send(t,e=void 0){let n=new jv;return Rm(n,t),Rm(n,e),this.sendBuffer(n.buffer)}sendBuffer(t){try{return this.protocol.send(t),t.byteLength}catch{return 0}}onRawMessage(t){let e=new Pm(t),n=kd(e),r=kd(e),i=n[0];switch(i){case 100:return this.logger?.logIncoming(t.byteLength,n[1],1,`${Pd(i)}: ${n[2]}.${n[3]}`,r),this.onPromise({type:i,id:n[1],channelName:n[2],name:n[3],arg:r});case 102:return this.logger?.logIncoming(t.byteLength,n[1],1,`${Pd(i)}: ${n[2]}.${n[3]}`,r),this.onEventListen({type:i,id:n[1],channelName:n[2],name:n[3],arg:r});case 101:return this.logger?.logIncoming(t.byteLength,n[1],1,`${Pd(i)}`),this.disposeActiveRequest({type:i,id:n[1]});case 103:return this.logger?.logIncoming(t.byteLength,n[1],1,`${Pd(i)}`),this.disposeActiveRequest({type:i,id:n[1]})}}onPromise(t){let e=this.channels.get(t.channelName);if(!e){this.collectPendingRequest(t);return}let n=new ht,r;try{r=e.call(this.ctx,t.name,t.arg,n.token)}catch(a){r=Promise.reject(a)}let i=t.id;r.then(a=>{this.sendResponse({id:i,data:a,type:201})},a=>{a instanceof Error?this.sendResponse({id:i,data:{message:a.message,name:a.name,stack:a.stack?a.stack.split(` + `):void 0},type:202}):this.sendResponse({id:i,data:a,type:203})}).finally(()=>{s.dispose(),this.activeRequests.delete(t.id)});let s=ie(()=>n.cancel());this.activeRequests.set(t.id,s)}onEventListen(t){let e=this.channels.get(t.channelName);if(!e){this.collectPendingRequest(t);return}let n=t.id,i=e.listen(this.ctx,t.name,t.arg)(s=>this.sendResponse({id:n,data:s,type:204}));this.activeRequests.set(t.id,i)}disposeActiveRequest(t){let e=this.activeRequests.get(t.id);e&&(e.dispose(),this.activeRequests.delete(t.id))}collectPendingRequest(t){let e=this.pendingRequests.get(t.channelName);e||(e=[],this.pendingRequests.set(t.channelName,e));let n=setTimeout(()=>{console.error(`Unknown channel: ${t.channelName}`),t.type===100&&this.sendResponse({id:t.id,data:{name:"Unknown channel",message:`Channel name '${t.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);e.push({request:t,timeoutTimer:n})}flushPendingRequests(t){let e=this.pendingRequests.get(t);if(e){for(let n of e)switch(clearTimeout(n.timeoutTimer),n.request.type){case 100:this.onPromise(n.request);break;case 102:this.onEventListen(n.request);break}this.pendingRequests.delete(t)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Jt(this.activeRequests.values()),this.activeRequests.clear()}},Rd=class{constructor(t,e=null){this.protocol=t;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new P;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(n=>this.onBuffer(n)),this.logger=e}getChannel(t){let e=this;return{call(n,r,i){return e.isDisposed?Promise.reject(new et):e.requestPromise(t,n,r,i)},listen(n,r){return e.isDisposed?F.None:e.requestEvent(t,n,r)}}}requestPromise(t,e,n,r=Ee.None){let i=this.lastRequestId++,a={id:i,type:100,channelName:t,name:e,arg:n};if(r.isCancellationRequested)return Promise.reject(new et);let l,c;return new Promise((p,m)=>{if(r.isCancellationRequested)return m(new et);let g=()=>{let I=T=>{switch(T.type){case 201:this.handlers.delete(i),p(T.data);break;case 202:{this.handlers.delete(i);let C=new Error(T.data.message);C.stack=Array.isArray(T.data.stack)?T.data.stack.join(` + `):T.data.stack,C.name=T.data.name,m(C);break}case 203:this.handlers.delete(i),m(T.data);break}};this.handlers.set(i,I),this.sendRequest(a)},h=null;this.state===1?g():(h=kr(I=>this.whenInitialized()),h.then(()=>{h=null,g()}));let v=()=>{h?(h.cancel(),h=null):this.sendRequest({id:i,type:101}),m(new et)};l=r.onCancellationRequested(v),c={dispose:qa(()=>{v(),l.dispose()})},this.activeRequests.add(c)}).finally(()=>{l?.dispose(),this.activeRequests.delete(c)})}requestEvent(t,e,n){let r=this.lastRequestId++,s={id:r,type:102,channelName:t,name:e,arg:n},a=null,l=new P({onWillAddFirstListener:()=>{let u=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?u():(a=kr(p=>this.whenInitialized()),a.then(()=>{a=null,u()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:r,type:103})),this.handlers.delete(r)}}),c=u=>l.fire(u.data);return this.handlers.set(r,c),l.event}sendRequest(t){switch(t.type){case 100:case 102:{let e=this.send([t.type,t.id,t.channelName,t.name],t.arg);this.logger?.logOutgoing(e,t.id,0,`${Pd(t.type)}: ${t.channelName}.${t.name}`,t.arg);return}case 101:case 103:{let e=this.send([t.type,t.id]);this.logger?.logOutgoing(e,t.id,0,Pd(t.type));return}}}send(t,e=void 0){let n=new jv;return Rm(n,t),Rm(n,e),this.sendBuffer(n.buffer)}sendBuffer(t){try{return this.protocol.send(t),t.byteLength}catch{return 0}}onBuffer(t){let e=new Pm(t),n=kd(e),r=kd(e),i=n[0];switch(i){case 200:return this.logger?.logIncoming(t.byteLength,0,0,Kv(i)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(t.byteLength,n[1],0,Kv(i),r),this.onResponse({type:n[0],id:n[1],data:r})}}onResponse(t){if(t.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(t.id)?.(t)}get onDidInitializePromise(){return F.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Jt(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};E([je],Rd.prototype,"onDidInitializePromise",1);km=class{constructor(t,e,n){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new P;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new P;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new se;this.disposables.add(t(({protocol:r,onDidClientDisconnect:i})=>{let s=F.once(r.onMessage);this.disposables.add(s(a=>{let l=new Pm(a),c=kd(l),u=new Qv(r,c,e,n),p=new Rd(r,e);this.channels.forEach((g,h)=>u.registerChannel(h,g));let m={channelServer:u,channelClient:p,ctx:c};this._connections.add(m),this._onDidAddConnection.fire(m),this.disposables.add(i(()=>{u.dispose(),p.dispose(),this._connections.delete(m),this._onDidRemoveConnection.fire(m)}))}))}))}get connections(){let t=[];return this._connections.forEach(e=>t.push(e)),t}getChannel(t,e){let n=this;return{call(r,i,s){let a;if(hc(e)){let c=Xk(n.connections.filter(e));a=c?Promise.resolve(c):F.toPromise(F.filter(n.onDidAddConnection,e))}else a=e.routeCall(n,r,i);let l=a.then(c=>c.channelClient.getChannel(t));return bL(l).call(r,i,s)},listen(r,i){if(hc(e))return n.getMulticastEvent(t,e,r,i);let s=e.routeEvent(n,r,i).then(a=>a.channelClient.getChannel(t));return bL(s).listen(r,i)}}}getMulticastEvent(t,e,n,r){let i=this,s,a=new P({onWillAddFirstListener:()=>{s=new se;let l=new Jg,c=new Map,u=m=>{let h=m.channelClient.getChannel(t).listen(n,r),v=l.add(h);c.set(m,v)},p=m=>{let g=c.get(m);g&&(g.dispose(),c.delete(m))};i.connections.filter(e).forEach(u),F.filter(i.onDidAddConnection,e)(u,void 0,s),i.onDidRemoveConnection(p,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return i.disposables.add(a),a.event}registerChannel(t,e){this.channels.set(t,e);for(let n of this._connections)n.channelServer.registerChannel(t,e)}dispose(){this.disposables.dispose();for(let t of this._connections)t.channelClient.dispose(),t.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}};Jv=class{constructor(t){this.fn=t}routeCall(t){return this.route(t)}routeEvent(t){return this.route(t)}async route(t){for(let e of t.connections)if(await Promise.resolve(this.fn(e.ctx)))return Promise.resolve(e);return await F.toPromise(t.onDidAddConnection),await this.route(t)}};(r=>{function o(i,s,a){let l=i,c=a?.disableMarshalling,u=new Map;for(let p in l)e(p)&&u.set(p,F.buffer(l[p],p,!0,void 0,s));return new class{listen(p,m,g){let h=u.get(m);if(h)return h;let v=l[m];if(typeof v=="function"){if(n(m))return v.call(l,g);if(e(m))return u.set(m,F.buffer(l[m],m,!0,void 0,s)),u.get(m)}throw new pr(`Event not found: ${m}`)}call(p,m,g){let h=l[m];if(typeof h=="function"){if(!c&&Array.isArray(g))for(let I=0;I{ce()});import{fork as H9}from"child_process";var ca,Xv=y(()=>{ze();nt();Bt();EL();Se();le();K();on();em();Yp();la();ca=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new P;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new Sp(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,r,i){return e.requestPromise(t,n,r,i)},listen(n,r){return e.requestEvent(t,n,r)}}}requestPromise(t,e,n,r=Ee.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(r.isCancellationRequested)return Promise.reject(mp());this.disposeDelayer.cancel();let i=this.getCachedChannel(t),s=kr(c=>i.call(e,n,c)),a=r.onCancellationRequested(()=>s.cancel()),l=ie(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(t,e,n){if(!this.disposeDelayer)return F.None;this.disposeDelayer.cancel();let r,i=new P({onWillAddFirstListener:()=>{r=this.getCachedChannel(t).listen(e,n)(i.fire,i),this.activeRequests.add(r)},onDidRemoveLastListener:()=>{this.activeRequests.delete(r),r.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return i.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...fo(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(p=>!/^--inspect(-brk)?=/.test(p)).filter(p=>!p.startsWith("--vscode-"))),Gh(e.env),this.child=H9(this.modulePath,t,e);let n=new P,i=F.fromNodeEventEmitter(this.child,"message",p=>p)(p=>{if(xL(p)){SL(p,`IPC Library: ${this.options.serverName}`);return}n.fire(A.wrap(Buffer.from(p,"base64")))}),s=this.options.useQueue?u0(this.child):this.child,a=p=>this.child?.connected&&s.send(p.buffer.toString("base64")),l=n.event,c={send:a,onMessage:l};this._client=new Rd(c);let u=()=>this.disposeClient();process.once("exit",u),this.child.on("error",p=>console.warn('IPC "'+this.options.serverName+'" errored with '+p)),this.child.on("exit",(p,m)=>{process.removeListener("exit",u),i.dispose(),this.activeRequests.forEach(g=>Jt(g)),this.activeRequests.clear(),p!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+p+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:p,signal:m})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}}});var Yv,CL=y(()=>{$e();la();Xv();Cl();Yv=class extends Hv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new ca(bt.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:r})=>this.onError(`terminated by itself with code ${n}, signal: ${r} (ETERM)`))),ni.toService(IL(e.getChannel("watcher")))}}});import{watchFile as $9,unwatchFile as z9}from"fs";var Zv,wL=y(()=>{K();Cl();le();ot();ce();ze();rl();Se();Zv=class extends D{constructor(){super();this._onDidChangeFile=this._register(new P);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new P);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new P);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Fr);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Rr(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Br;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return $v(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:po(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Br;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[r,i]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(r)||n.push(i);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(r=>Ke(r))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new se;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let r=this.recursiveWatcher?.subscribe(e.path,(i,s)=>{n.isDisposed||(i?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return r?(n.add(r),!0):!1}doMonitorWithNodeJS(e,n){let r=!1,i=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),c=this.isPathNotFound(a),u=r;r=l,!l&&(c||u)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{$9(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},i)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(ie(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{z9(e.path,i)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:x.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let r=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(r,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${hL(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}}});import{watch as G9,promises as q9}from"fs";var ey,TL=y(()=>{ze();Bt();bi();K();lh();Oe();pe();Ut();ce();gr();ot();Cl();Ji();ey=class o extends D{constructor(e,n,r,i,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=r;this.onDidWatchFail=i;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new kc({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new sh(e=>this.handleFileChanges(e),o.FILE_CHANGES_HANDLER_DELAY));this.cts=new ht;this.realPath=new gn(async()=>{let e=this.request.path;try{e=await Te.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Me;this.excludes=tC(this.request.path,this.request.excludes,l),this.includes=this.request.includes?tC(this.request.path,this.request.includes,l):void 0,this.filter=$v(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await q9.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new se;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let r=x.file(this.request.path),i=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await l1(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:a.type,cId:this.request.correlationId},!0))});return i?(n.add(i),!0):!1}async doWatchWithNodeJS(e,n){let r=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(it&&Wr(r,"/Volumes/",!0)){this.error(`Refusing to watch ${r} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let i=new ht(this.cts.token);n.add(ie(()=>i.dispose(!0)));let s=new se;n.add(s);try{let a=x.file(this.request.path),l=dt(r),c=G9(r);s.add(ie(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${r}'`);let u=new Set;if(e)try{for(let m of await Te.readdir(r))u.add(m)}catch(m){this.error(m)}if(i.token.isCancellationRequested)return;let p=new Map;s.add(ie(()=>{for(let[,m]of p)m.dispose();p.clear()})),c.on("error",(m,g)=>{i.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${m}, ${g})`),this.notifyWatchFailed())}),c.on("change",(m,g)=>{if(i.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${m}"] ${g}`);let h="";if(g&&(h=g.toString(),it&&(h=Tp(h))),!(!h||m!=="change"&&m!=="rename"))if(e)if(m==="rename"){p.get(h)?.dispose();let v=setTimeout(async()=>{if(p.delete(h),Cc(h,l,!Me)&&!await Te.exists(r)){this.onWatchedPathDeleted(a);return}if(i.token.isCancellationRequested)return;let I=await this.existsChildStrictCase(H(r,h));if(i.token.isCancellationRequested)return;let T;I?u.has(h)?T=0:(T=1,u.add(h)):(u.delete(h),T=2),this.onFileChange({resource:ve(a,h),type:T,cId:this.request.correlationId})},o.FILE_DELETE_HANDLER_DELAY);p.set(h,ie(()=>clearTimeout(v)))}else{let v;u.has(h)?v=0:(v=1,u.add(h)),this.onFileChange({resource:ve(a,h),type:v,cId:this.request.correlationId})}else if(m==="rename"||!Cc(h,l,!Me)){let v=setTimeout(async()=>{let I=await Te.exists(r);i.token.isCancellationRequested||(I?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},o.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(ie(()=>clearTimeout(v)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(i.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=fL(e),r=[];for(let s of n){if(gL(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}r.push(s)}if(r.length===0)return;if(this.verboseLogging)for(let s of r)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(r)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${r.length}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Me)return Te.exists(e);try{let n=dt(e);return(await Te.readdir(Tt(e))).some(i=>i===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}}});var ty,PL=y(()=>{le();Vv();wL();pe();TL();ze();K();ty=class extends Zv{constructor(e){super();this.recursiveWatcher=e;this.onDidError=F.None;this._watchers=new Map;this.worker=this._register(new fr)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],r=new Set(Array.from(this.watchers));for(let i of e){let s=this._watchers.get(this.requestToWatcherKey(i));s&&ZE(s.request.excludes,i.excludes)&&ZE(s.request.includes,i.includes)?r.delete(s):n.push(i)}n.length&&this.trace(`Request to start watching: ${n.map(i=>this.requestToString(i)).join(",")}`),r.size&&this.trace(`Request to stop watching: ${Array.from(r).map(i=>this.requestToString(i.request)).join(",")}`),this.worker.clear();for(let i of r)this.stopWatching(i);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new kc({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Me?e:e.toLowerCase()}startWatching(e){let n=new ey(e,this.recursiveWatcher,i=>this._onDidChangeFile.fire(i),()=>this._onDidWatchFail.fire(e),i=>this._onDidLogMessage.fire(i),this.verboseLogging),r={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),r)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let r of e){let i=n.get(r.correlationId);i||(i=new Map,n.set(r.correlationId,i));let s=this.pathToWatcherKey(r.path);i.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(r)}`),i.set(s,r)}return Array.from(n.values()).flatMap(r=>Array.from(r.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}}});var ny,RL=y(()=>{Cl();PL();ny=class extends Bv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new ty(void 0))}}});import{constants as nC,promises as Tl}from"fs";var _i,Dm=y(()=>{ze();Hn();nt();le();bi();K();Oe();pe();Ut();_c();gr();ue();ot();KE();vL();CL();RL();_i=class o extends Gv{constructor(){super(...arguments);this.onDidChangeCapabilities=F.None;this.resourceLocks=new ut(e=>tl.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Me&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:r}=await er.stat(this.toFilePath(e)),i;return(n.mode&128)===0&&(i=2),(n.mode&nC.S_IXUSR||n.mode&nC.S_IXGRP||n.mode&nC.S_IXOTH)&&(i=(i??0)|4),{type:this.toType(n,r),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:i}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return Te.realpath(n)}async readdir(e){try{let n=await Te.readdir(this.toFilePath(e),{withFileTypes:!0}),r=[];return await Promise.all(n.map(async i=>{try{let s;i.isSymbolicLink()?s=(await this.stat(ve(e,i.name))).type:s=this.toType(i),r.push([i.name,s])}catch(s){this.logService.trace(s)}})),r}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let r;return n?.dangling?r=0:e.isFile()?r=1:e.isDirectory()?r=2:r=0,n&&(r|=64),r}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let r;for(;r=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await r.wait();let i=new lo;return this.resourceLocks.set(e,i),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),ie(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),i.open()})}async readFile(e,n){let r;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),r=await this.createResourceLock(e));let i=this.toFilePath(e);return await Tl.readFile(i)}catch(i){throw this.toFileSystemProviderError(i)}finally{r?.dispose()}}traceLock(e){o.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,r){let i=Hs(s=>A.concat(s.map(a=>A.wrap(a))).buffer);return Nv(this,e,i,s=>s.buffer,{...n,bufferSize:256*1024},r),i}async writeFile(e,n,r){return r?.atomic!==!1&&r?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,ve(rh(e),`${Zn(e)}${r.atomic.postfix}`),n,r):this.doWriteFile(e,n,r)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:r}=await er.stat(n);if(r)return!1}catch{}return!0}async doWriteFileAtomic(e,n,r,i){let s=new se;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,r,{...i,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,r,i){let s;try{let a=this.toFilePath(e);if(!r.create||!r.overwrite){if(await Te.exists(a)){if(!r.overwrite)throw Lo(d(2155,null),"EntryExists")}else if(!r.create)throw Lo(d(2158,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:r.append,unlock:r.unlock},i),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){o.canFlush=e}async open(e,n,r){let i=this.toFilePath(e),s;dl(n)&&!r&&(s=await this.createResourceLock(e));let a;try{if(dl(n)&&n.unlock)try{let{stat:l}=await er.stat(i);l.mode&128||await Tl.chmod(i,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(te&&dl(n)&&!n.append)try{a=await Te.open(i,"r+"),await Te.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await Te.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await Te.open(i,dl(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),dl(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),dl(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${i})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${i})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&o.canFlush)try{await Te.fdatasync(e)}catch(r){o.configureFlushOnWrite(!1),this.logService.error(r)}return await Te.close(e)}catch(r){throw this.toFileSystemProviderError(r)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.read(e,r,i,s,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,r){let i=this.mapHandleToPos.get(e);typeof i=="number"&&(typeof n=="number"||(typeof r=="number"?this.mapHandleToPos.set(e,i+r):this.mapHandleToPos.delete(e)))}async write(e,n,r,i,s){return q1(()=>this.doWrite(e,n,r,i,s),100,3)}async doWrite(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.write(e,r,i,s,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),c)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Tl.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let r=this.toFilePath(e);if(n.recursive){let i;n?.atomic!==!1&&n.atomic.postfix&&(i=H(Tt(r),`${dt(r)}${n.atomic.postfix}`)),await Te.rm(r,1,i)}else try{await Tl.unlink(r)}catch(i){if(i.code==="EPERM"||i.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await er.stat(r);s=a.isDirectory()&&!l}catch{}if(s)await Tl.rmdir(r);else throw i}else throw i}}catch(r){throw this.toFileSystemProviderError(r)}}async rename(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"move",r.overwrite),await Te.rename(i,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2159,null,dt(i),dt(Tt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"copy",r.overwrite),await Te.copy(i,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2153,null,dt(i),dt(Tt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,r,i){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=Cc(s,a,!0)),l){if(r==="copy")throw Lo(d(2154,null),"EntryExists");if(r==="move")return}let u=await this.statIgnoreError(e);if(!u)throw Lo(d(2157,null),"EntryNotFound");let p=await this.statIgnoreError(n);if(p){if(!i)throw Lo(d(2156,null),"EntryExists");(u.type&1)!==0&&(p.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(Cc(i,s,!a))return;let l=new se;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),r&&await Tl.mkdir(Tt(s),{recursive:!0}),await Tl.copyFile(i,s)}catch(c){if(c.code==="ENOENT"&&!r)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(e,n,r){return new Yv(i=>e(i),i=>n(i),r)}createNonRecursiveWatcher(e,n,r){return new ny(i=>e(i),i=>n(i),r)}toFileSystemProviderError(e){if(e instanceof Hc)return e;let n=e,r;switch(e.code){case"ENOENT":r="EntryNotFound";break;case"EISDIR":r="EntryIsADirectory";break;case"ENOTDIR":r="EntryNotADirectory";break;case"EEXIST":r="EntryExists";break;case"EPERM":case"EACCES":r="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,r="Unknown";break;default:r="Unknown"}return Lo(n,r)}async toFileSystemProviderWriteError(e,n){let r=this.toFileSystemProviderError(n);if(e&&r.code==="NoPermissions")try{let{stat:i}=await er.stat(this.toFilePath(e));i.mode&128||(r=Lo(n,"EntryWriteLocked"))}catch(i){this.logService.trace(i)}return r}}});function kL(o){return o.getFullYear()+"-"+String(o.getMonth()+1).padStart(2,"0")+"-"+String(o.getDate()).padStart(2,"0")+"T"+String(o.getHours()).padStart(2,"0")+":"+String(o.getMinutes()).padStart(2,"0")+":"+String(o.getSeconds()).padStart(2,"0")+"."+(o.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var K9,j9,rC,jde,Qde,Jde,DL=y(()=>{ue();Ji();pe();K9=60,j9=K9*60,rC=j9*24,jde=rC*7,Qde=rC*30,Jde=rC*365});function Q9(o,t){return ry(o["inspect-extensions"],o["inspect-brk-extensions"],5870,t,o.debugId,o.extensionEnvironment)}function ry(o,t,e,n,r,i){let a=Number(t||o)||(n?null:e),l=a?!!t:!1,c;if(i)try{c=JSON.parse(i)}catch{}return{port:a,break:l,debugId:r,env:c}}var _L,at,LL=y(()=>{DL();qv();$e();Oe();no();Ut();ce();_L=/^([^.]+\..+)[:=](.+)$/,at=class{constructor(t,e,n){this._args=t;this.paths=e;this.productService=n}get appRoot(){return Tt(bt.asFileUri("").fsPath)}get userHome(){return x.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return x.file(H(this.userDataPath,"User"))}get tmpDir(){return x.file(this.paths.tmpDir)}get cacheHome(){return x.file(this.userDataPath)}get stateResource(){return ve(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:z.vscodeUserData})}get userDataSyncHome(){return ve(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let t=kL(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=H(this.userDataPath,"logs",t)}return x.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return ve(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return ve(this.appSettingsHome,"History")}get keyboardLayoutResource(){return ve(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let t=$t.VSCODE_PORTABLE;return t?x.file(H(t,"argv.json")):ve(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return x.file(H(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let t=this.args["builtin-extensions-dir"];return t?Bn(t):In(H(bt.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let t=this.args["extensions-download-dir"];return t?x.file(Bn(t)):x.file(H(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let t=this.args["extensions-dir"];if(t)return Bn(t);let e=$t.VSCODE_EXTENSIONS;if(e)return e;let n=$t.VSCODE_PORTABLE;return n?H(n,"extensions"):ve(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let t=this.args["agent-plugins-dir"];if(t)return Bn(t);let e=$t.VSCODE_AGENT_PLUGINS;if(e)return e;let n=$t.VSCODE_PORTABLE;return n?H(n,"agent-plugins"):ve(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let t=this.args.extensionDevelopmentPath;if(Array.isArray(t))return t.map(e=>/^[^:/?#]+?:\/\//.test(e)?x.parse(e):x.file(In(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(t=>t==="ui"||t==="workspace"||t==="web"?t:"workspace")}get extensionTestsLocationURI(){let t=this.args.extensionTestsPath;if(t)return/^[^:/?#]+?:\/\//.test(t)?x.parse(t):x.file(In(t))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let t=this.args["disable-extension"];if(t){if(typeof t=="string")return[t];if(Array.isArray(t)&&t.length>0)return t}return!1}get skipBuiltinExtensions(){let t=$t.VSCODE_SKIP_BUILTIN_EXTENSIONS;return t?t.split(",").map(e=>e.trim()).filter(e=>e):[]}get debugExtensionHost(){return Q9(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!$t.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(t=>!_L.test(t))}get extensionLogLevel(){let t=[];for(let e of this.args.log||[]){let n=_L.exec(e);n?.[1]&&n[2]&&t.push([n[1],n[2]])}return t.length?t:void 0}get serviceMachineIdResource(){return ve(x.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let t=$t.VSCODE_PORTABLE;return t?x.file(H(t,"policy.json")):ve(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return ve(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(t){this.args.continueOn=t}get args(){return this._args}};E([je],at.prototype,"appRoot",1),E([je],at.prototype,"userHome",1),E([je],at.prototype,"userDataPath",1),E([je],at.prototype,"appSettingsHome",1),E([je],at.prototype,"tmpDir",1),E([je],at.prototype,"cacheHome",1),E([je],at.prototype,"stateResource",1),E([je],at.prototype,"userRoamingDataHome",1),E([je],at.prototype,"userDataSyncHome",1),E([je],at.prototype,"sync",1),E([je],at.prototype,"workspaceStorageHome",1),E([je],at.prototype,"localHistoryHome",1),E([je],at.prototype,"keyboardLayoutResource",1),E([je],at.prototype,"argvResource",1),E([je],at.prototype,"isExtensionDevelopment",1),E([je],at.prototype,"untitledWorkspacesHome",1),E([je],at.prototype,"builtinExtensionsPath",1),E([je],at.prototype,"extensionsDownloadLocation",1),E([je],at.prototype,"extensionsPath",1),E([je],at.prototype,"agentPluginsPath",1),E([je],at.prototype,"extensionDevelopmentLocationURI",1),E([je],at.prototype,"extensionDevelopmentKind",1),E([je],at.prototype,"extensionTestsLocationURI",1),E([je],at.prototype,"debugExtensionHost",1),E([je],at.prototype,"logLevel",1),E([je],at.prototype,"extensionLogLevel",1),E([je],at.prototype,"serviceMachineIdResource",1),E([je],at.prototype,"disableTelemetry",1),E([je],at.prototype,"disableExperiments",1),E([je],at.prototype,"disableWorkspaceTrust",1),E([je],at.prototype,"useInMemorySecretStorage",1),E([je],at.prototype,"policyFile",1),E([je],at.prototype,"agentSessionsWorkspace",1)});import{homedir as ML}from"os";import{resolve as J9,isAbsolute as X9,join as _d}from"path";function OL(o,t){let e=Z9(o,t),n=[e];return X9(e)||n.unshift(Y9),J9(...n)}function Z9(o,t){process.env.VSCODE_DEV&&(process.isEmbeddedApp?t="agents-oss-dev":t="code-oss-dev");let e=process.env.VSCODE_PORTABLE;if(e)return _d(e,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return _d(n,t);let r=o["user-data-dir"];if(r)return r;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let i=process.env.USERPROFILE;if(typeof i!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=_d(i,"AppData","Roaming")}break;case"darwin":n=_d(ML(),"Library","Application Support");break;case"linux":n=process.env.XDG_CONFIG_HOME||_d(ML(),".config");break;default:throw new Error("Platform not supported")}return _d(n,t)}var Y9,AL=y(()=>{Y9=process.env.VSCODE_CWD||process.cwd()});import{homedir as eW,tmpdir as tW}from"os";function NL(o,t){return ry(o["inspect-ptyhost"],o["inspect-brk-ptyhost"],5877,t,o.extensionEnvironment)}function UL(o,t){return ry(o["inspect-agenthost"],o["inspect-brk-agenthost"],5878,t,o.extensionEnvironment)}var oy,iy=y(()=>{LL();AL();oy=class extends at{constructor(t,e){super(t,{homeDir:eW(),tmpDir:tW(),userDataDir:OL(t,e.nameShort)},e)}}});function da(){return oC||(oC=A.alloc(0)),oC}function FL(o){switch(o){case 0:return"None";case 1:return"Regular";case 2:return"Control";case 3:return"Ack";case 5:return"Disconnect";case 6:return"ReplayRequest";case 7:return"PauseWriting";case 8:return"ResumeWriting";case 9:return"KeepAlive"}}var lC,oC,_m,No,sy,ay,Pl,iC,sC,aC,Lm,Rl=y(()=>{nt();le();K();la();(s=>{s.enableDiagnostics=!1,s.records=[];let e=new WeakMap,n=0;function r(a,l){if(!e.has(a)){let c=String(++n);e.set(a,c)}return e.get(a)}function i(a,l,c,u){}s.traceSocketEvent=i})(lC||={});oC=null;_m=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(t){this._chunks.push(t),this._totalLength+=t.byteLength}read(t){return this._read(t,!0)}peek(t){return this._read(t,!1)}_read(t,e){if(t===0)return da();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=t),s}if(this._chunks[0].byteLength>t){let s=this._chunks[0].slice(0,t);return e&&(this._chunks[0]=this._chunks[0].slice(t),this._totalLength-=t),s}let n=A.alloc(t),r=0,i=0;for(;t>0;){let s=this._chunks[i];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,r),r+=t,e&&(this._chunks[i]=s.slice(t),this._totalLength-=t),t-=t}else n.set(s,r),r+=s.byteLength,e?(this._chunks.shift(),this._totalLength-=s.byteLength):i++,t-=s.byteLength}return n}};No=class{constructor(t,e,n,r){this.type=t;this.id=e;this.ack=n;this.data=r;this.writtenTime=0}get size(){return this.data.byteLength}},sy=class extends D{constructor(e){super();this._onMessage=this._register(new P);this.onMessage=this._onMessage.event;this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0};this._socket=e,this._isDisposed=!1,this._incomingData=new _m,this._register(this._socket.onData(n=>this.acceptChunk(n))),this.lastReadTime=Date.now()}acceptChunk(e){if(!(!e||e.byteLength===0))for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){let n=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=n.readUInt32BE(9),this._state.messageType=n.readUInt8(0),this._state.id=n.readUInt32BE(1),this._state.ack=n.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:FL(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let r=this._state.messageType,i=this._state.id,s=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",n),this._onMessage.fire(new No(r,i,s,n)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},ay=class{constructor(t){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=t,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){try{this.flush()}catch{}this._isDisposed=!0}drain(){return this.flush(),this._socket.drain()}flush(){this._writeNow()}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this._scheduleWriting()}write(t){if(this._isDisposed)return;t.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=A.alloc(13);e.writeUInt8(t.type,0),e.writeUInt32BE(t.id,1),e.writeUInt32BE(t.ack,5),e.writeUInt32BE(t.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:FL(t.type),id:t.id,ack:t.ack,messageSize:t.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",t.data),this._writeSoon(e,t.data)}_bufferAdd(t,e){let n=this._totalLength===0;return this._data.push(t,e),this._totalLength+=t.byteLength+e.byteLength,n}_bufferTake(){let t=A.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,t}_writeSoon(t,e){this._bufferAdd(t,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let t=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:t.byteLength}),this._socket.write(t)}},Pl=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new P({onWillAddFirstListener:()=>{this._hasListeners=!0,queueMicrotask(()=>this._deliverMessages())},onDidRemoveLastListener:()=>{this._hasListeners=!1}}),this.event=this._emitter.event}_deliverMessages(){if(!this._isDeliveringMessages){for(this._isDeliveringMessages=!0;this._hasListeners&&this._bufferedMessages.length>0;)this._emitter.fire(this._bufferedMessages.shift());this._isDeliveringMessages=!1}}fire(t){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(t):this._emitter.fire(t):this._bufferedMessages.push(t)}flushBuffer(){this._bufferedMessages=[]}},iC=class{constructor(t){this.data=t,this.next=null}},sC=class{constructor(){this._first=null,this._last=null}length(){let t=0,e=this._first;for(;e;)e=e.next,t++;return t}peek(){return this._first?this._first.data:null}toArray(){let t=[],e=0,n=this._first;for(;n;)t[e++]=n.data,n=n.next;return t}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(t){let e=new iC(t);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},aC=class o{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return o._INSTANCE||(o._INSTANCE=new o),o._INSTANCE}constructor(){this.lastRuns=[];let t=Date.now();for(let e=0;e{for(let e=o._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let t=Date.now(),e=(1+o._HISTORY_LENGTH)*1e3,n=0;for(let r=0;r=.5}},Lm=class{constructor(t){this._onControlMessage=new Pl;this.onControlMessage=this._onControlMessage.event;this._onMessage=new Pl;this.onMessage=this._onMessage.event;this._onDidDispose=new Pl;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new Pl;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new Pl;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=t.loadEstimator??aC.getInstance(),this._shouldSendKeepAlive=t.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new sC,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socketDisposables=new se,this._socket=t.socket,this._socketWriter=this._socketDisposables.add(new ay(this._socket)),this._socketReader=this._socketDisposables.add(new sy(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),t.initialChunk&&this._socketReader.acceptChunk(t.initialChunk),this._shouldSendKeepAlive?this._keepAliveInterval=setInterval(()=>{this._sendKeepAlive()},5e3):this._keepAliveInterval=null}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._keepAliveInterval&&(clearInterval(this._keepAliveInterval),this._keepAliveInterval=null),this._socketDisposables.dispose()}drain(){return this._socketWriter.drain()}sendDisconnect(){if(!this._didSendDisconnect){this._didSendDisconnect=!0;let t=new No(5,0,0,da());this._socketWriter.write(t),this._socketWriter.flush()}}sendPause(){let t=new No(7,0,0,da());this._socketWriter.write(t)}sendResume(){let t=new No(8,0,0,da());this._socketWriter.write(t)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(t,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new se,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=t,this._socketWriter=this._socketDisposables.add(new ay(this._socket)),this._socketReader=this._socketDisposables.add(new sy(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(n=>this._receiveMessage(n))),this._socketDisposables.add(this._socket.onClose(n=>this._onSocketClose.fire(n))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let t=new No(3,0,this._incomingAckId,da());this._socketWriter.write(t);let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;nthis._outgoingAckId){this._outgoingAckId=t.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=t.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(t.type){case 0:break;case 1:{if(t.id>this._incomingMsgId)if(t.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new No(6,0,0,da())))}else this._incomingMsgId=t.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(t.data);break}case 2:{this._onControlMessage.fire(t.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;n=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-t+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let t=this._outgoingUnackMsg.peek(),e=Date.now()-t.writtenTime,n=Date.now()-this._socketReader.lastReadTime,r=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&n>=2e4&&r>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:n});return}let i=Math.max(2e4-e,2e4-n,2e4-r,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},i)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let t=new No(3,0,this._incomingAckId,da());this._socketWriter.write(t)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let t=new No(9,0,this._incomingAckId,da());this._socketWriter.write(t)}}});function nW(o,t){if(typeof o!="string"||o.trim().length===0)return console.log(`[reconnection-grace-time] No CLI argument provided, using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let e=Number(o);if(!isFinite(e)||e<0)return console.log(`[reconnection-grace-time] Invalid value '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let n=Math.floor(e*1e3);return!isFinite(n)||n>Number.MAX_SAFE_INTEGER?(console.log(`[reconnection-grace-time] Value too large '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t):(console.log(`[reconnection-grace-time] Parsed CLI argument: ${e}s -> ${n}ms`),n)}var dC,ua,Li,kl=y(()=>{ue();iy();tm();re();vn();qv();ce();Ut();Oe();Rl();dC={"disable-update-check":{type:"boolean"},auth:{type:"string"},"disable-file-downloads":{type:"boolean"},"disable-file-uploads":{type:"boolean"},"disable-getting-started-override":{type:"boolean"},locale:{type:"string"},"link-protection-trusted-domains":{type:"string[]"},host:{type:"string",cat:"o",args:"ip-address",description:d(2714,null)},port:{type:"string",cat:"o",args:"port | port range",description:d(2715,null)},"socket-path":{type:"string",cat:"o",args:"path",description:d(2719,null)},"server-base-path":{type:"string",cat:"o",args:"path",description:d(2717,null)},"connection-token":{type:"string",cat:"o",args:"token",deprecates:["connectionToken"],description:d(2710,null)},"connection-token-file":{type:"string",cat:"o",args:"path",deprecates:["connection-secret","connectionTokenFile"],description:d(2711,null)},"without-connection-token":{type:"boolean",cat:"o",description:d(2722,null)},"disable-websocket-compression":{type:"boolean"},"print-startup-performance":{type:"boolean"},"print-ip-address":{type:"boolean"},"accept-server-license-terms":{type:"boolean",cat:"o",description:d(2707,null)},"server-data-dir":{type:"string",cat:"o",description:d(2718,null)},"telemetry-level":{type:"string",cat:"o",args:"level",description:d(2721,null)},"user-data-dir":kt["user-data-dir"],"enable-smoke-test-driver":kt["enable-smoke-test-driver"],"disable-telemetry":kt["disable-telemetry"],"disable-experiments":kt["disable-experiments"],"disable-workspace-trust":kt["disable-workspace-trust"],"file-watcher-polling":{type:"string",deprecates:["fileWatcherPolling"]},log:kt.log,logsPath:kt.logsPath,"force-disable-user-env":kt["force-disable-user-env"],"enable-proposed-api":kt["enable-proposed-api"],folder:{type:"string",deprecationMessage:"No longer supported. Folder needs to be provided in the browser URL or with `default-folder`."},workspace:{type:"string",deprecationMessage:"No longer supported. Workspace needs to be provided in the browser URL or with `default-workspace`."},"default-folder":{type:"string",description:d(2712,null)},"default-workspace":{type:"string",description:d(2713,null)},"enable-sync":{type:"boolean"},"github-auth":{type:"string"},"use-test-resolver":{type:"boolean"},"extensions-dir":kt["extensions-dir"],"extensions-download-dir":kt["extensions-download-dir"],"builtin-extensions-dir":kt["builtin-extensions-dir"],"install-extension":kt["install-extension"],"install-builtin-extension":kt["install-builtin-extension"],"update-extensions":kt["update-extensions"],"uninstall-extension":kt["uninstall-extension"],"list-extensions":kt["list-extensions"],"locate-extension":kt["locate-extension"],"show-versions":kt["show-versions"],category:kt.category,force:kt.force,"do-not-sync":kt["do-not-sync"],"do-not-include-pack-dependencies":kt["do-not-include-pack-dependencies"],"pre-release":kt["pre-release"],"start-server":{type:"boolean",cat:"e",description:d(2720,null)},"enable-remote-auto-shutdown":{type:"boolean"},"remote-auto-shutdown-without-delay":{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"agent-host-port":{type:"string",cat:"o",args:"port",description:d(2709,null)},"agent-host-path":{type:"string",cat:"o",args:"path",description:d(2708,null)},"use-host-proxy":{type:"boolean"},"without-browser-env-var":{type:"boolean"},"reconnection-grace-time":{type:"string",cat:"o",args:"seconds",description:d(2716,null)},help:kt.help,version:kt.version,"locate-shell-integration-path":kt["locate-shell-integration-path"],compatibility:{type:"string"},_:kt._},ua=xt,Li=class extends oy{get userRoamingDataHome(){return this.appSettingsHome}get machineSettingsResource(){return ve(x.file(H(this.userDataPath,"Machine")),"settings.json")}get mcpResource(){return ve(x.file(H(this.userDataPath,"User")),"mcp.json")}get args(){return super.args}get reconnectionGraceTime(){return nW(this.args["reconnection-grace-time"],108e5)}};E([je],Li.prototype,"userRoamingDataHome",1),E([je],Li.prototype,"machineSettingsResource",1),E([je],Li.prototype,"mcpResource",1),E([je],Li.prototype,"reconnectionGraceTime",1)});var rW,VL,pa,uC=y(()=>{Bt();Se();$e();Ut();ta();ce();ue();or();Ao();_n();yn();rW=o=>d(2054,null,o),VL=d(2067,null,"ms-dotnettools.csharp"),pa=class{constructor(t,e,n,r,i){this.extensionsForceVersionByQuality=t;this.logger=e;this.extensionManagementService=n;this.extensionGalleryService=r;this.productService=i;this.extensionsForceVersionByQuality=this.extensionsForceVersionByQuality.map(s=>s.toLowerCase())}get location(){}async listExtensions(t,e,n){let r=await this.extensionManagementService.getInstalled(1,n),i=rv.map(a=>a.toLowerCase());if(e&&e!==""){if(i.indexOf(e.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}r=r.filter(a=>a.manifest.categories?a.manifest.categories.map(c=>c.toLowerCase()).indexOf(e.toLowerCase())>-1:!1)}else if(e===""){this.logger.info("Possible Categories: "),i.forEach(a=>{this.logger.info(a)});return}this.location&&this.logger.info(d(2053,null,this.location)),r=r.sort((a,l)=>a.identifier.id.localeCompare(l.identifier.id));let s;for(let a of r)s!==a.identifier.id&&(s=a.identifier.id,this.logger.info(t?`${s}@${a.manifest.version}`:s))}async installExtensions(t,e,n,r){let i=[];try{t.length&&this.logger.info(this.location?d(2052,null,this.location):d(2051,null));let s=[],a=[],l=(u,p,m)=>{this.extensionsForceVersionByQuality?.some(g=>g===u.toLowerCase())&&(p=this.productService.quality!=="stable"?"prerelease":void 0),a.push({id:u,version:p!=="prerelease"?p:void 0,installOptions:{...n,isBuiltin:m,installPreReleaseVersion:p==="prerelease"||n.installPreReleaseVersion}})};for(let u of t)if(u instanceof x)s.push({vsix:u,installOptions:n});else{let[p,m]=um(u);l(p,m,!1)}for(let u of e)if(u instanceof x)s.push({vsix:u,installOptions:{...n,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{let[p,m]=um(u);l(p,m,!0)}let c=await this.extensionManagementService.getInstalled(void 0,n.profileLocation);if(s.length&&await Promise.all(s.map(async({vsix:u,installOptions:p})=>{try{await this.installVSIX(u,p,r,c)}catch(m){this.logger.error(m),i.push(u.toString())}})),a.length){let u=await this.installGalleryExtensions(a,c,r);i.push(...u)}}catch(s){throw this.logger.error(d(2041,null,fe(s))),s}if(i.length)throw new Error(d(2046,null,i.join(", ")))}async updateExtensions(t){let e=await this.extensionManagementService.getInstalled(1,t),n=[];for(let a of e)a.identifier.uuid&&n.push({...a.identifier,preRelease:a.preRelease});this.logger.trace(d(2065,null,n.length));let r=await this.extensionGalleryService.getExtensions(n,{compatible:!0},Ee.None),i=[];for(let a of r)for(let l of e)Ce(l.identifier,a.identifier)&&Pi(a.version,l.manifest.version)&&i.push({extension:a,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:t,isApplicationScoped:l.isApplicationScoped}});if(!i.length){this.logger.info(d(2064,null));return}this.logger.info(d(2063,null,i.map(a=>a.extension.identifier.id).join(", ")));let s=await this.extensionManagementService.installGalleryExtensions(i);for(let a of s)a.error?this.logger.error(d(2043,null,a.identifier.id,fe(a.error))):this.logger.info(d(2060,null,a.identifier.id,a.local?.manifest.version))}async installGalleryExtensions(t,e,n){if(t=t.filter(a=>{let{id:l,version:c,installOptions:u}=a,p=e.find(m=>Ce(m.identifier,{id:l}));if(p){let m=this.validateBuiltinExtensionEnabledWithAutoUpdates(p);if(m)return this.logger.info(m),!1;if(!n&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(2037,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(2036,null,`${l}@${c}`)),!1;p.preRelease&&c!=="prerelease"&&(u.preRelease=!1)}return!0}),!t.length)return[];let r=[],i=[],s=await this.getGalleryExtensions(t);if(await Promise.all(t.map(async({id:a,version:l,installOptions:c})=>{let u=s.get(a.toLowerCase());if(!u){this.logger.error(`${rW(l?`${a}@${l}`:a)} ++`);return t===-1?o:o.substring(0,t)}function SL(o,t){let{args:e,stack:n}=W9(o),r=typeof e[0]=="string"&&e.length===1,i=B9(n);i&&(i=`(${i.trim()})`);let s=[];if(typeof e[0]=="string"?i&&r?s=[`%c[${t}] %c${e[0]} %c${i}`,Dd("blue"),Dd(""),Dd("grey")]:s=[`%c[${t}] %c${e[0]}`,Dd("blue"),Dd(""),...e.slice(1)]:s=[`%c[${t}]%`,Dd("blue"),...e],i&&!r&&s.push(i),typeof console[o.severity]!="function")throw new Error("Unknown console method");console[o.severity].apply(console,s)}function Dd(o){return`color: ${o}`}var EL=y(()=>{ce()});import{fork as H9}from"child_process";var ca,Xv=y(()=>{ze();nt();Bt();EL();Se();le();K();on();em();Yp();la();ca=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new P;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new Sp(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,r,i){return e.requestPromise(t,n,r,i)},listen(n,r){return e.requestEvent(t,n,r)}}}requestPromise(t,e,n,r=Ee.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(r.isCancellationRequested)return Promise.reject(mp());this.disposeDelayer.cancel();let i=this.getCachedChannel(t),s=kr(c=>i.call(e,n,c)),a=r.onCancellationRequested(()=>s.cancel()),l=ie(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(t,e,n){if(!this.disposeDelayer)return F.None;this.disposeDelayer.cancel();let r,i=new P({onWillAddFirstListener:()=>{r=this.getCachedChannel(t).listen(e,n)(i.fire,i),this.activeRequests.add(r)},onDidRemoveLastListener:()=>{this.activeRequests.delete(r),r.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return i.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...fo(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(p=>!/^--inspect(-brk)?=/.test(p)).filter(p=>!p.startsWith("--vscode-"))),Gh(e.env),this.child=H9(this.modulePath,t,e);let n=new P,i=F.fromNodeEventEmitter(this.child,"message",p=>p)(p=>{if(xL(p)){SL(p,`IPC Library: ${this.options.serverName}`);return}n.fire(A.wrap(Buffer.from(p,"base64")))}),s=this.options.useQueue?u0(this.child):this.child,a=p=>this.child?.connected&&s.send(p.buffer.toString("base64")),l=n.event,c={send:a,onMessage:l};this._client=new Rd(c);let u=()=>this.disposeClient();process.once("exit",u),this.child.on("error",p=>console.warn('IPC "'+this.options.serverName+'" errored with '+p)),this.child.on("exit",(p,m)=>{process.removeListener("exit",u),i.dispose(),this.activeRequests.forEach(g=>Jt(g)),this.activeRequests.clear(),p!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+p+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:p,signal:m})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}}});var Yv,CL=y(()=>{$e();la();Xv();Cl();Yv=class extends Hv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new ca(bt.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:r})=>this.onError(`terminated by itself with code ${n}, signal: ${r} (ETERM)`))),ni.toService(IL(e.getChannel("watcher")))}}});import{watchFile as $9,unwatchFile as z9}from"fs";var Zv,wL=y(()=>{K();Cl();le();ot();ce();ze();rl();Se();Zv=class extends D{constructor(){super();this._onDidChangeFile=this._register(new P);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new P);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new P);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Fr);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Rr(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Br;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return $v(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:po(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Br;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[r,i]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(r)||n.push(i);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(r=>Ke(r))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new se;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let r=this.recursiveWatcher?.subscribe(e.path,(i,s)=>{n.isDisposed||(i?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return r?(n.add(r),!0):!1}doMonitorWithNodeJS(e,n){let r=!1,i=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),c=this.isPathNotFound(a),u=r;r=l,!l&&(c||u)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{$9(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},i)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(ie(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{z9(e.path,i)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:x.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let r=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(r,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${hL(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}}});import{watch as G9,promises as q9}from"fs";var ey,TL=y(()=>{ze();Bt();bi();K();lh();Oe();pe();Ut();ce();gr();ot();Cl();Ji();ey=class o extends D{constructor(e,n,r,i,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=r;this.onDidWatchFail=i;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new kc({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new sh(e=>this.handleFileChanges(e),o.FILE_CHANGES_HANDLER_DELAY));this.cts=new ht;this.realPath=new gn(async()=>{let e=this.request.path;try{e=await Te.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Me;this.excludes=tC(this.request.path,this.request.excludes,l),this.includes=this.request.includes?tC(this.request.path,this.request.includes,l):void 0,this.filter=$v(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await q9.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new se;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let r=x.file(this.request.path),i=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await l1(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:a.type,cId:this.request.correlationId},!0))});return i?(n.add(i),!0):!1}async doWatchWithNodeJS(e,n){let r=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(it&&Wr(r,"/Volumes/",!0)){this.error(`Refusing to watch ${r} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let i=new ht(this.cts.token);n.add(ie(()=>i.dispose(!0)));let s=new se;n.add(s);try{let a=x.file(this.request.path),l=dt(r),c=G9(r);s.add(ie(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${r}'`);let u=new Set;if(e)try{for(let m of await Te.readdir(r))u.add(m)}catch(m){this.error(m)}if(i.token.isCancellationRequested)return;let p=new Map;s.add(ie(()=>{for(let[,m]of p)m.dispose();p.clear()})),c.on("error",(m,g)=>{i.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${m}, ${g})`),this.notifyWatchFailed())}),c.on("change",(m,g)=>{if(i.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${m}"] ${g}`);let h="";if(g&&(h=g.toString(),it&&(h=Tp(h))),!(!h||m!=="change"&&m!=="rename"))if(e)if(m==="rename"){p.get(h)?.dispose();let v=setTimeout(async()=>{if(p.delete(h),Cc(h,l,!Me)&&!await Te.exists(r)){this.onWatchedPathDeleted(a);return}if(i.token.isCancellationRequested)return;let I=await this.existsChildStrictCase(H(r,h));if(i.token.isCancellationRequested)return;let T;I?u.has(h)?T=0:(T=1,u.add(h)):(u.delete(h),T=2),this.onFileChange({resource:ve(a,h),type:T,cId:this.request.correlationId})},o.FILE_DELETE_HANDLER_DELAY);p.set(h,ie(()=>clearTimeout(v)))}else{let v;u.has(h)?v=0:(v=1,u.add(h)),this.onFileChange({resource:ve(a,h),type:v,cId:this.request.correlationId})}else if(m==="rename"||!Cc(h,l,!Me)){let v=setTimeout(async()=>{let I=await Te.exists(r);i.token.isCancellationRequested||(I?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},o.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(ie(()=>clearTimeout(v)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(i.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=fL(e),r=[];for(let s of n){if(gL(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}r.push(s)}if(r.length===0)return;if(this.verboseLogging)for(let s of r)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(r)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${r.length}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Me)return Te.exists(e);try{let n=dt(e);return(await Te.readdir(Tt(e))).some(i=>i===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}}});var ty,PL=y(()=>{le();Vv();wL();pe();TL();ze();K();ty=class extends Zv{constructor(e){super();this.recursiveWatcher=e;this.onDidError=F.None;this._watchers=new Map;this.worker=this._register(new fr)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],r=new Set(Array.from(this.watchers));for(let i of e){let s=this._watchers.get(this.requestToWatcherKey(i));s&&ZE(s.request.excludes,i.excludes)&&ZE(s.request.includes,i.includes)?r.delete(s):n.push(i)}n.length&&this.trace(`Request to start watching: ${n.map(i=>this.requestToString(i)).join(",")}`),r.size&&this.trace(`Request to stop watching: ${Array.from(r).map(i=>this.requestToString(i.request)).join(",")}`),this.worker.clear();for(let i of r)this.stopWatching(i);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new kc({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Me?e:e.toLowerCase()}startWatching(e){let n=new ey(e,this.recursiveWatcher,i=>this._onDidChangeFile.fire(i),()=>this._onDidWatchFail.fire(e),i=>this._onDidLogMessage.fire(i),this.verboseLogging),r={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),r)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let r of e){let i=n.get(r.correlationId);i||(i=new Map,n.set(r.correlationId,i));let s=this.pathToWatcherKey(r.path);i.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(r)}`),i.set(s,r)}return Array.from(n.values()).flatMap(r=>Array.from(r.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}}});var ny,RL=y(()=>{Cl();PL();ny=class extends Bv{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new ty(void 0))}}});import{constants as nC,promises as Tl}from"fs";var _i,Dm=y(()=>{ze();Hn();nt();le();bi();K();Oe();pe();Ut();_c();gr();ue();ot();KE();vL();CL();RL();_i=class o extends Gv{constructor(){super(...arguments);this.onDidChangeCapabilities=F.None;this.resourceLocks=new ut(e=>tl.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Me&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:r}=await er.stat(this.toFilePath(e)),i;return(n.mode&128)===0&&(i=2),(n.mode&nC.S_IXUSR||n.mode&nC.S_IXGRP||n.mode&nC.S_IXOTH)&&(i=(i??0)|4),{type:this.toType(n,r),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:i}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return Te.realpath(n)}async readdir(e){try{let n=await Te.readdir(this.toFilePath(e),{withFileTypes:!0}),r=[];return await Promise.all(n.map(async i=>{try{let s;i.isSymbolicLink()?s=(await this.stat(ve(e,i.name))).type:s=this.toType(i),r.push([i.name,s])}catch(s){this.logService.trace(s)}})),r}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let r;return n?.dangling?r=0:e.isFile()?r=1:e.isDirectory()?r=2:r=0,n&&(r|=64),r}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let r;for(;r=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await r.wait();let i=new lo;return this.resourceLocks.set(e,i),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),ie(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),i.open()})}async readFile(e,n){let r;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),r=await this.createResourceLock(e));let i=this.toFilePath(e);return await Tl.readFile(i)}catch(i){throw this.toFileSystemProviderError(i)}finally{r?.dispose()}}traceLock(e){o.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,r){let i=Hs(s=>A.concat(s.map(a=>A.wrap(a))).buffer);return Nv(this,e,i,s=>s.buffer,{...n,bufferSize:256*1024},r),i}async writeFile(e,n,r){return r?.atomic!==!1&&r?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,ve(rh(e),`${Zn(e)}${r.atomic.postfix}`),n,r):this.doWriteFile(e,n,r)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:r}=await er.stat(n);if(r)return!1}catch{}return!0}async doWriteFileAtomic(e,n,r,i){let s=new se;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,r,{...i,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,r,i){let s;try{let a=this.toFilePath(e);if(!r.create||!r.overwrite){if(await Te.exists(a)){if(!r.overwrite)throw Lo(d(2155,null),"EntryExists")}else if(!r.create)throw Lo(d(2158,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:r.append,unlock:r.unlock},i),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){o.canFlush=e}async open(e,n,r){let i=this.toFilePath(e),s;dl(n)&&!r&&(s=await this.createResourceLock(e));let a;try{if(dl(n)&&n.unlock)try{let{stat:l}=await er.stat(i);l.mode&128||await Tl.chmod(i,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(te&&dl(n)&&!n.append)try{a=await Te.open(i,"r+"),await Te.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await Te.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await Te.open(i,dl(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),dl(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),dl(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${i})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${i})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&o.canFlush)try{await Te.fdatasync(e)}catch(r){o.configureFlushOnWrite(!1),this.logService.error(r)}return await Te.close(e)}catch(r){throw this.toFileSystemProviderError(r)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.read(e,r,i,s,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,r){let i=this.mapHandleToPos.get(e);typeof i=="number"&&(typeof n=="number"||(typeof r=="number"?this.mapHandleToPos.set(e,i+r):this.mapHandleToPos.delete(e)))}async write(e,n,r,i,s){return q1(()=>this.doWrite(e,n,r,i,s),100,3)}async doWrite(e,n,r,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await Te.write(e,r,i,s,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),c)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Tl.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let r=this.toFilePath(e);if(n.recursive){let i;n?.atomic!==!1&&n.atomic.postfix&&(i=H(Tt(r),`${dt(r)}${n.atomic.postfix}`)),await Te.rm(r,1,i)}else try{await Tl.unlink(r)}catch(i){if(i.code==="EPERM"||i.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await er.stat(r);s=a.isDirectory()&&!l}catch{}if(s)await Tl.rmdir(r);else throw i}else throw i}}catch(r){throw this.toFileSystemProviderError(r)}}async rename(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"move",r.overwrite),await Te.rename(i,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2159,null,dt(i),dt(Tt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"copy",r.overwrite),await Te.copy(i,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(d(2153,null,dt(i),dt(Tt(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,r,i){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=Cc(s,a,!0)),l){if(r==="copy")throw Lo(d(2154,null),"EntryExists");if(r==="move")return}let u=await this.statIgnoreError(e);if(!u)throw Lo(d(2157,null),"EntryNotFound");let p=await this.statIgnoreError(n);if(p){if(!i)throw Lo(d(2156,null),"EntryExists");(u.type&1)!==0&&(p.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,r){let i=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(Cc(i,s,!a))return;let l=new se;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),r&&await Tl.mkdir(Tt(s),{recursive:!0}),await Tl.copyFile(i,s)}catch(c){if(c.code==="ENOENT"&&!r)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(e,n,r){return new Yv(i=>e(i),i=>n(i),r)}createNonRecursiveWatcher(e,n,r){return new ny(i=>e(i),i=>n(i),r)}toFileSystemProviderError(e){if(e instanceof Hc)return e;let n=e,r;switch(e.code){case"ENOENT":r="EntryNotFound";break;case"EISDIR":r="EntryIsADirectory";break;case"ENOTDIR":r="EntryNotADirectory";break;case"EEXIST":r="EntryExists";break;case"EPERM":case"EACCES":r="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,r="Unknown";break;default:r="Unknown"}return Lo(n,r)}async toFileSystemProviderWriteError(e,n){let r=this.toFileSystemProviderError(n);if(e&&r.code==="NoPermissions")try{let{stat:i}=await er.stat(this.toFilePath(e));i.mode&128||(r=Lo(n,"EntryWriteLocked"))}catch(i){this.logService.trace(i)}return r}}});function kL(o){return o.getFullYear()+"-"+String(o.getMonth()+1).padStart(2,"0")+"-"+String(o.getDate()).padStart(2,"0")+"T"+String(o.getHours()).padStart(2,"0")+":"+String(o.getMinutes()).padStart(2,"0")+":"+String(o.getSeconds()).padStart(2,"0")+"."+(o.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var K9,j9,rC,jde,Qde,Jde,DL=y(()=>{ue();Ji();pe();K9=60,j9=K9*60,rC=j9*24,jde=rC*7,Qde=rC*30,Jde=rC*365});function Q9(o,t){return ry(o["inspect-extensions"],o["inspect-brk-extensions"],5870,t,o.debugId,o.extensionEnvironment)}function ry(o,t,e,n,r,i){let a=Number(t||o)||(n?null:e),l=a?!!t:!1,c;if(i)try{c=JSON.parse(i)}catch{}return{port:a,break:l,debugId:r,env:c}}var _L,at,LL=y(()=>{DL();qv();$e();Oe();no();Ut();ce();_L=/^([^.]+\..+)[:=](.+)$/,at=class{constructor(t,e,n){this._args=t;this.paths=e;this.productService=n}get appRoot(){return Tt(bt.asFileUri("").fsPath)}get userHome(){return x.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return x.file(H(this.userDataPath,"User"))}get tmpDir(){return x.file(this.paths.tmpDir)}get cacheHome(){return x.file(this.userDataPath)}get stateResource(){return ve(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:z.vscodeUserData})}get userDataSyncHome(){return ve(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let t=kL(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=H(this.userDataPath,"logs",t)}return x.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return ve(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return ve(this.appSettingsHome,"History")}get keyboardLayoutResource(){return ve(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let t=$t.VSCODE_PORTABLE;return t?x.file(H(t,"argv.json")):ve(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return x.file(H(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let t=this.args["builtin-extensions-dir"];return t?Bn(t):In(H(bt.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let t=this.args["extensions-download-dir"];return t?x.file(Bn(t)):x.file(H(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let t=this.args["extensions-dir"];if(t)return Bn(t);let e=$t.VSCODE_EXTENSIONS;if(e)return e;let n=$t.VSCODE_PORTABLE;return n?H(n,"extensions"):ve(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let t=this.args["agent-plugins-dir"];if(t)return Bn(t);let e=$t.VSCODE_AGENT_PLUGINS;if(e)return e;let n=$t.VSCODE_PORTABLE;return n?H(n,"agent-plugins"):ve(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let t=this.args.extensionDevelopmentPath;if(Array.isArray(t))return t.map(e=>/^[^:/?#]+?:\/\//.test(e)?x.parse(e):x.file(In(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(t=>t==="ui"||t==="workspace"||t==="web"?t:"workspace")}get extensionTestsLocationURI(){let t=this.args.extensionTestsPath;if(t)return/^[^:/?#]+?:\/\//.test(t)?x.parse(t):x.file(In(t))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let t=this.args["disable-extension"];if(t){if(typeof t=="string")return[t];if(Array.isArray(t)&&t.length>0)return t}return!1}get skipBuiltinExtensions(){let t=$t.VSCODE_SKIP_BUILTIN_EXTENSIONS;return t?t.split(",").map(e=>e.trim()).filter(e=>e):[]}get debugExtensionHost(){return Q9(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!$t.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(t=>!_L.test(t))}get extensionLogLevel(){let t=[];for(let e of this.args.log||[]){let n=_L.exec(e);n?.[1]&&n[2]&&t.push([n[1],n[2]])}return t.length?t:void 0}get serviceMachineIdResource(){return ve(x.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let t=$t.VSCODE_PORTABLE;return t?x.file(H(t,"policy.json")):ve(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return ve(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(t){this.args.continueOn=t}get args(){return this._args}};E([je],at.prototype,"appRoot",1),E([je],at.prototype,"userHome",1),E([je],at.prototype,"userDataPath",1),E([je],at.prototype,"appSettingsHome",1),E([je],at.prototype,"tmpDir",1),E([je],at.prototype,"cacheHome",1),E([je],at.prototype,"stateResource",1),E([je],at.prototype,"userRoamingDataHome",1),E([je],at.prototype,"userDataSyncHome",1),E([je],at.prototype,"sync",1),E([je],at.prototype,"workspaceStorageHome",1),E([je],at.prototype,"localHistoryHome",1),E([je],at.prototype,"keyboardLayoutResource",1),E([je],at.prototype,"argvResource",1),E([je],at.prototype,"isExtensionDevelopment",1),E([je],at.prototype,"untitledWorkspacesHome",1),E([je],at.prototype,"builtinExtensionsPath",1),E([je],at.prototype,"extensionsDownloadLocation",1),E([je],at.prototype,"extensionsPath",1),E([je],at.prototype,"agentPluginsPath",1),E([je],at.prototype,"extensionDevelopmentLocationURI",1),E([je],at.prototype,"extensionDevelopmentKind",1),E([je],at.prototype,"extensionTestsLocationURI",1),E([je],at.prototype,"debugExtensionHost",1),E([je],at.prototype,"logLevel",1),E([je],at.prototype,"extensionLogLevel",1),E([je],at.prototype,"serviceMachineIdResource",1),E([je],at.prototype,"disableTelemetry",1),E([je],at.prototype,"disableExperiments",1),E([je],at.prototype,"disableWorkspaceTrust",1),E([je],at.prototype,"useInMemorySecretStorage",1),E([je],at.prototype,"policyFile",1),E([je],at.prototype,"agentSessionsWorkspace",1)});import{homedir as ML}from"os";import{resolve as J9,isAbsolute as X9,join as _d}from"path";function OL(o,t){let e=Z9(o,t),n=[e];return X9(e)||n.unshift(Y9),J9(...n)}function Z9(o,t){process.env.VSCODE_DEV&&(process.isEmbeddedApp?t="agents-oss-dev":t="code-oss-dev");let e=process.env.VSCODE_PORTABLE;if(e)return _d(e,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return _d(n,t);let r=o["user-data-dir"];if(r)return r;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let i=process.env.USERPROFILE;if(typeof i!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=_d(i,"AppData","Roaming")}break;case"darwin":n=_d(ML(),"Library","Application Support");break;case"linux":default:n=process.env.XDG_CONFIG_HOME||_d(ML(),".config");break}return _d(n,t)}var Y9,AL=y(()=>{Y9=process.env.VSCODE_CWD||process.cwd()});import{homedir as eW,tmpdir as tW}from"os";function NL(o,t){return ry(o["inspect-ptyhost"],o["inspect-brk-ptyhost"],5877,t,o.extensionEnvironment)}function UL(o,t){return ry(o["inspect-agenthost"],o["inspect-brk-agenthost"],5878,t,o.extensionEnvironment)}var oy,iy=y(()=>{LL();AL();oy=class extends at{constructor(t,e){super(t,{homeDir:eW(),tmpDir:tW(),userDataDir:OL(t,e.nameShort)},e)}}});function da(){return oC||(oC=A.alloc(0)),oC}function FL(o){switch(o){case 0:return"None";case 1:return"Regular";case 2:return"Control";case 3:return"Ack";case 5:return"Disconnect";case 6:return"ReplayRequest";case 7:return"PauseWriting";case 8:return"ResumeWriting";case 9:return"KeepAlive"}}var lC,oC,_m,No,sy,ay,Pl,iC,sC,aC,Lm,Rl=y(()=>{nt();le();K();la();(s=>{s.enableDiagnostics=!1,s.records=[];let e=new WeakMap,n=0;function r(a,l){if(!e.has(a)){let c=String(++n);e.set(a,c)}return e.get(a)}function i(a,l,c,u){}s.traceSocketEvent=i})(lC||={});oC=null;_m=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(t){this._chunks.push(t),this._totalLength+=t.byteLength}read(t){return this._read(t,!0)}peek(t){return this._read(t,!1)}_read(t,e){if(t===0)return da();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=t),s}if(this._chunks[0].byteLength>t){let s=this._chunks[0].slice(0,t);return e&&(this._chunks[0]=this._chunks[0].slice(t),this._totalLength-=t),s}let n=A.alloc(t),r=0,i=0;for(;t>0;){let s=this._chunks[i];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,r),r+=t,e&&(this._chunks[i]=s.slice(t),this._totalLength-=t),t-=t}else n.set(s,r),r+=s.byteLength,e?(this._chunks.shift(),this._totalLength-=s.byteLength):i++,t-=s.byteLength}return n}};No=class{constructor(t,e,n,r){this.type=t;this.id=e;this.ack=n;this.data=r;this.writtenTime=0}get size(){return this.data.byteLength}},sy=class extends D{constructor(e){super();this._onMessage=this._register(new P);this.onMessage=this._onMessage.event;this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0};this._socket=e,this._isDisposed=!1,this._incomingData=new _m,this._register(this._socket.onData(n=>this.acceptChunk(n))),this.lastReadTime=Date.now()}acceptChunk(e){if(!(!e||e.byteLength===0))for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){let n=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=n.readUInt32BE(9),this._state.messageType=n.readUInt8(0),this._state.id=n.readUInt32BE(1),this._state.ack=n.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:FL(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let r=this._state.messageType,i=this._state.id,s=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",n),this._onMessage.fire(new No(r,i,s,n)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},ay=class{constructor(t){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=t,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){try{this.flush()}catch{}this._isDisposed=!0}drain(){return this.flush(),this._socket.drain()}flush(){this._writeNow()}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this._scheduleWriting()}write(t){if(this._isDisposed)return;t.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=A.alloc(13);e.writeUInt8(t.type,0),e.writeUInt32BE(t.id,1),e.writeUInt32BE(t.ack,5),e.writeUInt32BE(t.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:FL(t.type),id:t.id,ack:t.ack,messageSize:t.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",t.data),this._writeSoon(e,t.data)}_bufferAdd(t,e){let n=this._totalLength===0;return this._data.push(t,e),this._totalLength+=t.byteLength+e.byteLength,n}_bufferTake(){let t=A.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,t}_writeSoon(t,e){this._bufferAdd(t,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let t=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:t.byteLength}),this._socket.write(t)}},Pl=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new P({onWillAddFirstListener:()=>{this._hasListeners=!0,queueMicrotask(()=>this._deliverMessages())},onDidRemoveLastListener:()=>{this._hasListeners=!1}}),this.event=this._emitter.event}_deliverMessages(){if(!this._isDeliveringMessages){for(this._isDeliveringMessages=!0;this._hasListeners&&this._bufferedMessages.length>0;)this._emitter.fire(this._bufferedMessages.shift());this._isDeliveringMessages=!1}}fire(t){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(t):this._emitter.fire(t):this._bufferedMessages.push(t)}flushBuffer(){this._bufferedMessages=[]}},iC=class{constructor(t){this.data=t,this.next=null}},sC=class{constructor(){this._first=null,this._last=null}length(){let t=0,e=this._first;for(;e;)e=e.next,t++;return t}peek(){return this._first?this._first.data:null}toArray(){let t=[],e=0,n=this._first;for(;n;)t[e++]=n.data,n=n.next;return t}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(t){let e=new iC(t);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},aC=class o{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return o._INSTANCE||(o._INSTANCE=new o),o._INSTANCE}constructor(){this.lastRuns=[];let t=Date.now();for(let e=0;e{for(let e=o._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let t=Date.now(),e=(1+o._HISTORY_LENGTH)*1e3,n=0;for(let r=0;r=.5}},Lm=class{constructor(t){this._onControlMessage=new Pl;this.onControlMessage=this._onControlMessage.event;this._onMessage=new Pl;this.onMessage=this._onMessage.event;this._onDidDispose=new Pl;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new Pl;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new Pl;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=t.loadEstimator??aC.getInstance(),this._shouldSendKeepAlive=t.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new sC,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socketDisposables=new se,this._socket=t.socket,this._socketWriter=this._socketDisposables.add(new ay(this._socket)),this._socketReader=this._socketDisposables.add(new sy(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),t.initialChunk&&this._socketReader.acceptChunk(t.initialChunk),this._shouldSendKeepAlive?this._keepAliveInterval=setInterval(()=>{this._sendKeepAlive()},5e3):this._keepAliveInterval=null}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._keepAliveInterval&&(clearInterval(this._keepAliveInterval),this._keepAliveInterval=null),this._socketDisposables.dispose()}drain(){return this._socketWriter.drain()}sendDisconnect(){if(!this._didSendDisconnect){this._didSendDisconnect=!0;let t=new No(5,0,0,da());this._socketWriter.write(t),this._socketWriter.flush()}}sendPause(){let t=new No(7,0,0,da());this._socketWriter.write(t)}sendResume(){let t=new No(8,0,0,da());this._socketWriter.write(t)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(t,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new se,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=t,this._socketWriter=this._socketDisposables.add(new ay(this._socket)),this._socketReader=this._socketDisposables.add(new sy(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(n=>this._receiveMessage(n))),this._socketDisposables.add(this._socket.onClose(n=>this._onSocketClose.fire(n))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let t=new No(3,0,this._incomingAckId,da());this._socketWriter.write(t);let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;nthis._outgoingAckId){this._outgoingAckId=t.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=t.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(t.type){case 0:break;case 1:{if(t.id>this._incomingMsgId)if(t.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new No(6,0,0,da())))}else this._incomingMsgId=t.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(t.data);break}case 2:{this._onControlMessage.fire(t.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let n=0,r=e.length;n=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-t+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let t=this._outgoingUnackMsg.peek(),e=Date.now()-t.writtenTime,n=Date.now()-this._socketReader.lastReadTime,r=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&n>=2e4&&r>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:n});return}let i=Math.max(2e4-e,2e4-n,2e4-r,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},i)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let t=new No(3,0,this._incomingAckId,da());this._socketWriter.write(t)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let t=new No(9,0,this._incomingAckId,da());this._socketWriter.write(t)}}});function nW(o,t){if(typeof o!="string"||o.trim().length===0)return console.log(`[reconnection-grace-time] No CLI argument provided, using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let e=Number(o);if(!isFinite(e)||e<0)return console.log(`[reconnection-grace-time] Invalid value '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let n=Math.floor(e*1e3);return!isFinite(n)||n>Number.MAX_SAFE_INTEGER?(console.log(`[reconnection-grace-time] Value too large '${o}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t):(console.log(`[reconnection-grace-time] Parsed CLI argument: ${e}s -> ${n}ms`),n)}var dC,ua,Li,kl=y(()=>{ue();iy();tm();re();vn();qv();ce();Ut();Oe();Rl();dC={"disable-update-check":{type:"boolean"},auth:{type:"string"},"disable-file-downloads":{type:"boolean"},"disable-file-uploads":{type:"boolean"},"disable-getting-started-override":{type:"boolean"},locale:{type:"string"},"link-protection-trusted-domains":{type:"string[]"},host:{type:"string",cat:"o",args:"ip-address",description:d(2714,null)},port:{type:"string",cat:"o",args:"port | port range",description:d(2715,null)},"socket-path":{type:"string",cat:"o",args:"path",description:d(2719,null)},"server-base-path":{type:"string",cat:"o",args:"path",description:d(2717,null)},"connection-token":{type:"string",cat:"o",args:"token",deprecates:["connectionToken"],description:d(2710,null)},"connection-token-file":{type:"string",cat:"o",args:"path",deprecates:["connection-secret","connectionTokenFile"],description:d(2711,null)},"without-connection-token":{type:"boolean",cat:"o",description:d(2722,null)},"disable-websocket-compression":{type:"boolean"},"print-startup-performance":{type:"boolean"},"print-ip-address":{type:"boolean"},"accept-server-license-terms":{type:"boolean",cat:"o",description:d(2707,null)},"server-data-dir":{type:"string",cat:"o",description:d(2718,null)},"telemetry-level":{type:"string",cat:"o",args:"level",description:d(2721,null)},"user-data-dir":kt["user-data-dir"],"enable-smoke-test-driver":kt["enable-smoke-test-driver"],"disable-telemetry":kt["disable-telemetry"],"disable-experiments":kt["disable-experiments"],"disable-workspace-trust":kt["disable-workspace-trust"],"file-watcher-polling":{type:"string",deprecates:["fileWatcherPolling"]},log:kt.log,logsPath:kt.logsPath,"force-disable-user-env":kt["force-disable-user-env"],"enable-proposed-api":kt["enable-proposed-api"],folder:{type:"string",deprecationMessage:"No longer supported. Folder needs to be provided in the browser URL or with `default-folder`."},workspace:{type:"string",deprecationMessage:"No longer supported. Workspace needs to be provided in the browser URL or with `default-workspace`."},"default-folder":{type:"string",description:d(2712,null)},"default-workspace":{type:"string",description:d(2713,null)},"enable-sync":{type:"boolean"},"github-auth":{type:"string"},"use-test-resolver":{type:"boolean"},"extensions-dir":kt["extensions-dir"],"extensions-download-dir":kt["extensions-download-dir"],"builtin-extensions-dir":kt["builtin-extensions-dir"],"install-extension":kt["install-extension"],"install-builtin-extension":kt["install-builtin-extension"],"update-extensions":kt["update-extensions"],"uninstall-extension":kt["uninstall-extension"],"list-extensions":kt["list-extensions"],"locate-extension":kt["locate-extension"],"show-versions":kt["show-versions"],category:kt.category,force:kt.force,"do-not-sync":kt["do-not-sync"],"do-not-include-pack-dependencies":kt["do-not-include-pack-dependencies"],"pre-release":kt["pre-release"],"start-server":{type:"boolean",cat:"e",description:d(2720,null)},"enable-remote-auto-shutdown":{type:"boolean"},"remote-auto-shutdown-without-delay":{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"agent-host-port":{type:"string",cat:"o",args:"port",description:d(2709,null)},"agent-host-path":{type:"string",cat:"o",args:"path",description:d(2708,null)},"use-host-proxy":{type:"boolean"},"without-browser-env-var":{type:"boolean"},"reconnection-grace-time":{type:"string",cat:"o",args:"seconds",description:d(2716,null)},help:kt.help,version:kt.version,"locate-shell-integration-path":kt["locate-shell-integration-path"],compatibility:{type:"string"},_:kt._},ua=xt,Li=class extends oy{get userRoamingDataHome(){return this.appSettingsHome}get machineSettingsResource(){return ve(x.file(H(this.userDataPath,"Machine")),"settings.json")}get mcpResource(){return ve(x.file(H(this.userDataPath,"User")),"mcp.json")}get args(){return super.args}get reconnectionGraceTime(){return nW(this.args["reconnection-grace-time"],108e5)}};E([je],Li.prototype,"userRoamingDataHome",1),E([je],Li.prototype,"machineSettingsResource",1),E([je],Li.prototype,"mcpResource",1),E([je],Li.prototype,"reconnectionGraceTime",1)});var rW,VL,pa,uC=y(()=>{Bt();Se();$e();Ut();ta();ce();ue();or();Ao();_n();yn();rW=o=>d(2054,null,o),VL=d(2067,null,"ms-dotnettools.csharp"),pa=class{constructor(t,e,n,r,i){this.extensionsForceVersionByQuality=t;this.logger=e;this.extensionManagementService=n;this.extensionGalleryService=r;this.productService=i;this.extensionsForceVersionByQuality=this.extensionsForceVersionByQuality.map(s=>s.toLowerCase())}get location(){}async listExtensions(t,e,n){let r=await this.extensionManagementService.getInstalled(1,n),i=rv.map(a=>a.toLowerCase());if(e&&e!==""){if(i.indexOf(e.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}r=r.filter(a=>a.manifest.categories?a.manifest.categories.map(c=>c.toLowerCase()).indexOf(e.toLowerCase())>-1:!1)}else if(e===""){this.logger.info("Possible Categories: "),i.forEach(a=>{this.logger.info(a)});return}this.location&&this.logger.info(d(2053,null,this.location)),r=r.sort((a,l)=>a.identifier.id.localeCompare(l.identifier.id));let s;for(let a of r)s!==a.identifier.id&&(s=a.identifier.id,this.logger.info(t?`${s}@${a.manifest.version}`:s))}async installExtensions(t,e,n,r){let i=[];try{t.length&&this.logger.info(this.location?d(2052,null,this.location):d(2051,null));let s=[],a=[],l=(u,p,m)=>{this.extensionsForceVersionByQuality?.some(g=>g===u.toLowerCase())&&(p=this.productService.quality!=="stable"?"prerelease":void 0),a.push({id:u,version:p!=="prerelease"?p:void 0,installOptions:{...n,isBuiltin:m,installPreReleaseVersion:p==="prerelease"||n.installPreReleaseVersion}})};for(let u of t)if(u instanceof x)s.push({vsix:u,installOptions:n});else{let[p,m]=um(u);l(p,m,!1)}for(let u of e)if(u instanceof x)s.push({vsix:u,installOptions:{...n,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{let[p,m]=um(u);l(p,m,!0)}let c=await this.extensionManagementService.getInstalled(void 0,n.profileLocation);if(s.length&&await Promise.all(s.map(async({vsix:u,installOptions:p})=>{try{await this.installVSIX(u,p,r,c)}catch(m){this.logger.error(m),i.push(u.toString())}})),a.length){let u=await this.installGalleryExtensions(a,c,r);i.push(...u)}}catch(s){throw this.logger.error(d(2041,null,fe(s))),s}if(i.length)throw new Error(d(2046,null,i.join(", ")))}async updateExtensions(t){let e=await this.extensionManagementService.getInstalled(1,t),n=[];for(let a of e)a.identifier.uuid&&n.push({...a.identifier,preRelease:a.preRelease});this.logger.trace(d(2065,null,n.length));let r=await this.extensionGalleryService.getExtensions(n,{compatible:!0},Ee.None),i=[];for(let a of r)for(let l of e)Ce(l.identifier,a.identifier)&&Pi(a.version,l.manifest.version)&&i.push({extension:a,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:t,isApplicationScoped:l.isApplicationScoped}});if(!i.length){this.logger.info(d(2064,null));return}this.logger.info(d(2063,null,i.map(a=>a.extension.identifier.id).join(", ")));let s=await this.extensionManagementService.installGalleryExtensions(i);for(let a of s)a.error?this.logger.error(d(2043,null,a.identifier.id,fe(a.error))):this.logger.info(d(2060,null,a.identifier.id,a.local?.manifest.version))}async installGalleryExtensions(t,e,n){if(t=t.filter(a=>{let{id:l,version:c,installOptions:u}=a,p=e.find(m=>Ce(m.identifier,{id:l}));if(p){let m=this.validateBuiltinExtensionEnabledWithAutoUpdates(p);if(m)return this.logger.info(m),!1;if(!n&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(2037,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(2036,null,`${l}@${c}`)),!1;p.preRelease&&c!=="prerelease"&&(u.preRelease=!1)}return!0}),!t.length)return[];let r=[],i=[],s=await this.getGalleryExtensions(t);if(await Promise.all(t.map(async({id:a,version:l,installOptions:c})=>{let u=s.get(a.toLowerCase());if(!u){this.logger.error(`${rW(l?`${a}@${l}`:a)} + ${VL}`),r.push(a);return}try{let m=await this.extensionGalleryService.getManifest(u,Ee.None);if(m&&!this.validateExtensionKind(m))return}catch(m){this.logger.error(m.message||m.stack||m),r.push(a);return}let p=e.find(m=>Ce(m.identifier,u.identifier));if(p){if(u.version===p.manifest.version){this.logger.info(d(2036,null,l?`${a}@${l}`:a));return}this.logger.info(d(2066,null,a,u.version))}c.isBuiltin?this.logger.info(l?d(2049,null,a,l):d(2048,null,a)):this.logger.info(l?d(2050,null,a,l):d(2047,null,a)),i.push({extension:u,options:{...c,installGivenVersion:!!l,isApplicationScoped:c.isApplicationScoped||p?.isApplicationScoped}})})),i.length){let a=await this.extensionManagementService.installGalleryExtensions(i);for(let l of a)l.error?(this.logger.error(d(2042,null,l.identifier.id,fe(l.error))),r.push(l.identifier.id)):this.logger.info(d(2057,null,l.identifier.id,l.local?.manifest.version))}return r}async installVSIX(t,e,n,r){let i=await this.extensionManagementService.getManifest(t);if(!i)throw new Error("Invalid vsix");if(await this.validateVSIX(i,n,e.profileLocation,r))try{await this.extensionManagementService.install(t,{...e,installGivenVersion:!0}),this.logger.info(d(2061,null,Zn(t)))}catch(a){if(Tn(a))this.logger.info(d(2040,null,Zn(t)));else throw a}}async getGalleryExtensions(t){let e=new Map,n=t.some(s=>s.installOptions.installPreReleaseVersion),r=await this.extensionManagementService.getTargetPlatform(),i=[];for(let s of t)am.test(s.id)&&i.push({...s,preRelease:n});if(i.length){let s=await this.extensionGalleryService.getExtensions(i,{targetPlatform:r},Ee.None);for(let a of s)e.set(a.identifier.id.toLowerCase(),a)}return e}validateExtensionKind(t){return!0}async validateVSIX(t,e,n,r){let i={id:ir(t.publisher,t.name)},s=r.find(a=>Ce(i,a.identifier));if(s){let a=this.validateBuiltinExtensionEnabledWithAutoUpdates(s);if(a)return this.logger.info(a),!1;if(!e&&Pi(s.manifest.version,t.version))return this.logger.info(d(2044,null,s.identifier.id,s.manifest.version,t.version)),!1}return this.validateExtensionKind(t)}async uninstallExtensions(t,e,n){let r=async s=>{if(s instanceof x){let a=await this.extensionManagementService.getManifest(s);return nd(a.publisher,a.name)}return s},i=[];for(let s of t){let a=await r(s),c=(await this.extensionManagementService.getInstalled(void 0,n)).filter(u=>Ce(u.identifier,{id:a}));if(!c.length)throw new Error(`${this.notInstalled(a)} + ${VL}`);if(c.some(u=>u.type===0)){this.logger.info(d(2038,null,a));return}if(!e&&c.some(u=>u.isBuiltin)){this.logger.info(d(2045,null,a));return}this.logger.info(d(2062,null,a));for(let u of c)await this.extensionManagementService.uninstall(u,{profileLocation:n}),i.push(u);this.location?this.logger.info(d(2059,null,a,this.location)):this.logger.info(d(2058,null,a))}}async locateExtension(t){let e=await this.extensionManagementService.getInstalled();t.forEach(n=>{e.forEach(r=>{if(r.identifier.id===n&&r.location.scheme===z.file){this.logger.info(r.location.fsPath);return}})})}notInstalled(t){return this.location?d(2056,null,t,this.location):d(2055,null,t)}validateBuiltinExtensionEnabledWithAutoUpdates(t){if(t.isBuiltin&&this.productService.builtInExtensionsEnabledWithAutoUpdates.some(e=>e.toLowerCase()===t.identifier.id.toLowerCase())&&!t.forceAutoUpdate)return d(2039,null,t.identifier.id,this.productService.quality)}};pa=E([b(2,ed),b(3,$n),b(4,We)],pa)});function oW(o){return o.tags.find(t=>t.startsWith("lp-"))?.split("lp-")[1]}var Md,Ld,ly=y(()=>{Bt();K();pe();ue();or();re();Md=_("languagePackService"),Ld=class extends D{constructor(e){super();this.extensionGalleryService=e}async getAvailableLanguages(){let e=new ht;setTimeout(()=>e.cancel(),1e3);let n;try{n=await this.extensionGalleryService.query({text:'category:"language packs"',pageSize:20},e.token)}catch{return[]}let i=n.firstPage.filter(s=>s.properties.localizedLanguages?.length&&s.tags.some(a=>a.startsWith("lp-"))).map(s=>{let a=s.properties.localizedLanguages?.[0],l=oW(s);return{...this.createQuickPickItem(l,a,s),extensionId:s.identifier.id,galleryExtension:s}});return i.push(this.createQuickPickItem("en","English")),i}createQuickPickItem(e,n,r){let i=n??e,s;if(i!==e&&(s=`(${e})`),e.toLowerCase()===wn.toLowerCase()&&(s??="",s+=d(2170,null)),r?.installCount){s??="";let a=r.installCount,l;a>1e6?l=`${Math.floor(a/1e5)/10}M`:a>1e3?l=`${Math.floor(a/1e3)}K`:l=String(a),s+=` $(cloud-download) ${l}`}return{id:e,label:i,description:s}}};Ld=E([b(0,$n)],Ld)});import*as WL from"fs";import{createHash as iW}from"crypto";function sW(o){if(typeof o.languageId!="string"||!Array.isArray(o.translations)||o.translations.length===0)return!1;for(let t of o.translations)if(typeof t.id!="string"||typeof t.path!="string")return!1;return!(o.languageName&&typeof o.languageName!="string"||o.localizedLanguageName&&typeof o.localizedLanguageName!="string")}var ma,Mm,pC=y(()=>{Nt();ze();K();$e();Oe();gr();vn();or();Ao();Ve();ly();ce();ma=class extends Ld{constructor(e,n,r,i){super(r);this.extensionManagementService=e;this.logService=i;this.cache=this._register(new Mm(n,i)),this.extensionManagementService.registerParticipant({postInstall:async s=>this.postInstallExtension(s),postUninstall:async s=>this.postUninstallExtension(s)})}async getBuiltInExtensionTranslationsUri(e,n){let i=(await this.cache.getLanguagePacks())[n];if(!i){this.logService.warn(`No language pack found for ${n}`);return}let s=i.translations[e];return s?x.file(s):void 0}async getInstalledLanguages(){let e=await this.cache.getLanguagePacks(),n=Object.keys(e).map(r=>{let i=e[r];return{...this.createQuickPickItem(r,i.label),extensionId:i.extensions[0].extensionIdentifier.id}});return n.push(this.createQuickPickItem("en","English")),n.sort((r,i)=>r.label.localeCompare(i.label)),n}async postInstallExtension(e){e&&e.manifest&&e.manifest.contributes&&e.manifest.contributes.localizations&&e.manifest.contributes.localizations.length&&(this.logService.info("Adding language packs from the extension",e.identifier.id),await this.update())}async postUninstallExtension(e){let n=await this.cache.getLanguagePacks();Object.keys(n).some(r=>n[r]&&n[r].extensions.some(i=>Ce(i.extensionIdentifier,e.identifier)))&&(this.logService.info("Removing language packs from the extension",e.identifier.id),await this.update())}async update(){let[e,n]=await Promise.all([this.cache.getLanguagePacks(),this.extensionManagementService.getInstalled()]),r=await this.cache.update(n);return!mn(Object.keys(e),Object.keys(r))}};ma=E([b(0,ed),b(1,Dn),b(2,$n),b(3,Q)],ma);Mm=class extends D{constructor(e,n){super();this.logService=n;this.languagePacks={};this.languagePacksFilePath=H(e.userDataPath,"languagepacks.json"),this.languagePacksFileLimiter=new co}getLanguagePacks(){return this.languagePacksFileLimiter.size||!this.initializedCache?this.withLanguagePacks().then(()=>this.languagePacks):Promise.resolve(this.languagePacks)}update(e){return this.withLanguagePacks(n=>{Object.keys(n).forEach(r=>delete n[r]),this.createLanguagePacksFromExtensions(n,...e)}).then(()=>this.languagePacks)}createLanguagePacksFromExtensions(e,...n){for(let r of n)r&&r.manifest&&r.manifest.contributes&&r.manifest.contributes.localizations&&r.manifest.contributes.localizations.length&&this.createLanguagePacksFromExtension(e,r);Object.keys(e).forEach(r=>this.updateHash(e[r]))}createLanguagePacksFromExtension(e,n){let r=n.identifier,i=n.manifest.contributes&&n.manifest.contributes.localizations?n.manifest.contributes.localizations:[];for(let s of i)if(n.location.scheme===z.file&&sW(s)){let a=e[s.languageId];a||(a={hash:"",extensions:[],translations:{},label:s.localizedLanguageName??s.languageName},e[s.languageId]=a);let l=a.extensions.filter(c=>Ce(c.extensionIdentifier,r))[0];l?l.version=n.manifest.version:a.extensions.push({extensionIdentifier:r,version:n.manifest.version});for(let c of s.translations)a.translations[c.id]=H(n.location.fsPath,c.path)}}updateHash(e){if(e){let n=iW("md5");for(let r of e.extensions)n.update(r.extensionIdentifier.uuid||r.extensionIdentifier.id).update(r.version);e.hash=n.digest("hex")}}withLanguagePacks(e=()=>null){return this.languagePacksFileLimiter.queue(()=>{let n=null;return WL.promises.readFile(this.languagePacksFilePath,"utf8").then(void 0,r=>r.code==="ENOENT"?Promise.resolve("{}"):Promise.reject(r)).then(r=>{try{return JSON.parse(r)}catch{return{}}}).then(r=>(n=e(r),r)).then(r=>{for(let s of Object.keys(r))r[s]||delete r[s];this.languagePacks=r,this.initializedCache=!0;let i=JSON.stringify(this.languagePacks);return this.logService.debug("Writing language packs",i),Te.writeFile(this.languagePacksFilePath,i)}).then(()=>n,r=>this.logService.error(r))})}};Mm=E([b(0,Dn),b(1,Q)],Mm)});var Od,BL=y(()=>{Bt();$e();ot();Zo();Od=class{constructor(t,e){this.requestService=t;this.fileService=e}async download(t,e,n,r=Ee.None){if(t.scheme===z.file||t.scheme===z.vscodeRemote){await this.fileService.copy(t,e);return}let i={type:"GET",url:t.toString(!0),callSite:n},s=await this.requestService.request(i,r);if(s.res.statusCode===200)await this.fileService.writeFile(e,s.stream);else{let a=await wi(s);throw new Error(`Expected 200, got back ${s.res.statusCode} instead. diff --git a/lib/vscode/out/vs/platform/agentHost/node/agentHostMain.js b/lib/vscode/out/vs/platform/agentHost/node/agentHostMain.js -index b443401aa5fef96843bc60dd21168437a58173f0..b465619a73f1735c593dd320bac5427744bbd0f3 100644 +index ef926d9fff09c9b7a71f69a67423876e2a0b31d1..af51e03b5db8b5c3512ad8930fc7d0f91a984c15 100644 --- a/lib/vscode/out/vs/platform/agentHost/node/agentHostMain.js +++ b/lib/vscode/out/vs/platform/agentHost/node/agentHostMain.js -@@ -412,7 +412,7 @@ ${d.join(` - | KEY '=~' REGEX - | KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,n){let i=f(1882,null,e,At.getLexeme(t)),s=t.offset,o=At.getLexeme(t);return this._parsingErrors.push({message:i,offset:s,lexeme:o,additionalInfo:n}),r._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},ge=class{static false(){return ye.INSTANCE}static true(){return Ce.INSTANCE}static has(e){return nn.create(e)}static equals(e,t){return Dr.create(e,t)}static notEquals(e,t){return Ar.create(e,t)}static regex(e,t){return Fr.create(e,t)}static in(e,t){return rs.create(e,t)}static notIn(e,t){return is.create(e,t)}static not(e){return rn.create(e)}static and(...e){return ss.create(e,null,!0)}static or(...e){return Ur.create(e,null,!0)}static greater(e,t){return Vn.create(e,t)}static greaterEquals(e,t){return kr.create(e,t)}static smaller(e,t){return Lr.create(e,t)}static smallerEquals(e,t){return Or.create(e,t)}static{this._parser=new ba({regexParsingWithErrorRecovery:!1})}static deserialize(e){return e==null?void 0:this._parser.parse(e)}};function Pr(r,e){return r.cmp(e)}var ye=class r{constructor(){this.type=0}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}map(e){return this}negate(){return Ce.INSTANCE}},Ce=class r{constructor(){this.type=1}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}map(e){return this}negate(){return ye.INSTANCE}},nn=class r{constructor(e,t){this.key=e;this.negated=t;this.type=2}static create(e,t=null){let n=ue.get(e);return typeof n=="boolean"?n?Ce.INSTANCE:ye.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Uu(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=ue.get(this.key);return typeof e=="boolean"?e?Ce.INSTANCE:ye.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(e){return e.mapDefined(this.key)}negate(){return this.negated||(this.negated=rn.create(this.key,this)),this.negated}},Dr=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=4}static create(e,t,n=null){if(typeof t=="boolean")return t?nn.create(e,n):rn.create(e,n);let i=ue.get(e);return typeof i=="boolean"?t===(i?"true":"false")?Ce.INSTANCE:ye.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:sn(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=ue.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?Ce.INSTANCE:ye.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(e){return e.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Ar.create(this.key,this.value,this)),this.negated}},rs=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=10;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:sn(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.valueKey),n=e.getValue(this.key);if(Array.isArray(t)){if(t.includes(n))return!0;if($&&typeof n=="string"&&n.startsWith("file:///")){let i=n.toLowerCase();return t.some(s=>typeof s=="string"&&s.toLowerCase()===i)}return!1}if(typeof n=="string"&&typeof t=="object"&&t!==null){if(th.call(t,n))return!0;if($&&n.startsWith("file:///")){let i=n.toLowerCase();return Object.keys(t).some(s=>s.toLowerCase()===i)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(e){return e.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=is.create(this.key,this.valueKey)),this.negated}},is=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=11;this._negated=rs.create(e,t)}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(e){return e.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Ar=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=5}static create(e,t,n=null){if(typeof t=="boolean")return t?rn.create(e,n):nn.create(e,n);let i=ue.get(e);return typeof i=="boolean"?t===(i?"true":"false")?ye.INSTANCE:Ce.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:sn(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=ue.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?ye.INSTANCE:Ce.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(e){return e.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Dr.create(this.key,this.value,this)),this.negated}},rn=class r{constructor(e,t){this.key=e;this.negated=t;this.type=3}static create(e,t=null){let n=ue.get(e);return typeof n=="boolean"?n?ye.INSTANCE:Ce.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Uu(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=ue.get(this.key);return typeof e=="boolean"?e?ye.INSTANCE:Ce.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(e){return e.mapNot(this.key)}negate(){return this.negated||(this.negated=nn.create(this.key,this)),this.negated}};function as(r,e){if(typeof r=="string"){let t=parseFloat(r);isNaN(t)||(r=t)}return typeof r=="string"||typeof r=="number"?e(r):ye.INSTANCE}var Vn=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=12}static create(e,t,n=null){return as(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:sn(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=Or.create(this.key,this.value,this)),this.negated}},kr=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=13}static create(e,t,n=null){return as(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:sn(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Lr.create(this.key,this.value,this)),this.negated}},Lr=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=14}static create(e,t,n=null){return as(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:sn(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:sn(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(e){return e.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Vn.create(this.key,this.value,this)),this.negated}},Fr=class r{constructor(e,t){this.key=e;this.regexp=t;this.type=7;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.keye.key)return 1;let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return tn?1:0}equals(e){if(e.type===this.type){let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return this.key===e.key&&t===n}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){let e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}map(e){return e.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=ya.create(this)),this.negated}},ya=class r{constructor(e){this._actual=e;this.type=8}static create(e){return new r(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(e){return new r(this._actual.map(e))}negate(){return this._actual}};function Fu(r){let e=null;for(let t=0,n=r.length;te.expr.length)return 1;for(let t=0,n=this.expr.length;t1;){let o=i[i.length-1];if(o.type!==9)break;i.pop();let a=i.pop(),l=i.length===0,c=Ur.create(o.expr.map(d=>r.create([d,a],null,n)),null,l);c&&(i.push(c),i.sort(Pr))}if(i.length===1)return i[0];if(n){for(let o=0;oe.serialize()).join(" && ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());this.negated=Ur.create(e,this,!0)}return this.negated}},Ur=class r{constructor(e,t){this.expr=e;this.negated=t;this.type=9}static create(e,t,n){return r._normalizeArr(e,t,n)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,n=this.expr.length;te.serialize()).join(" || ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){let t=e.shift(),n=e.shift(),i=[];for(let s of Ou(t))for(let o of Ou(n))i.push(ss.create([s,o],null,!1));e.unshift(r.create(i,null,!1))}this.negated=r.create(e,this,!0)}return this.negated}},os=class r extends nn{static{this._info=[]}static all(){return r._info.values()}constructor(e,t,n){super(e,null),this._defaultValue=t,typeof n=="object"?r._info.push({...n,key:e}):n!==!0&&r._info.push({key:e,description:n,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return Dr.create(this.key,e)}notEqualsTo(e){return Ar.create(this.key,e)}greater(e){return Vn.create(this.key,e)}},oS=Fe("contextKeyService");function Uu(r,e){return re?1:0}function sn(r,e,t,n){return rt?1:en?1:0}function Ou(r){return r.type===9?r.expr:[r]}var Oe=Fe("logService"),SS=Fe("loggerService");function Ia(r){return tr(r)}var Nu=3;function uh(r,e){return r!==0&&r<=e}function qn(r,e=!1){let t="";for(let n=0;n0?" ":"")+i}return t}var ls=class extends A{constructor(){super(...arguments);this.level=Nu;this._onDidChangeLogLevel=this._register(new I)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(t){this.level!==t&&(this.level=t,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(t){return uh(this.level,t)}canLog(t){return this._store.isDisposed?!1:this.checkLogLevel(t)}},Nr=class extends ls{constructor(t){super();this.logAlways=t}checkLogLevel(t){return this.logAlways||super.checkLogLevel(t)}trace(t,...n){this.canLog(1)&&this.log(1,qn([t,...n],!0))}debug(t,...n){this.canLog(2)&&this.log(2,qn([t,...n]))}info(t,...n){this.canLog(3)&&this.log(3,qn([t,...n]))}warn(t,...n){this.canLog(4)&&this.log(4,qn([t,...n]))}error(t,...n){if(this.canLog(5))if(t instanceof Error){let i=Array.prototype.slice.call(arguments);i[0]=t.stack,this.log(5,qn(i))}else this.log(5,qn([t,...n]))}flush(){}};var cs=class extends ls{constructor(t){super();this.loggers=t;t.length&&this.setLevel(t[0].getLevel())}setLevel(t){for(let n of this.loggers)n.setLevel(t);super.setLevel(t)}trace(t,...n){for(let i of this.loggers)i.trace(t,...n)}debug(t,...n){for(let i of this.loggers)i.debug(t,...n)}info(t,...n){for(let i of this.loggers)i.info(t,...n)}warn(t,...n){for(let i of this.loggers)i.warn(t,...n)}error(t,...n){for(let i of this.loggers)i.error(t,...n)}flush(){for(let t of this.loggers)t.flush()}dispose(){for(let t of this.loggers)t.dispose();super.dispose()}},Mr=class extends A{constructor(t,n,i){super();this.logLevel=t;this.logsHome=n;this._loggers=new rt;this._onDidChangeLoggers=this._register(new I);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new I);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new I);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(i)for(let s of i)this._loggers.set(s.resource,{logger:void 0,info:s})}getLoggerEntry(t){return Ut(t)?[...this._loggers.values()].find(n=>n.info.id===t):this._loggers.get(t)}getLogger(t){return this.getLoggerEntry(t)?.logger}createLogger(t,n){let i=this.toResource(t),s=Ut(t)?t:n?.id??Bn(i.toString()).toString(16),o=this._loggers.get(i)?.logger,a=n?.logLevel==="always"?1:n?.logLevel;o||(o=this.doCreateLogger(i,a??this.getLogLevel(i)??this.logLevel,{...n,id:s}));let l={logger:o,info:{resource:i,id:s,logLevel:a,name:n?.name,hidden:n?.hidden,group:n?.group,extensionId:n?.extensionId,when:n?.when}};return this.registerLogger(l.info),this._loggers.set(i,l),o}toResource(t){return Ut(t)?oe(this.logsHome,`${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):t}setLogLevel(t,n){if(m.isUri(t)){let i=t,s=n,o=this._loggers.get(i);o&&s!==o.info.logLevel&&(o.info.logLevel=s===this.logLevel?void 0:s,o.logger?.setLevel(s),this._loggers.set(o.info.resource,o),this._onDidChangeLogLevel.fire([i,s]))}else{this.logLevel=t;for(let[i,s]of this._loggers.entries())this._loggers.get(i)?.info.logLevel===void 0&&s.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(t,n){let i=this.getLoggerEntry(t);i&&n!==!i.info.hidden&&(i.info.hidden=!n,this._loggers.set(i.info.resource,i),this._onDidChangeVisibility.fire([i.info.resource,n]))}getLogLevel(t){let n;return t&&(n=this._loggers.get(t)?.info.logLevel),n??this.logLevel}registerLogger(t){let n=this._loggers.get(t.resource);n?n.info.hidden!==t.hidden&&this.setVisibility(t.resource,!t.hidden):(this._loggers.set(t.resource,{info:t,logger:void 0}),this._onDidChangeLoggers.fire({added:[t],removed:[]}))}deregisterLogger(t){let n=this.toResource(t),i=this._loggers.get(n);i&&(i.logger&&i.logger.dispose(),this._loggers.delete(n),this._onDidChangeLoggers.fire({added:[],removed:[i.info]}))}*getRegisteredLoggers(){for(let t of this._loggers.values())yield t.info}getRegisteredLogger(t){return this._loggers.get(t)?.info}dispose(){this._loggers.forEach(t=>t.logger?.dispose()),this._loggers.clear(),super.dispose()}};function Mu(r){if(r.verbose)return 1;if(typeof r.logLevel=="string"){let e=ph(r.logLevel.toLowerCase());if(e!==void 0)return e}return Nu}function dh(r){switch(r){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}function ph(r){switch(r){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warn":return 4;case"error":return 5;case"critical":return 5;case"off":return 0}}var _S=new os("logLevel",dh(3));var fh={"root/agentsChanged":!1,"root/activeSessionsChanged":!1,"session/ready":!1,"session/creationFailed":!1,"session/turnStarted":!0,"session/delta":!1,"session/responsePart":!1,"session/toolCallStart":!1,"session/toolCallDelta":!1,"session/toolCallReady":!1,"session/toolCallConfirmed":!0,"session/toolCallComplete":!0,"session/toolCallResultConfirmed":!0,"session/turnComplete":!1,"session/turnCancelled":!0,"session/error":!1,"session/titleChanged":!1,"session/usage":!1,"session/reasoning":!1,"session/modelChanged":!0,"session/serverToolsChanged":!1,"session/activeClientChanged":!0,"session/activeClientToolsChanged":!0,"session/pendingMessageSet":!0,"session/pendingMessageRemoved":!0,"session/queuedMessagesReordered":!0,"session/customizationsChanged":!1,"session/customizationToggled":!0};function Sa(r,e){let t=`Unhandled action type: ${JSON.stringify(r)}`;(e??console.warn)(t)}function Br(r){return{toolCallId:r.toolCallId,toolName:r.toolName,displayName:r.displayName,toolClientId:r.toolClientId,_meta:r._meta}}function Ta(r,e,t,n,i){if(!r.activeTurn||r.activeTurn.id!==e)return r;let s=r.activeTurn,o=s.responseParts.map(l=>{if(l.kind!=="toolCall")return l;let c=l.toolCall;return c.status==="completed"||c.status==="cancelled"?l:{kind:"toolCall",toolCall:{status:"cancelled",...Br(c),invocationMessage:c.status==="streaming"?c.invocationMessage??"":c.invocationMessage,toolInput:c.status==="streaming"?void 0:c.toolInput,reason:"skipped"}}}),a={id:s.id,userMessage:s.userMessage,responseParts:o,usage:s.usage,state:t,error:i};return{...r,turns:[...r.turns,a],activeTurn:void 0,summary:{...r.summary,status:n,modifiedAt:Date.now()}}}function Wr(r,e,t,n){let i=r.activeTurn;if(!i||i.id!==e)return r;let s=!1,o=i.responseParts.map(a=>{if(a.kind==="toolCall"&&a.toolCall.toolCallId===t){let l=n(a.toolCall);return l===a.toolCall?a:(s=!0,{...a,toolCall:l})}return a});return s?{...r,activeTurn:{...i,responseParts:o}}:r}function Wu(r,e,t,n){let i=r.activeTurn;if(!i||i.id!==e)return r;let s=!1,o=i.responseParts.map(a=>!s&&(a.kind==="toolCall"?a.toolCall.toolCallId:"id"in a?a.id:void 0)===t?(s=!0,n(a)):a);return s?{...r,activeTurn:{...i,responseParts:o}}:r}function _a(r,e,t){switch(e.type){case"root/agentsChanged":return{...r,agents:e.agents};case"root/activeSessionsChanged":return{...r,activeSessions:e.activeSessions};default:return Sa(e,t),r}}function xa(r,e,t){switch(e.type){case"session/ready":return{...r,lifecycle:"ready",summary:{...r.summary,status:"idle"}};case"session/creationFailed":return{...r,lifecycle:"creationFailed",creationError:e.error};case"session/turnStarted":{let n={...r,summary:{...r.summary,status:"in-progress",modifiedAt:Date.now()},activeTurn:{id:e.turnId,userMessage:e.userMessage,responseParts:[],usage:void 0}};if(e.queuedMessageId&&(n.steeringMessage?.id===e.queuedMessageId&&(n={...n,steeringMessage:void 0}),n.queuedMessages)){let i=n.queuedMessages.filter(s=>s.id!==e.queuedMessageId);n={...n,queuedMessages:i.length>0?i:void 0}}return n}case"session/delta":return Wu(r,e.turnId,e.partId,n=>n.kind==="markdown"?{...n,content:n.content+e.content}:n);case"session/responsePart":return!r.activeTurn||r.activeTurn.id!==e.turnId?r:{...r,activeTurn:{...r.activeTurn,responseParts:[...r.activeTurn.responseParts,e.part]}};case"session/turnComplete":return Ta(r,e.turnId,"complete","idle");case"session/turnCancelled":return Ta(r,e.turnId,"cancelled","idle");case"session/error":return Ta(r,e.turnId,"error","error",e.error);case"session/toolCallStart":return!r.activeTurn||r.activeTurn.id!==e.turnId?r:{...r,activeTurn:{...r.activeTurn,responseParts:[...r.activeTurn.responseParts,{kind:"toolCall",toolCall:{toolCallId:e.toolCallId,toolName:e.toolName,displayName:e.displayName,toolClientId:e.toolClientId,_meta:e._meta,status:"streaming"}}]}};case"session/toolCallDelta":return Wr(r,e.turnId,e.toolCallId,n=>n.status!=="streaming"?n:{...n,partialInput:(n.partialInput??"")+e.content,invocationMessage:e.invocationMessage??n.invocationMessage});case"session/toolCallReady":return Wr(r,e.turnId,e.toolCallId,n=>{if(n.status!=="streaming"&&n.status!=="running")return n;let i=Br(n);return e.confirmed?{status:"running",...i,invocationMessage:e.invocationMessage,toolInput:e.toolInput,confirmed:e.confirmed}:{status:"pending-confirmation",...i,invocationMessage:e.invocationMessage,toolInput:e.toolInput,confirmationTitle:e.confirmationTitle}});case"session/toolCallConfirmed":return Wr(r,e.turnId,e.toolCallId,n=>{if(n.status!=="pending-confirmation")return n;let i=Br(n);return e.approved?{status:"running",...i,invocationMessage:n.invocationMessage,toolInput:n.toolInput,confirmed:e.confirmed}:{status:"cancelled",...i,invocationMessage:n.invocationMessage,toolInput:n.toolInput,reason:e.reason,reasonMessage:e.reasonMessage,userSuggestion:e.userSuggestion}});case"session/toolCallComplete":return Wr(r,e.turnId,e.toolCallId,n=>{if(n.status!=="running"&&n.status!=="pending-confirmation")return n;let i=Br(n),s=n.status==="running"?n.confirmed:"not-needed";return e.requiresResultConfirmation?{status:"pending-result-confirmation",...i,invocationMessage:n.invocationMessage,toolInput:n.toolInput,confirmed:s,...e.result}:{status:"completed",...i,invocationMessage:n.invocationMessage,toolInput:n.toolInput,confirmed:s,...e.result}});case"session/toolCallResultConfirmed":return Wr(r,e.turnId,e.toolCallId,n=>{if(n.status!=="pending-result-confirmation")return n;let i=Br(n);return e.approved?{status:"completed",...i,invocationMessage:n.invocationMessage,toolInput:n.toolInput,confirmed:n.confirmed,success:n.success,pastTenseMessage:n.pastTenseMessage,content:n.content,structuredContent:n.structuredContent,error:n.error}:{status:"cancelled",...i,invocationMessage:n.invocationMessage,toolInput:n.toolInput,reason:"result-denied"}});case"session/titleChanged":return{...r,summary:{...r.summary,title:e.title,modifiedAt:Date.now()}};case"session/usage":return!r.activeTurn||r.activeTurn.id!==e.turnId?r:{...r,activeTurn:{...r.activeTurn,usage:e.usage}};case"session/reasoning":return Wu(r,e.turnId,e.partId,n=>n.kind==="reasoning"?{...n,content:n.content+e.content}:n);case"session/modelChanged":return{...r,summary:{...r.summary,model:e.model,modifiedAt:Date.now()}};case"session/serverToolsChanged":return{...r,serverTools:e.tools};case"session/activeClientChanged":return{...r,activeClient:e.activeClient??void 0};case"session/activeClientToolsChanged":return r.activeClient?{...r,activeClient:{...r.activeClient,tools:e.tools}}:r;case"session/customizationsChanged":return{...r,customizations:e.customizations};case"session/customizationToggled":{let n=r.customizations;if(!n)return r;let i=n.findIndex(o=>o.customization.uri===e.uri);if(i<0)return r;let s=[...n];return s[i]={...n[i],enabled:e.enabled},{...r,customizations:s}}case"session/pendingMessageSet":{let n={id:e.id,userMessage:e.userMessage};if(e.kind==="steering")return{...r,steeringMessage:n};let i=r.queuedMessages??[],s=i.findIndex(o=>o.id===e.id);if(s>=0){let o=[...i];return o[s]=n,{...r,queuedMessages:o}}return{...r,queuedMessages:[...i,n]}}case"session/pendingMessageRemoved":{if(e.kind==="steering")return!r.steeringMessage||r.steeringMessage.id!==e.id?r:{...r,steeringMessage:void 0};let n=r.queuedMessages;if(!n)return r;let i=n.filter(s=>s.id!==e.id);return i.length===n.length?r:{...r,queuedMessages:i.length>0?i:void 0}}case"session/queuedMessagesReordered":{let n=r.queuedMessages;if(!n)return r;let i=new Map(n.map(a=>[a.id,a])),s=new Set,o=e.order.filter(a=>i.has(a)&&!s.has(a)?(s.add(a),!0):!1).map(a=>i.get(a));for(let a of n)s.has(a.id)||o.push(a);return{...r,queuedMessages:o}}default:return Sa(e,t),r}}var $n=class extends A{constructor(t){super();this._logService=t;this._serverSeq=0;this._sessionStates=new Map;this._activeTurnToSession=new Map;this._onDidEmitEnvelope=this._register(new I);this.onDidEmitEnvelope=this._onDidEmitEnvelope.event;this._onDidEmitNotification=this._register(new I);this.onDidEmitNotification=this._onDidEmitNotification.event;this._log=t=>this._logService.warn(`[SessionStateManager] ${t}`);this._rootState=mu()}get hasActiveSessions(){return this._activeTurnToSession.size>0}get rootState(){return this._rootState}getSessionState(t){return this._sessionStates.get(t)}get serverSeq(){return this._serverSeq}getSnapshot(t){if(t===Yi)return{resource:t,state:this._rootState,fromSeq:this._serverSeq};let n=this._sessionStates.get(t);if(n)return{resource:t,state:n,fromSeq:this._serverSeq}}createSession(t){let n=t.resource;if(this._sessionStates.has(n))return this._logService.warn(`[SessionStateManager] Session already exists: ${n}`),this._sessionStates.get(n);let i=la(t);return this._sessionStates.set(n,i),this._logService.trace(`[SessionStateManager] Created session: ${n}`),this._onDidEmitNotification.fire({type:"notify/sessionAdded",summary:t}),i}restoreSession(t,n){let i=t.resource;if(this._sessionStates.has(i))return this._logService.warn(`[SessionStateManager] Session already exists (restore): ${i}`),this._sessionStates.get(i);let s={...la(t),lifecycle:"ready",turns:n};return this._sessionStates.set(i,s),this._logService.trace(`[SessionStateManager] Restored session: ${i} (${n.length} turns)`),s}removeSession(t){let n=this._sessionStates.get(t);n&&(n.activeTurn&&this._activeTurnToSession.delete(n.activeTurn.id),this._sessionStates.delete(t),this._logService.trace(`[SessionStateManager] Removed session: ${t}`))}deleteSession(t){this.removeSession(t),this._onDidEmitNotification.fire({type:"notify/sessionRemoved",session:t})}getActiveTurnId(t){return this._sessionStates.get(t)?.activeTurn?.id}dispatchServerAction(t){this._applyAndEmit(t,void 0)}dispatchClientAction(t,n){return this._applyAndEmit(t,n)}_applyAndEmit(t,n){let i;if(au(t)&&(this._rootState=_a(this._rootState,t,this._log),i=this._rootState),Qi(t)){let o=t,a=o.session,l=this._sessionStates.get(a);if(l){let c=xa(l,o,this._log);this._sessionStates.set(a,c),o.type==="session/turnStarted"?(this._activeTurnToSession.set(o.turnId,a),this.dispatchServerAction({type:"root/activeSessionsChanged",activeSessions:this._activeTurnToSession.size})):(o.type==="session/turnComplete"||o.type==="session/turnCancelled"||o.type==="session/error")&&(this._activeTurnToSession.delete(o.turnId),this.dispatchServerAction({type:"root/activeSessionsChanged",activeSessions:this._activeTurnToSession.size})),i=c}else this._logService.warn(`[SessionStateManager] Action for unknown session: ${a}, type=${t.type}`)}let s={action:t,serverSeq:++this._serverSeq,origin:n};return this._logService.trace(`[SessionStateManager] Emitting envelope: seq=${s.serverSeq}, type=${t.type}${n?`, origin=${n.clientId}:${n.clientSeq}`:""}`),this._onDidEmitEnvelope.fire(s),i}};$n=P([_e(0,Oe)],$n);var us=class extends A{constructor(t,n,i){super();this._logService=t;this._fileService=n;this._sessionDataService=i;this._onDidAction=this._register(new I);this.onDidAction=this._onDidAction.event;this._onDidNotification=this._register(new I);this.onDidNotification=this._onDidNotification.event;this._providers=new Map;this._sessionToProvider=new Map;this._providerSubscriptions=this._register(new D);this._agents=xr("agents",[]);this._logService.info("AgentService initialized"),this._stateManager=this._register(new $n(t)),this._register(this._stateManager.onDidEmitEnvelope(s=>this._onDidAction.fire(s))),this._register(this._stateManager.onDidEmitNotification(s=>this._onDidNotification.fire(s))),this._sideEffects=this._register(new ts(this._stateManager,{getAgent:s=>this._findProviderForSession(s),sessionDataService:this._sessionDataService,agents:this._agents},this._logService))}get stateManager(){return this._stateManager}registerProvider(t){if(this._providers.has(t.id))throw new Error(`Agent provider already registered: ${t.id}`);this._logService.info(`Registering agent provider: ${t.id}`),this._providers.set(t.id,t),this._providerSubscriptions.add(this._sideEffects.registerProgressListener(t)),this._defaultProvider||(this._defaultProvider=t.id),this._updateAgents()}async listAgents(){return[...this._providers.values()].map(t=>t.getDescriptor())}async getResourceMetadata(){return{resources:[...this._providers.values()].flatMap(n=>n.getProtectedResources())}}getResourceMetadataSync(){return{resources:[...this._providers.values()].flatMap(n=>n.getProtectedResources())}}async authenticate(t){this._logService.trace(`[AgentService] authenticate called: resource=${t.resource}`);for(let n of this._providers.values())if(n.getProtectedResources().some(s=>s.resource===t.resource)&&await n.authenticate(t.resource,t.token))return{authenticated:!0};return{authenticated:!1}}async listSessions(){this._logService.trace("[AgentService] listSessions called");let n=(await Promise.all([...this._providers.values()].map(i=>i.listSessions()))).flat();return this._logService.trace(`[AgentService] listSessions returned ${n.length} sessions`),n}async refreshModels(){this._logService.trace("[AgentService] refreshModels called"),this._updateAgents()}async createSession(t){let n=t?.provider??this._defaultProvider,i=n?this._providers.get(n):void 0;if(!i)throw new Error(`No agent provider registered for: ${n??"(none)"}`);this._logService.trace(`[AgentService] createSession: provider=${i.id} model=${t?.model??"(default)"}`);let s=await i.createSession(t);this._sessionToProvider.set(s.toString(),i.id),this._logService.trace(`[AgentService] createSession returned: ${s.toString()}`);let o={resource:s.toString(),provider:i.id,title:"New Session",status:"idle",createdAt:Date.now(),modifiedAt:Date.now(),workingDirectory:t?.workingDirectory?.toString()};return this._stateManager.createSession(o),this._stateManager.dispatchServerAction({type:"session/ready",session:s.toString()}),s}async disposeSession(t){this._logService.trace(`[AgentService] disposeSession: ${t.toString()}`);let n=this._findProviderForSession(t);n&&(await n.disposeSession(t),this._sessionToProvider.delete(t.toString())),this._stateManager.deleteSession(t.toString())}async subscribe(t){this._logService.trace(`[AgentService] subscribe: ${t.toString()}`);let n=this._stateManager.getSnapshot(t.toString());if(n||(await this.restoreSession(t),n=this._stateManager.getSnapshot(t.toString())),!n)throw new Error(`Cannot subscribe to unknown resource: ${t.toString()}`);return n}unsubscribe(t){this._logService.trace(`[AgentService] unsubscribe: ${t.toString()}`)}dispatchAction(t,n,i){this._logService.trace(`[AgentService] dispatchAction: type=${t.type}, clientId=${n}, clientSeq=${i}`,t);let s={clientId:n,clientSeq:i},o=this._stateManager.dispatchClientAction(t,s);this._logService.trace("[AgentService] resulting state:",o),this._sideEffects.handleAction(t)}async browseDirectory(t){let n;try{n=await this._fileService.resolve(t)}catch{throw new X(mt.NotFound,`Directory not found: ${t.toString()}`)}if(!n.isDirectory)throw new X(mt.NotFound,`Not a directory: ${t.toString()}`);return{entries:(n.children??[]).map(s=>({name:s.name,type:s.isDirectory?"directory":"file"}))}}async restoreSession(t){let n=t.toString();if(this._stateManager.getSessionState(n))return;let i=this._findProviderForSession(t);if(!i)throw new X(Mn,`No agent for session: ${n}`);let s;try{s=await i.listSessions()}catch(d){if(d instanceof X)throw d;let u=d instanceof Error?d.message:String(d);throw new X(Nn,`Failed to list sessions for ${n}: ${u}`)}let o=s.find(d=>d.session.toString()===n);if(!o)throw new X(Mn,`Session not found on backend: ${n}`);let a;try{a=await i.getSessionMessages(t)}catch(d){if(d instanceof X)throw d;let u=d instanceof Error?d.message:String(d);throw new X(Nn,`Failed to restore session ${n}: ${u}`)}let l=this._buildTurnsFromMessages(a),c={resource:n,provider:i.id,title:o.summary??"Session",status:"idle",createdAt:o.startTime,modifiedAt:o.modifiedTime,workingDirectory:o.workingDirectory?.toString()};this._stateManager.restoreSession(c,l),this._logService.info(`[AgentService] Restored session ${n} with ${l.length} turns`)}async fetchContent(t){let n=Cu(t.toString());if(n)return this._fetchSessionDbContent(n);try{return{data:(await this._fileService.readFile(t)).value.toString(),encoding:"utf-8",contentType:"text/plain"}}catch{throw new X(mt.NotFound,`Content not found: ${t.toString()}`)}}async writeFile(t){let n=typeof t.uri=="string"?m.parse(t.uri):m.revive(t.uri),i;t.encoding==="base64"?i=Ic(t.data):i=x.fromString(t.data);try{return t.createOnly?await this._fileService.createFile(n,i,{overwrite:!1}):await this._fileService.writeFile(n,i),{}}catch(s){let o=tn(s);throw o==="EntryExists"?new X(mt.AlreadyExists,`File already exists: ${n.toString()}`):o==="NoPermissions"?new X(mt.PermissionDenied,`Permission denied: ${n.toString()}`):new X(mt.NotFound,`Failed to write file: ${n.toString()}`)}}async shutdown(){this._logService.info("AgentService: shutting down all providers...");let t=[];for(let n of this._providers.values())t.push(n.shutdown());await Promise.all(t),this._sessionToProvider.clear()}_buildTurnsFromMessages(t){let n=[],i,s=(a,l)=>{n.push({id:a.id,userMessage:a.userMessage,responseParts:a.responseParts,usage:void 0,state:l})},o=(a,l)=>({id:a,userMessage:{text:l},responseParts:[],pendingTools:new Map});for(let a of t)if(a.type==="message"&&a.role==="user")i&&s(i,"cancelled"),i=o(a.messageId,a.content);else if(a.type==="message"&&a.role==="assistant")i||(i=o(a.messageId,"")),a.content&&i.responseParts.push({kind:"markdown",id:Ge(),content:a.content}),(!a.toolRequests||a.toolRequests.length===0)&&(s(i,"complete"),i=void 0);else if(a.type==="tool_start")i?.pendingTools.set(a.toolCallId,a);else if(a.type==="tool_complete"&&i){let l=i.pendingTools.get(a.toolCallId);i.pendingTools.delete(a.toolCallId);let c={status:"completed",toolCallId:a.toolCallId,toolName:l?.toolName??"unknown",displayName:l?.displayName??"Unknown Tool",invocationMessage:l?.invocationMessage??"",toolInput:l?.toolInput,success:a.result.success,pastTenseMessage:a.result.pastTenseMessage,content:a.result.content,error:a.result.error,confirmed:"not-needed",_meta:l?{toolKind:l.toolKind,language:l.language}:void 0};i.responseParts.push({kind:"toolCall",toolCall:c})}return i&&s(i,"cancelled"),n}async _fetchSessionDbContent(t){let n=m.parse(t.sessionUri),i=this._sessionDataService.openDatabase(n);try{let s=await i.object.readFileEditContent(t.toolCallId,t.filePath);if(!s)throw new X(mt.NotFound,`File edit not found: toolCallId=${t.toolCallId}, filePath=${t.filePath}`);let o=t.part==="before"?s.beforeContent:s.afterContent;return{data:new TextDecoder().decode(o),encoding:"utf-8",contentType:"text/plain"}}finally{i.dispose()}}_findProviderForSession(t){let n=typeof t=="string"?t:t.toString(),i=this._sessionToProvider.get(n);if(i)return this._providers.get(i);let s=ae.provider(t);if(s)return this._providers.get(s);if(this._defaultProvider)return this._providers.get(this._defaultProvider)}_updateAgents(){this._agents.set([...this._providers.values()],void 0)}dispose(){for(let t of this._providers.values())t.dispose();this._providers.clear(),super.dispose()}};import{CopilotClient as vh}from"@github/copilot-sdk";import{rgPath as bh}from"@vscode/ripgrep";var ds=Fe("sessionDataService");var hh=new Set(["edit","write","patch"]);function zn(r){return hh.has(r)}function ps(r){if(typeof r=="string")try{r=JSON.parse(r)}catch{return}return r?.path}var fs=new Set(["bash","powershell"]),gh=new Set(["report_intent"]);function Vr(r){return gh.has(r)}function Kn(r,e){return r.length>e?r.substring(0,e-3)+"...":r}function qr(r){switch(r){case"bash":return f(1855,null);case"powershell":return f(1862,null);case"read_bash":case"read_powershell":return f(1863,null);case"write_bash":case"write_powershell":return f(1867,null);case"bash_shutdown":return f(1856,null);case"list_bash":case"list_powershell":return f(1860,null);case"view":return f(1864,null);case"edit":return f(1857,null);case"write":return f(1866,null);case"grep":return f(1859,null);case"glob":return f(1858,null);case"patch":return f(1861,null);case"web_search":return f(1865,null);case"ask_user":return f(1854,null);default:return r}}function hs(r,e,t){if(fs.has(r)){let n=t;if(n?.command){let i=n.command.split(` - `)[0];return f(1849,null,Kn(i,80))}return f(1848,null,e)}switch(r){case"view":{let n=t;return n?.path?f(1851,null,n.path):f(1850,null)}case"edit":{let n=t;return n?.path?f(1842,null,n.path):f(1841,null)}case"write":{let n=t;return n?.path?f(1853,null,n.path):f(1852,null)}case"grep":{let n=t;return n?.pattern?f(1847,null,Kn(n.pattern,80)):f(1846,null)}case"glob":{let n=t;return n?.pattern?f(1845,null,Kn(n.pattern,80)):f(1844,null)}default:return f(1843,null,e)}}function gs(r,e,t,n){if(!n)return f(1829,null,e);if(fs.has(r)){let i=t;if(i?.command){let s=i.command.split(` --`)[0];return f(1836,null,Kn(s,80))}return f(1835,null,e)}switch(r){case"view":{let i=t;return i?.path?f(1838,null,i.path):f(1837,null)}case"edit":{let i=t;return i?.path?f(1828,null,i.path):f(1827,null)}case"write":{let i=t;return i?.path?f(1840,null,i.path):f(1839,null)}case"grep":{let i=t;return i?.pattern?f(1834,null,Kn(i.pattern,80)):f(1833,null)}case"glob":{let i=t;return i?.pattern?f(1832,null,Kn(i.pattern,80)):f(1831,null)}default:return f(1830,null,e)}}function ms(r,e,t){if(!(!e&&!t)){if(fs.has(r))return e?.command??t;switch(r){case"grep":return e?.pattern??t;default:if(e)try{return JSON.stringify(e,null,2)}catch{return t}return t}}}function vs(r){if(fs.has(r))return"terminal"}function bs(r){return r==="powershell"?"powershell":"shellscript"}function ys(r){try{return JSON.stringify(r)}catch{return}}async function Bu(r,e,t){let n=[],i=new Map,s=[];for(let l of t)if(l.type==="tool.execution_start"){let c=l.data;if(Vr(c.toolName))continue;let d=c.arguments!==void 0?ys(c.arguments):void 0,u;if(d)try{u=JSON.parse(d)}catch{}i.set(c.toolCallId,{toolName:c.toolName,parameters:u}),zn(c.toolName)&&s.push(c.toolCallId)}let o;if(e&&s.length>0)try{let l=await e.getFileEdits(s);if(l.length>0){o=new Map;for(let c of l){let d=o.get(c.toolCallId);d||(d=[],o.set(c.toolCallId,d)),d.push(c)}}}catch{}let a=r.toString();for(let l of t)if(l.type==="assistant.message"||l.type==="user.message"){let c=l.data;n.push({session:r,type:"message",role:l.type==="user.message"?"user":"assistant",messageId:c?.messageId??c?.interactionId??"",content:c?.content??"",toolRequests:c?.toolRequests?.map(d=>({toolCallId:d.toolCallId,name:d.name,arguments:d.arguments!==void 0?ys(d.arguments):void 0,type:d.type})),reasoningOpaque:c?.reasoningOpaque,reasoningText:c?.reasoningText,encryptedContent:c?.encryptedContent,parentToolCallId:c?.parentToolCallId})}else if(l.type==="tool.execution_start"){let c=l.data;if(Vr(c.toolName))continue;let d=i.get(c.toolCallId),u=qr(c.toolName),p=vs(c.toolName),h=c.arguments!==void 0?ys(c.arguments):void 0;n.push({session:r,type:"tool_start",toolCallId:c.toolCallId,toolName:c.toolName,displayName:u,invocationMessage:hs(c.toolName,u,d?.parameters),toolInput:ms(c.toolName,d?.parameters,h),toolKind:p,language:p==="terminal"?bs(c.toolName):void 0,toolArguments:h,mcpServerName:c.mcpServerName,mcpToolName:c.mcpToolName,parentToolCallId:c.parentToolCallId})}else if(l.type==="tool.execution_complete"){let c=l.data,d=i.get(c.toolCallId);if(!d)continue;i.delete(c.toolCallId);let u=qr(d.toolName),p=c.error?.message??c.result?.content,h=[];p!==void 0&&h.push({type:"text",text:p});let g=o?.get(c.toolCallId);if(g)for(let b of g)h.push({type:"fileEdit",beforeURI:wr(a,b.toolCallId,b.filePath,"before"),afterURI:wr(a,b.toolCallId,b.filePath,"after"),diff:b.addedLines!==void 0||b.removedLines!==void 0?{added:b.addedLines,removed:b.removedLines}:void 0});n.push({session:r,type:"tool_complete",toolCallId:c.toolCallId,result:{success:c.success,pastTenseMessage:gs(d.toolName,u,d.parameters,c.success),content:h.length>0?h:void 0,error:c.error},isUserRequested:c.isUserRequested,toolTelemetry:c.toolTelemetry!==void 0?ys(c.toolTelemetry):void 0,parentToolCallId:c.parentToolCallId})}return n}function on(r){try{return JSON.stringify(r)}catch{return}}function mh(r){let e=typeof r.path=="string"?r.path:typeof r.fileName=="string"?r.fileName:void 0,t=typeof r.fullCommandText=="string"?r.fullCommandText:void 0,n=typeof r.intention=="string"?r.intention:void 0,i=typeof r.serverName=="string"?r.serverName:void 0,s=typeof r.toolName=="string"?r.toolName:void 0;switch(r.kind){case"shell":return{confirmationTitle:f(1823,null),invocationMessage:n??f(1822,null),toolInput:t};case"write":return{confirmationTitle:f(1826,null),invocationMessage:e?f(1824,null,e):f(1825,null),toolInput:on(e?{path:e}:r)??void 0};case"mcp":{let o=s??f(1819,null);return{confirmationTitle:i?`${i}: ${o}`:o,invocationMessage:i?`${i}: ${o}`:o,toolInput:on({serverName:i,toolName:s})??void 0}}case"read":return{confirmationTitle:f(1821,null),invocationMessage:n??f(1820,null),toolInput:on(e?{path:e,intention:n}:r)??void 0};default:return{confirmationTitle:f(1818,null),invocationMessage:f(1817,null),toolInput:on(r)??void 0}}}var jn=class extends A{constructor(t,n,i,s,o,a,l,c){super();this._onDidSessionProgress=s;this._wrapperFactory=o;this._fileService=a;this._logService=l;this._activeToolCalls=new Map;this._pendingPermissions=new Map;this._turnId="";this.sessionId=n,this.sessionUri=t,this._workingDirectory=i,this._databaseRef=c.openDatabase(t),this._register(O(()=>this._databaseRef.dispose())),this._editTracker=new ns(t.toString(),this._databaseRef.object,this._fileService,this._logService),this._register(O(()=>this._denyPendingPermissions()))}async initializeSession(){this._wrapper=this._register(await this._wrapperFactory({onPermissionRequest:t=>this.handlePermissionRequest(t),hooks:{onPreToolUse:async t=>{if(zn(t.toolName)){let n=ps(t.toolArgs);n&&await this._editTracker.trackEditStart(n)}},onPostToolUse:async t=>{if(zn(t.toolName)){let n=ps(t.toolArgs);n&&await this._editTracker.completeEdit(n)}}}})),this._subscribeToEvents(),this._subscribeForLogging()}async send(t,n){this._logService.info(`[Copilot:${this.sessionId}] sendMessage called: "${t.substring(0,100)}${t.length>100?"...":""}" (${n?.length??0} attachments)`);let i=n?.map(s=>s.type==="selection"?{type:"selection",filePath:s.path,displayName:s.displayName??s.path,text:s.text,selection:s.selection}:{type:s.type,path:s.path,displayName:s.displayName});i?.length&&this._logService.trace(`[Copilot:${this.sessionId}] Attachments: ${JSON.stringify(i.map(s=>({type:s.type,path:s.type==="selection"?s.filePath:s.path})))}`),await this._wrapper.session.send({prompt:t,attachments:i}),this._logService.info(`[Copilot:${this.sessionId}] session.send() returned`)}sendSteering(t){this._logService.info(`[Copilot:${this.sessionId}] Sending steering message: "${t.userMessage.text.substring(0,100)}"`),this._wrapper.session.send({prompt:t.userMessage.text,mode:"immediate"}).catch(n=>{this._logService.error(`[Copilot:${this.sessionId}] Steering message failed`,n)})}async getMessages(){let t=await this._wrapper.session.getMessages(),n;try{n=this._databaseRef.object}catch{}return Bu(this.sessionUri,n,t)}async abort(){this._logService.info(`[Copilot:${this.sessionId}] Aborting session...`),this._denyPendingPermissions(),await this._wrapper.session.abort()}async setModel(t){this._logService.info(`[Copilot:${this.sessionId}] Changing model to: ${t}`),await this._wrapper.session.setModel(t)}async handlePermissionRequest(t){if(this._logService.info(`[Copilot:${this.sessionId}] Permission request: kind=${t.kind}`),t.kind==="read"){let c=typeof t.path=="string"?t.path:void 0;if(c&&this._workingDirectory&&mn.isEqualOrParent(ic(m.file(c)),this._workingDirectory))return this._logService.trace(`[Copilot:${this.sessionId}] Auto-approving read inside working directory: ${c}`),{kind:"approved"}}let n=t.toolCallId;if(!n)return this._logService.warn(`[Copilot:${this.sessionId}] Permission request without toolCallId, auto-denying: kind=${t.kind}`),{kind:"denied-interactively-by-user"};this._logService.info(`[Copilot:${this.sessionId}] Requesting confirmation for tool call: ${n}`);let i=new Ze;this._pendingPermissions.set(n,i);let{confirmationTitle:s,invocationMessage:o,toolInput:a}=mh(t);this._onDidSessionProgress.fire({session:this.sessionUri,type:"tool_ready",toolCallId:n,invocationMessage:o,toolInput:a,confirmationTitle:s,permissionKind:t.kind,permissionPath:typeof t.path=="string"?t.path:typeof t.fileName=="string"?t.fileName:void 0});let l=await i.p;return this._logService.info(`[Copilot:${this.sessionId}] Permission response: toolCallId=${n}, approved=${l}`),{kind:l?"approved":"denied-interactively-by-user"}}respondToPermissionRequest(t,n){let i=this._pendingPermissions.get(t);return i?(this._pendingPermissions.delete(t),i.complete(n),!0):!1}_subscribeToEvents(){let t=this._wrapper,n=this.sessionId,i=this.sessionUri;this._register(t.onMessageDelta(s=>{this._logService.trace(`[Copilot:${n}] delta: ${s.data.deltaContent}`),this._onDidSessionProgress.fire({session:i,type:"delta",messageId:s.data.messageId,content:s.data.deltaContent,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onMessage(s=>{this._logService.info(`[Copilot:${n}] Full message received: ${s.data.content.length} chars`),this._onDidSessionProgress.fire({session:i,type:"message",role:"assistant",messageId:s.data.messageId,content:s.data.content,toolRequests:s.data.toolRequests?.map(o=>({toolCallId:o.toolCallId,name:o.name,arguments:o.arguments!==void 0?on(o.arguments):void 0,type:o.type})),reasoningOpaque:s.data.reasoningOpaque,reasoningText:s.data.reasoningText,encryptedContent:s.data.encryptedContent,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onToolStart(s=>{if(Vr(s.data.toolName)){this._logService.trace(`[Copilot:${n}] Tool started (hidden): ${s.data.toolName}`);return}this._logService.info(`[Copilot:${n}] Tool started: ${s.data.toolName}`);let o=s.data.arguments!==void 0?on(s.data.arguments):void 0,a;if(o)try{a=JSON.parse(o)}catch{}let l=qr(s.data.toolName);this._activeToolCalls.set(s.data.toolCallId,{toolName:s.data.toolName,displayName:l,parameters:a});let c=vs(s.data.toolName);this._onDidSessionProgress.fire({session:i,type:"tool_start",toolCallId:s.data.toolCallId,toolName:s.data.toolName,displayName:l,invocationMessage:hs(s.data.toolName,l,a),toolInput:ms(s.data.toolName,a,o),toolKind:c,language:c==="terminal"?bs(s.data.toolName):void 0,toolArguments:o,mcpServerName:s.data.mcpServerName,mcpToolName:s.data.mcpToolName,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onTurnStart(s=>{this._turnId=s.data.turnId})),this._register(t.onToolComplete(s=>{let o=this._activeToolCalls.get(s.data.toolCallId);if(!o)return;this._logService.info(`[Copilot:${n}] Tool completed: ${s.data.toolCallId}`),this._activeToolCalls.delete(s.data.toolCallId);let a=o.displayName,l=s.data.error?.message??s.data.result?.content,c=[];l!==void 0&&c.push({type:"text",text:l});let d=zn(o.toolName)?ps(o.parameters):void 0;if(d){let u=this._editTracker.takeCompletedEdit(this._turnId,s.data.toolCallId,d);u&&c.push(u)}this._onDidSessionProgress.fire({session:i,type:"tool_complete",toolCallId:s.data.toolCallId,result:{success:s.data.success,pastTenseMessage:gs(o.toolName,a,o.parameters,s.data.success),content:c.length>0?c:void 0,error:s.data.error},isUserRequested:s.data.isUserRequested,toolTelemetry:s.data.toolTelemetry!==void 0?on(s.data.toolTelemetry):void 0,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onIdle(()=>{this._logService.info(`[Copilot:${n}] Session idle`),this._onDidSessionProgress.fire({session:i,type:"idle"})})),this._register(t.onSessionError(s=>{this._logService.error(`[Copilot:${n}] Session error: ${s.data.errorType} - ${s.data.message}`),this._onDidSessionProgress.fire({session:i,type:"error",errorType:s.data.errorType,message:s.data.message,stack:s.data.stack})})),this._register(t.onUsage(s=>{this._logService.trace(`[Copilot:${n}] Usage: model=${s.data.model}, in=${s.data.inputTokens??"?"}, out=${s.data.outputTokens??"?"}, cacheRead=${s.data.cacheReadTokens??"?"}`),this._onDidSessionProgress.fire({session:i,type:"usage",inputTokens:s.data.inputTokens,outputTokens:s.data.outputTokens,model:s.data.model,cacheReadTokens:s.data.cacheReadTokens})})),this._register(t.onReasoningDelta(s=>{this._logService.trace(`[Copilot:${n}] Reasoning delta: ${s.data.deltaContent.length} chars`),this._onDidSessionProgress.fire({session:i,type:"reasoning",content:s.data.deltaContent})}))}_subscribeForLogging(){let t=this._wrapper,n=this.sessionId;this._register(t.onSessionStart(i=>{this._logService.trace(`[Copilot:${n}] Session started: model=${i.data.selectedModel??"default"}, producer=${i.data.producer}`)})),this._register(t.onSessionResume(i=>{this._logService.trace(`[Copilot:${n}] Session resumed: eventCount=${i.data.eventCount}`)})),this._register(t.onSessionInfo(i=>{this._logService.trace(`[Copilot:${n}] Session info [${i.data.infoType}]: ${i.data.message}`)})),this._register(t.onSessionModelChange(i=>{this._logService.trace(`[Copilot:${n}] Model changed: ${i.data.previousModel??"(none)"} -> ${i.data.newModel}`)})),this._register(t.onSessionHandoff(i=>{this._logService.trace(`[Copilot:${n}] Session handoff: sourceType=${i.data.sourceType}, remoteSessionId=${i.data.remoteSessionId??"(none)"}`)})),this._register(t.onSessionTruncation(i=>{this._logService.trace(`[Copilot:${n}] Session truncation: removed ${i.data.tokensRemovedDuringTruncation} tokens, ${i.data.messagesRemovedDuringTruncation} messages`)})),this._register(t.onSessionSnapshotRewind(i=>{this._logService.trace(`[Copilot:${n}] Snapshot rewind: upTo=${i.data.upToEventId}, eventsRemoved=${i.data.eventsRemoved}`)})),this._register(t.onSessionShutdown(i=>{this._logService.trace(`[Copilot:${n}] Session shutdown: type=${i.data.shutdownType}, premiumRequests=${i.data.totalPremiumRequests}, apiDuration=${i.data.totalApiDurationMs}ms`)})),this._register(t.onSessionUsageInfo(i=>{this._logService.trace(`[Copilot:${n}] Usage info: ${i.data.currentTokens}/${i.data.tokenLimit} tokens, ${i.data.messagesLength} messages`)})),this._register(t.onSessionCompactionStart(()=>{this._logService.trace(`[Copilot:${n}] Compaction started`)})),this._register(t.onSessionCompactionComplete(i=>{this._logService.trace(`[Copilot:${n}] Compaction complete: success=${i.data.success}, tokensRemoved=${i.data.tokensRemoved??"?"}`)})),this._register(t.onUserMessage(i=>{this._logService.trace(`[Copilot:${n}] User message: ${i.data.content.length} chars, ${i.data.attachments?.length??0} attachments`)})),this._register(t.onPendingMessagesModified(()=>{this._logService.trace(`[Copilot:${n}] Pending messages modified`)})),this._register(t.onTurnStart(i=>{this._logService.trace(`[Copilot:${n}] Turn started: ${i.data.turnId}`)})),this._register(t.onIntent(i=>{this._logService.trace(`[Copilot:${n}] Intent: ${i.data.intent}`)})),this._register(t.onReasoning(i=>{this._logService.trace(`[Copilot:${n}] Reasoning: ${i.data.content.length} chars`)})),this._register(t.onTurnEnd(i=>{this._logService.trace(`[Copilot:${n}] Turn ended: ${i.data.turnId}`)})),this._register(t.onAbort(i=>{this._logService.trace(`[Copilot:${n}] Aborted: ${i.data.reason}`)})),this._register(t.onToolUserRequested(i=>{this._logService.trace(`[Copilot:${n}] Tool user-requested: ${i.data.toolName} (${i.data.toolCallId})`)})),this._register(t.onToolPartialResult(i=>{this._logService.trace(`[Copilot:${n}] Tool partial result: ${i.data.toolCallId} (${i.data.partialOutput.length} chars)`)})),this._register(t.onToolProgress(i=>{this._logService.trace(`[Copilot:${n}] Tool progress: ${i.data.toolCallId} - ${i.data.progressMessage}`)})),this._register(t.onSkillInvoked(i=>{this._logService.trace(`[Copilot:${n}] Skill invoked: ${i.data.name} (${i.data.path})`)})),this._register(t.onSubagentStarted(i=>{this._logService.trace(`[Copilot:${n}] Subagent started: ${i.data.agentName} (${i.data.agentDisplayName})`)})),this._register(t.onSubagentCompleted(i=>{this._logService.trace(`[Copilot:${n}] Subagent completed: ${i.data.agentName}`)})),this._register(t.onSubagentFailed(i=>{this._logService.error(`[Copilot:${n}] Subagent failed: ${i.data.agentName} - ${i.data.error}`)})),this._register(t.onSubagentSelected(i=>{this._logService.trace(`[Copilot:${n}] Subagent selected: ${i.data.agentName}`)})),this._register(t.onHookStart(i=>{this._logService.trace(`[Copilot:${n}] Hook started: ${i.data.hookType} (${i.data.hookInvocationId})`)})),this._register(t.onHookEnd(i=>{this._logService.trace(`[Copilot:${n}] Hook ended: ${i.data.hookType} (${i.data.hookInvocationId}), success=${i.data.success}`)})),this._register(t.onSystemMessage(i=>{this._logService.trace(`[Copilot:${n}] System message [${i.data.role}]: ${i.data.content.length} chars`)}))}_denyPendingPermissions(){for(let[,t]of this._pendingPermissions)t.complete(!1);this._pendingPermissions.clear()}};jn=P([_e(5,Fn),_e(6,Oe),_e(7,ds)],jn);var $r=class extends A{constructor(t){super();this.session=t;this._register(O(()=>{t.destroy().catch(()=>{})}))}get sessionId(){return this.session.sessionId}get onMessageDelta(){return this._onMessageDelta??=this._sdkEvent("assistant.message_delta")}get onMessage(){return this._onMessage??=this._sdkEvent("assistant.message")}get onToolStart(){return this._onToolStart??=this._sdkEvent("tool.execution_start")}get onToolComplete(){return this._onToolComplete??=this._sdkEvent("tool.execution_complete")}get onIdle(){return this._onIdle??=this._sdkEvent("session.idle")}get onSessionStart(){return this._onSessionStart??=this._sdkEvent("session.start")}get onSessionResume(){return this._onSessionResume??=this._sdkEvent("session.resume")}get onSessionError(){return this._onSessionError??=this._sdkEvent("session.error")}get onSessionInfo(){return this._onSessionInfo??=this._sdkEvent("session.info")}get onSessionModelChange(){return this._onSessionModelChange??=this._sdkEvent("session.model_change")}get onSessionHandoff(){return this._onSessionHandoff??=this._sdkEvent("session.handoff")}get onSessionTruncation(){return this._onSessionTruncation??=this._sdkEvent("session.truncation")}get onSessionSnapshotRewind(){return this._onSessionSnapshotRewind??=this._sdkEvent("session.snapshot_rewind")}get onSessionShutdown(){return this._onSessionShutdown??=this._sdkEvent("session.shutdown")}get onSessionUsageInfo(){return this._onSessionUsageInfo??=this._sdkEvent("session.usage_info")}get onSessionCompactionStart(){return this._onSessionCompactionStart??=this._sdkEvent("session.compaction_start")}get onSessionCompactionComplete(){return this._onSessionCompactionComplete??=this._sdkEvent("session.compaction_complete")}get onUserMessage(){return this._onUserMessage??=this._sdkEvent("user.message")}get onPendingMessagesModified(){return this._onPendingMessagesModified??=this._sdkEvent("pending_messages.modified")}get onTurnStart(){return this._onTurnStart??=this._sdkEvent("assistant.turn_start")}get onIntent(){return this._onIntent??=this._sdkEvent("assistant.intent")}get onReasoning(){return this._onReasoning??=this._sdkEvent("assistant.reasoning")}get onReasoningDelta(){return this._onReasoningDelta??=this._sdkEvent("assistant.reasoning_delta")}get onTurnEnd(){return this._onTurnEnd??=this._sdkEvent("assistant.turn_end")}get onUsage(){return this._onUsage??=this._sdkEvent("assistant.usage")}get onAbort(){return this._onAbort??=this._sdkEvent("abort")}get onToolUserRequested(){return this._onToolUserRequested??=this._sdkEvent("tool.user_requested")}get onToolPartialResult(){return this._onToolPartialResult??=this._sdkEvent("tool.execution_partial_result")}get onToolProgress(){return this._onToolProgress??=this._sdkEvent("tool.execution_progress")}get onSkillInvoked(){return this._onSkillInvoked??=this._sdkEvent("skill.invoked")}get onSubagentStarted(){return this._onSubagentStarted??=this._sdkEvent("subagent.started")}get onSubagentCompleted(){return this._onSubagentCompleted??=this._sdkEvent("subagent.completed")}get onSubagentFailed(){return this._onSubagentFailed??=this._sdkEvent("subagent.failed")}get onSubagentSelected(){return this._onSubagentSelected??=this._sdkEvent("subagent.selected")}get onHookStart(){return this._onHookStart??=this._sdkEvent("hook.start")}get onHookEnd(){return this._onHookEnd??=this._sdkEvent("hook.end")}get onSystemMessage(){return this._onSystemMessage??=this._sdkEvent("system.message")}_sdkEvent(t){let n=this._register(new I),i=this.session.on(t,s=>n.fire(s));return this._register(O(i)),n.event}};var Hn=class extends A{constructor(t,n){super();this._logService=t;this._instantiationService=n;this.id="copilot";this._onDidSessionProgress=this._register(new I);this.onDidSessionProgress=this._onDidSessionProgress.event;this._sessions=this._register(new Ye)}getDescriptor(){return{provider:"copilot",displayName:"Agent Host - Copilot",description:"Copilot SDK agent running in a dedicated process",requiresAuth:!0}}getProtectedResources(){return[{resource:"https://api.github.com",resource_name:"GitHub Copilot",authorization_servers:["https://github.com/login/oauth"],scopes_supported:["read:user","user:email"]}]}async authenticate(t,n){if(t!=="https://api.github.com")return!1;let i=this._githubToken!==n;if(this._githubToken=n,this._logService.info(`[Copilot] Auth token ${i?"updated":"unchanged"}`),i&&this._client&&this._sessions.size===0){this._logService.info("[Copilot] Restarting CopilotClient with new token");let s=this._client;this._client=void 0,this._clientStarting=void 0,await s.stop()}return!0}async _ensureClient(){return this._client?this._client:this._clientStarting?this._clientStarting:(this._clientStarting=(async()=>{this._logService.info(`[Copilot] Starting CopilotClient... ${this._githubToken?"(with token)":"(no token)"}`);let t=Object.assign({},process.env,{ELECTRON_RUN_AS_NODE:"1"});delete t.NODE_OPTIONS,delete t.VSCODE_INSPECTOR_OPTIONS,delete t.VSCODE_ESM_ENTRYPOINT,delete t.VSCODE_HANDLES_UNCAUGHT_ERRORS;for(let c of Object.keys(t))c!=="ELECTRON_RUN_AS_NODE"&&(c.startsWith("VSCODE_")||c.startsWith("ELECTRON_"))&&delete t[c];t.COPILOT_CLI_RUN_AS_NODE="1",t.USE_BUILTIN_RIPGREP="0";let n=m.joinPath(Ct.asFileUri(""),"..","node_modules","@github","copilot","index.js").fsPath,i=bh.replace(/\bnode_modules\.asar\b/,"node_modules.asar.unpacked"),s=be(i),o=Object.keys(t).find(c=>c.toUpperCase()==="PATH")??"PATH",a=t[o];t[o]=a?`${a}${fo}${s}`:s,this._logService.info(`[Copilot] Resolved CLI path: ${n}`);let l=new vh({githubToken:this._githubToken,useLoggedInUser:!this._githubToken,useStdio:!0,autoStart:!0,env:t,cliPath:n});return await l.start(),this._logService.info("[Copilot] CopilotClient started successfully"),this._client=l,this._clientStarting=void 0,l})(),this._clientStarting)}async listSessions(){this._logService.info("[Copilot] Listing sessions...");let i=(await(await this._ensureClient()).listSessions()).map(s=>({session:ae.uri(this.id,s.sessionId),startTime:s.startTime.getTime(),modifiedTime:s.modifiedTime.getTime(),summary:s.summary,workingDirectory:typeof s.context?.cwd=="string"?m.file(s.context.cwd):void 0}));return this._logService.info(`[Copilot] Found ${i.length} sessions`),i}async listModels(){this._logService.info("[Copilot] Listing models...");let i=(await(await this._ensureClient()).listModels()).map(s=>({provider:this.id,id:s.id,name:s.name,maxContextWindow:s.capabilities.limits.max_context_window_tokens,supportsVision:s.capabilities.supports.vision,supportsReasoningEffort:s.capabilities.supports.reasoningEffort,supportedReasoningEfforts:s.supportedReasoningEfforts,defaultReasoningEffort:s.defaultReasoningEffort,policyState:s.policy?.state,billingMultiplier:s.billing?.multiplier}));return this._logService.info(`[Copilot] Found ${i.length} models`),i}async createSession(t){this._logService.info(`[Copilot] Creating session... ${t?.model?`model=${t.model}`:""}`);let n=await this._ensureClient(),i=async a=>{let l=await n.createSession({model:t?.model,sessionId:t?.session?ae.id(t.session):void 0,streaming:!0,workingDirectory:t?.workingDirectory?.fsPath,onPermissionRequest:a.onPermissionRequest,hooks:a.hooks});return new $r(l)},s=this._createAgentSession(i,t?.workingDirectory,t?.session?ae.id(t.session):void 0);await s.initializeSession();let o=s.sessionUri;return this._logService.info(`[Copilot] Session created: ${o.toString()}`),o}async sendMessage(t,n,i){let s=ae.id(t);await(this._sessions.get(s)??await this._resumeSession(s)).send(n,i)}setPendingMessages(t,n,i){let s=ae.id(t),o=this._sessions.get(s);if(!o){this._logService.warn(`[Copilot:${s}] setPendingMessages: session not found`);return}n&&o.sendSteering(n)}async getSessionMessages(t){let n=ae.id(t),i=this._sessions.get(n)??await this._resumeSession(n).catch(()=>{});return i?i.getMessages():[]}async disposeSession(t){let n=ae.id(t);this._sessions.deleteAndDispose(n)}async abortSession(t){let n=ae.id(t),i=this._sessions.get(n);i&&await i.abort()}async changeModel(t,n){let i=ae.id(t),s=this._sessions.get(i);s&&await s.setModel(n)}async shutdown(){this._logService.info("[Copilot] Shutting down..."),this._sessions.clearAndDisposeAll(),await this._client?.stop(),this._client=void 0}respondToPermissionRequest(t,n){for(let[,i]of this._sessions)if(i.respondToPermissionRequest(t,n))return}hasSession(t){return this._sessions.has(ae.id(t))}_createAgentSession(t,n,i){let s=i??Ge(),o=ae.uri(this.id,s),a=this._instantiationService.createInstance(jn,o,s,n,this._onDidSessionProgress,t);return this._sessions.set(s,a),a}async _resumeSession(t){this._logService.info(`[Copilot:${t}] Session not in memory, resuming...`);let n=await this._ensureClient(),i=async o=>{let a=await n.resumeSession(t,{onPermissionRequest:o.onPermissionRequest,workingDirectory:void 0,hooks:o.hooks});return new $r(a)},s=this._createAgentSession(i,void 0,t);return await s.initializeSession(),s}dispose(){this._client?.stop().catch(()=>{}),super.dispose()}};Hn=P([_e(0,Oe),_e(1,Oi)],Hn);var yh=1e3;function Is(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ra(r,e,t,n){return{jsonrpc:"2.0",id:r,error:{code:e,message:t,...n!==void 0?{data:n}:{}}}}function Ts(r,e){if(e instanceof X)return Ra(r,e.code,e.message,e.data);let t=e instanceof Error?e.stack??e.message:String(e);return Ra(r,Nn,t)}var Gn=class extends A{constructor(t,n,i,s,o){super();this._agentService=t;this._stateManager=n;this._server=i;this._config=s;this._logService=o;this._clients=new Map;this._replayBuffer=[];this._onDidChangeConnectionCount=this._register(new I);this.onDidChangeConnectionCount=this._onDidChangeConnectionCount.event;this._requestHandlers={subscribe:async(t,n)=>{try{let i=await this._agentService.subscribe(m.parse(n.resource));return t.subscriptions.add(n.resource),{snapshot:i}}catch(i){throw i instanceof X?i:new X(Mn,`Resource not found: ${n.resource}`)}},createSession:async(t,n)=>{let i;try{i=await this._agentService.createSession({provider:n.provider,model:n.model,workingDirectory:n.workingDirectory?m.parse(n.workingDirectory):void 0,session:m.parse(n.session)})}catch(s){throw s instanceof X?s:new X(cu,s instanceof Error?s.message:String(s))}return i.toString()!==m.parse(n.session).toString()&&this._logService.warn(`[ProtocolServer] createSession: provider returned URI ${i.toString()} but client requested ${n.session}`),null},disposeSession:async(t,n)=>(await this._agentService.disposeSession(m.parse(n.session)),null),writeFile:async(t,n)=>this._agentService.writeFile(n),listSessions:async()=>({items:(await this._agentService.listSessions()).map(i=>({resource:i.session.toString(),provider:ae.provider(i.session)??"copilot",title:i.summary??"Session",status:"idle",createdAt:i.startTime,modifiedAt:i.modifiedTime,workingDirectory:i.workingDirectory?.toString()}))}),fetchTurns:async(t,n)=>{let i=this._stateManager.getSessionState(n.session);if(!i)throw new X(Mn,`Session not found: ${n.session}`);let s=i.turns,o=Math.min(n.limit??50,100),a=s.length;if(n.before){let c=s.findIndex(d=>d.id===n.before);c!==-1&&(a=c)}let l=Math.max(0,a-o);return{turns:s.slice(l,a),hasMore:l>0}},browseDirectory:async(t,n)=>this._agentService.browseDirectory(m.parse(n.uri)),fetchContent:async(t,n)=>this._agentService.fetchContent(m.parse(n.uri))};this._register(this._server.onConnection(a=>{this._handleNewConnection(a)})),this._register(this._stateManager.onDidEmitEnvelope(a=>{this._replayBuffer.push(a),this._replayBuffer.length>yh&&this._replayBuffer.shift(),this._broadcastAction(a)})),this._register(this._stateManager.onDidEmitNotification(a=>{this._broadcastNotification(a)}))}_handleNewConnection(t){let n=new D,i;n.add(t.onMessage(s=>{if(du(s)){if(this._logService.trace(`[ProtocolServer] request: method=${s.method} id=${s.id}`),!i&&s.method==="initialize"){try{let o=this._handleInitialize(s.params,t,n);i=o.client,t.send(Is(s.id,o.response))}catch(o){t.send(Ts(s.id,o))}return}if(!i&&s.method==="reconnect"){try{let o=this._handleReconnect(s.params,t,n);i=o.client,t.send(Is(s.id,o.response))}catch(o){t.send(Ts(s.id,o))}return}if(!i)return;this._handleRequest(i,s.method,s.params,s.id)}else if(pu(s))switch(this._logService.trace(`[ProtocolServer] notification: method=${s.method}`),s.method){case"unsubscribe":i&&i.subscriptions.delete(s.params.resource);break;case"dispatchAction":if(i){this._logService.trace(`[ProtocolServer] dispatchAction: ${JSON.stringify(s.params.action.type)}`);let o=s.params.action;this._agentService.dispatchAction(o,i.clientId,s.params.clientSeq)}break}})),n.add(t.onClose(()=>{i&&this._clients.get(i.clientId)===i&&(this._logService.info(`[ProtocolServer] Client disconnected: ${i.clientId}`),this._clients.delete(i.clientId),this._onDidChangeConnectionCount.fire(this._clients.size)),n.dispose()})),n.add(t)}_handleInitialize(t,n,i){if(this._logService.info(`[ProtocolServer] Initialize: clientId=${t.clientId}, version=${t.protocolVersion}`),t.protocolVersion<1)throw new X(uu,`Client protocol version ${t.protocolVersion} is below minimum ${1}`);let s={clientId:t.clientId,protocolVersion:t.protocolVersion,transport:n,subscriptions:new Set,disposables:i};this._clients.set(t.clientId,s),this._onDidChangeConnectionCount.fire(this._clients.size);let o=[];if(t.initialSubscriptions)for(let a of t.initialSubscriptions){let l=this._stateManager.getSnapshot(a);l&&(o.push(l),s.subscriptions.add(a.toString()))}return{client:s,response:{protocolVersion:1,serverSeq:this._stateManager.serverSeq,snapshots:o,defaultDirectory:this._config.defaultDirectory}}}_handleReconnect(t,n,i){this._logService.info(`[ProtocolServer] Reconnect: clientId=${t.clientId}, lastSeenSeq=${t.lastSeenServerSeq}`);let s={clientId:t.clientId,protocolVersion:1,transport:n,subscriptions:new Set,disposables:i};this._clients.set(t.clientId,s),this._onDidChangeConnectionCount.fire(this._clients.size);let o=this._replayBuffer.length>0?this._replayBuffer[0].serverSeq:this._stateManager.serverSeq;if(t.lastSeenServerSeq>=o){let l=[];for(let c of t.subscriptions)s.subscriptions.add(c.toString());for(let c of this._replayBuffer)c.serverSeq>t.lastSeenServerSeq&&this._isRelevantToClient(s,c)&&l.push(c);return{client:s,response:{type:"replay",actions:l}}}else{let l=[];for(let c of t.subscriptions){let d=this._stateManager.getSnapshot(c);d&&(l.push(d),s.subscriptions.add(c))}return{client:s,response:{type:"snapshot",snapshots:l}}}}_handleRequest(t,n,i,s){let o=this._requestHandlers.hasOwnProperty(n)?this._requestHandlers[n]:void 0;if(o){o(t,i).then(l=>{this._logService.trace(`[ProtocolServer] Request '${n}' id=${s} succeeded`),t.transport.send(Is(s,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Request '${n}' failed`,l),t.transport.send(Ts(s,l))});return}let a=this._handleExtensionRequest(n,i);if(a){a.then(l=>{t.transport.send(Is(s,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Extension request '${n}' failed`,l),t.transport.send(Ts(s,l))});return}t.transport.send(Ra(s,Nn,`Unknown method: ${n}`))}_handleExtensionRequest(t,n){switch(t){case"getResourceMetadata":return this._agentService.getResourceMetadata();case"authenticate":{let i=n;return!i||typeof i.resource!="string"||typeof i.token!="string"?Promise.reject(new X(-32602,"Invalid authenticate params")):this._agentService.authenticate(i)}case"refreshModels":return this._agentService.refreshModels();case"listAgents":return this._agentService.listAgents();case"shutdown":return this._agentService.shutdown();default:return}}_broadcastAction(t){this._logService.trace(`[ProtocolServer] Broadcasting action: ${t.action.type}`);let n={jsonrpc:"2.0",method:"action",params:t};for(let i of this._clients.values())this._isRelevantToClient(i,t)&&i.transport.send(n)}_broadcastNotification(t){let n={jsonrpc:"2.0",method:"notification",params:{notification:t}};for(let i of this._clients.values())i.transport.send(n)}_isRelevantToClient(t,n){let i=n.action;return i.type.startsWith("root/")?t.subscriptions.has(Yi):Qi(i)?t.subscriptions.has(i.session):!1}dispose(){for(let t of this._clients.values())t.disposables.dispose();this._clients.clear(),this._replayBuffer.length=0,super.dispose()}};Gn=P([_e(4,Oe)],Gn);var wa=class extends A{constructor(t,n){super();this._ws=t;this._WebSocket=n;this._onMessage=this._register(new I);this.onMessage=this._onMessage.event;this._onClose=this._register(new I);this.onClose=this._onClose.event;this._ws.on("message",i=>{try{let s=typeof i=="string"?i:i.toString("utf-8"),o=JSON.parse(s);this._onMessage.fire(o)}catch{this.send({jsonrpc:"2.0",id:null,error:{code:lu,message:"Parse error"}})}}),this._ws.on("close",()=>{this._onClose.fire()}),this._ws.on("error",()=>{this._onClose.fire()})}send(t){this._ws.readyState===this._WebSocket.OPEN&&this._ws.send(JSON.stringify(t))}dispose(){this._ws.close(),super.dispose()}},Ss=class r extends A{constructor(t,n,i,s,o){super();this._logService=n;this._onConnection=this._register(new I);this.onConnection=this._onConnection.event;this._WebSocket=i.WebSocket;let a=typeof t=="number"?{port:t}:t,l=a.host??"127.0.0.1",c=a.connectionTokenValidate?(d,u)=>{let h=o.parse(d.req.url??"",!0).query[xo];if(!a.connectionTokenValidate(h)){this._logService.warn("[WebSocketProtocol] Connection rejected: invalid connection token"),u(!1,403,"Forbidden");return}u(!0)}:void 0;a.socketPath?(this._httpServer=s.createServer(),this._wss=new i.WebSocketServer({server:this._httpServer,verifyClient:c}),this._httpServer.listen(a.socketPath,()=>{this._logService.info(`[WebSocketProtocol] Server listening on socket ${a.socketPath}`)})):(this._wss=new i.WebSocketServer({port:a.port,host:l,verifyClient:c}),this._logService.info(`[WebSocketProtocol] Server listening on ${l}:${a.port}`)),this._wss.on("connection",d=>{this._logService.trace("[WebSocketProtocol] New client connection");let u=new wa(d,this._WebSocket);this._onConnection.fire(u)}),this._wss.on("error",d=>{this._logService.error("[WebSocketProtocol] Server error",d)})}get address(){let t=this._wss.address();return!t||typeof t=="string"?t??void 0:`${t.address}:${t.port}`}static async create(t,n){let[i,s,o]=await Promise.all([import("ws"),import("http"),import("url")]);return new r(t,n,i,s,o)}dispose(){this._wss.close(),this._httpServer?.close(),super.dispose()}};import{homedir as wh,tmpdir as Ch}from"os";var Ih=60,Th=Ih*60,Ca=Th*24,Q4=Ca*7,J4=Ca*30,Y4=Ca*365;function $u(r){return r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+(r.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var Ku=/^([^.]+\..+)[:=](.+)$/,M=class{constructor(e,t,n){this._args=e;this.paths=t;this.productService=n}get appRoot(){return be(Ct.asFileUri("").fsPath)}get userHome(){return m.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return m.file(J(this.userDataPath,"User"))}get tmpDir(){return m.file(this.paths.tmpDir)}get cacheHome(){return m.file(this.userDataPath)}get stateResource(){return oe(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:Y.vscodeUserData})}get userDataSyncHome(){return oe(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let e=$u(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=J(this.userDataPath,"logs",e)}return m.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return oe(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return oe(this.appSettingsHome,"History")}get keyboardLayoutResource(){return oe(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let e=ie.VSCODE_PORTABLE;return e?m.file(J(e,"argv.json")):oe(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return m.file(J(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let e=this.args["builtin-extensions-dir"];return e?qt(e):Me(J(Ct.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let e=this.args["extensions-download-dir"];return e?m.file(qt(e)):m.file(J(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let e=this.args["extensions-dir"];if(e)return qt(e);let t=ie.VSCODE_EXTENSIONS;if(t)return t;let n=ie.VSCODE_PORTABLE;return n?J(n,"extensions"):oe(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let e=this.args["agent-plugins-dir"];if(e)return qt(e);let t=ie.VSCODE_AGENT_PLUGINS;if(t)return t;let n=ie.VSCODE_PORTABLE;return n?J(n,"agent-plugins"):oe(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let e=this.args.extensionDevelopmentPath;if(Array.isArray(e))return e.map(t=>/^[^:/?#]+?:\/\//.test(t)?m.parse(t):m.file(Me(t)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(e=>e==="ui"||e==="workspace"||e==="web"?e:"workspace")}get extensionTestsLocationURI(){let e=this.args.extensionTestsPath;if(e)return/^[^:/?#]+?:\/\//.test(e)?m.parse(e):m.file(Me(e))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let e=this.args["disable-extension"];if(e){if(typeof e=="string")return[e];if(Array.isArray(e)&&e.length>0)return e}return!1}get debugExtensionHost(){return Sh(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!ie.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(e=>!Ku.test(e))}get extensionLogLevel(){let e=[];for(let t of this.args.log||[]){let n=Ku.exec(t);n?.[1]&&n[2]&&e.push([n[1],n[2]])}return e.length?e:void 0}get serviceMachineIdResource(){return oe(m.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let e=ie.VSCODE_PORTABLE;return e?m.file(J(e,"policy.json")):oe(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return oe(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(e){this.args.continueOn=e}get args(){return this._args}};P([B],M.prototype,"appRoot",1),P([B],M.prototype,"userHome",1),P([B],M.prototype,"userDataPath",1),P([B],M.prototype,"appSettingsHome",1),P([B],M.prototype,"tmpDir",1),P([B],M.prototype,"cacheHome",1),P([B],M.prototype,"stateResource",1),P([B],M.prototype,"userRoamingDataHome",1),P([B],M.prototype,"userDataSyncHome",1),P([B],M.prototype,"sync",1),P([B],M.prototype,"workspaceStorageHome",1),P([B],M.prototype,"localHistoryHome",1),P([B],M.prototype,"keyboardLayoutResource",1),P([B],M.prototype,"argvResource",1),P([B],M.prototype,"isExtensionDevelopment",1),P([B],M.prototype,"untitledWorkspacesHome",1),P([B],M.prototype,"builtinExtensionsPath",1),P([B],M.prototype,"extensionsDownloadLocation",1),P([B],M.prototype,"extensionsPath",1),P([B],M.prototype,"agentPluginsPath",1),P([B],M.prototype,"extensionDevelopmentLocationURI",1),P([B],M.prototype,"extensionDevelopmentKind",1),P([B],M.prototype,"extensionTestsLocationURI",1),P([B],M.prototype,"debugExtensionHost",1),P([B],M.prototype,"logLevel",1),P([B],M.prototype,"extensionLogLevel",1),P([B],M.prototype,"serviceMachineIdResource",1),P([B],M.prototype,"disableTelemetry",1),P([B],M.prototype,"disableExperiments",1),P([B],M.prototype,"disableWorkspaceTrust",1),P([B],M.prototype,"useInMemorySecretStorage",1),P([B],M.prototype,"policyFile",1),P([B],M.prototype,"agentSessionsWorkspace",1);function Sh(r,e){return zu(r["inspect-extensions"],r["inspect-brk-extensions"],5870,e,r.debugId,r.extensionEnvironment)}function zu(r,e,t,n,i,s){let a=Number(e||r)||(n?null:t),l=a?!!e:!1,c;if(s)try{c=JSON.parse(s)}catch{}return{port:a,break:l,debugId:i,env:c}}import{homedir as ju}from"os";import{resolve as _h,isAbsolute as xh,join as Qn}from"path";var Eh=process.env.VSCODE_CWD||process.cwd();function Hu(r,e){let t=Rh(r,e),n=[t];return xh(t)||n.unshift(Eh),_h(...n)}function Rh(r,e){process.env.VSCODE_DEV&&(process.isEmbeddedApp?e="sessions-oss-dev":e="code-oss-dev");let t=process.env.VSCODE_PORTABLE;if(t)return Qn(t,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Qn(n,e);let i=r["user-data-dir"];if(i)return i;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let s=process.env.USERPROFILE;if(typeof s!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Qn(s,"AppData","Roaming")}break;case"darwin":n=Qn(ju(),"Library","Application Support");break;case"linux":n=process.env.XDG_CONFIG_HOME||Qn(ju(),".config");break;default:throw new Error("Platform not supported")}return Qn(n,e)}var _s=class extends M{constructor(e,t){super(e,{homeDir:wh(),tmpDir:Ch(),userDataDir:Hu(e,t.nameShort)},t)}};import Ph from"minimist";var bx={o:f(1944,null),e:f(1928,null),t:f(1959,null),m:f(1939,null)};var Gu={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:f(1948,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:f(1915,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:f(1911,null)},maximize:{type:"boolean",cat:"o",description:f(1914,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:f(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:f(1942,null)},profile:{type:"string",cat:"o",args:"profileName",description:f(1947,null)},help:{type:"boolean",alias:"h",description:f(1930,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:f(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:f(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:f(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:f(1920,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:f(1940,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:f(1910,null)},remove:{type:"boolean",cat:"o",args:"folder",description:f(1949,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:f(1929,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:f(1941,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:f(1950,null)},sessions:{type:"boolean",cat:"o",description:f(1952,null)},wait:{type:"boolean",cat:"o",alias:"w",description:f(1969,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:f(1936,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:f(1966,null)},profile:{type:"string",cat:"o",args:"profileName",description:f(1947,null)},help:{type:"boolean",cat:"o",alias:"h",description:f(1930,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:f(1917,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:f(1927,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:f(1935,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:f(1953,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:f(1913,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:f(1934,null)},"pre-release":{type:"boolean",cat:"e",description:f(1933,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:f(1961,null)},"update-extensions":{type:"boolean",cat:"e",description:f(1964,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:f(1926,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:f(1912,null)},version:{type:"boolean",cat:"t",alias:"v",description:f(1968,null)},verbose:{type:"boolean",cat:"t",global:!0,description:f(1967,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:f(1938,null)},status:{type:"boolean",alias:"s",cat:"t",description:f(1954,null)},"prof-startup":{type:"boolean",cat:"t",description:f(1946,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:f(1923,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:f(1922,null)},sync:{type:"string",cat:"t",description:f(1960,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:f(1932,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:f(1931,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:f(1925,null)},"disable-gpu":{type:"boolean",cat:"t",description:f(1924,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:f(1921,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:f(1937,null)},telemetry:{type:"boolean",cat:"t",description:f(1957,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},transient:{type:"boolean",cat:"t",description:f(1958,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},Dh={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function Pa(r,e,t=Dh){let n=r.find((p,h)=>p.length>0&&p[0]!=="-"&&e.hasOwnProperty(p)&&e[p].type==="subcommand"),i={},s=["_"],o=[],a={},l;for(let p in e){let h=e[p];h.type==="subcommand"?p===n&&(l=h):(h.alias&&(i[p]=h.alias),h.type==="string"||h.type==="string[]"?(s.push(p),h.deprecates&&s.push(...h.deprecates)):h.type==="boolean"&&(o.push(p),h.deprecates&&o.push(...h.deprecates)),h.global&&(a[p]=h))}if(l&&n){let p=a;for(let W in l.options)p[W]=l.options[W];let h=r.filter(W=>W!==n),g=t.getSubcommandReporter?t.getSubcommandReporter(n):void 0,b=Pa(h,p,g);return{[n]:b,_:[]}}let c=Ph(r,{string:s,boolean:o,alias:i}),d={},u=c;d._=c._.map(p=>String(p)).filter(p=>p.length>0),delete u._;for(let p in e){let h=e[p];if(h.type==="subcommand")continue;h.alias&&delete u[h.alias];let g=u[p];if(h.deprecates)for(let b of h.deprecates)u.hasOwnProperty(b)&&(g||(g=u[b],g&&t.onDeprecatedOption(b,h.deprecationMessage||f(1919,null,p))),delete u[b]);if(typeof g<"u"){if(h.type==="string[]"){if(Array.isArray(g)||(g=[g]),!h.allowEmptyValue){let b=g.filter(W=>W.length>0);b.length!==g.length&&(t.onEmptyValue(p),g=b.length>0?b:void 0)}}else h.type==="string"&&(Array.isArray(g)?(g=g.pop(),t.onMultipleValues(p,g)):!g&&!h.allowEmptyValue&&(t.onEmptyValue(p),g=void 0));d[p]=g,h.deprecationMessage&&t.onDeprecatedOption(p,h.deprecationMessage)}delete u[p]}for(let p in u)t.onUnknownOption(p);return d}var xs=class extends A{constructor(e,t=[]){super(),this.logger=new cs([e,...t]),this._register(e.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}flush(){this.logger.flush()}};async function kh(r,e,t,n,i){try{let s=await import("@vscode/spdlog");s.setFlushOn(0);let o=await s.createAsyncRotatingLogger(r,e,t,n);return i?o.clearFormatters():o.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),o}catch(s){console.error(s)}return null}function Qu(r,e,t){switch(e){case 1:r.trace(t);break;case 2:r.debug(t);break;case 3:r.info(t);break;case 4:r.warn(t);break;case 5:r.error(t);break;case 0:break;default:throw new Error(`Invalid log level ${e}`)}}function Ju(r,e){switch(e){case 1:r.setLevel(0);break;case 2:r.setLevel(1);break;case 3:r.setLevel(2);break;case 4:r.setLevel(3);break;case 5:r.setLevel(4);break;case 0:r.setLevel(6);break;default:throw new Error(`Invalid log level ${e}`)}}var Es=class extends Nr{constructor(t,n,i,s,o){super();this.buffer=[];this.setLevel(o),this._loggerCreationPromise=this._createSpdLogLogger(t,n,i,s),this._register(this.onDidChangeLogLevel(a=>{this._logger&&Ju(this._logger,a)}))}async _createSpdLogLogger(t,n,i,s){let o=i?6:1,a=30/o*zi.MB,l=await kh(t,n,a,o,s);if(l){this._logger=l,Ju(this._logger,this.getLevel());for(let{level:c,message:d}of this.buffer)Qu(this._logger,c,d);this.buffer=[]}}log(t,n){this._logger?Qu(this._logger,t,n):this.getLevel()<=t&&this.buffer.push({level:t,message:n})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}};var Rs=class extends Mr{doCreateLogger(e,t,n){return new Es(Ge(),e.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,t)}};var ws=class{constructor(e,t){this.loggerService=e;this.getUriTransformer=t}listen(e,t){let n=this.getUriTransformer(e);switch(t){case"onDidChangeLoggers":return V.map(this.loggerService.onDidChangeLoggers,i=>({added:[...i.added].map(s=>this.transformLogger(s,n)),removed:[...i.removed].map(s=>this.transformLogger(s,n))}));case"onDidChangeVisibility":return V.map(this.loggerService.onDidChangeVisibility,i=>[n.transformOutgoingURI(i[0]),i[1]]);case"onDidChangeLogLevel":return V.map(this.loggerService.onDidChangeLogLevel,i=>Ia(i)?i:[n.transformOutgoingURI(i[0]),i[1]])}throw new Error(`Event not found: ${t}`)}async call(e,t,n){let i=this.getUriTransformer(e);switch(t){case"setLogLevel":return Ia(n[0])?this.loggerService.setLogLevel(n[0]):this.loggerService.setLogLevel(m.revive(i.transformIncoming(n[0][0])),n[0][1]);case"getRegisteredLoggers":return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(s=>this.transformLogger(s,i)))}throw new Error(`Call not found: ${t}`)}transformLogger(e,t){return{...e,resource:t.transformOutgoingURI(e.resource)}}};var Yu=new class{transformIncoming(r){return r}transformOutgoing(r){return r}transformOutgoingURI(r){return r}transformOutgoingScheme(r){return r}};var Ie,Da=globalThis.vscode;if(typeof Da<"u"&&typeof Da.context<"u"){let r=Da.context.configuration();if(r)Ie=r.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(Ie=globalThis._VSCODE_PRODUCT_JSON,ie.VSCODE_DEV&&Object.assign(Ie,{nameShort:`${Ie.nameShort} Dev`,nameLong:`${Ie.nameLong} Dev`,dataFolderName:`${Ie.dataFolderName}-dev`,serverDataFolderName:Ie.serverDataFolderName?`${Ie.serverDataFolderName}-dev`:void 0}),!Ie.version){let r=globalThis._VSCODE_PACKAGE_JSON;Object.assign(Ie,{version:r.version})}Object.assign(Ie,{extensionsGallery:ie.EXTENSIONS_GALLERY?JSON.parse(ie.EXTENSIONS_GALLERY):Ie.extensionsGallery||{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item",extensionUrlTemplate:"https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",resourceUrlTemplate:"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",controlUrl:"",recommendationsUrl:""},telemetryEndpoint:ie.CS_TELEMETRY_URL||Ie.telemetryEndpoint||"https://v1.telemetry.coder.com/track"})}else Ie={nameShort:"code-server",nameLong:"code-server",applicationName:"code-server",dataFolderName:".code-server",win32MutexName:"codeserver",licenseName:"MIT",licenseUrl:"https://github.com/coder/code-server/blob/main/LICENSE",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"code-server",win32NameVersion:"code-server",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"coder.code-server",win32ShellNameShort:"c&ode-server",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.coder.code.server",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"com.coder.code.server",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/coder/code-server/issues/new",nodejsRepository:"https://nodejs.org",urlProtocol:"code-oss",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.112.0",sha256:"c24322931434940938f8cf76ebc3dac1e95a5539b9625b165b6672d7f7eafea8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE.com"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",completionsRefreshTokenCommand:"github.copilot.signIn",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry"},trustedExtensionAuthAccess:["vscode.git","vscode.github","github.vscode-pull-request-github","github.copilot","github.copilot-chat"],enableTelemetry:!0,quality:"stable",codeServerVersion:"4.114.1",documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",linkProtectionTrustedDomains:["https://open-vsx.org"],aiConfig:{ariaKey:"code-server"},version:"1.114.0",commit:"4af6408e399e2f795e98b043fd30c16ba31ab0c6",date:"2026-04-01T09:27:11Z"},Object.keys(Ie).length===0&&Object.assign(Ie,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var Xu=Ie;function Aa(r){let e=[];typeof r=="number"&&e.push("code/timeOrigin",r);function t(s,o){e.push(s,o?.startTime??Date.now())}function n(){let s=[];for(let o=0;o=0;o-=2)typeof e[o]=="string"&&e[o].startsWith(s)&&e.splice(o,2)}return{mark:t,getMarks:n,clearMarks:i}}function Lh(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?Aa():{mark(r,e){performance.mark(r,e)},clearMarks(r){let e=new Set;for(let t of performance.getEntriesByType("mark"))t.name.startsWith(r)&&e.add(t.name);for(let t of e)performance.clearMarks(t)},getMarks(){let r=performance.timeOrigin;typeof r!="number"&&(r=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let e=[{name:"code/timeOrigin",startTime:Math.round(r)}];for(let t of performance.getEntriesByType("mark"))e.push({name:t.name,startTime:Math.round(r+t.startTime)});return e}};if(typeof process=="object"){let r=performance?.timeOrigin;return Aa(r)}else return console.trace("perf-util loaded in UNKNOWN environment"),Aa()}function Oh(r){return r.MonacoPerformanceMarks||(r.MonacoPerformanceMarks=Lh()),r.MonacoPerformanceMarks}var ka=Oh(globalThis),Zu=ka.mark,i5=ka.clearMarks,s5=ka.getMarks;async function Cs(r,e,t,n,i,s){let o;try{await Fh(r,e,t,n,i,s)}catch(a){o=a}finally{o&&i.errorTransformer&&(o=i.errorTransformer(o)),typeof o<"u"&&t.error(o),t.end()}}async function Fh(r,e,t,n,i,s){La(s);let o=await r.open(e,{create:!1});try{La(s);let a=0,l=0,c=i&&typeof i.length=="number"?i.length:void 0,d=x.alloc(Math.min(i.bufferSize,typeof c=="number"?c:i.bufferSize)),u=i&&typeof i.position=="number"?i.position:0,p=0;do l=await r.read(o,u,d.buffer,p,d.byteLength-p),u+=l,p+=l,a+=l,typeof c=="number"&&(c-=l),p===d.byteLength&&(await t.write(n(d)),d=x.alloc(Math.min(i.bufferSize,typeof c=="number"?c:i.bufferSize)),p=0);while(l>0&&(typeof c!="number"||c>0)&&La(s)&&Uh(a,i));if(p>0){let h=p;typeof c=="number"&&(h=Math.min(p,c)),t.write(n(d.slice(0,h)))}}catch(a){throw gt(a)}finally{await r.close(o)}}function La(r){if(r.isCancellationRequested)throw Qr();return!0}function Uh(r,e){if(typeof e?.limits?.size=="number"&&r>e.limits.size)throw Qe(f(2128,null),"EntryTooLarge");return!0}var kt=class extends A{constructor(t){super();this.logService=t;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new I);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new I);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new I);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new I);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new I);this._onDidUncorrelatedFilesChange=this._register(new I);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new I);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new vn)}registerProvider(t,n){if(this.provider.has(t))throw new Error(`A filesystem provider for the scheme '${t}' is already registered.`);Zu(`code/registerFilesystem/${t}`);let i=new D;return this.provider.set(t,n),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:t,provider:n}),i.add(n.onDidChangeFile(s=>{let o=new Ki(s,!this.isPathCaseSensitive(n));this.internalOnDidFilesChange.fire(o),o.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(o)})),typeof n.onDidWatchError=="function"&&i.add(n.onDidWatchError(s=>this._onDidWatchError.fire(new Error(s)))),i.add(n.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:n,scheme:t}))),O(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:t,provider:n}),this.provider.delete(t),Ee(i)})}getProvider(t){return this.provider.get(t)}async activateProvider(t){let n=[];this._onWillActivateFileSystemProvider.fire({scheme:t,join(i){n.push(i)}}),!this.provider.has(t)&&await Gt.settled(n)}async canHandleResource(t){return await this.activateProvider(t.scheme),this.hasProvider(t)}hasProvider(t){return this.provider.has(t.scheme)}hasCapability(t,n){let i=this.provider.get(t.scheme);return!!(i&&i.capabilities&n)}listCapabilities(){return nr.map(this.provider,([t,n])=>({scheme:t,capabilities:n.capabilities}))}async withProvider(t){if(!sc(t))throw new ce(f(2117,null,this.resourceForError(t)),8);await this.activateProvider(t.scheme);let n=this.provider.get(t.scheme);if(!n){let i=new Je;throw i.message=f(2119,null,t.toString()),i}return n}async withReadProvider(t){let n=await this.withProvider(t);if(ht(n)||Ne(n)||ji(n))return n;throw new Error(`Filesystem provider for scheme '${t.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(t){let n=await this.withProvider(t);if(ht(n)||Ne(n))return n;throw new Error(`Filesystem provider for scheme '${t.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(t,n){try{return await this.doResolveFile(t,n)}catch(i){throw tn(i)==="EntryNotFound"?new ce(f(2114,null,this.resourceForError(t)),1):gt(i)}}async doResolveFile(t,n){let i=await this.withProvider(t),s=this.isPathCaseSensitive(i),o=n?.resolveTo,a=n?.resolveSingleChildDescendants,l=n?.resolveMetadata,c=await i.stat(t),d;return this.toFileStat(i,t,c,void 0,!!l,(u,p)=>(d||(d=Dt.forUris(()=>!s),d.set(t,!0),o&&d.fill(!0,o)),d.get(u.resource)||d.findSuperstr(u.resource.with({query:null,fragment:null}))?!0:u.isDirectory&&a?p===1:!1))}async toFileStat(t,n,i,s,o,a){let{providerExtUri:l}=this.getExtUri(t),c={resource:n,name:l.basename(n),isFile:(i.type&1)!==0,isDirectory:(i.type&2)!==0,isSymbolicLink:(i.type&64)!==0,mtime:i.mtime,ctime:i.ctime,size:i.size,readonly:!!((i.permissions??0)&1)||!!(t.capabilities&2048),locked:!!((i.permissions??0)&2),executable:!!((i.permissions??0)&4),etag:ra({mtime:i.mtime,size:i.size}),children:void 0};if(c.isDirectory&&a(c,s)){try{let d=await t.readdir(n),u=await Gt.settled(d.map(async([p,h])=>{try{let g=l.joinPath(n,p),b=o?await t.stat(g):{type:h};return await this.toFileStat(t,g,b,d.length,o,a)}catch(g){return this.logService.trace(g),null}}));c.children=Yr(u)}catch(d){this.logService.trace(d),c.children=[]}return c}return c}async resolveAll(t){return Gt.settled(t.map(async n=>{try{return{stat:await this.doResolveFile(n.resource,n.options),success:!0}}catch(i){return this.logService.trace(i),{stat:void 0,success:!1}}}))}async stat(t){let n=await this.withProvider(t),i=await n.stat(t);return this.toFileStat(n,t,i,void 0,!0,()=>!1)}async realpath(t){let n=await this.withProvider(t);if(iu(n)){let i=await n.realpath(t);return t.with({path:i})}}async exists(t){let n=await this.withProvider(t);try{return!!await n.stat(t)}catch{return!1}}async canCreateFile(t,n){try{await this.doValidateCreateFile(t,n)}catch(i){return i}return!0}async doValidateCreateFile(t,n){if(!n?.overwrite&&await this.exists(t))throw new ce(f(2110,null,this.resourceForError(t)),3,n)}async createFile(t,n=x.fromString(""),i){await this.doValidateCreateFile(t,i);let s=await this.writeFile(t,n);return this._onDidRunOperation.fire(new ft(t,0,s)),s}async writeFile(t,n,i){let s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),{providerExtUri:o}=this.getExtUri(s),a=i;if(ta(s)&&!a?.atomic){let l=s.enforceAtomicWriteFile?.(t);l&&(a={...i,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(s,t,n,a);l||await this.mkdirp(s,o.dirname(t)),c||(c=await this.peekBufferForWriting(s,n)),!ht(s)||Ne(s)&&c instanceof x||Ne(s)&&ta(s)&&a?.atomic?await this.doWriteUnbuffered(s,t,a,c):await this.doWriteBuffered(s,t,a,c instanceof x?vc(c):c),this._onDidRunOperation.fire(new ft(t,4))}catch(l){throw new ce(f(2109,null,this.resourceForError(t),gt(l).toString()),na(l),a)}return this.resolve(t,{resolveMetadata:!0})}async peekBufferForWriting(t,n){let i;if(Ne(t)&&!(n instanceof x))if(pr(n)){let s=await pc(n,3);s.ended?i=x.concat(s.buffer):i=s}else i=dc(n,s=>x.concat(s),3);else i=n;return i}async validateWriteFile(t,n,i,s){let o=!!s?.unlock;if(o&&!(t.capabilities&8192))throw new Error(f(2127,null,this.resourceForError(n)));if(s?.append&&!nu(t))throw new ce(f(2106,null,this.resourceForError(n)),6);if(!!s?.atomic){if(!(t.capabilities&32768))throw new Error(f(2125,null,this.resourceForError(n)));if(!(t.capabilities&2))throw new Error(f(2126,null,this.resourceForError(n)));if(o)throw new Error(f(2124,null,this.resourceForError(n)))}let l;try{l=await t.stat(n)}catch{return Object.create(null)}if((l.type&2)!==0)throw new ce(f(2112,null,this.resourceForError(n)),0,s);this.throwIfFileIsReadonly(n,l);let c;if(typeof s?.mtime=="number"&&typeof s.etag=="string"&&s.etag!==Gi&&typeof l.mtime=="number"&&typeof l.size=="number"&&s.mtime{this.writeQueue.queueFor(n,async()=>{try{let l=await this.doReadFile(t,n,i,s);o(l)}catch(l){a(l)}},this.getExtUri(t).providerExtUri)})}async doReadFile(t,n,i,s){let o=await this.doReadFileStream(t,n,{...i,preferUnbuffered:!0},s);return{...o,value:await hr(o.value)}}async readFileStream(t,n,i){let s=await this.withReadProvider(t);return this.doReadFileStream(s,t,n,i)}async doReadFileStream(t,n,i,s){let o=new Re(s),a=i;Hi(t)&&t.enforceAtomicReadFile?.(n)&&(a={...i,atomic:!0});let l=this.validateReadFile(n,a).then(d=>d,d=>{throw o.dispose(!0),d}),c;try{return typeof a?.etag=="string"&&a.etag!==Gi&&await l,a?.atomic&&Hi(t)||!(ht(t)||ji(t))||Ne(t)&&a?.preferUnbuffered?c=this.readFileUnbuffered(t,n,a):ji(t)?c=this.readFileStreamed(t,n,o.token,a):c=this.readFileBuffered(t,n,o.token,a),c.on("end",()=>o.dispose()),c.on("error",()=>o.dispose()),{...await l,value:c}}catch(d){throw c&&await xi(c),this.restoreReadError(d,n,a)}}restoreReadError(t,n,i){let s=f(2107,null,this.resourceForError(n),gt(t).toString());return t instanceof On?new On(s,t.stat,i):t instanceof Ln?new Ln(s,t.fileOperationResult,t.size,t.options):new ce(s,na(t),i)}readFileStreamed(t,n,i,s=Object.create(null)){let o=t.readFileStream(n,s,i);return ko(o,{data:a=>a instanceof x?a:x.wrap(a),error:a=>this.restoreReadError(a,n,s)},a=>x.concat(a))}readFileBuffered(t,n,i,s=Object.create(null)){let o=yc();return Cs(t,n,o,a=>a,{...s,bufferSize:this.BUFFER_SIZE,errorTransformer:a=>this.restoreReadError(a,n,s)},i),o}readFileUnbuffered(t,n,i){let s=Qt(o=>x.concat(o));return(async()=>{try{let o;i?.atomic&&Hi(t)?o=await t.readFile(n,{atomic:!0}):o=await t.readFile(n),typeof i?.position=="number"&&(o=o.slice(i.position)),typeof i?.length=="number"&&(o=o.slice(0,i.length)),this.validateReadFileLimits(n,o.byteLength,i),s.end(x.wrap(o))}catch(o){s.error(o),s.end()}})(),s}async validateReadFile(t,n){let i=await this.resolve(t,{resolveMetadata:!0});if(i.isDirectory)throw new ce(f(2111,null,this.resourceForError(t)),0,n);if(typeof n?.etag=="string"&&n.etag!==Gi&&n.etag===i.etag)throw new On(f(2115,null),i,n);return this.validateReadFileLimits(t,i.size,n),i}validateReadFileLimits(t,n,i){if(typeof i?.limits?.size=="number"&&n>i.limits.size)throw new Ln(f(2116,null,this.resourceForError(t)),7,n,i)}async canMove(t,n,i){return this.doCanMoveCopy(t,n,"move",i)}async canCopy(t,n,i){return this.doCanMoveCopy(t,n,"copy",i)}async doCanMoveCopy(t,n,i,s){if(t.toString()!==n.toString())try{let o=i==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t):await this.withReadProvider(t),a=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);await this.doValidateMoveCopy(o,t,a,n,i,s)}catch(o){return o}return!0}async move(t,n,i){let s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(s,t,o,n,"move",!!i),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ft(t,a==="move"?2:3,l)),l}async copy(t,n,i){let s=await this.withReadProvider(t),o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(s,t,o,n,"copy",!!i),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ft(t,a==="copy"?3:2,l)),l}async doMoveCopy(t,n,i,s,o,a){if(n.toString()===s.toString())return o;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(t,n,i,s,o,a);if(l&&!c&&a&&await this.del(s,{recursive:!0}),await this.mkdirp(i,this.getExtUri(i).providerExtUri.dirname(s)),o==="copy"){if(t===i&&ea(t))await t.copy(n,s,{overwrite:a});else{let d=await this.resolve(n);d.isDirectory?await this.doCopyFolder(t,d,i,s):await this.doCopyFile(t,n,i,s)}return o}else return t===i?(await t.rename(n,s,{overwrite:a}),o):(await this.doMoveCopy(t,n,i,s,"copy",a),await this.del(n,{recursive:!0}),"copy")}async doCopyFile(t,n,i,s){if(ht(t)&&ht(i))return this.doPipeBuffered(t,n,i,s);if(ht(t)&&Ne(i))return this.doPipeBufferedToUnbuffered(t,n,i,s);if(Ne(t)&&ht(i))return this.doPipeUnbufferedToBuffered(t,n,i,s);if(Ne(t)&&Ne(i))return this.doPipeUnbuffered(t,n,i,s)}async doCopyFolder(t,n,i,s){await i.mkdir(s),Array.isArray(n.children)&&await Gt.settled(n.children.map(async o=>{let a=this.getExtUri(i).providerExtUri.joinPath(s,o.name);return o.isDirectory?this.doCopyFolder(t,await this.resolve(o.resource),i,a):this.doCopyFile(t,o.resource,i,a)}))}async doValidateMoveCopy(t,n,i,s,o,a){let l=!1;if(t===i){let{providerExtUri:d,isPathCaseSensitive:u}=this.getExtUri(t);if(u||(l=d.isEqual(n,s)),l&&o==="copy")throw new Error(f(2120,null,this.resourceForError(n),this.resourceForError(s)));if(!l&&d.isEqualOrParent(s,n))throw new Error(f(2121,null,this.resourceForError(n),this.resourceForError(s)))}let c=await this.exists(s);if(c&&!l){if(!a)throw new ce(f(2122,null,this.resourceForError(n),this.resourceForError(s)),4);if(t===i){let{providerExtUri:d}=this.getExtUri(t);if(d.isEqualOrParent(n,s))throw new Error(f(2123,null,this.resourceForError(n),this.resourceForError(s)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(t){let n=this.isPathCaseSensitive(t);return{providerExtUri:n?N:nc,isPathCaseSensitive:n}}isPathCaseSensitive(t){return!!(t.capabilities&1024)}async createFolder(t){let n=this.throwIfFileSystemIsReadonly(await this.withProvider(t),t);await this.mkdirp(n,t);let i=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ft(t,0,i)),i}async mkdirp(t,n){let i=[],{providerExtUri:s}=this.getExtUri(t);for(;!s.isEqual(n,s.dirname(n));)try{if(((await t.stat(n)).type&2)===0)throw new Error(f(2118,null,this.resourceForError(n)));break}catch(o){if(tn(o)!=="EntryNotFound")throw o;i.push(s.basename(n)),n=s.dirname(n)}for(let o=i.length-1;o>=0;o--){n=s.joinPath(n,i[o]);try{await t.mkdir(n)}catch(a){if(tn(a)!=="EntryExists")throw a}}}async canDelete(t,n){try{await this.doValidateDelete(t,n)}catch(i){return i}return!0}async doValidateDelete(t,n){let i=this.throwIfFileSystemIsReadonly(await this.withProvider(t),t),s=!!n?.useTrash;if(s&&!(i.capabilities&4096))throw new Error(f(2105,null,this.resourceForError(t)));let o=n?.atomic;if(o&&!(i.capabilities&65536))throw new Error(f(2101,null,this.resourceForError(t)));if(s&&o)throw new Error(f(2104,null,this.resourceForError(t)));let a;try{a=await i.stat(t)}catch{}if(a)this.throwIfFileIsReadonly(t,a);else throw new ce(f(2103,null,this.resourceForError(t)),1);if(!!!n?.recursive){let c=await this.resolve(t);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(f(2102,null,this.resourceForError(t)))}return i}async del(t,n){let i=await this.doValidateDelete(t,n),s=n;if(su(i)&&!s?.atomic){let c=i.enforceAtomicDelete?.(t);c&&(s={...n,atomic:c})}let o=!!s?.useTrash,a=!!s?.recursive,l=s?.atomic??!1;await i.delete(t,{recursive:a,useTrash:o,atomic:l}),this._onDidRunOperation.fire(new ft(t,1))}async cloneFile(t,n){let i=await this.withProvider(t),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);if(!(i===s&&this.getExtUri(i).providerExtUri.isEqual(t,n)))return i===s&&ru(i)?i.cloneFile(t,n):(await this.mkdirp(s,this.getExtUri(s).providerExtUri.dirname(n)),i===s&&ea(i)?this.writeQueue.queueFor(t,()=>i.copy(t,n,{overwrite:!0}),this.getExtUri(i).providerExtUri):this.writeQueue.queueFor(t,()=>this.doCopyFile(i,t,s,n),this.getExtUri(i).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(t,n){return this.watch(t,{...n,correlationId:kt.WATCHER_CORRELATION_IDS++})}watch(t,n={recursive:!1,excludes:[]}){let i=new D,s=!1,o=()=>{s=!0};i.add(O(()=>o())),(async()=>{try{let l=await this.doWatch(t,n);s?Ee(l):o=()=>Ee(l)}catch(l){this.logService.error(l)}})();let a=n.correlationId;if(typeof a=="number"){let l=i.add(new I);return i.add(this.internalOnDidFilesChange.event(d=>{d.correlates(a)&&l.fire(d)})),{onDidChange:l.event,dispose:()=>i.dispose()}}return i}async doWatch(t,n){let i=await this.withProvider(t),s=Bn([this.getExtUri(i).providerExtUri.getComparisonKey(t),n]),o=this.activeWatchers.get(s);return o||(o={count:0,disposable:i.watch(t,n)},this.activeWatchers.set(s,o)),o.count+=1,O(()=>{o&&(o.count--,o.count===0&&(Ee(o.disposable),this.activeWatchers.delete(s)))})}dispose(){super.dispose();for(let[,t]of this.activeWatchers)Ee(t.disposable);this.activeWatchers.clear()}async doWriteBuffered(t,n,i,s){return this.writeQueue.queueFor(n,async()=>{let o=await t.open(n,{create:!0,unlock:i?.unlock??!1,append:i?.append??!1});try{pr(s)||_i(s)?await this.doWriteStreamBufferedQueued(t,o,s):await this.doWriteReadableBufferedQueued(t,o,s)}catch(a){throw gt(a)}finally{await t.close(o)}},this.getExtUri(t).providerExtUri)}async doWriteStreamBufferedQueued(t,n,i){let s=0,o;if(_i(i)){if(i.buffer.length>0){let a=x.concat(i.buffer);await this.doWriteBuffer(t,n,a,a.byteLength,s,0),s+=a.byteLength}if(i.ended)return;o=i.stream}else o=i;return new Promise((a,l)=>{Ei(o,{onData:async c=>{o.pause();try{await this.doWriteBuffer(t,n,c,c.byteLength,s,0)}catch(d){return l(d)}s+=c.byteLength,setTimeout(()=>o.resume())},onError:c=>l(c),onEnd:()=>a()})})}async doWriteReadableBufferedQueued(t,n,i){let s=0,o;for(;(o=i.read())!==null;)await this.doWriteBuffer(t,n,o,o.byteLength,s,0),s+=o.byteLength}async doWriteBuffer(t,n,i,s,o,a){let l=0;for(;lthis.doWriteUnbufferedQueued(t,n,i,s),this.getExtUri(t).providerExtUri)}async doWriteUnbufferedQueued(t,n,i,s){let o;s instanceof x?o=s:pr(s)?o=await hr(s):_i(s)?o=await bc(s):o=mc(s),await t.writeFile(n,o.buffer,{create:!0,overwrite:!0,unlock:i?.unlock??!1,atomic:i?.atomic??!1,append:i?.append??!1})}async doPipeBuffered(t,n,i,s){return this.writeQueue.queueFor(s,()=>this.doPipeBufferedQueued(t,n,i,s),this.getExtUri(i).providerExtUri)}async doPipeBufferedQueued(t,n,i,s){let o,a;try{o=await t.open(n,{create:!1}),a=await i.open(s,{create:!0,unlock:!1});let l=x.alloc(this.BUFFER_SIZE),c=0,d=0,u=0;do u=await t.read(o,c,l.buffer,d,l.byteLength-d),await this.doWriteBuffer(i,a,l,u,c,d),c+=u,d+=u,d===l.byteLength&&(d=0);while(u>0)}catch(l){throw gt(l)}finally{await Gt.settled([typeof o=="number"?t.close(o):Promise.resolve(),typeof a=="number"?i.close(a):Promise.resolve()])}}async doPipeUnbuffered(t,n,i,s){return this.writeQueue.queueFor(s,()=>this.doPipeUnbufferedQueued(t,n,i,s),this.getExtUri(i).providerExtUri)}async doPipeUnbufferedQueued(t,n,i,s){return i.writeFile(s,await t.readFile(n),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(t,n,i,s){return this.writeQueue.queueFor(s,()=>this.doPipeUnbufferedToBufferedQueued(t,n,i,s),this.getExtUri(i).providerExtUri)}async doPipeUnbufferedToBufferedQueued(t,n,i,s){let o=await i.open(s,{create:!0,unlock:!1});try{let a=await t.readFile(n);await this.doWriteBuffer(i,o,x.wrap(a),a.byteLength,0,0)}catch(a){throw gt(a)}finally{await i.close(o)}}async doPipeBufferedToUnbuffered(t,n,i,s){let o=await hr(this.readFileBuffered(t,n,Ke.None));await this.doWriteUnbuffered(i,s,void 0,o)}throwIfFileSystemIsReadonly(t,n){if(t.capabilities&2048)throw new ce(f(2108,null,this.resourceForError(n)),6);return t}throwIfFileIsReadonly(t,n){if((n.permissions??0)&1)throw new ce(f(2108,null,this.resourceForError(t)),6)}resourceForError(t){return t.scheme===Y.file?t.fsPath:t.toString(!0)}};kt=P([_e(0,Oe)],kt);import{constants as Na,promises as an}from"fs";function ks(r){return typeof r.correlationId=="number"}function td(r){return r.recursive===!0}var Ps=class r extends A{constructor(t,n,i,s){super();this.onFileChanges=t;this.onLogMessage=n;this.verboseLogging=i;this.options=s;this.watcherDisposables=this._register(new St);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let t=new D;this.watcherDisposables.value=t,this.watcher=this.createWatcher(t),this.watcher.setVerboseLogging(this.verboseLogging),t.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),t.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),t.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(t,n){this.canRestart(t,n)?this.restartCounter({type:e.type,resource:m.revive(e.resource),cId:e.cId}))}function nd(r){let e=new Oa;for(let t of r)e.processEvent(t);return e.coalesce()}function Bh(r,e){return typeof e=="string"&&!e.startsWith(Wn)&&!di(e)?{base:r,pattern:e}:e}function Ua(r,e,t){let n=[];for(let i of e)n.push(da(Bh(r,i),{ignoreCase:t}));return n}var Oa=class{constructor(){this.coalesced=new Set;this.mapPathToChange=new Map}toKey(e){return te?e.resource.fsPath:e.resource.fsPath.toLowerCase()}processEvent(e){let t=this.mapPathToChange.get(this.toKey(e)),n=!1;if(t){let i=t.type,s=e.type;t.resource.fsPath!==e.resource.fsPath&&(e.type===2||e.type===1)?n=!0:i===1&&s===2?(this.mapPathToChange.delete(this.toKey(e)),this.coalesced.delete(t)):i===2&&s===1?t.type=0:i===1&&s===0||(t.type=s)}else n=!0;n&&(this.coalesced.add(e),this.mapPathToChange.set(this.toKey(e),e))}coalesce(){let e=[],t=[];return Array.from(this.coalesced).filter(n=>n.type!==2?(e.push(n),!1):!0).sort((n,i)=>n.resource.fsPath.length-i.resource.fsPath.length).filter(n=>t.some(i=>ou(n.resource.fsPath,i,!te))?!1:(t.push(n.resource.fsPath),!0)).concat(e)}};function rd(r,e){if(typeof e=="number")switch(r.type){case 1:return(e&4)===0;case 2:return(e&8)===0;case 0:return(e&2)===0}return!1}function id(r){if(typeof r=="number"){let e=[];return r&4&&e.push("Added"),r&8&&e.push("Deleted"),r&2&&e.push("Updated"),e.length===0?"":`[${e.join(", ")}]`}return""}var Ls=class extends A{constructor(t,n){super();this.logService=t;this.options=n;this._onDidChangeFile=this._register(new I);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new I);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new jt(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new jt(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(t,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(t,n):this.watchNonRecursive(t,n)}getRefreshWatchersDelay(t){return t>200?500:0}watchUniversal(t,n){let i=this.toWatchRequest(t,n),s=js(this.universalWatchRequests,i);return this.refreshUniversalWatchers(),O(()=>{s(),this.refreshUniversalWatchers()})}toWatchRequest(t,n){let i={path:this.toWatchPath(t),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(td(i)){let s=this.options?.watcher?.recursive?.usePolling;s===!0?i.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(s)&&s.includes(i.path)&&(i.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return i}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(t=>Z(t))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(t=>this._onDidChangeFile.fire(Fa(t)),t=>this.onWatcherLogMessage(t),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(t,n){let i={path:this.toWatchPath(t),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},s=js(this.nonRecursiveWatchRequests,i);return this.refreshNonRecursiveWatchers(),O(()=>{s(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(t=>Z(t))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(t=>this._onDidChangeFile.fire(Fa(t)),t=>this.onWatcherLogMessage(t),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(t){t.type==="error"&&this._onDidWatchError.fire(t.message),this.logWatcherMessage(t)}logWatcherMessage(t){this.logService[t.type](t.message)}toFilePath(t){return Me(t.fsPath)}toWatchPath(t){let n=this.toFilePath(t);return jl(n)}};var Os=class extends As{constructor(e,t,n){super(e,t,n),this.init()}createWatcher(e){let t=e.add(new Ai(Ct.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return e.add(t.onDidProcessExit(({code:n,signal:i})=>this.onError(`terminated by itself with code ${n}, signal: ${i} (ETERM)`))),En.toService(Sc(t.getChannel("watcher")))}};import{watchFile as Vh,unwatchFile as qh}from"fs";var Fs=class extends A{constructor(){super();this._onDidChangeFile=this._register(new I);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new I);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new I);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Ye);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new jt(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Ze;this.verboseLogging=!1;this._register(this.onDidWatchFail(t=>this.suspendWatchRequest({id:this.computeId(t),correlationId:this.isCorrelated(t)?t.correlationId:void 0,path:t.path})))}isCorrelated(t){return ks(t)}computeId(t){return this.isCorrelated(t)?t.correlationId:Bn(t)}async watch(t){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Ze;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of t)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(t){let n=[];for(let[i,s]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(i)||n.push(s);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),t?this.getUpdateWatchersDelay():0).catch(i=>Z(i))}getUpdateWatchersDelay(){return 800}isSuspended(t){let n=this.computeId(t);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(t){if(this.suspendedWatchRequests.has(t.id))return;let n=new D;this.suspendedWatchRequests.set(t.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(t,n),this.updateWatchers(!0))}resumeWatchRequest(t){this.suspendedWatchRequests.deleteAndDispose(t.id),this.suspendedWatchRequestsWithPolling.delete(t.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(t,n){this.doMonitorWithExistingWatcher(t,n)?(this.trace(`reusing an existing recursive watcher to monitor ${t.path}`),this.suspendedWatchRequestsWithPolling.delete(t.id)):(this.doMonitorWithNodeJS(t,n),this.suspendedWatchRequestsWithPolling.add(t.id))}doMonitorWithExistingWatcher(t,n){let i=this.recursiveWatcher?.subscribe(t.path,(s,o)=>{n.isDisposed||(s?this.monitorSuspendedWatchRequest(t,n):o?.type===1&&this.onMonitoredPathAdded(t))});return i?(n.add(i),!0):!1}doMonitorWithNodeJS(t,n){let i=!1,s=(o,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(o),c=this.isPathNotFound(a),d=i;i=l,!l&&(c||d)&&this.onMonitoredPathAdded(t)};this.trace(`starting fs.watchFile() on ${t.path} (correlationId: ${t.correlationId})`);try{Vh(t.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},s)}catch(o){this.warn(`fs.watchFile() failed with error ${o} on path ${t.path} (correlationId: ${t.correlationId})`)}n.add(O(()=>{this.trace(`stopping fs.watchFile() on ${t.path} (correlationId: ${t.correlationId})`);try{qh(t.path,s)}catch(o){this.warn(`fs.unwatchFile() failed with error ${o} on path ${t.path} (correlationId: ${t.correlationId})`)}}))}onMonitoredPathAdded(t){this.trace(`detected ${t.path} exists again, resuming watcher (correlationId: ${t.correlationId})`);let n={resource:m.file(t.path),type:1,cId:t.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,t),this.resumeWatchRequest(t)}isPathNotFound(t){return t.ctimeMs===0&&t.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(t,n){if(this.verboseLogging){let i=` >> normalized ${t.type===1?"[ADDED]":t.type===2?"[DELETED]":"[CHANGED]"} ${t.resource.fsPath}`;this.traceWithCorrelation(i,n)}}traceWithCorrelation(t,n){this.verboseLogging&&this.trace(`${t}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(t){return`${t.path} (excludes: ${t.excludes.length>0?t.excludes:""}, includes: ${t.includes&&t.includes.length>0?JSON.stringify(t.includes):""}, filter: ${id(t.filter)}, correlationId: ${typeof t.correlationId=="number"?t.correlationId:""})`}async setVerboseLogging(t){this.verboseLogging=t}};import{watch as $h,promises as Kh}from"fs";var Us=class r extends A{constructor(t,n,i,s,o,a){super();this.request=t;this.recursiveWatcher=n;this.onDidFilesChange=i;this.onDidWatchFail=s;this.onLogMessage=o;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new bn({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},t=>this.onDidFilesChange(t)));this.fileChangesAggregator=this._register(new Ii(t=>this.handleFileChanges(t),r.FILE_CHANGES_HANDLER_DELAY));this.cts=new Re;this.realPath=new Pe(async()=>{let t=this.request.path;try{t=await ee.realpath(this.request.path),this.request.path!==t&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${t})`)}catch{}return t});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!te;this.excludes=Ua(this.request.path,this.request.excludes,l),this.includes=this.request.includes?Ua(this.request.path,this.request.includes,l):void 0,this.filter=ks(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let t=await Kh.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(t.isDirectory()))}catch(t){t.code!=="ENOENT"?this.error(t):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${t})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(t){let n=new D;return this.doWatchWithExistingWatcher(t,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(t,n)),n}doWatchWithExistingWatcher(t,n){if(t)return!1;let i=m.file(this.request.path),s=this.recursiveWatcher?.subscribe(this.request.path,async(o,a)=>{n.isDisposed||(o?await dl(this.doWatch(t),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:i,type:a.type,cId:this.request.correlationId},!0))});return s?(n.add(s),!0):!1}async doWatchWithNodeJS(t,n){let i=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if($e&<(i,"/Volumes/",!0)){this.error(`Refusing to watch ${i} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let s=new Re(this.cts.token);n.add(O(()=>s.dispose(!0)));let o=new D;n.add(o);try{let a=m.file(this.request.path),l=We(i),c=$h(i);o.add(O(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${i}'`);let d=new Set;if(t)try{for(let p of await ee.readdir(i))d.add(p)}catch(p){this.error(p)}if(s.token.isCancellationRequested)return;let u=new Map;o.add(O(()=>{for(let[,p]of u)p.dispose();u.clear()})),c.on("error",(p,h)=>{s.token.isCancellationRequested||(this.error(`Failed to watch ${i} for changes using fs.watch() (${p}, ${h})`),this.notifyWatchFailed())}),c.on("change",(p,h)=>{if(s.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${p}"] ${h}`);let g="";if(h&&(g=h.toString(),$e&&(g=Ir(g))),!(!g||p!=="change"&&p!=="rename"))if(t)if(p==="rename"){u.get(g)?.dispose();let b=setTimeout(async()=>{if(u.delete(g),gn(g,l,!te)&&!await ee.exists(i)){this.onWatchedPathDeleted(a);return}if(s.token.isCancellationRequested)return;let W=await this.existsChildStrictCase(J(i,g));if(s.token.isCancellationRequested)return;let j;W?d.has(g)?j=0:(j=1,d.add(g)):(d.delete(g),j=2),this.onFileChange({resource:oe(a,g),type:j,cId:this.request.correlationId})},r.FILE_DELETE_HANDLER_DELAY);u.set(g,O(()=>clearTimeout(b)))}else{let b;d.has(g)?b=0:(b=1,d.add(g)),this.onFileChange({resource:oe(a,g),type:b,cId:this.request.correlationId})}else if(p==="rename"||!gn(g,l,!te)){let b=setTimeout(async()=>{let W=await ee.exists(i);s.token.isCancellationRequested||(W?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),o.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},r.FILE_DELETE_HANDLER_DELAY);o.clear(),o.add(O(()=>clearTimeout(b)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(s.token.isCancellationRequested)return;this.error(`Failed to watch ${i} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(t){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:t,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(t,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${t.type===1?"[ADDED]":t.type===2?"[DELETED]":"[CHANGED]"} ${t.resource.fsPath}`),!n&&this.excludes.some(i=>i(t.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${t.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(i=>i(t.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${t.resource.fsPath}`):this.fileChangesAggregator.work(t))}handleFileChanges(t){let n=nd(t),i=[];for(let o of n){if(rd(o,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${o.resource.fsPath}`);continue}i.push(o)}if(i.length===0)return;if(this.verboseLogging)for(let o of i)this.traceWithCorrelation(` >> normalized ${o.type===1?"[ADDED]":o.type===2?"[DELETED]":"[CHANGED]"} ${o.resource.fsPath}`);this.throttledFileChangesEmitter.work(i)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${i[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${i.length}, most recent change: ${i[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(t){if(te)return ee.exists(t);try{let n=We(t);return(await ee.readdir(be(t))).some(s=>s===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(t){this.verboseLogging=t}error(t){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${t}`})}warn(t){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${t}`})}trace(t){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${t}`})}traceWithCorrelation(t){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${t}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}};var Ns=class extends Fs{constructor(t){super();this.recursiveWatcher=t;this.onDidError=V.None;this._watchers=new Map;this.worker=this._register(new St)}get watchers(){return this._watchers.values()}async doWatch(t){t=this.removeDuplicateRequests(t);let n=[],i=new Set(Array.from(this.watchers));for(let s of t){let o=this._watchers.get(this.requestToWatcherKey(s));o&&pa(o.request.excludes,s.excludes)&&pa(o.request.includes,s.includes)?i.delete(o):n.push(s)}n.length&&this.trace(`Request to start watching: ${n.map(s=>this.requestToString(s)).join(",")}`),i.size&&this.trace(`Request to stop watching: ${Array.from(i).map(s=>this.requestToString(s.request)).join(",")}`),this.worker.clear();for(let s of i)this.stopWatching(s);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new bn({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},t=>{for(let n of t)this.startWatching(n)}),this.worker.value}requestToWatcherKey(t){return typeof t.correlationId=="number"?t.correlationId:this.pathToWatcherKey(t.path)}pathToWatcherKey(t){return te?t:t.toLowerCase()}startWatching(t){let n=new Us(t,this.recursiveWatcher,s=>this._onDidChangeFile.fire(s),()=>this._onDidWatchFail.fire(t),s=>this._onDidLogMessage.fire(s),this.verboseLogging),i={request:t,instance:n};this._watchers.set(this.requestToWatcherKey(t),i)}async stop(){await super.stop();for(let t of this.watchers)this.stopWatching(t)}stopWatching(t){this.trace("stopping file watcher",t),this._watchers.delete(this.requestToWatcherKey(t.request)),t.instance.dispose()}removeDuplicateRequests(t){let n=new Map;for(let i of t){let s=n.get(i.correlationId);s||(s=new Map,n.set(i.correlationId,s));let o=this.pathToWatcherKey(i.path);s.has(o)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(i)}`),s.set(o,i)}return Array.from(n.values()).flatMap(i=>Array.from(i.values()))}async setVerboseLogging(t){super.setVerboseLogging(t);for(let n of this.watchers)n.instance.setVerboseLogging(t)}trace(t,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(t,n)})}warn(t){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(t)})}toMessage(t,n){return n?`[File Watcher (node.js)] ${t} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${t}`}};var Ms=class extends Ds{constructor(e,t,n){super(e,t,n),this.init()}createWatcher(e){return e.add(new Ns(void 0))}};var Ws=class r extends Ls{constructor(){super(...arguments);this.onDidChangeCapabilities=V.None;this.resourceLocks=new rt(t=>mn.getComparisonKey(t));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,te&&(this._capabilities|=1024)),this._capabilities}async stat(t){try{let{stat:n,symbolicLink:i}=await et.stat(this.toFilePath(t)),s;return(n.mode&128)===0&&(s=2),(n.mode&Na.S_IXUSR||n.mode&Na.S_IXGRP||n.mode&Na.S_IXOTH)&&(s=(s??0)|4),{type:this.toType(n,i),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:s}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(t){try{return await this.stat(t)}catch{return}}async realpath(t){let n=this.toFilePath(t);return ee.realpath(n)}async readdir(t){try{let n=await ee.readdir(this.toFilePath(t),{withFileTypes:!0}),i=[];return await Promise.all(n.map(async s=>{try{let o;s.isSymbolicLink()?o=(await this.stat(oe(t,s.name))).type:o=this.toType(s),i.push([s.name,o])}catch(o){this.logService.trace(o)}})),i}catch(n){throw this.toFileSystemProviderError(n)}}toType(t,n){let i;return n?.dangling?i=0:t.isFile()?i=1:t.isDirectory()?i=2:i=0,n&&(i|=64),i}async createResourceLock(t){let n=this.toFilePath(t);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let i;for(;i=this.resourceLocks.get(t);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await i.wait();let s=new bi;return this.resourceLocks.set(t,s),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),O(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(t)===s&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(t)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),s.open()})}async readFile(t,n){let i;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(t)})`),i=await this.createResourceLock(t));let s=this.toFilePath(t);return await an.readFile(s)}catch(s){throw this.toFileSystemProviderError(s)}finally{i?.dispose()}}traceLock(t){r.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(t)}readFileStream(t,n,i){let s=Qt(o=>x.concat(o.map(a=>x.wrap(a))).buffer);return Cs(this,t,s,o=>o.buffer,{...n,bufferSize:256*1024},i),s}async writeFile(t,n,i){return i?.atomic!==!1&&i?.atomic?.postfix&&await this.canWriteFileAtomic(t)?this.doWriteFileAtomic(t,oe(rc(t),`${Eo(t)}${i.atomic.postfix}`),n,i):this.doWriteFile(t,n,i)}async canWriteFileAtomic(t){try{let n=this.toFilePath(t),{symbolicLink:i}=await et.stat(n);if(i)return!1}catch{}return!0}async doWriteFileAtomic(t,n,i,s){let o=new D;try{o.add(await this.createResourceLock(t)),o.add(await this.createResourceLock(n)),await this.doWriteFile(n,i,{...s,create:!0,overwrite:!0},!0);try{await this.rename(n,t,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{o.dispose()}}async doWriteFile(t,n,i,s){let o;try{let a=this.toFilePath(t);if(!i.create||!i.overwrite){if(await ee.exists(a)){if(!i.overwrite)throw Qe(f(2131,null),"EntryExists")}else if(!i.create)throw Qe(f(2134,null),"EntryNotFound")}o=await this.open(t,{create:!0,append:i.append,unlock:i.unlock},s),await this.write(o,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(t,a)}finally{typeof o=="number"&&await this.close(o)}}static{this.canFlush=!0}static configureFlushOnWrite(t){r.canFlush=t}async open(t,n,i){let s=this.toFilePath(t),o;en(n)&&!i&&(o=await this.createResourceLock(t));let a;try{if(en(n)&&n.unlock)try{let{stat:l}=await et.stat(s);l.mode&128||await an.chmod(s,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if($&&en(n)&&!n.append)try{a=await ee.open(s,"r+"),await ee.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await ee.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await ee.open(s,en(n)?n.append?"a":"w":"r"))}catch(l){throw o?.dispose(),en(n)?await this.toFileSystemProviderWriteError(t,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),en(n)&&this.writeHandles.set(a,t),o){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${s})`),this.mapHandleToLock.set(a,o),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${s})`),l.dispose())}return a}async close(t){let n=this.mapHandleToLock.get(t);try{if(this.mapHandleToPos.delete(t),this.writeHandles.delete(t)&&r.canFlush)try{await ee.fdatasync(t)}catch(i){r.configureFlushOnWrite(!1),this.logService.error(i)}return await ee.close(t)}catch(i){throw this.toFileSystemProviderError(i)}finally{n&&(this.mapHandleToLock.get(t)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${t}`),this.mapHandleToLock.delete(t)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${t}`),n.dispose())}}async read(t,n,i,s,o){let a=this.normalizePos(t,n),l=null;try{l=(await ee.read(t,i,s,o,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(t,a,l)}return l}normalizePos(t,n){return n===this.mapHandleToPos.get(t)?null:n}updatePos(t,n,i){let s=this.mapHandleToPos.get(t);typeof s=="number"&&(typeof n=="number"||(typeof i=="number"?this.mapHandleToPos.set(t,s+i):this.mapHandleToPos.delete(t)))}async write(t,n,i,s,o){return cc(()=>this.doWrite(t,n,i,s,o),100,3)}async doWrite(t,n,i,s,o){let a=this.normalizePos(t,n),l=null;try{l=(await ee.write(t,i,s,o,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(t),c)}finally{this.updatePos(t,a,l)}return l}async mkdir(t){try{await an.mkdir(this.toFilePath(t))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(t,n){try{let i=this.toFilePath(t);if(n.recursive){let s;n?.atomic!==!1&&n.atomic.postfix&&(s=J(be(i),`${We(i)}${n.atomic.postfix}`)),await ee.rm(i,1,s)}else try{await an.unlink(i)}catch(s){if(s.code==="EPERM"||s.code==="EISDIR"){let o=!1;try{let{stat:a,symbolicLink:l}=await et.stat(i);o=a.isDirectory()&&!l}catch{}if(o)await an.rmdir(i);else throw s}else throw s}}catch(i){throw this.toFileSystemProviderError(i)}}async rename(t,n,i){let s=this.toFilePath(t),o=this.toFilePath(n);if(s!==o)try{await this.validateMoveCopy(t,n,"move",i.overwrite),await ee.rename(s,o)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(f(2135,null,We(s),We(be(o)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(t,n,i){let s=this.toFilePath(t),o=this.toFilePath(n);if(s!==o)try{await this.validateMoveCopy(t,n,"copy",i.overwrite),await ee.copy(s,o,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(f(2129,null,We(s),We(be(o)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(t,n,i,s){let o=this.toFilePath(t),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=gn(o,a,!0)),l){if(i==="copy")throw Qe(f(2130,null),"EntryExists");if(i==="move")return}let d=await this.statIgnoreError(t);if(!d)throw Qe(f(2133,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!s)throw Qe(f(2132,null),"EntryExists");(d.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(t,n){return this.doCloneFile(t,n,!1)}async doCloneFile(t,n,i){let s=this.toFilePath(t),o=this.toFilePath(n),a=!!(this.capabilities&1024);if(gn(s,o,!a))return;let l=new D;try{l.add(await this.createResourceLock(t)),l.add(await this.createResourceLock(n)),i&&await an.mkdir(be(o),{recursive:!0}),await an.copyFile(s,o)}catch(c){if(c.code==="ENOENT"&&!i)return this.doCloneFile(t,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(t,n,i){return new Os(s=>t(s),s=>n(s),i)}createNonRecursiveWatcher(t,n,i){return new Ms(s=>t(s),s=>n(s),i)}toFileSystemProviderError(t){if(t instanceof kn)return t;let n=t,i;switch(t.code){case"ENOENT":i="EntryNotFound";break;case"EISDIR":i="EntryIsADirectory";break;case"ENOTDIR":i="EntryNotADirectory";break;case"EEXIST":i="EntryExists";break;case"EPERM":case"EACCES":i="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${t.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,i="Unknown";break;default:i="Unknown"}return Qe(n,i)}async toFileSystemProviderWriteError(t,n){let i=this.toFileSystemProviderError(n);if(t&&i.code==="NoPermissions")try{let{stat:s}=await et.stat(this.toFilePath(t));s.mode&128||(i=Qe(n,"EntryWriteLocked"))}catch(s){this.logService.trace(s)}return i}};var bt=class{constructor(e,t=[],n=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=n}};var Ma=class{constructor(e,t){this.key=e;this.data=t;this.incoming=new Map;this.outgoing=new Map}},Kr=class{constructor(e){this._hashFn=e;this._nodes=new Map}roots(){let e=[];for(let t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){let n=this.lookupOrInsertNode(e),i=this.lookupOrInsertNode(t);n.outgoing.set(i.key,i),i.incoming.set(n.key,n)}removeNode(e){let t=this._hashFn(e);this._nodes.delete(t);for(let n of this._nodes.values())n.outgoing.delete(t),n.incoming.delete(t)}lookupOrInsertNode(e){let t=this._hashFn(e),n=this._nodes.get(t);return n||(n=new Ma(t,e),this._nodes.set(t,n)),n}lookup(e){return this._nodes.get(this._hashFn(e))}isEmpty(){return this._nodes.size===0}toString(){let e=[];for(let[t,n]of this._nodes)e.push(`${t} -+`)[0];return f(1836,null,Kn(s,80))}return f(1835,null,e)}switch(r){case"view":{let i=t;return i?.path?f(1838,null,i.path):f(1837,null)}case"edit":{let i=t;return i?.path?f(1828,null,i.path):f(1827,null)}case"write":{let i=t;return i?.path?f(1840,null,i.path):f(1839,null)}case"grep":{let i=t;return i?.pattern?f(1834,null,Kn(i.pattern,80)):f(1833,null)}case"glob":{let i=t;return i?.pattern?f(1832,null,Kn(i.pattern,80)):f(1831,null)}default:return f(1830,null,e)}}function ms(r,e,t){if(!(!e&&!t)){if(fs.has(r))return e?.command??t;switch(r){case"grep":return e?.pattern??t;default:if(e)try{return JSON.stringify(e,null,2)}catch{return t}return t}}}function vs(r){if(fs.has(r))return"terminal"}function bs(r){return r==="powershell"?"powershell":"shellscript"}function ys(r){try{return JSON.stringify(r)}catch{return}}async function Bu(r,e,t){let n=[],i=new Map,s=[];for(let l of t)if(l.type==="tool.execution_start"){let c=l.data;if(Vr(c.toolName))continue;let d=c.arguments!==void 0?ys(c.arguments):void 0,u;if(d)try{u=JSON.parse(d)}catch{}i.set(c.toolCallId,{toolName:c.toolName,parameters:u}),zn(c.toolName)&&s.push(c.toolCallId)}let o;if(e&&s.length>0)try{let l=await e.getFileEdits(s);if(l.length>0){o=new Map;for(let c of l){let d=o.get(c.toolCallId);d||(d=[],o.set(c.toolCallId,d)),d.push(c)}}}catch{}let a=r.toString();for(let l of t)if(l.type==="assistant.message"||l.type==="user.message"){let c=l.data;n.push({session:r,type:"message",role:l.type==="user.message"?"user":"assistant",messageId:c?.messageId??c?.interactionId??"",content:c?.content??"",toolRequests:c?.toolRequests?.map(d=>({toolCallId:d.toolCallId,name:d.name,arguments:d.arguments!==void 0?ys(d.arguments):void 0,type:d.type})),reasoningOpaque:c?.reasoningOpaque,reasoningText:c?.reasoningText,encryptedContent:c?.encryptedContent,parentToolCallId:c?.parentToolCallId})}else if(l.type==="tool.execution_start"){let c=l.data;if(Vr(c.toolName))continue;let d=i.get(c.toolCallId),u=qr(c.toolName),p=vs(c.toolName),h=c.arguments!==void 0?ys(c.arguments):void 0;n.push({session:r,type:"tool_start",toolCallId:c.toolCallId,toolName:c.toolName,displayName:u,invocationMessage:hs(c.toolName,u,d?.parameters),toolInput:ms(c.toolName,d?.parameters,h),toolKind:p,language:p==="terminal"?bs(c.toolName):void 0,toolArguments:h,mcpServerName:c.mcpServerName,mcpToolName:c.mcpToolName,parentToolCallId:c.parentToolCallId})}else if(l.type==="tool.execution_complete"){let c=l.data,d=i.get(c.toolCallId);if(!d)continue;i.delete(c.toolCallId);let u=qr(d.toolName),p=c.error?.message??c.result?.content,h=[];p!==void 0&&h.push({type:"text",text:p});let g=o?.get(c.toolCallId);if(g)for(let b of g)h.push({type:"fileEdit",beforeURI:wr(a,b.toolCallId,b.filePath,"before"),afterURI:wr(a,b.toolCallId,b.filePath,"after"),diff:b.addedLines!==void 0||b.removedLines!==void 0?{added:b.addedLines,removed:b.removedLines}:void 0});n.push({session:r,type:"tool_complete",toolCallId:c.toolCallId,result:{success:c.success,pastTenseMessage:gs(d.toolName,u,d.parameters,c.success),content:h.length>0?h:void 0,error:c.error},isUserRequested:c.isUserRequested,toolTelemetry:c.toolTelemetry!==void 0?ys(c.toolTelemetry):void 0,parentToolCallId:c.parentToolCallId})}return n}function on(r){try{return JSON.stringify(r)}catch{return}}function mh(r){let e=typeof r.path=="string"?r.path:typeof r.fileName=="string"?r.fileName:void 0,t=typeof r.fullCommandText=="string"?r.fullCommandText:void 0,n=typeof r.intention=="string"?r.intention:void 0,i=typeof r.serverName=="string"?r.serverName:void 0,s=typeof r.toolName=="string"?r.toolName:void 0;switch(r.kind){case"shell":return{confirmationTitle:f(1823,null),invocationMessage:n??f(1822,null),toolInput:t};case"write":return{confirmationTitle:f(1826,null),invocationMessage:e?f(1824,null,e):f(1825,null),toolInput:on(e?{path:e}:r)??void 0};case"mcp":{let o=s??f(1819,null);return{confirmationTitle:i?`${i}: ${o}`:o,invocationMessage:i?`${i}: ${o}`:o,toolInput:on({serverName:i,toolName:s})??void 0}}case"read":return{confirmationTitle:f(1821,null),invocationMessage:n??f(1820,null),toolInput:on(e?{path:e,intention:n}:r)??void 0};default:return{confirmationTitle:f(1818,null),invocationMessage:f(1817,null),toolInput:on(r)??void 0}}}var jn=class extends A{constructor(t,n,i,s,o,a,l,c){super();this._onDidSessionProgress=s;this._wrapperFactory=o;this._fileService=a;this._logService=l;this._activeToolCalls=new Map;this._pendingPermissions=new Map;this._turnId="";this.sessionId=n,this.sessionUri=t,this._workingDirectory=i,this._databaseRef=c.openDatabase(t),this._register(O(()=>this._databaseRef.dispose())),this._editTracker=new ns(t.toString(),this._databaseRef.object,this._fileService,this._logService),this._register(O(()=>this._denyPendingPermissions()))}async initializeSession(){this._wrapper=this._register(await this._wrapperFactory({onPermissionRequest:t=>this.handlePermissionRequest(t),hooks:{onPreToolUse:async t=>{if(zn(t.toolName)){let n=ps(t.toolArgs);n&&await this._editTracker.trackEditStart(n)}},onPostToolUse:async t=>{if(zn(t.toolName)){let n=ps(t.toolArgs);n&&await this._editTracker.completeEdit(n)}}}})),this._subscribeToEvents(),this._subscribeForLogging()}async send(t,n){this._logService.info(`[Copilot:${this.sessionId}] sendMessage called: "${t.substring(0,100)}${t.length>100?"...":""}" (${n?.length??0} attachments)`);let i=n?.map(s=>s.type==="selection"?{type:"selection",filePath:s.path,displayName:s.displayName??s.path,text:s.text,selection:s.selection}:{type:s.type,path:s.path,displayName:s.displayName});i?.length&&this._logService.trace(`[Copilot:${this.sessionId}] Attachments: ${JSON.stringify(i.map(s=>({type:s.type,path:s.type==="selection"?s.filePath:s.path})))}`),await this._wrapper.session.send({prompt:t,attachments:i}),this._logService.info(`[Copilot:${this.sessionId}] session.send() returned`)}sendSteering(t){this._logService.info(`[Copilot:${this.sessionId}] Sending steering message: "${t.userMessage.text.substring(0,100)}"`),this._wrapper.session.send({prompt:t.userMessage.text,mode:"immediate"}).catch(n=>{this._logService.error(`[Copilot:${this.sessionId}] Steering message failed`,n)})}async getMessages(){let t=await this._wrapper.session.getMessages(),n;try{n=this._databaseRef.object}catch{}return Bu(this.sessionUri,n,t)}async abort(){this._logService.info(`[Copilot:${this.sessionId}] Aborting session...`),this._denyPendingPermissions(),await this._wrapper.session.abort()}async setModel(t){this._logService.info(`[Copilot:${this.sessionId}] Changing model to: ${t}`),await this._wrapper.session.setModel(t)}async handlePermissionRequest(t){if(this._logService.info(`[Copilot:${this.sessionId}] Permission request: kind=${t.kind}`),t.kind==="read"){let c=typeof t.path=="string"?t.path:void 0;if(c&&this._workingDirectory&&mn.isEqualOrParent(ic(m.file(c)),this._workingDirectory))return this._logService.trace(`[Copilot:${this.sessionId}] Auto-approving read inside working directory: ${c}`),{kind:"approved"}}let n=t.toolCallId;if(!n)return this._logService.warn(`[Copilot:${this.sessionId}] Permission request without toolCallId, auto-denying: kind=${t.kind}`),{kind:"denied-interactively-by-user"};this._logService.info(`[Copilot:${this.sessionId}] Requesting confirmation for tool call: ${n}`);let i=new Ze;this._pendingPermissions.set(n,i);let{confirmationTitle:s,invocationMessage:o,toolInput:a}=mh(t);this._onDidSessionProgress.fire({session:this.sessionUri,type:"tool_ready",toolCallId:n,invocationMessage:o,toolInput:a,confirmationTitle:s,permissionKind:t.kind,permissionPath:typeof t.path=="string"?t.path:typeof t.fileName=="string"?t.fileName:void 0});let l=await i.p;return this._logService.info(`[Copilot:${this.sessionId}] Permission response: toolCallId=${n}, approved=${l}`),{kind:l?"approved":"denied-interactively-by-user"}}respondToPermissionRequest(t,n){let i=this._pendingPermissions.get(t);return i?(this._pendingPermissions.delete(t),i.complete(n),!0):!1}_subscribeToEvents(){let t=this._wrapper,n=this.sessionId,i=this.sessionUri;this._register(t.onMessageDelta(s=>{this._logService.trace(`[Copilot:${n}] delta: ${s.data.deltaContent}`),this._onDidSessionProgress.fire({session:i,type:"delta",messageId:s.data.messageId,content:s.data.deltaContent,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onMessage(s=>{this._logService.info(`[Copilot:${n}] Full message received: ${s.data.content.length} chars`),this._onDidSessionProgress.fire({session:i,type:"message",role:"assistant",messageId:s.data.messageId,content:s.data.content,toolRequests:s.data.toolRequests?.map(o=>({toolCallId:o.toolCallId,name:o.name,arguments:o.arguments!==void 0?on(o.arguments):void 0,type:o.type})),reasoningOpaque:s.data.reasoningOpaque,reasoningText:s.data.reasoningText,encryptedContent:s.data.encryptedContent,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onToolStart(s=>{if(Vr(s.data.toolName)){this._logService.trace(`[Copilot:${n}] Tool started (hidden): ${s.data.toolName}`);return}this._logService.info(`[Copilot:${n}] Tool started: ${s.data.toolName}`);let o=s.data.arguments!==void 0?on(s.data.arguments):void 0,a;if(o)try{a=JSON.parse(o)}catch{}let l=qr(s.data.toolName);this._activeToolCalls.set(s.data.toolCallId,{toolName:s.data.toolName,displayName:l,parameters:a});let c=vs(s.data.toolName);this._onDidSessionProgress.fire({session:i,type:"tool_start",toolCallId:s.data.toolCallId,toolName:s.data.toolName,displayName:l,invocationMessage:hs(s.data.toolName,l,a),toolInput:ms(s.data.toolName,a,o),toolKind:c,language:c==="terminal"?bs(s.data.toolName):void 0,toolArguments:o,mcpServerName:s.data.mcpServerName,mcpToolName:s.data.mcpToolName,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onTurnStart(s=>{this._turnId=s.data.turnId})),this._register(t.onToolComplete(s=>{let o=this._activeToolCalls.get(s.data.toolCallId);if(!o)return;this._logService.info(`[Copilot:${n}] Tool completed: ${s.data.toolCallId}`),this._activeToolCalls.delete(s.data.toolCallId);let a=o.displayName,l=s.data.error?.message??s.data.result?.content,c=[];l!==void 0&&c.push({type:"text",text:l});let d=zn(o.toolName)?ps(o.parameters):void 0;if(d){let u=this._editTracker.takeCompletedEdit(this._turnId,s.data.toolCallId,d);u&&c.push(u)}this._onDidSessionProgress.fire({session:i,type:"tool_complete",toolCallId:s.data.toolCallId,result:{success:s.data.success,pastTenseMessage:gs(o.toolName,a,o.parameters,s.data.success),content:c.length>0?c:void 0,error:s.data.error},isUserRequested:s.data.isUserRequested,toolTelemetry:s.data.toolTelemetry!==void 0?on(s.data.toolTelemetry):void 0,parentToolCallId:s.data.parentToolCallId})})),this._register(t.onIdle(()=>{this._logService.info(`[Copilot:${n}] Session idle`),this._onDidSessionProgress.fire({session:i,type:"idle"})})),this._register(t.onSessionError(s=>{this._logService.error(`[Copilot:${n}] Session error: ${s.data.errorType} - ${s.data.message}`),this._onDidSessionProgress.fire({session:i,type:"error",errorType:s.data.errorType,message:s.data.message,stack:s.data.stack})})),this._register(t.onUsage(s=>{this._logService.trace(`[Copilot:${n}] Usage: model=${s.data.model}, in=${s.data.inputTokens??"?"}, out=${s.data.outputTokens??"?"}, cacheRead=${s.data.cacheReadTokens??"?"}`),this._onDidSessionProgress.fire({session:i,type:"usage",inputTokens:s.data.inputTokens,outputTokens:s.data.outputTokens,model:s.data.model,cacheReadTokens:s.data.cacheReadTokens})})),this._register(t.onReasoningDelta(s=>{this._logService.trace(`[Copilot:${n}] Reasoning delta: ${s.data.deltaContent.length} chars`),this._onDidSessionProgress.fire({session:i,type:"reasoning",content:s.data.deltaContent})}))}_subscribeForLogging(){let t=this._wrapper,n=this.sessionId;this._register(t.onSessionStart(i=>{this._logService.trace(`[Copilot:${n}] Session started: model=${i.data.selectedModel??"default"}, producer=${i.data.producer}`)})),this._register(t.onSessionResume(i=>{this._logService.trace(`[Copilot:${n}] Session resumed: eventCount=${i.data.eventCount}`)})),this._register(t.onSessionInfo(i=>{this._logService.trace(`[Copilot:${n}] Session info [${i.data.infoType}]: ${i.data.message}`)})),this._register(t.onSessionModelChange(i=>{this._logService.trace(`[Copilot:${n}] Model changed: ${i.data.previousModel??"(none)"} -> ${i.data.newModel}`)})),this._register(t.onSessionHandoff(i=>{this._logService.trace(`[Copilot:${n}] Session handoff: sourceType=${i.data.sourceType}, remoteSessionId=${i.data.remoteSessionId??"(none)"}`)})),this._register(t.onSessionTruncation(i=>{this._logService.trace(`[Copilot:${n}] Session truncation: removed ${i.data.tokensRemovedDuringTruncation} tokens, ${i.data.messagesRemovedDuringTruncation} messages`)})),this._register(t.onSessionSnapshotRewind(i=>{this._logService.trace(`[Copilot:${n}] Snapshot rewind: upTo=${i.data.upToEventId}, eventsRemoved=${i.data.eventsRemoved}`)})),this._register(t.onSessionShutdown(i=>{this._logService.trace(`[Copilot:${n}] Session shutdown: type=${i.data.shutdownType}, premiumRequests=${i.data.totalPremiumRequests}, apiDuration=${i.data.totalApiDurationMs}ms`)})),this._register(t.onSessionUsageInfo(i=>{this._logService.trace(`[Copilot:${n}] Usage info: ${i.data.currentTokens}/${i.data.tokenLimit} tokens, ${i.data.messagesLength} messages`)})),this._register(t.onSessionCompactionStart(()=>{this._logService.trace(`[Copilot:${n}] Compaction started`)})),this._register(t.onSessionCompactionComplete(i=>{this._logService.trace(`[Copilot:${n}] Compaction complete: success=${i.data.success}, tokensRemoved=${i.data.tokensRemoved??"?"}`)})),this._register(t.onUserMessage(i=>{this._logService.trace(`[Copilot:${n}] User message: ${i.data.content.length} chars, ${i.data.attachments?.length??0} attachments`)})),this._register(t.onPendingMessagesModified(()=>{this._logService.trace(`[Copilot:${n}] Pending messages modified`)})),this._register(t.onTurnStart(i=>{this._logService.trace(`[Copilot:${n}] Turn started: ${i.data.turnId}`)})),this._register(t.onIntent(i=>{this._logService.trace(`[Copilot:${n}] Intent: ${i.data.intent}`)})),this._register(t.onReasoning(i=>{this._logService.trace(`[Copilot:${n}] Reasoning: ${i.data.content.length} chars`)})),this._register(t.onTurnEnd(i=>{this._logService.trace(`[Copilot:${n}] Turn ended: ${i.data.turnId}`)})),this._register(t.onAbort(i=>{this._logService.trace(`[Copilot:${n}] Aborted: ${i.data.reason}`)})),this._register(t.onToolUserRequested(i=>{this._logService.trace(`[Copilot:${n}] Tool user-requested: ${i.data.toolName} (${i.data.toolCallId})`)})),this._register(t.onToolPartialResult(i=>{this._logService.trace(`[Copilot:${n}] Tool partial result: ${i.data.toolCallId} (${i.data.partialOutput.length} chars)`)})),this._register(t.onToolProgress(i=>{this._logService.trace(`[Copilot:${n}] Tool progress: ${i.data.toolCallId} - ${i.data.progressMessage}`)})),this._register(t.onSkillInvoked(i=>{this._logService.trace(`[Copilot:${n}] Skill invoked: ${i.data.name} (${i.data.path})`)})),this._register(t.onSubagentStarted(i=>{this._logService.trace(`[Copilot:${n}] Subagent started: ${i.data.agentName} (${i.data.agentDisplayName})`)})),this._register(t.onSubagentCompleted(i=>{this._logService.trace(`[Copilot:${n}] Subagent completed: ${i.data.agentName}`)})),this._register(t.onSubagentFailed(i=>{this._logService.error(`[Copilot:${n}] Subagent failed: ${i.data.agentName} - ${i.data.error}`)})),this._register(t.onSubagentSelected(i=>{this._logService.trace(`[Copilot:${n}] Subagent selected: ${i.data.agentName}`)})),this._register(t.onHookStart(i=>{this._logService.trace(`[Copilot:${n}] Hook started: ${i.data.hookType} (${i.data.hookInvocationId})`)})),this._register(t.onHookEnd(i=>{this._logService.trace(`[Copilot:${n}] Hook ended: ${i.data.hookType} (${i.data.hookInvocationId}), success=${i.data.success}`)})),this._register(t.onSystemMessage(i=>{this._logService.trace(`[Copilot:${n}] System message [${i.data.role}]: ${i.data.content.length} chars`)}))}_denyPendingPermissions(){for(let[,t]of this._pendingPermissions)t.complete(!1);this._pendingPermissions.clear()}};jn=P([_e(5,Fn),_e(6,Oe),_e(7,ds)],jn);var $r=class extends A{constructor(t){super();this.session=t;this._register(O(()=>{t.destroy().catch(()=>{})}))}get sessionId(){return this.session.sessionId}get onMessageDelta(){return this._onMessageDelta??=this._sdkEvent("assistant.message_delta")}get onMessage(){return this._onMessage??=this._sdkEvent("assistant.message")}get onToolStart(){return this._onToolStart??=this._sdkEvent("tool.execution_start")}get onToolComplete(){return this._onToolComplete??=this._sdkEvent("tool.execution_complete")}get onIdle(){return this._onIdle??=this._sdkEvent("session.idle")}get onSessionStart(){return this._onSessionStart??=this._sdkEvent("session.start")}get onSessionResume(){return this._onSessionResume??=this._sdkEvent("session.resume")}get onSessionError(){return this._onSessionError??=this._sdkEvent("session.error")}get onSessionInfo(){return this._onSessionInfo??=this._sdkEvent("session.info")}get onSessionModelChange(){return this._onSessionModelChange??=this._sdkEvent("session.model_change")}get onSessionHandoff(){return this._onSessionHandoff??=this._sdkEvent("session.handoff")}get onSessionTruncation(){return this._onSessionTruncation??=this._sdkEvent("session.truncation")}get onSessionSnapshotRewind(){return this._onSessionSnapshotRewind??=this._sdkEvent("session.snapshot_rewind")}get onSessionShutdown(){return this._onSessionShutdown??=this._sdkEvent("session.shutdown")}get onSessionUsageInfo(){return this._onSessionUsageInfo??=this._sdkEvent("session.usage_info")}get onSessionCompactionStart(){return this._onSessionCompactionStart??=this._sdkEvent("session.compaction_start")}get onSessionCompactionComplete(){return this._onSessionCompactionComplete??=this._sdkEvent("session.compaction_complete")}get onUserMessage(){return this._onUserMessage??=this._sdkEvent("user.message")}get onPendingMessagesModified(){return this._onPendingMessagesModified??=this._sdkEvent("pending_messages.modified")}get onTurnStart(){return this._onTurnStart??=this._sdkEvent("assistant.turn_start")}get onIntent(){return this._onIntent??=this._sdkEvent("assistant.intent")}get onReasoning(){return this._onReasoning??=this._sdkEvent("assistant.reasoning")}get onReasoningDelta(){return this._onReasoningDelta??=this._sdkEvent("assistant.reasoning_delta")}get onTurnEnd(){return this._onTurnEnd??=this._sdkEvent("assistant.turn_end")}get onUsage(){return this._onUsage??=this._sdkEvent("assistant.usage")}get onAbort(){return this._onAbort??=this._sdkEvent("abort")}get onToolUserRequested(){return this._onToolUserRequested??=this._sdkEvent("tool.user_requested")}get onToolPartialResult(){return this._onToolPartialResult??=this._sdkEvent("tool.execution_partial_result")}get onToolProgress(){return this._onToolProgress??=this._sdkEvent("tool.execution_progress")}get onSkillInvoked(){return this._onSkillInvoked??=this._sdkEvent("skill.invoked")}get onSubagentStarted(){return this._onSubagentStarted??=this._sdkEvent("subagent.started")}get onSubagentCompleted(){return this._onSubagentCompleted??=this._sdkEvent("subagent.completed")}get onSubagentFailed(){return this._onSubagentFailed??=this._sdkEvent("subagent.failed")}get onSubagentSelected(){return this._onSubagentSelected??=this._sdkEvent("subagent.selected")}get onHookStart(){return this._onHookStart??=this._sdkEvent("hook.start")}get onHookEnd(){return this._onHookEnd??=this._sdkEvent("hook.end")}get onSystemMessage(){return this._onSystemMessage??=this._sdkEvent("system.message")}_sdkEvent(t){let n=this._register(new I),i=this.session.on(t,s=>n.fire(s));return this._register(O(i)),n.event}};var Hn=class extends A{constructor(t,n){super();this._logService=t;this._instantiationService=n;this.id="copilot";this._onDidSessionProgress=this._register(new I);this.onDidSessionProgress=this._onDidSessionProgress.event;this._sessions=this._register(new Ye)}getDescriptor(){return{provider:"copilot",displayName:"Agent Host - Copilot",description:"Copilot SDK agent running in a dedicated process",requiresAuth:!0}}getProtectedResources(){return[{resource:"https://api.github.com",resource_name:"GitHub Copilot",authorization_servers:["https://github.com/login/oauth"],scopes_supported:["read:user","user:email"]}]}async authenticate(t,n){if(t!=="https://api.github.com")return!1;let i=this._githubToken!==n;if(this._githubToken=n,this._logService.info(`[Copilot] Auth token ${i?"updated":"unchanged"}`),i&&this._client&&this._sessions.size===0){this._logService.info("[Copilot] Restarting CopilotClient with new token");let s=this._client;this._client=void 0,this._clientStarting=void 0,await s.stop()}return!0}async _ensureClient(){return this._client?this._client:this._clientStarting?this._clientStarting:(this._clientStarting=(async()=>{this._logService.info(`[Copilot] Starting CopilotClient... ${this._githubToken?"(with token)":"(no token)"}`);let t=Object.assign({},process.env,{ELECTRON_RUN_AS_NODE:"1"});delete t.NODE_OPTIONS,delete t.VSCODE_INSPECTOR_OPTIONS,delete t.VSCODE_ESM_ENTRYPOINT,delete t.VSCODE_HANDLES_UNCAUGHT_ERRORS;for(let c of Object.keys(t))c!=="ELECTRON_RUN_AS_NODE"&&(c.startsWith("VSCODE_")||c.startsWith("ELECTRON_"))&&delete t[c];t.COPILOT_CLI_RUN_AS_NODE="1",t.USE_BUILTIN_RIPGREP="0";let n=m.joinPath(Ct.asFileUri(""),"..","node_modules","@github","copilot","index.js").fsPath,i=bh.replace(/\bnode_modules\.asar\b/,"node_modules.asar.unpacked"),s=be(i),o=Object.keys(t).find(c=>c.toUpperCase()==="PATH")??"PATH",a=t[o];t[o]=a?`${a}${fo}${s}`:s,this._logService.info(`[Copilot] Resolved CLI path: ${n}`);let l=new vh({githubToken:this._githubToken,useLoggedInUser:!this._githubToken,useStdio:!0,autoStart:!0,env:t,cliPath:n});return await l.start(),this._logService.info("[Copilot] CopilotClient started successfully"),this._client=l,this._clientStarting=void 0,l})(),this._clientStarting)}async listSessions(){this._logService.info("[Copilot] Listing sessions...");let i=(await(await this._ensureClient()).listSessions()).map(s=>({session:ae.uri(this.id,s.sessionId),startTime:s.startTime.getTime(),modifiedTime:s.modifiedTime.getTime(),summary:s.summary,workingDirectory:typeof s.context?.cwd=="string"?m.file(s.context.cwd):void 0}));return this._logService.info(`[Copilot] Found ${i.length} sessions`),i}async listModels(){this._logService.info("[Copilot] Listing models...");let i=(await(await this._ensureClient()).listModels()).map(s=>({provider:this.id,id:s.id,name:s.name,maxContextWindow:s.capabilities.limits.max_context_window_tokens,supportsVision:s.capabilities.supports.vision,supportsReasoningEffort:s.capabilities.supports.reasoningEffort,supportedReasoningEfforts:s.supportedReasoningEfforts,defaultReasoningEffort:s.defaultReasoningEffort,policyState:s.policy?.state,billingMultiplier:s.billing?.multiplier}));return this._logService.info(`[Copilot] Found ${i.length} models`),i}async createSession(t){this._logService.info(`[Copilot] Creating session... ${t?.model?`model=${t.model}`:""}`);let n=await this._ensureClient(),i=async a=>{let l=await n.createSession({model:t?.model,sessionId:t?.session?ae.id(t.session):void 0,streaming:!0,workingDirectory:t?.workingDirectory?.fsPath,onPermissionRequest:a.onPermissionRequest,hooks:a.hooks});return new $r(l)},s=this._createAgentSession(i,t?.workingDirectory,t?.session?ae.id(t.session):void 0);await s.initializeSession();let o=s.sessionUri;return this._logService.info(`[Copilot] Session created: ${o.toString()}`),o}async sendMessage(t,n,i){let s=ae.id(t);await(this._sessions.get(s)??await this._resumeSession(s)).send(n,i)}setPendingMessages(t,n,i){let s=ae.id(t),o=this._sessions.get(s);if(!o){this._logService.warn(`[Copilot:${s}] setPendingMessages: session not found`);return}n&&o.sendSteering(n)}async getSessionMessages(t){let n=ae.id(t),i=this._sessions.get(n)??await this._resumeSession(n).catch(()=>{});return i?i.getMessages():[]}async disposeSession(t){let n=ae.id(t);this._sessions.deleteAndDispose(n)}async abortSession(t){let n=ae.id(t),i=this._sessions.get(n);i&&await i.abort()}async changeModel(t,n){let i=ae.id(t),s=this._sessions.get(i);s&&await s.setModel(n)}async shutdown(){this._logService.info("[Copilot] Shutting down..."),this._sessions.clearAndDisposeAll(),await this._client?.stop(),this._client=void 0}respondToPermissionRequest(t,n){for(let[,i]of this._sessions)if(i.respondToPermissionRequest(t,n))return}hasSession(t){return this._sessions.has(ae.id(t))}_createAgentSession(t,n,i){let s=i??Ge(),o=ae.uri(this.id,s),a=this._instantiationService.createInstance(jn,o,s,n,this._onDidSessionProgress,t);return this._sessions.set(s,a),a}async _resumeSession(t){this._logService.info(`[Copilot:${t}] Session not in memory, resuming...`);let n=await this._ensureClient(),i=async o=>{let a=await n.resumeSession(t,{onPermissionRequest:o.onPermissionRequest,workingDirectory:void 0,hooks:o.hooks});return new $r(a)},s=this._createAgentSession(i,void 0,t);return await s.initializeSession(),s}dispose(){this._client?.stop().catch(()=>{}),super.dispose()}};Hn=P([_e(0,Oe),_e(1,Oi)],Hn);var yh=1e3;function Is(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ra(r,e,t,n){return{jsonrpc:"2.0",id:r,error:{code:e,message:t,...n!==void 0?{data:n}:{}}}}function Ts(r,e){if(e instanceof X)return Ra(r,e.code,e.message,e.data);let t=e instanceof Error?e.stack??e.message:String(e);return Ra(r,Nn,t)}var Gn=class extends A{constructor(t,n,i,s,o){super();this._agentService=t;this._stateManager=n;this._server=i;this._config=s;this._logService=o;this._clients=new Map;this._replayBuffer=[];this._onDidChangeConnectionCount=this._register(new I);this.onDidChangeConnectionCount=this._onDidChangeConnectionCount.event;this._requestHandlers={subscribe:async(t,n)=>{try{let i=await this._agentService.subscribe(m.parse(n.resource));return t.subscriptions.add(n.resource),{snapshot:i}}catch(i){throw i instanceof X?i:new X(Mn,`Resource not found: ${n.resource}`)}},createSession:async(t,n)=>{let i;try{i=await this._agentService.createSession({provider:n.provider,model:n.model,workingDirectory:n.workingDirectory?m.parse(n.workingDirectory):void 0,session:m.parse(n.session)})}catch(s){throw s instanceof X?s:new X(cu,s instanceof Error?s.message:String(s))}return i.toString()!==m.parse(n.session).toString()&&this._logService.warn(`[ProtocolServer] createSession: provider returned URI ${i.toString()} but client requested ${n.session}`),null},disposeSession:async(t,n)=>(await this._agentService.disposeSession(m.parse(n.session)),null),writeFile:async(t,n)=>this._agentService.writeFile(n),listSessions:async()=>({items:(await this._agentService.listSessions()).map(i=>({resource:i.session.toString(),provider:ae.provider(i.session)??"copilot",title:i.summary??"Session",status:"idle",createdAt:i.startTime,modifiedAt:i.modifiedTime,workingDirectory:i.workingDirectory?.toString()}))}),fetchTurns:async(t,n)=>{let i=this._stateManager.getSessionState(n.session);if(!i)throw new X(Mn,`Session not found: ${n.session}`);let s=i.turns,o=Math.min(n.limit??50,100),a=s.length;if(n.before){let c=s.findIndex(d=>d.id===n.before);c!==-1&&(a=c)}let l=Math.max(0,a-o);return{turns:s.slice(l,a),hasMore:l>0}},browseDirectory:async(t,n)=>this._agentService.browseDirectory(m.parse(n.uri)),fetchContent:async(t,n)=>this._agentService.fetchContent(m.parse(n.uri))};this._register(this._server.onConnection(a=>{this._handleNewConnection(a)})),this._register(this._stateManager.onDidEmitEnvelope(a=>{this._replayBuffer.push(a),this._replayBuffer.length>yh&&this._replayBuffer.shift(),this._broadcastAction(a)})),this._register(this._stateManager.onDidEmitNotification(a=>{this._broadcastNotification(a)}))}_handleNewConnection(t){let n=new D,i;n.add(t.onMessage(s=>{if(du(s)){if(this._logService.trace(`[ProtocolServer] request: method=${s.method} id=${s.id}`),!i&&s.method==="initialize"){try{let o=this._handleInitialize(s.params,t,n);i=o.client,t.send(Is(s.id,o.response))}catch(o){t.send(Ts(s.id,o))}return}if(!i&&s.method==="reconnect"){try{let o=this._handleReconnect(s.params,t,n);i=o.client,t.send(Is(s.id,o.response))}catch(o){t.send(Ts(s.id,o))}return}if(!i)return;this._handleRequest(i,s.method,s.params,s.id)}else if(pu(s))switch(this._logService.trace(`[ProtocolServer] notification: method=${s.method}`),s.method){case"unsubscribe":i&&i.subscriptions.delete(s.params.resource);break;case"dispatchAction":if(i){this._logService.trace(`[ProtocolServer] dispatchAction: ${JSON.stringify(s.params.action.type)}`);let o=s.params.action;this._agentService.dispatchAction(o,i.clientId,s.params.clientSeq)}break}})),n.add(t.onClose(()=>{i&&this._clients.get(i.clientId)===i&&(this._logService.info(`[ProtocolServer] Client disconnected: ${i.clientId}`),this._clients.delete(i.clientId),this._onDidChangeConnectionCount.fire(this._clients.size)),n.dispose()})),n.add(t)}_handleInitialize(t,n,i){if(this._logService.info(`[ProtocolServer] Initialize: clientId=${t.clientId}, version=${t.protocolVersion}`),t.protocolVersion<1)throw new X(uu,`Client protocol version ${t.protocolVersion} is below minimum ${1}`);let s={clientId:t.clientId,protocolVersion:t.protocolVersion,transport:n,subscriptions:new Set,disposables:i};this._clients.set(t.clientId,s),this._onDidChangeConnectionCount.fire(this._clients.size);let o=[];if(t.initialSubscriptions)for(let a of t.initialSubscriptions){let l=this._stateManager.getSnapshot(a);l&&(o.push(l),s.subscriptions.add(a.toString()))}return{client:s,response:{protocolVersion:1,serverSeq:this._stateManager.serverSeq,snapshots:o,defaultDirectory:this._config.defaultDirectory}}}_handleReconnect(t,n,i){this._logService.info(`[ProtocolServer] Reconnect: clientId=${t.clientId}, lastSeenSeq=${t.lastSeenServerSeq}`);let s={clientId:t.clientId,protocolVersion:1,transport:n,subscriptions:new Set,disposables:i};this._clients.set(t.clientId,s),this._onDidChangeConnectionCount.fire(this._clients.size);let o=this._replayBuffer.length>0?this._replayBuffer[0].serverSeq:this._stateManager.serverSeq;if(t.lastSeenServerSeq>=o){let l=[];for(let c of t.subscriptions)s.subscriptions.add(c.toString());for(let c of this._replayBuffer)c.serverSeq>t.lastSeenServerSeq&&this._isRelevantToClient(s,c)&&l.push(c);return{client:s,response:{type:"replay",actions:l}}}else{let l=[];for(let c of t.subscriptions){let d=this._stateManager.getSnapshot(c);d&&(l.push(d),s.subscriptions.add(c))}return{client:s,response:{type:"snapshot",snapshots:l}}}}_handleRequest(t,n,i,s){let o=this._requestHandlers.hasOwnProperty(n)?this._requestHandlers[n]:void 0;if(o){o(t,i).then(l=>{this._logService.trace(`[ProtocolServer] Request '${n}' id=${s} succeeded`),t.transport.send(Is(s,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Request '${n}' failed`,l),t.transport.send(Ts(s,l))});return}let a=this._handleExtensionRequest(n,i);if(a){a.then(l=>{t.transport.send(Is(s,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Extension request '${n}' failed`,l),t.transport.send(Ts(s,l))});return}t.transport.send(Ra(s,Nn,`Unknown method: ${n}`))}_handleExtensionRequest(t,n){switch(t){case"getResourceMetadata":return this._agentService.getResourceMetadata();case"authenticate":{let i=n;return!i||typeof i.resource!="string"||typeof i.token!="string"?Promise.reject(new X(-32602,"Invalid authenticate params")):this._agentService.authenticate(i)}case"refreshModels":return this._agentService.refreshModels();case"listAgents":return this._agentService.listAgents();case"shutdown":return this._agentService.shutdown();default:return}}_broadcastAction(t){this._logService.trace(`[ProtocolServer] Broadcasting action: ${t.action.type}`);let n={jsonrpc:"2.0",method:"action",params:t};for(let i of this._clients.values())this._isRelevantToClient(i,t)&&i.transport.send(n)}_broadcastNotification(t){let n={jsonrpc:"2.0",method:"notification",params:{notification:t}};for(let i of this._clients.values())i.transport.send(n)}_isRelevantToClient(t,n){let i=n.action;return i.type.startsWith("root/")?t.subscriptions.has(Yi):Qi(i)?t.subscriptions.has(i.session):!1}dispose(){for(let t of this._clients.values())t.disposables.dispose();this._clients.clear(),this._replayBuffer.length=0,super.dispose()}};Gn=P([_e(4,Oe)],Gn);var wa=class extends A{constructor(t,n){super();this._ws=t;this._WebSocket=n;this._onMessage=this._register(new I);this.onMessage=this._onMessage.event;this._onClose=this._register(new I);this.onClose=this._onClose.event;this._ws.on("message",i=>{try{let s=typeof i=="string"?i:i.toString("utf-8"),o=JSON.parse(s);this._onMessage.fire(o)}catch{this.send({jsonrpc:"2.0",id:null,error:{code:lu,message:"Parse error"}})}}),this._ws.on("close",()=>{this._onClose.fire()}),this._ws.on("error",()=>{this._onClose.fire()})}send(t){this._ws.readyState===this._WebSocket.OPEN&&this._ws.send(JSON.stringify(t))}dispose(){this._ws.close(),super.dispose()}},Ss=class r extends A{constructor(t,n,i,s,o){super();this._logService=n;this._onConnection=this._register(new I);this.onConnection=this._onConnection.event;this._WebSocket=i.WebSocket;let a=typeof t=="number"?{port:t}:t,l=a.host??"127.0.0.1",c=a.connectionTokenValidate?(d,u)=>{let h=o.parse(d.req.url??"",!0).query[xo];if(!a.connectionTokenValidate(h)){this._logService.warn("[WebSocketProtocol] Connection rejected: invalid connection token"),u(!1,403,"Forbidden");return}u(!0)}:void 0;a.socketPath?(this._httpServer=s.createServer(),this._wss=new i.WebSocketServer({server:this._httpServer,verifyClient:c}),this._httpServer.listen(a.socketPath,()=>{this._logService.info(`[WebSocketProtocol] Server listening on socket ${a.socketPath}`)})):(this._wss=new i.WebSocketServer({port:a.port,host:l,verifyClient:c}),this._logService.info(`[WebSocketProtocol] Server listening on ${l}:${a.port}`)),this._wss.on("connection",d=>{this._logService.trace("[WebSocketProtocol] New client connection");let u=new wa(d,this._WebSocket);this._onConnection.fire(u)}),this._wss.on("error",d=>{this._logService.error("[WebSocketProtocol] Server error",d)})}get address(){let t=this._wss.address();return!t||typeof t=="string"?t??void 0:`${t.address}:${t.port}`}static async create(t,n){let[i,s,o]=await Promise.all([import("ws"),import("http"),import("url")]);return new r(t,n,i,s,o)}dispose(){this._wss.close(),this._httpServer?.close(),super.dispose()}};import{homedir as wh,tmpdir as Ch}from"os";var Ih=60,Th=Ih*60,Ca=Th*24,Q4=Ca*7,J4=Ca*30,Y4=Ca*365;function $u(r){return r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+(r.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var Ku=/^([^.]+\..+)[:=](.+)$/,M=class{constructor(e,t,n){this._args=e;this.paths=t;this.productService=n}get appRoot(){return be(Ct.asFileUri("").fsPath)}get userHome(){return m.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return m.file(J(this.userDataPath,"User"))}get tmpDir(){return m.file(this.paths.tmpDir)}get cacheHome(){return m.file(this.userDataPath)}get stateResource(){return oe(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:Y.vscodeUserData})}get userDataSyncHome(){return oe(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let e=$u(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=J(this.userDataPath,"logs",e)}return m.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return oe(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return oe(this.appSettingsHome,"History")}get keyboardLayoutResource(){return oe(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let e=ie.VSCODE_PORTABLE;return e?m.file(J(e,"argv.json")):oe(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return m.file(J(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let e=this.args["builtin-extensions-dir"];return e?qt(e):Me(J(Ct.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let e=this.args["extensions-download-dir"];return e?m.file(qt(e)):m.file(J(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let e=this.args["extensions-dir"];if(e)return qt(e);let t=ie.VSCODE_EXTENSIONS;if(t)return t;let n=ie.VSCODE_PORTABLE;return n?J(n,"extensions"):oe(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let e=this.args["agent-plugins-dir"];if(e)return qt(e);let t=ie.VSCODE_AGENT_PLUGINS;if(t)return t;let n=ie.VSCODE_PORTABLE;return n?J(n,"agent-plugins"):oe(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let e=this.args.extensionDevelopmentPath;if(Array.isArray(e))return e.map(t=>/^[^:/?#]+?:\/\//.test(t)?m.parse(t):m.file(Me(t)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(e=>e==="ui"||e==="workspace"||e==="web"?e:"workspace")}get extensionTestsLocationURI(){let e=this.args.extensionTestsPath;if(e)return/^[^:/?#]+?:\/\//.test(e)?m.parse(e):m.file(Me(e))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let e=this.args["disable-extension"];if(e){if(typeof e=="string")return[e];if(Array.isArray(e)&&e.length>0)return e}return!1}get debugExtensionHost(){return Sh(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!ie.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(e=>!Ku.test(e))}get extensionLogLevel(){let e=[];for(let t of this.args.log||[]){let n=Ku.exec(t);n?.[1]&&n[2]&&e.push([n[1],n[2]])}return e.length?e:void 0}get serviceMachineIdResource(){return oe(m.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let e=ie.VSCODE_PORTABLE;return e?m.file(J(e,"policy.json")):oe(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return oe(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(e){this.args.continueOn=e}get args(){return this._args}};P([B],M.prototype,"appRoot",1),P([B],M.prototype,"userHome",1),P([B],M.prototype,"userDataPath",1),P([B],M.prototype,"appSettingsHome",1),P([B],M.prototype,"tmpDir",1),P([B],M.prototype,"cacheHome",1),P([B],M.prototype,"stateResource",1),P([B],M.prototype,"userRoamingDataHome",1),P([B],M.prototype,"userDataSyncHome",1),P([B],M.prototype,"sync",1),P([B],M.prototype,"workspaceStorageHome",1),P([B],M.prototype,"localHistoryHome",1),P([B],M.prototype,"keyboardLayoutResource",1),P([B],M.prototype,"argvResource",1),P([B],M.prototype,"isExtensionDevelopment",1),P([B],M.prototype,"untitledWorkspacesHome",1),P([B],M.prototype,"builtinExtensionsPath",1),P([B],M.prototype,"extensionsDownloadLocation",1),P([B],M.prototype,"extensionsPath",1),P([B],M.prototype,"agentPluginsPath",1),P([B],M.prototype,"extensionDevelopmentLocationURI",1),P([B],M.prototype,"extensionDevelopmentKind",1),P([B],M.prototype,"extensionTestsLocationURI",1),P([B],M.prototype,"debugExtensionHost",1),P([B],M.prototype,"logLevel",1),P([B],M.prototype,"extensionLogLevel",1),P([B],M.prototype,"serviceMachineIdResource",1),P([B],M.prototype,"disableTelemetry",1),P([B],M.prototype,"disableExperiments",1),P([B],M.prototype,"disableWorkspaceTrust",1),P([B],M.prototype,"useInMemorySecretStorage",1),P([B],M.prototype,"policyFile",1),P([B],M.prototype,"agentSessionsWorkspace",1);function Sh(r,e){return zu(r["inspect-extensions"],r["inspect-brk-extensions"],5870,e,r.debugId,r.extensionEnvironment)}function zu(r,e,t,n,i,s){let a=Number(e||r)||(n?null:t),l=a?!!e:!1,c;if(s)try{c=JSON.parse(s)}catch{}return{port:a,break:l,debugId:i,env:c}}import{homedir as ju}from"os";import{resolve as _h,isAbsolute as xh,join as Qn}from"path";var Eh=process.env.VSCODE_CWD||process.cwd();function Hu(r,e){let t=Rh(r,e),n=[t];return xh(t)||n.unshift(Eh),_h(...n)}function Rh(r,e){process.env.VSCODE_DEV&&(process.isEmbeddedApp?e="sessions-oss-dev":e="code-oss-dev");let t=process.env.VSCODE_PORTABLE;if(t)return Qn(t,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Qn(n,e);let i=r["user-data-dir"];if(i)return i;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let s=process.env.USERPROFILE;if(typeof s!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Qn(s,"AppData","Roaming")}break;case"darwin":n=Qn(ju(),"Library","Application Support");break;case"linux":default:n=process.env.XDG_CONFIG_HOME||Qn(ju(),".config");break}return Qn(n,e)}var _s=class extends M{constructor(e,t){super(e,{homeDir:wh(),tmpDir:Ch(),userDataDir:Hu(e,t.nameShort)},t)}};import Ph from"minimist";var bx={o:f(1944,null),e:f(1928,null),t:f(1959,null),m:f(1939,null)};var Gu={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:f(1948,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:f(1915,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:f(1911,null)},maximize:{type:"boolean",cat:"o",description:f(1914,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:f(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:f(1942,null)},profile:{type:"string",cat:"o",args:"profileName",description:f(1947,null)},help:{type:"boolean",alias:"h",description:f(1930,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:f(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:f(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:f(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:f(1920,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:f(1940,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:f(1910,null)},remove:{type:"boolean",cat:"o",args:"folder",description:f(1949,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:f(1929,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:f(1941,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:f(1950,null)},sessions:{type:"boolean",cat:"o",description:f(1952,null)},wait:{type:"boolean",cat:"o",alias:"w",description:f(1969,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:f(1936,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:f(1966,null)},profile:{type:"string",cat:"o",args:"profileName",description:f(1947,null)},help:{type:"boolean",cat:"o",alias:"h",description:f(1930,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:f(1917,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:f(1927,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:f(1935,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:f(1953,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:f(1913,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:f(1934,null)},"pre-release":{type:"boolean",cat:"e",description:f(1933,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:f(1961,null)},"update-extensions":{type:"boolean",cat:"e",description:f(1964,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:f(1926,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:f(1912,null)},version:{type:"boolean",cat:"t",alias:"v",description:f(1968,null)},verbose:{type:"boolean",cat:"t",global:!0,description:f(1967,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:f(1938,null)},status:{type:"boolean",alias:"s",cat:"t",description:f(1954,null)},"prof-startup":{type:"boolean",cat:"t",description:f(1946,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:f(1923,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:f(1922,null)},sync:{type:"string",cat:"t",description:f(1960,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:f(1932,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:f(1931,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:f(1925,null)},"disable-gpu":{type:"boolean",cat:"t",description:f(1924,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:f(1921,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:f(1937,null)},telemetry:{type:"boolean",cat:"t",description:f(1957,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},transient:{type:"boolean",cat:"t",description:f(1958,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},Dh={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function Pa(r,e,t=Dh){let n=r.find((p,h)=>p.length>0&&p[0]!=="-"&&e.hasOwnProperty(p)&&e[p].type==="subcommand"),i={},s=["_"],o=[],a={},l;for(let p in e){let h=e[p];h.type==="subcommand"?p===n&&(l=h):(h.alias&&(i[p]=h.alias),h.type==="string"||h.type==="string[]"?(s.push(p),h.deprecates&&s.push(...h.deprecates)):h.type==="boolean"&&(o.push(p),h.deprecates&&o.push(...h.deprecates)),h.global&&(a[p]=h))}if(l&&n){let p=a;for(let W in l.options)p[W]=l.options[W];let h=r.filter(W=>W!==n),g=t.getSubcommandReporter?t.getSubcommandReporter(n):void 0,b=Pa(h,p,g);return{[n]:b,_:[]}}let c=Ph(r,{string:s,boolean:o,alias:i}),d={},u=c;d._=c._.map(p=>String(p)).filter(p=>p.length>0),delete u._;for(let p in e){let h=e[p];if(h.type==="subcommand")continue;h.alias&&delete u[h.alias];let g=u[p];if(h.deprecates)for(let b of h.deprecates)u.hasOwnProperty(b)&&(g||(g=u[b],g&&t.onDeprecatedOption(b,h.deprecationMessage||f(1919,null,p))),delete u[b]);if(typeof g<"u"){if(h.type==="string[]"){if(Array.isArray(g)||(g=[g]),!h.allowEmptyValue){let b=g.filter(W=>W.length>0);b.length!==g.length&&(t.onEmptyValue(p),g=b.length>0?b:void 0)}}else h.type==="string"&&(Array.isArray(g)?(g=g.pop(),t.onMultipleValues(p,g)):!g&&!h.allowEmptyValue&&(t.onEmptyValue(p),g=void 0));d[p]=g,h.deprecationMessage&&t.onDeprecatedOption(p,h.deprecationMessage)}delete u[p]}for(let p in u)t.onUnknownOption(p);return d}var xs=class extends A{constructor(e,t=[]){super(),this.logger=new cs([e,...t]),this._register(e.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}flush(){this.logger.flush()}};async function kh(r,e,t,n,i){try{let s=await import("@vscode/spdlog");s.setFlushOn(0);let o=await s.createAsyncRotatingLogger(r,e,t,n);return i?o.clearFormatters():o.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),o}catch(s){console.error(s)}return null}function Qu(r,e,t){switch(e){case 1:r.trace(t);break;case 2:r.debug(t);break;case 3:r.info(t);break;case 4:r.warn(t);break;case 5:r.error(t);break;case 0:break;default:throw new Error(`Invalid log level ${e}`)}}function Ju(r,e){switch(e){case 1:r.setLevel(0);break;case 2:r.setLevel(1);break;case 3:r.setLevel(2);break;case 4:r.setLevel(3);break;case 5:r.setLevel(4);break;case 0:r.setLevel(6);break;default:throw new Error(`Invalid log level ${e}`)}}var Es=class extends Nr{constructor(t,n,i,s,o){super();this.buffer=[];this.setLevel(o),this._loggerCreationPromise=this._createSpdLogLogger(t,n,i,s),this._register(this.onDidChangeLogLevel(a=>{this._logger&&Ju(this._logger,a)}))}async _createSpdLogLogger(t,n,i,s){let o=i?6:1,a=30/o*zi.MB,l=await kh(t,n,a,o,s);if(l){this._logger=l,Ju(this._logger,this.getLevel());for(let{level:c,message:d}of this.buffer)Qu(this._logger,c,d);this.buffer=[]}}log(t,n){this._logger?Qu(this._logger,t,n):this.getLevel()<=t&&this.buffer.push({level:t,message:n})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}};var Rs=class extends Mr{doCreateLogger(e,t,n){return new Es(Ge(),e.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,t)}};var ws=class{constructor(e,t){this.loggerService=e;this.getUriTransformer=t}listen(e,t){let n=this.getUriTransformer(e);switch(t){case"onDidChangeLoggers":return V.map(this.loggerService.onDidChangeLoggers,i=>({added:[...i.added].map(s=>this.transformLogger(s,n)),removed:[...i.removed].map(s=>this.transformLogger(s,n))}));case"onDidChangeVisibility":return V.map(this.loggerService.onDidChangeVisibility,i=>[n.transformOutgoingURI(i[0]),i[1]]);case"onDidChangeLogLevel":return V.map(this.loggerService.onDidChangeLogLevel,i=>Ia(i)?i:[n.transformOutgoingURI(i[0]),i[1]])}throw new Error(`Event not found: ${t}`)}async call(e,t,n){let i=this.getUriTransformer(e);switch(t){case"setLogLevel":return Ia(n[0])?this.loggerService.setLogLevel(n[0]):this.loggerService.setLogLevel(m.revive(i.transformIncoming(n[0][0])),n[0][1]);case"getRegisteredLoggers":return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(s=>this.transformLogger(s,i)))}throw new Error(`Call not found: ${t}`)}transformLogger(e,t){return{...e,resource:t.transformOutgoingURI(e.resource)}}};var Yu=new class{transformIncoming(r){return r}transformOutgoing(r){return r}transformOutgoingURI(r){return r}transformOutgoingScheme(r){return r}};var Ie,Da=globalThis.vscode;if(typeof Da<"u"&&typeof Da.context<"u"){let r=Da.context.configuration();if(r)Ie=r.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(Ie=globalThis._VSCODE_PRODUCT_JSON,ie.VSCODE_DEV&&Object.assign(Ie,{nameShort:`${Ie.nameShort} Dev`,nameLong:`${Ie.nameLong} Dev`,dataFolderName:`${Ie.dataFolderName}-dev`,serverDataFolderName:Ie.serverDataFolderName?`${Ie.serverDataFolderName}-dev`:void 0}),!Ie.version){let r=globalThis._VSCODE_PACKAGE_JSON;Object.assign(Ie,{version:r.version})}Object.assign(Ie,{extensionsGallery:ie.EXTENSIONS_GALLERY?JSON.parse(ie.EXTENSIONS_GALLERY):Ie.extensionsGallery||{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item",extensionUrlTemplate:"https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",resourceUrlTemplate:"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",controlUrl:"",recommendationsUrl:""},telemetryEndpoint:ie.CS_TELEMETRY_URL||Ie.telemetryEndpoint||"https://v1.telemetry.coder.com/track"})}else Ie={nameShort:"code-server",nameLong:"code-server",applicationName:"code-server",dataFolderName:".code-server",win32MutexName:"codeserver",licenseName:"MIT",licenseUrl:"https://github.com/coder/code-server/blob/main/LICENSE",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"code-server",win32NameVersion:"code-server",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"coder.code-server",win32ShellNameShort:"c&ode-server",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.coder.code.server",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"com.coder.code.server",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/coder/code-server/issues/new",nodejsRepository:"https://nodejs.org",urlProtocol:"code-oss",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.112.0",sha256:"c24322931434940938f8cf76ebc3dac1e95a5539b9625b165b6672d7f7eafea8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE.com"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",completionsRefreshTokenCommand:"github.copilot.signIn",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry"},trustedExtensionAuthAccess:["vscode.git","vscode.github","github.vscode-pull-request-github","github.copilot","github.copilot-chat"],enableTelemetry:!0,quality:"stable",codeServerVersion:"4.114.1",documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",linkProtectionTrustedDomains:["https://open-vsx.org"],aiConfig:{ariaKey:"code-server"},version:"1.114.0",commit:"4af6408e399e2f795e98b043fd30c16ba31ab0c6",date:"2026-04-01T09:27:11Z"},Object.keys(Ie).length===0&&Object.assign(Ie,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var Xu=Ie;function Aa(r){let e=[];typeof r=="number"&&e.push("code/timeOrigin",r);function t(s,o){e.push(s,o?.startTime??Date.now())}function n(){let s=[];for(let o=0;o=0;o-=2)typeof e[o]=="string"&&e[o].startsWith(s)&&e.splice(o,2)}return{mark:t,getMarks:n,clearMarks:i}}function Lh(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?Aa():{mark(r,e){performance.mark(r,e)},clearMarks(r){let e=new Set;for(let t of performance.getEntriesByType("mark"))t.name.startsWith(r)&&e.add(t.name);for(let t of e)performance.clearMarks(t)},getMarks(){let r=performance.timeOrigin;typeof r!="number"&&(r=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let e=[{name:"code/timeOrigin",startTime:Math.round(r)}];for(let t of performance.getEntriesByType("mark"))e.push({name:t.name,startTime:Math.round(r+t.startTime)});return e}};if(typeof process=="object"){let r=performance?.timeOrigin;return Aa(r)}else return console.trace("perf-util loaded in UNKNOWN environment"),Aa()}function Oh(r){return r.MonacoPerformanceMarks||(r.MonacoPerformanceMarks=Lh()),r.MonacoPerformanceMarks}var ka=Oh(globalThis),Zu=ka.mark,i5=ka.clearMarks,s5=ka.getMarks;async function Cs(r,e,t,n,i,s){let o;try{await Fh(r,e,t,n,i,s)}catch(a){o=a}finally{o&&i.errorTransformer&&(o=i.errorTransformer(o)),typeof o<"u"&&t.error(o),t.end()}}async function Fh(r,e,t,n,i,s){La(s);let o=await r.open(e,{create:!1});try{La(s);let a=0,l=0,c=i&&typeof i.length=="number"?i.length:void 0,d=x.alloc(Math.min(i.bufferSize,typeof c=="number"?c:i.bufferSize)),u=i&&typeof i.position=="number"?i.position:0,p=0;do l=await r.read(o,u,d.buffer,p,d.byteLength-p),u+=l,p+=l,a+=l,typeof c=="number"&&(c-=l),p===d.byteLength&&(await t.write(n(d)),d=x.alloc(Math.min(i.bufferSize,typeof c=="number"?c:i.bufferSize)),p=0);while(l>0&&(typeof c!="number"||c>0)&&La(s)&&Uh(a,i));if(p>0){let h=p;typeof c=="number"&&(h=Math.min(p,c)),t.write(n(d.slice(0,h)))}}catch(a){throw gt(a)}finally{await r.close(o)}}function La(r){if(r.isCancellationRequested)throw Qr();return!0}function Uh(r,e){if(typeof e?.limits?.size=="number"&&r>e.limits.size)throw Qe(f(2128,null),"EntryTooLarge");return!0}var kt=class extends A{constructor(t){super();this.logService=t;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new I);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new I);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new I);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new I);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new I);this._onDidUncorrelatedFilesChange=this._register(new I);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new I);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new vn)}registerProvider(t,n){if(this.provider.has(t))throw new Error(`A filesystem provider for the scheme '${t}' is already registered.`);Zu(`code/registerFilesystem/${t}`);let i=new D;return this.provider.set(t,n),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:t,provider:n}),i.add(n.onDidChangeFile(s=>{let o=new Ki(s,!this.isPathCaseSensitive(n));this.internalOnDidFilesChange.fire(o),o.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(o)})),typeof n.onDidWatchError=="function"&&i.add(n.onDidWatchError(s=>this._onDidWatchError.fire(new Error(s)))),i.add(n.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:n,scheme:t}))),O(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:t,provider:n}),this.provider.delete(t),Ee(i)})}getProvider(t){return this.provider.get(t)}async activateProvider(t){let n=[];this._onWillActivateFileSystemProvider.fire({scheme:t,join(i){n.push(i)}}),!this.provider.has(t)&&await Gt.settled(n)}async canHandleResource(t){return await this.activateProvider(t.scheme),this.hasProvider(t)}hasProvider(t){return this.provider.has(t.scheme)}hasCapability(t,n){let i=this.provider.get(t.scheme);return!!(i&&i.capabilities&n)}listCapabilities(){return nr.map(this.provider,([t,n])=>({scheme:t,capabilities:n.capabilities}))}async withProvider(t){if(!sc(t))throw new ce(f(2117,null,this.resourceForError(t)),8);await this.activateProvider(t.scheme);let n=this.provider.get(t.scheme);if(!n){let i=new Je;throw i.message=f(2119,null,t.toString()),i}return n}async withReadProvider(t){let n=await this.withProvider(t);if(ht(n)||Ne(n)||ji(n))return n;throw new Error(`Filesystem provider for scheme '${t.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(t){let n=await this.withProvider(t);if(ht(n)||Ne(n))return n;throw new Error(`Filesystem provider for scheme '${t.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(t,n){try{return await this.doResolveFile(t,n)}catch(i){throw tn(i)==="EntryNotFound"?new ce(f(2114,null,this.resourceForError(t)),1):gt(i)}}async doResolveFile(t,n){let i=await this.withProvider(t),s=this.isPathCaseSensitive(i),o=n?.resolveTo,a=n?.resolveSingleChildDescendants,l=n?.resolveMetadata,c=await i.stat(t),d;return this.toFileStat(i,t,c,void 0,!!l,(u,p)=>(d||(d=Dt.forUris(()=>!s),d.set(t,!0),o&&d.fill(!0,o)),d.get(u.resource)||d.findSuperstr(u.resource.with({query:null,fragment:null}))?!0:u.isDirectory&&a?p===1:!1))}async toFileStat(t,n,i,s,o,a){let{providerExtUri:l}=this.getExtUri(t),c={resource:n,name:l.basename(n),isFile:(i.type&1)!==0,isDirectory:(i.type&2)!==0,isSymbolicLink:(i.type&64)!==0,mtime:i.mtime,ctime:i.ctime,size:i.size,readonly:!!((i.permissions??0)&1)||!!(t.capabilities&2048),locked:!!((i.permissions??0)&2),executable:!!((i.permissions??0)&4),etag:ra({mtime:i.mtime,size:i.size}),children:void 0};if(c.isDirectory&&a(c,s)){try{let d=await t.readdir(n),u=await Gt.settled(d.map(async([p,h])=>{try{let g=l.joinPath(n,p),b=o?await t.stat(g):{type:h};return await this.toFileStat(t,g,b,d.length,o,a)}catch(g){return this.logService.trace(g),null}}));c.children=Yr(u)}catch(d){this.logService.trace(d),c.children=[]}return c}return c}async resolveAll(t){return Gt.settled(t.map(async n=>{try{return{stat:await this.doResolveFile(n.resource,n.options),success:!0}}catch(i){return this.logService.trace(i),{stat:void 0,success:!1}}}))}async stat(t){let n=await this.withProvider(t),i=await n.stat(t);return this.toFileStat(n,t,i,void 0,!0,()=>!1)}async realpath(t){let n=await this.withProvider(t);if(iu(n)){let i=await n.realpath(t);return t.with({path:i})}}async exists(t){let n=await this.withProvider(t);try{return!!await n.stat(t)}catch{return!1}}async canCreateFile(t,n){try{await this.doValidateCreateFile(t,n)}catch(i){return i}return!0}async doValidateCreateFile(t,n){if(!n?.overwrite&&await this.exists(t))throw new ce(f(2110,null,this.resourceForError(t)),3,n)}async createFile(t,n=x.fromString(""),i){await this.doValidateCreateFile(t,i);let s=await this.writeFile(t,n);return this._onDidRunOperation.fire(new ft(t,0,s)),s}async writeFile(t,n,i){let s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),{providerExtUri:o}=this.getExtUri(s),a=i;if(ta(s)&&!a?.atomic){let l=s.enforceAtomicWriteFile?.(t);l&&(a={...i,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(s,t,n,a);l||await this.mkdirp(s,o.dirname(t)),c||(c=await this.peekBufferForWriting(s,n)),!ht(s)||Ne(s)&&c instanceof x||Ne(s)&&ta(s)&&a?.atomic?await this.doWriteUnbuffered(s,t,a,c):await this.doWriteBuffered(s,t,a,c instanceof x?vc(c):c),this._onDidRunOperation.fire(new ft(t,4))}catch(l){throw new ce(f(2109,null,this.resourceForError(t),gt(l).toString()),na(l),a)}return this.resolve(t,{resolveMetadata:!0})}async peekBufferForWriting(t,n){let i;if(Ne(t)&&!(n instanceof x))if(pr(n)){let s=await pc(n,3);s.ended?i=x.concat(s.buffer):i=s}else i=dc(n,s=>x.concat(s),3);else i=n;return i}async validateWriteFile(t,n,i,s){let o=!!s?.unlock;if(o&&!(t.capabilities&8192))throw new Error(f(2127,null,this.resourceForError(n)));if(s?.append&&!nu(t))throw new ce(f(2106,null,this.resourceForError(n)),6);if(!!s?.atomic){if(!(t.capabilities&32768))throw new Error(f(2125,null,this.resourceForError(n)));if(!(t.capabilities&2))throw new Error(f(2126,null,this.resourceForError(n)));if(o)throw new Error(f(2124,null,this.resourceForError(n)))}let l;try{l=await t.stat(n)}catch{return Object.create(null)}if((l.type&2)!==0)throw new ce(f(2112,null,this.resourceForError(n)),0,s);this.throwIfFileIsReadonly(n,l);let c;if(typeof s?.mtime=="number"&&typeof s.etag=="string"&&s.etag!==Gi&&typeof l.mtime=="number"&&typeof l.size=="number"&&s.mtime{this.writeQueue.queueFor(n,async()=>{try{let l=await this.doReadFile(t,n,i,s);o(l)}catch(l){a(l)}},this.getExtUri(t).providerExtUri)})}async doReadFile(t,n,i,s){let o=await this.doReadFileStream(t,n,{...i,preferUnbuffered:!0},s);return{...o,value:await hr(o.value)}}async readFileStream(t,n,i){let s=await this.withReadProvider(t);return this.doReadFileStream(s,t,n,i)}async doReadFileStream(t,n,i,s){let o=new Re(s),a=i;Hi(t)&&t.enforceAtomicReadFile?.(n)&&(a={...i,atomic:!0});let l=this.validateReadFile(n,a).then(d=>d,d=>{throw o.dispose(!0),d}),c;try{return typeof a?.etag=="string"&&a.etag!==Gi&&await l,a?.atomic&&Hi(t)||!(ht(t)||ji(t))||Ne(t)&&a?.preferUnbuffered?c=this.readFileUnbuffered(t,n,a):ji(t)?c=this.readFileStreamed(t,n,o.token,a):c=this.readFileBuffered(t,n,o.token,a),c.on("end",()=>o.dispose()),c.on("error",()=>o.dispose()),{...await l,value:c}}catch(d){throw c&&await xi(c),this.restoreReadError(d,n,a)}}restoreReadError(t,n,i){let s=f(2107,null,this.resourceForError(n),gt(t).toString());return t instanceof On?new On(s,t.stat,i):t instanceof Ln?new Ln(s,t.fileOperationResult,t.size,t.options):new ce(s,na(t),i)}readFileStreamed(t,n,i,s=Object.create(null)){let o=t.readFileStream(n,s,i);return ko(o,{data:a=>a instanceof x?a:x.wrap(a),error:a=>this.restoreReadError(a,n,s)},a=>x.concat(a))}readFileBuffered(t,n,i,s=Object.create(null)){let o=yc();return Cs(t,n,o,a=>a,{...s,bufferSize:this.BUFFER_SIZE,errorTransformer:a=>this.restoreReadError(a,n,s)},i),o}readFileUnbuffered(t,n,i){let s=Qt(o=>x.concat(o));return(async()=>{try{let o;i?.atomic&&Hi(t)?o=await t.readFile(n,{atomic:!0}):o=await t.readFile(n),typeof i?.position=="number"&&(o=o.slice(i.position)),typeof i?.length=="number"&&(o=o.slice(0,i.length)),this.validateReadFileLimits(n,o.byteLength,i),s.end(x.wrap(o))}catch(o){s.error(o),s.end()}})(),s}async validateReadFile(t,n){let i=await this.resolve(t,{resolveMetadata:!0});if(i.isDirectory)throw new ce(f(2111,null,this.resourceForError(t)),0,n);if(typeof n?.etag=="string"&&n.etag!==Gi&&n.etag===i.etag)throw new On(f(2115,null),i,n);return this.validateReadFileLimits(t,i.size,n),i}validateReadFileLimits(t,n,i){if(typeof i?.limits?.size=="number"&&n>i.limits.size)throw new Ln(f(2116,null,this.resourceForError(t)),7,n,i)}async canMove(t,n,i){return this.doCanMoveCopy(t,n,"move",i)}async canCopy(t,n,i){return this.doCanMoveCopy(t,n,"copy",i)}async doCanMoveCopy(t,n,i,s){if(t.toString()!==n.toString())try{let o=i==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t):await this.withReadProvider(t),a=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);await this.doValidateMoveCopy(o,t,a,n,i,s)}catch(o){return o}return!0}async move(t,n,i){let s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(s,t,o,n,"move",!!i),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ft(t,a==="move"?2:3,l)),l}async copy(t,n,i){let s=await this.withReadProvider(t),o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(s,t,o,n,"copy",!!i),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ft(t,a==="copy"?3:2,l)),l}async doMoveCopy(t,n,i,s,o,a){if(n.toString()===s.toString())return o;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(t,n,i,s,o,a);if(l&&!c&&a&&await this.del(s,{recursive:!0}),await this.mkdirp(i,this.getExtUri(i).providerExtUri.dirname(s)),o==="copy"){if(t===i&&ea(t))await t.copy(n,s,{overwrite:a});else{let d=await this.resolve(n);d.isDirectory?await this.doCopyFolder(t,d,i,s):await this.doCopyFile(t,n,i,s)}return o}else return t===i?(await t.rename(n,s,{overwrite:a}),o):(await this.doMoveCopy(t,n,i,s,"copy",a),await this.del(n,{recursive:!0}),"copy")}async doCopyFile(t,n,i,s){if(ht(t)&&ht(i))return this.doPipeBuffered(t,n,i,s);if(ht(t)&&Ne(i))return this.doPipeBufferedToUnbuffered(t,n,i,s);if(Ne(t)&&ht(i))return this.doPipeUnbufferedToBuffered(t,n,i,s);if(Ne(t)&&Ne(i))return this.doPipeUnbuffered(t,n,i,s)}async doCopyFolder(t,n,i,s){await i.mkdir(s),Array.isArray(n.children)&&await Gt.settled(n.children.map(async o=>{let a=this.getExtUri(i).providerExtUri.joinPath(s,o.name);return o.isDirectory?this.doCopyFolder(t,await this.resolve(o.resource),i,a):this.doCopyFile(t,o.resource,i,a)}))}async doValidateMoveCopy(t,n,i,s,o,a){let l=!1;if(t===i){let{providerExtUri:d,isPathCaseSensitive:u}=this.getExtUri(t);if(u||(l=d.isEqual(n,s)),l&&o==="copy")throw new Error(f(2120,null,this.resourceForError(n),this.resourceForError(s)));if(!l&&d.isEqualOrParent(s,n))throw new Error(f(2121,null,this.resourceForError(n),this.resourceForError(s)))}let c=await this.exists(s);if(c&&!l){if(!a)throw new ce(f(2122,null,this.resourceForError(n),this.resourceForError(s)),4);if(t===i){let{providerExtUri:d}=this.getExtUri(t);if(d.isEqualOrParent(n,s))throw new Error(f(2123,null,this.resourceForError(n),this.resourceForError(s)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(t){let n=this.isPathCaseSensitive(t);return{providerExtUri:n?N:nc,isPathCaseSensitive:n}}isPathCaseSensitive(t){return!!(t.capabilities&1024)}async createFolder(t){let n=this.throwIfFileSystemIsReadonly(await this.withProvider(t),t);await this.mkdirp(n,t);let i=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new ft(t,0,i)),i}async mkdirp(t,n){let i=[],{providerExtUri:s}=this.getExtUri(t);for(;!s.isEqual(n,s.dirname(n));)try{if(((await t.stat(n)).type&2)===0)throw new Error(f(2118,null,this.resourceForError(n)));break}catch(o){if(tn(o)!=="EntryNotFound")throw o;i.push(s.basename(n)),n=s.dirname(n)}for(let o=i.length-1;o>=0;o--){n=s.joinPath(n,i[o]);try{await t.mkdir(n)}catch(a){if(tn(a)!=="EntryExists")throw a}}}async canDelete(t,n){try{await this.doValidateDelete(t,n)}catch(i){return i}return!0}async doValidateDelete(t,n){let i=this.throwIfFileSystemIsReadonly(await this.withProvider(t),t),s=!!n?.useTrash;if(s&&!(i.capabilities&4096))throw new Error(f(2105,null,this.resourceForError(t)));let o=n?.atomic;if(o&&!(i.capabilities&65536))throw new Error(f(2101,null,this.resourceForError(t)));if(s&&o)throw new Error(f(2104,null,this.resourceForError(t)));let a;try{a=await i.stat(t)}catch{}if(a)this.throwIfFileIsReadonly(t,a);else throw new ce(f(2103,null,this.resourceForError(t)),1);if(!!!n?.recursive){let c=await this.resolve(t);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(f(2102,null,this.resourceForError(t)))}return i}async del(t,n){let i=await this.doValidateDelete(t,n),s=n;if(su(i)&&!s?.atomic){let c=i.enforceAtomicDelete?.(t);c&&(s={...n,atomic:c})}let o=!!s?.useTrash,a=!!s?.recursive,l=s?.atomic??!1;await i.delete(t,{recursive:a,useTrash:o,atomic:l}),this._onDidRunOperation.fire(new ft(t,1))}async cloneFile(t,n){let i=await this.withProvider(t),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);if(!(i===s&&this.getExtUri(i).providerExtUri.isEqual(t,n)))return i===s&&ru(i)?i.cloneFile(t,n):(await this.mkdirp(s,this.getExtUri(s).providerExtUri.dirname(n)),i===s&&ea(i)?this.writeQueue.queueFor(t,()=>i.copy(t,n,{overwrite:!0}),this.getExtUri(i).providerExtUri):this.writeQueue.queueFor(t,()=>this.doCopyFile(i,t,s,n),this.getExtUri(i).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(t,n){return this.watch(t,{...n,correlationId:kt.WATCHER_CORRELATION_IDS++})}watch(t,n={recursive:!1,excludes:[]}){let i=new D,s=!1,o=()=>{s=!0};i.add(O(()=>o())),(async()=>{try{let l=await this.doWatch(t,n);s?Ee(l):o=()=>Ee(l)}catch(l){this.logService.error(l)}})();let a=n.correlationId;if(typeof a=="number"){let l=i.add(new I);return i.add(this.internalOnDidFilesChange.event(d=>{d.correlates(a)&&l.fire(d)})),{onDidChange:l.event,dispose:()=>i.dispose()}}return i}async doWatch(t,n){let i=await this.withProvider(t),s=Bn([this.getExtUri(i).providerExtUri.getComparisonKey(t),n]),o=this.activeWatchers.get(s);return o||(o={count:0,disposable:i.watch(t,n)},this.activeWatchers.set(s,o)),o.count+=1,O(()=>{o&&(o.count--,o.count===0&&(Ee(o.disposable),this.activeWatchers.delete(s)))})}dispose(){super.dispose();for(let[,t]of this.activeWatchers)Ee(t.disposable);this.activeWatchers.clear()}async doWriteBuffered(t,n,i,s){return this.writeQueue.queueFor(n,async()=>{let o=await t.open(n,{create:!0,unlock:i?.unlock??!1,append:i?.append??!1});try{pr(s)||_i(s)?await this.doWriteStreamBufferedQueued(t,o,s):await this.doWriteReadableBufferedQueued(t,o,s)}catch(a){throw gt(a)}finally{await t.close(o)}},this.getExtUri(t).providerExtUri)}async doWriteStreamBufferedQueued(t,n,i){let s=0,o;if(_i(i)){if(i.buffer.length>0){let a=x.concat(i.buffer);await this.doWriteBuffer(t,n,a,a.byteLength,s,0),s+=a.byteLength}if(i.ended)return;o=i.stream}else o=i;return new Promise((a,l)=>{Ei(o,{onData:async c=>{o.pause();try{await this.doWriteBuffer(t,n,c,c.byteLength,s,0)}catch(d){return l(d)}s+=c.byteLength,setTimeout(()=>o.resume())},onError:c=>l(c),onEnd:()=>a()})})}async doWriteReadableBufferedQueued(t,n,i){let s=0,o;for(;(o=i.read())!==null;)await this.doWriteBuffer(t,n,o,o.byteLength,s,0),s+=o.byteLength}async doWriteBuffer(t,n,i,s,o,a){let l=0;for(;lthis.doWriteUnbufferedQueued(t,n,i,s),this.getExtUri(t).providerExtUri)}async doWriteUnbufferedQueued(t,n,i,s){let o;s instanceof x?o=s:pr(s)?o=await hr(s):_i(s)?o=await bc(s):o=mc(s),await t.writeFile(n,o.buffer,{create:!0,overwrite:!0,unlock:i?.unlock??!1,atomic:i?.atomic??!1,append:i?.append??!1})}async doPipeBuffered(t,n,i,s){return this.writeQueue.queueFor(s,()=>this.doPipeBufferedQueued(t,n,i,s),this.getExtUri(i).providerExtUri)}async doPipeBufferedQueued(t,n,i,s){let o,a;try{o=await t.open(n,{create:!1}),a=await i.open(s,{create:!0,unlock:!1});let l=x.alloc(this.BUFFER_SIZE),c=0,d=0,u=0;do u=await t.read(o,c,l.buffer,d,l.byteLength-d),await this.doWriteBuffer(i,a,l,u,c,d),c+=u,d+=u,d===l.byteLength&&(d=0);while(u>0)}catch(l){throw gt(l)}finally{await Gt.settled([typeof o=="number"?t.close(o):Promise.resolve(),typeof a=="number"?i.close(a):Promise.resolve()])}}async doPipeUnbuffered(t,n,i,s){return this.writeQueue.queueFor(s,()=>this.doPipeUnbufferedQueued(t,n,i,s),this.getExtUri(i).providerExtUri)}async doPipeUnbufferedQueued(t,n,i,s){return i.writeFile(s,await t.readFile(n),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(t,n,i,s){return this.writeQueue.queueFor(s,()=>this.doPipeUnbufferedToBufferedQueued(t,n,i,s),this.getExtUri(i).providerExtUri)}async doPipeUnbufferedToBufferedQueued(t,n,i,s){let o=await i.open(s,{create:!0,unlock:!1});try{let a=await t.readFile(n);await this.doWriteBuffer(i,o,x.wrap(a),a.byteLength,0,0)}catch(a){throw gt(a)}finally{await i.close(o)}}async doPipeBufferedToUnbuffered(t,n,i,s){let o=await hr(this.readFileBuffered(t,n,Ke.None));await this.doWriteUnbuffered(i,s,void 0,o)}throwIfFileSystemIsReadonly(t,n){if(t.capabilities&2048)throw new ce(f(2108,null,this.resourceForError(n)),6);return t}throwIfFileIsReadonly(t,n){if((n.permissions??0)&1)throw new ce(f(2108,null,this.resourceForError(t)),6)}resourceForError(t){return t.scheme===Y.file?t.fsPath:t.toString(!0)}};kt=P([_e(0,Oe)],kt);import{constants as Na,promises as an}from"fs";function ks(r){return typeof r.correlationId=="number"}function td(r){return r.recursive===!0}var Ps=class r extends A{constructor(t,n,i,s){super();this.onFileChanges=t;this.onLogMessage=n;this.verboseLogging=i;this.options=s;this.watcherDisposables=this._register(new St);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let t=new D;this.watcherDisposables.value=t,this.watcher=this.createWatcher(t),this.watcher.setVerboseLogging(this.verboseLogging),t.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),t.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),t.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(t,n){this.canRestart(t,n)?this.restartCounter({type:e.type,resource:m.revive(e.resource),cId:e.cId}))}function nd(r){let e=new Oa;for(let t of r)e.processEvent(t);return e.coalesce()}function Bh(r,e){return typeof e=="string"&&!e.startsWith(Wn)&&!di(e)?{base:r,pattern:e}:e}function Ua(r,e,t){let n=[];for(let i of e)n.push(da(Bh(r,i),{ignoreCase:t}));return n}var Oa=class{constructor(){this.coalesced=new Set;this.mapPathToChange=new Map}toKey(e){return te?e.resource.fsPath:e.resource.fsPath.toLowerCase()}processEvent(e){let t=this.mapPathToChange.get(this.toKey(e)),n=!1;if(t){let i=t.type,s=e.type;t.resource.fsPath!==e.resource.fsPath&&(e.type===2||e.type===1)?n=!0:i===1&&s===2?(this.mapPathToChange.delete(this.toKey(e)),this.coalesced.delete(t)):i===2&&s===1?t.type=0:i===1&&s===0||(t.type=s)}else n=!0;n&&(this.coalesced.add(e),this.mapPathToChange.set(this.toKey(e),e))}coalesce(){let e=[],t=[];return Array.from(this.coalesced).filter(n=>n.type!==2?(e.push(n),!1):!0).sort((n,i)=>n.resource.fsPath.length-i.resource.fsPath.length).filter(n=>t.some(i=>ou(n.resource.fsPath,i,!te))?!1:(t.push(n.resource.fsPath),!0)).concat(e)}};function rd(r,e){if(typeof e=="number")switch(r.type){case 1:return(e&4)===0;case 2:return(e&8)===0;case 0:return(e&2)===0}return!1}function id(r){if(typeof r=="number"){let e=[];return r&4&&e.push("Added"),r&8&&e.push("Deleted"),r&2&&e.push("Updated"),e.length===0?"":`[${e.join(", ")}]`}return""}var Ls=class extends A{constructor(t,n){super();this.logService=t;this.options=n;this._onDidChangeFile=this._register(new I);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new I);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new jt(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new jt(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(t,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(t,n):this.watchNonRecursive(t,n)}getRefreshWatchersDelay(t){return t>200?500:0}watchUniversal(t,n){let i=this.toWatchRequest(t,n),s=js(this.universalWatchRequests,i);return this.refreshUniversalWatchers(),O(()=>{s(),this.refreshUniversalWatchers()})}toWatchRequest(t,n){let i={path:this.toWatchPath(t),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(td(i)){let s=this.options?.watcher?.recursive?.usePolling;s===!0?i.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(s)&&s.includes(i.path)&&(i.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return i}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(t=>Z(t))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(t=>this._onDidChangeFile.fire(Fa(t)),t=>this.onWatcherLogMessage(t),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(t,n){let i={path:this.toWatchPath(t),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},s=js(this.nonRecursiveWatchRequests,i);return this.refreshNonRecursiveWatchers(),O(()=>{s(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(t=>Z(t))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(t=>this._onDidChangeFile.fire(Fa(t)),t=>this.onWatcherLogMessage(t),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(t){t.type==="error"&&this._onDidWatchError.fire(t.message),this.logWatcherMessage(t)}logWatcherMessage(t){this.logService[t.type](t.message)}toFilePath(t){return Me(t.fsPath)}toWatchPath(t){let n=this.toFilePath(t);return jl(n)}};var Os=class extends As{constructor(e,t,n){super(e,t,n),this.init()}createWatcher(e){let t=e.add(new Ai(Ct.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return e.add(t.onDidProcessExit(({code:n,signal:i})=>this.onError(`terminated by itself with code ${n}, signal: ${i} (ETERM)`))),En.toService(Sc(t.getChannel("watcher")))}};import{watchFile as Vh,unwatchFile as qh}from"fs";var Fs=class extends A{constructor(){super();this._onDidChangeFile=this._register(new I);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new I);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new I);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Ye);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new jt(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Ze;this.verboseLogging=!1;this._register(this.onDidWatchFail(t=>this.suspendWatchRequest({id:this.computeId(t),correlationId:this.isCorrelated(t)?t.correlationId:void 0,path:t.path})))}isCorrelated(t){return ks(t)}computeId(t){return this.isCorrelated(t)?t.correlationId:Bn(t)}async watch(t){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Ze;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of t)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(t){let n=[];for(let[i,s]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(i)||n.push(s);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),t?this.getUpdateWatchersDelay():0).catch(i=>Z(i))}getUpdateWatchersDelay(){return 800}isSuspended(t){let n=this.computeId(t);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(t){if(this.suspendedWatchRequests.has(t.id))return;let n=new D;this.suspendedWatchRequests.set(t.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(t,n),this.updateWatchers(!0))}resumeWatchRequest(t){this.suspendedWatchRequests.deleteAndDispose(t.id),this.suspendedWatchRequestsWithPolling.delete(t.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(t,n){this.doMonitorWithExistingWatcher(t,n)?(this.trace(`reusing an existing recursive watcher to monitor ${t.path}`),this.suspendedWatchRequestsWithPolling.delete(t.id)):(this.doMonitorWithNodeJS(t,n),this.suspendedWatchRequestsWithPolling.add(t.id))}doMonitorWithExistingWatcher(t,n){let i=this.recursiveWatcher?.subscribe(t.path,(s,o)=>{n.isDisposed||(s?this.monitorSuspendedWatchRequest(t,n):o?.type===1&&this.onMonitoredPathAdded(t))});return i?(n.add(i),!0):!1}doMonitorWithNodeJS(t,n){let i=!1,s=(o,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(o),c=this.isPathNotFound(a),d=i;i=l,!l&&(c||d)&&this.onMonitoredPathAdded(t)};this.trace(`starting fs.watchFile() on ${t.path} (correlationId: ${t.correlationId})`);try{Vh(t.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},s)}catch(o){this.warn(`fs.watchFile() failed with error ${o} on path ${t.path} (correlationId: ${t.correlationId})`)}n.add(O(()=>{this.trace(`stopping fs.watchFile() on ${t.path} (correlationId: ${t.correlationId})`);try{qh(t.path,s)}catch(o){this.warn(`fs.unwatchFile() failed with error ${o} on path ${t.path} (correlationId: ${t.correlationId})`)}}))}onMonitoredPathAdded(t){this.trace(`detected ${t.path} exists again, resuming watcher (correlationId: ${t.correlationId})`);let n={resource:m.file(t.path),type:1,cId:t.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,t),this.resumeWatchRequest(t)}isPathNotFound(t){return t.ctimeMs===0&&t.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(t,n){if(this.verboseLogging){let i=` >> normalized ${t.type===1?"[ADDED]":t.type===2?"[DELETED]":"[CHANGED]"} ${t.resource.fsPath}`;this.traceWithCorrelation(i,n)}}traceWithCorrelation(t,n){this.verboseLogging&&this.trace(`${t}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(t){return`${t.path} (excludes: ${t.excludes.length>0?t.excludes:""}, includes: ${t.includes&&t.includes.length>0?JSON.stringify(t.includes):""}, filter: ${id(t.filter)}, correlationId: ${typeof t.correlationId=="number"?t.correlationId:""})`}async setVerboseLogging(t){this.verboseLogging=t}};import{watch as $h,promises as Kh}from"fs";var Us=class r extends A{constructor(t,n,i,s,o,a){super();this.request=t;this.recursiveWatcher=n;this.onDidFilesChange=i;this.onDidWatchFail=s;this.onLogMessage=o;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new bn({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},t=>this.onDidFilesChange(t)));this.fileChangesAggregator=this._register(new Ii(t=>this.handleFileChanges(t),r.FILE_CHANGES_HANDLER_DELAY));this.cts=new Re;this.realPath=new Pe(async()=>{let t=this.request.path;try{t=await ee.realpath(this.request.path),this.request.path!==t&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${t})`)}catch{}return t});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!te;this.excludes=Ua(this.request.path,this.request.excludes,l),this.includes=this.request.includes?Ua(this.request.path,this.request.includes,l):void 0,this.filter=ks(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let t=await Kh.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(t.isDirectory()))}catch(t){t.code!=="ENOENT"?this.error(t):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${t})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(t){let n=new D;return this.doWatchWithExistingWatcher(t,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(t,n)),n}doWatchWithExistingWatcher(t,n){if(t)return!1;let i=m.file(this.request.path),s=this.recursiveWatcher?.subscribe(this.request.path,async(o,a)=>{n.isDisposed||(o?await dl(this.doWatch(t),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:i,type:a.type,cId:this.request.correlationId},!0))});return s?(n.add(s),!0):!1}async doWatchWithNodeJS(t,n){let i=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if($e&<(i,"/Volumes/",!0)){this.error(`Refusing to watch ${i} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let s=new Re(this.cts.token);n.add(O(()=>s.dispose(!0)));let o=new D;n.add(o);try{let a=m.file(this.request.path),l=We(i),c=$h(i);o.add(O(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${i}'`);let d=new Set;if(t)try{for(let p of await ee.readdir(i))d.add(p)}catch(p){this.error(p)}if(s.token.isCancellationRequested)return;let u=new Map;o.add(O(()=>{for(let[,p]of u)p.dispose();u.clear()})),c.on("error",(p,h)=>{s.token.isCancellationRequested||(this.error(`Failed to watch ${i} for changes using fs.watch() (${p}, ${h})`),this.notifyWatchFailed())}),c.on("change",(p,h)=>{if(s.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${p}"] ${h}`);let g="";if(h&&(g=h.toString(),$e&&(g=Ir(g))),!(!g||p!=="change"&&p!=="rename"))if(t)if(p==="rename"){u.get(g)?.dispose();let b=setTimeout(async()=>{if(u.delete(g),gn(g,l,!te)&&!await ee.exists(i)){this.onWatchedPathDeleted(a);return}if(s.token.isCancellationRequested)return;let W=await this.existsChildStrictCase(J(i,g));if(s.token.isCancellationRequested)return;let j;W?d.has(g)?j=0:(j=1,d.add(g)):(d.delete(g),j=2),this.onFileChange({resource:oe(a,g),type:j,cId:this.request.correlationId})},r.FILE_DELETE_HANDLER_DELAY);u.set(g,O(()=>clearTimeout(b)))}else{let b;d.has(g)?b=0:(b=1,d.add(g)),this.onFileChange({resource:oe(a,g),type:b,cId:this.request.correlationId})}else if(p==="rename"||!gn(g,l,!te)){let b=setTimeout(async()=>{let W=await ee.exists(i);s.token.isCancellationRequested||(W?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),o.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},r.FILE_DELETE_HANDLER_DELAY);o.clear(),o.add(O(()=>clearTimeout(b)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(s.token.isCancellationRequested)return;this.error(`Failed to watch ${i} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(t){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:t,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(t,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${t.type===1?"[ADDED]":t.type===2?"[DELETED]":"[CHANGED]"} ${t.resource.fsPath}`),!n&&this.excludes.some(i=>i(t.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${t.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(i=>i(t.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${t.resource.fsPath}`):this.fileChangesAggregator.work(t))}handleFileChanges(t){let n=nd(t),i=[];for(let o of n){if(rd(o,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${o.resource.fsPath}`);continue}i.push(o)}if(i.length===0)return;if(this.verboseLogging)for(let o of i)this.traceWithCorrelation(` >> normalized ${o.type===1?"[ADDED]":o.type===2?"[DELETED]":"[CHANGED]"} ${o.resource.fsPath}`);this.throttledFileChangesEmitter.work(i)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${i[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${i.length}, most recent change: ${i[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(t){if(te)return ee.exists(t);try{let n=We(t);return(await ee.readdir(be(t))).some(s=>s===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(t){this.verboseLogging=t}error(t){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${t}`})}warn(t){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${t}`})}trace(t){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${t}`})}traceWithCorrelation(t){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${t}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}};var Ns=class extends Fs{constructor(t){super();this.recursiveWatcher=t;this.onDidError=V.None;this._watchers=new Map;this.worker=this._register(new St)}get watchers(){return this._watchers.values()}async doWatch(t){t=this.removeDuplicateRequests(t);let n=[],i=new Set(Array.from(this.watchers));for(let s of t){let o=this._watchers.get(this.requestToWatcherKey(s));o&&pa(o.request.excludes,s.excludes)&&pa(o.request.includes,s.includes)?i.delete(o):n.push(s)}n.length&&this.trace(`Request to start watching: ${n.map(s=>this.requestToString(s)).join(",")}`),i.size&&this.trace(`Request to stop watching: ${Array.from(i).map(s=>this.requestToString(s.request)).join(",")}`),this.worker.clear();for(let s of i)this.stopWatching(s);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new bn({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},t=>{for(let n of t)this.startWatching(n)}),this.worker.value}requestToWatcherKey(t){return typeof t.correlationId=="number"?t.correlationId:this.pathToWatcherKey(t.path)}pathToWatcherKey(t){return te?t:t.toLowerCase()}startWatching(t){let n=new Us(t,this.recursiveWatcher,s=>this._onDidChangeFile.fire(s),()=>this._onDidWatchFail.fire(t),s=>this._onDidLogMessage.fire(s),this.verboseLogging),i={request:t,instance:n};this._watchers.set(this.requestToWatcherKey(t),i)}async stop(){await super.stop();for(let t of this.watchers)this.stopWatching(t)}stopWatching(t){this.trace("stopping file watcher",t),this._watchers.delete(this.requestToWatcherKey(t.request)),t.instance.dispose()}removeDuplicateRequests(t){let n=new Map;for(let i of t){let s=n.get(i.correlationId);s||(s=new Map,n.set(i.correlationId,s));let o=this.pathToWatcherKey(i.path);s.has(o)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(i)}`),s.set(o,i)}return Array.from(n.values()).flatMap(i=>Array.from(i.values()))}async setVerboseLogging(t){super.setVerboseLogging(t);for(let n of this.watchers)n.instance.setVerboseLogging(t)}trace(t,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(t,n)})}warn(t){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(t)})}toMessage(t,n){return n?`[File Watcher (node.js)] ${t} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${t}`}};var Ms=class extends Ds{constructor(e,t,n){super(e,t,n),this.init()}createWatcher(e){return e.add(new Ns(void 0))}};var Ws=class r extends Ls{constructor(){super(...arguments);this.onDidChangeCapabilities=V.None;this.resourceLocks=new rt(t=>mn.getComparisonKey(t));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,te&&(this._capabilities|=1024)),this._capabilities}async stat(t){try{let{stat:n,symbolicLink:i}=await et.stat(this.toFilePath(t)),s;return(n.mode&128)===0&&(s=2),(n.mode&Na.S_IXUSR||n.mode&Na.S_IXGRP||n.mode&Na.S_IXOTH)&&(s=(s??0)|4),{type:this.toType(n,i),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:s}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(t){try{return await this.stat(t)}catch{return}}async realpath(t){let n=this.toFilePath(t);return ee.realpath(n)}async readdir(t){try{let n=await ee.readdir(this.toFilePath(t),{withFileTypes:!0}),i=[];return await Promise.all(n.map(async s=>{try{let o;s.isSymbolicLink()?o=(await this.stat(oe(t,s.name))).type:o=this.toType(s),i.push([s.name,o])}catch(o){this.logService.trace(o)}})),i}catch(n){throw this.toFileSystemProviderError(n)}}toType(t,n){let i;return n?.dangling?i=0:t.isFile()?i=1:t.isDirectory()?i=2:i=0,n&&(i|=64),i}async createResourceLock(t){let n=this.toFilePath(t);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let i;for(;i=this.resourceLocks.get(t);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await i.wait();let s=new bi;return this.resourceLocks.set(t,s),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),O(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(t)===s&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(t)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),s.open()})}async readFile(t,n){let i;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(t)})`),i=await this.createResourceLock(t));let s=this.toFilePath(t);return await an.readFile(s)}catch(s){throw this.toFileSystemProviderError(s)}finally{i?.dispose()}}traceLock(t){r.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(t)}readFileStream(t,n,i){let s=Qt(o=>x.concat(o.map(a=>x.wrap(a))).buffer);return Cs(this,t,s,o=>o.buffer,{...n,bufferSize:256*1024},i),s}async writeFile(t,n,i){return i?.atomic!==!1&&i?.atomic?.postfix&&await this.canWriteFileAtomic(t)?this.doWriteFileAtomic(t,oe(rc(t),`${Eo(t)}${i.atomic.postfix}`),n,i):this.doWriteFile(t,n,i)}async canWriteFileAtomic(t){try{let n=this.toFilePath(t),{symbolicLink:i}=await et.stat(n);if(i)return!1}catch{}return!0}async doWriteFileAtomic(t,n,i,s){let o=new D;try{o.add(await this.createResourceLock(t)),o.add(await this.createResourceLock(n)),await this.doWriteFile(n,i,{...s,create:!0,overwrite:!0},!0);try{await this.rename(n,t,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{o.dispose()}}async doWriteFile(t,n,i,s){let o;try{let a=this.toFilePath(t);if(!i.create||!i.overwrite){if(await ee.exists(a)){if(!i.overwrite)throw Qe(f(2131,null),"EntryExists")}else if(!i.create)throw Qe(f(2134,null),"EntryNotFound")}o=await this.open(t,{create:!0,append:i.append,unlock:i.unlock},s),await this.write(o,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(t,a)}finally{typeof o=="number"&&await this.close(o)}}static{this.canFlush=!0}static configureFlushOnWrite(t){r.canFlush=t}async open(t,n,i){let s=this.toFilePath(t),o;en(n)&&!i&&(o=await this.createResourceLock(t));let a;try{if(en(n)&&n.unlock)try{let{stat:l}=await et.stat(s);l.mode&128||await an.chmod(s,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if($&&en(n)&&!n.append)try{a=await ee.open(s,"r+"),await ee.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await ee.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await ee.open(s,en(n)?n.append?"a":"w":"r"))}catch(l){throw o?.dispose(),en(n)?await this.toFileSystemProviderWriteError(t,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),en(n)&&this.writeHandles.set(a,t),o){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${s})`),this.mapHandleToLock.set(a,o),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${s})`),l.dispose())}return a}async close(t){let n=this.mapHandleToLock.get(t);try{if(this.mapHandleToPos.delete(t),this.writeHandles.delete(t)&&r.canFlush)try{await ee.fdatasync(t)}catch(i){r.configureFlushOnWrite(!1),this.logService.error(i)}return await ee.close(t)}catch(i){throw this.toFileSystemProviderError(i)}finally{n&&(this.mapHandleToLock.get(t)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${t}`),this.mapHandleToLock.delete(t)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${t}`),n.dispose())}}async read(t,n,i,s,o){let a=this.normalizePos(t,n),l=null;try{l=(await ee.read(t,i,s,o,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(t,a,l)}return l}normalizePos(t,n){return n===this.mapHandleToPos.get(t)?null:n}updatePos(t,n,i){let s=this.mapHandleToPos.get(t);typeof s=="number"&&(typeof n=="number"||(typeof i=="number"?this.mapHandleToPos.set(t,s+i):this.mapHandleToPos.delete(t)))}async write(t,n,i,s,o){return cc(()=>this.doWrite(t,n,i,s,o),100,3)}async doWrite(t,n,i,s,o){let a=this.normalizePos(t,n),l=null;try{l=(await ee.write(t,i,s,o,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(t),c)}finally{this.updatePos(t,a,l)}return l}async mkdir(t){try{await an.mkdir(this.toFilePath(t))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(t,n){try{let i=this.toFilePath(t);if(n.recursive){let s;n?.atomic!==!1&&n.atomic.postfix&&(s=J(be(i),`${We(i)}${n.atomic.postfix}`)),await ee.rm(i,1,s)}else try{await an.unlink(i)}catch(s){if(s.code==="EPERM"||s.code==="EISDIR"){let o=!1;try{let{stat:a,symbolicLink:l}=await et.stat(i);o=a.isDirectory()&&!l}catch{}if(o)await an.rmdir(i);else throw s}else throw s}}catch(i){throw this.toFileSystemProviderError(i)}}async rename(t,n,i){let s=this.toFilePath(t),o=this.toFilePath(n);if(s!==o)try{await this.validateMoveCopy(t,n,"move",i.overwrite),await ee.rename(s,o)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(f(2135,null,We(s),We(be(o)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(t,n,i){let s=this.toFilePath(t),o=this.toFilePath(n);if(s!==o)try{await this.validateMoveCopy(t,n,"copy",i.overwrite),await ee.copy(s,o,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(f(2129,null,We(s),We(be(o)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(t,n,i,s){let o=this.toFilePath(t),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=gn(o,a,!0)),l){if(i==="copy")throw Qe(f(2130,null),"EntryExists");if(i==="move")return}let d=await this.statIgnoreError(t);if(!d)throw Qe(f(2133,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!s)throw Qe(f(2132,null),"EntryExists");(d.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(t,n){return this.doCloneFile(t,n,!1)}async doCloneFile(t,n,i){let s=this.toFilePath(t),o=this.toFilePath(n),a=!!(this.capabilities&1024);if(gn(s,o,!a))return;let l=new D;try{l.add(await this.createResourceLock(t)),l.add(await this.createResourceLock(n)),i&&await an.mkdir(be(o),{recursive:!0}),await an.copyFile(s,o)}catch(c){if(c.code==="ENOENT"&&!i)return this.doCloneFile(t,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(t,n,i){return new Os(s=>t(s),s=>n(s),i)}createNonRecursiveWatcher(t,n,i){return new Ms(s=>t(s),s=>n(s),i)}toFileSystemProviderError(t){if(t instanceof kn)return t;let n=t,i;switch(t.code){case"ENOENT":i="EntryNotFound";break;case"EISDIR":i="EntryIsADirectory";break;case"ENOTDIR":i="EntryNotADirectory";break;case"EEXIST":i="EntryExists";break;case"EPERM":case"EACCES":i="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${t.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,i="Unknown";break;default:i="Unknown"}return Qe(n,i)}async toFileSystemProviderWriteError(t,n){let i=this.toFileSystemProviderError(n);if(t&&i.code==="NoPermissions")try{let{stat:s}=await et.stat(this.toFilePath(t));s.mode&128||(i=Qe(n,"EntryWriteLocked"))}catch(s){this.logService.trace(s)}return i}};var bt=class{constructor(e,t=[],n=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=n}};var Ma=class{constructor(e,t){this.key=e;this.data=t;this.incoming=new Map;this.outgoing=new Map}},Kr=class{constructor(e){this._hashFn=e;this._nodes=new Map}roots(){let e=[];for(let t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){let n=this.lookupOrInsertNode(e),i=this.lookupOrInsertNode(t);n.outgoing.set(i.key,i),i.incoming.set(n.key,n)}removeNode(e){let t=this._hashFn(e);this._nodes.delete(t);for(let n of this._nodes.values())n.outgoing.delete(t),n.incoming.delete(t)}lookupOrInsertNode(e){let t=this._hashFn(e),n=this._nodes.get(t);return n||(n=new Ma(t,e),this._nodes.set(t,n)),n}lookup(e){return this._nodes.get(this._hashFn(e))}isEmpty(){return this._nodes.size===0}toString(){let e=[];for(let[t,n]of this._nodes)e.push(`${t} +@@ -427,7 +427,7 @@ ${C}`))})),a.add(n.onClaimChanged(i.terminalUri,I=>{I.kind==="session"&&!I.toolC + ${S}`,"timeout"))},e);a.add(w(()=>clearTimeout(h))),v()})}function Wf(i,t,e){let n=B?"powershell":"bash",r={name:n,description:`Execute a command in a persistent ${n} shell. The shell is reused across calls.`,parameters:{type:"object",properties:{command:{type:"string",description:"The command to execute"},timeout:{type:"number",description:"Timeout in milliseconds (default 120000)"}},required:["command"]},overridesBuiltInTool:!0,handler:async(c,p)=>{let u=await i.getOrCreateShell(n,p.toolCallId,p.toolCallId),f=c.timeout??B1;return z1(u,c.command,f,t,e)}},o={name:`read_${n}`,description:`Read the latest output from a running ${n} shell.`,parameters:{type:"object",properties:{shell_id:{type:"string",description:"Shell ID to read from (optional; uses latest shell if omitted)"}}},overridesBuiltInTool:!0,handler:c=>{let p=i.listShells(),u=c.shell_id?i.getShell(c.shell_id):p[p.length-1];if(!u)return Ct("No active shell found.","no_shell");let f=t.getContent(u.terminalUri);return mt(f?Vn(f):"(no output)")}},s={name:`write_${n}`,description:`Send input to a running ${n} shell (e.g. answering a prompt, sending Ctrl+C).`,parameters:{type:"object",properties:{command:{type:"string",description:"Text to write to the shell stdin"}},required:["command"]},overridesBuiltInTool:!0,handler:c=>{let p=i.listShells(),u=p[p.length-1];return u?(t.writeInput(u.terminalUri,c.command),mt("Input sent to shell.")):Ct("No active shell found.","no_shell")}},a={name:n==="bash"?"bash_shutdown":`${n}_shutdown`,description:`Stop a ${n} shell.`,parameters:{type:"object",properties:{shell_id:{type:"string",description:"Shell ID to stop (optional; stops latest shell if omitted)"}}},overridesBuiltInTool:!0,handler:c=>{if(c.shell_id)return i.shutdownShell(c.shell_id)?mt("Shell stopped."):Ct("Shell not found.","not_found");let p=i.listShells(),u=p[p.length-1];return u?(i.shutdownShell(u.id),mt("Shell stopped.")):Ct("No active shell to stop.","no_shell")}},l={name:`list_${n}`,description:`List active ${n} shell instances.`,parameters:{type:"object",properties:{}},overridesBuiltInTool:!0,handler:()=>{let c=i.listShells();if(c.length===0)return mt("No active shells.");let p=c.map(u=>{let f=t.getExitCode(u.terminalUri),m=f!==void 0?`exited (${f})`:"running";return`- ${u.id}: ${u.shellType} [${m}]`});return mt(p.join(` + `))}};return[r,o,s,a,l]}var Bf="thinkingLevel",Q1=["low","medium","high","xhigh"];function Y1(i){return Q1.some(t=>t===i)}function X1(i){return b.joinPath(i,"..",`${Te(i.fsPath)}.worktrees`)}function Z1(i){return i.replace(/\//g,"-")}function eb(i,t){return`agents/${t?`${t}-${i.substring(0,8)}`:i}`}function $f(i){return g(1840,null,jt(i))+` + +-`}function tb(i,t){let e=i.findIndex(o=>o.type==="message"&&o.role==="assistant"&&!o.parentToolCallId);if(e===-1)return i;let n=i[e],r={...n,content:t+n.content};return[...i.slice(0,e),r,...i.slice(e+1)]}var Ie=class extends L{constructor(e,n,r,o,s,a){super();this._logService=e;this._instantiationService=n;this._fileService=r;this._sessionDataService=o;this._gitService=s;this._terminalManager=a;this.id="copilot";this._onDidSessionProgress=this._register(new x);this.onDidSessionProgress=this._onDidSessionProgress.event;this._models=Ln(this,[]);this.models=this._models;this._sessions=this._register(new it);this._createdWorktrees=new Map;this._pendingFirstTurnAnnouncements=new Map;this._sessionSequencer=new St;this._activeClients=new ut;this._plugins=this._instantiationService.createInstance(zi)}static{this._BRANCH_COMPLETION_LIMIT=25}_createCopilotClient(e){return new G1(e)}getDescriptor(){return{provider:"copilot",displayName:"Copilot CLI",description:"Copilot SDK agent running in a dedicated process"}}getProtectedResources(){return[{resource:"https://api.github.com",resource_name:"GitHub Copilot",authorization_servers:["https://github.com/login/oauth"],scopes_supported:["read:user","user:email"],required:!0}]}async authenticate(e,n){if(e!=="https://api.github.com")return!1;let r=this._githubToken!==n;return this._githubToken=n,this._logService.info(`[Copilot] Auth token ${r?"updated":"unchanged"}`),r&&this._client&&this._sessions.size===0&&(this._logService.info("[Copilot] Restarting CopilotClient with new token"),await this._stopClient()),r&&this._refreshModels(),!0}async _refreshModels(){let e=this._githubToken;if(!e){this._models.set([],void 0);return}try{let n=await this._listModels();this._githubToken===e&&this._models.set(n,void 0)}catch(n){this._logService.error(n,"[Copilot] Failed to refresh models"),this._githubToken===e&&this._models.set([],void 0)}}async _stopClient(){let e=this._client;this._client=void 0,this._clientStarting=void 0,await e?.stop()}async _ensureClient(){let e=this._githubToken;if(!e)throw new H(ns,"Authentication is required to use Copilot");if(this._client)return this._client;if(this._clientStarting)return this._clientStarting;let n=(async()=>{this._logService.info("[Copilot] Starting CopilotClient... (with token)");let r=Object.assign({},process.env,{ELECTRON_RUN_AS_NODE:"1"});delete r.NODE_OPTIONS,delete r.VSCODE_INSPECTOR_OPTIONS,delete r.VSCODE_ESM_ENTRYPOINT,delete r.VSCODE_HANDLES_UNCAUGHT_ERRORS;for(let u of Object.keys(r))u!=="ELECTRON_RUN_AS_NODE"&&(u.startsWith("VSCODE_")||u.startsWith("ELECTRON_"))&&delete r[u];r.COPILOT_CLI_RUN_AS_NODE="1",r.USE_BUILTIN_RIPGREP="false";let o=b.joinPath(Xe.asFileUri(""),"..","node_modules","@github","copilot","index.js").fsPath,s=J1.replace(/\bnode_modules\.asar\b/,"node_modules.asar.unpacked"),a=me(s),l=Object.keys(r).find(u=>u.toUpperCase()==="PATH")??"PATH",c=r[l];r[l]=c?`${c}${Va}${a}`:a,this._logService.info(`[Copilot] Resolved CLI path: ${o}`);let p=this._createCopilotClient({githubToken:e,useLoggedInUser:!1,useStdio:!0,autoStart:!0,env:r,cliPath:o});if(await p.start(),this._githubToken!==e)throw await p.stop(),new Error("Copilot authentication changed while the client was starting");return this._logService.info("[Copilot] CopilotClient started successfully"),this._client=p,this._clientStarting=void 0,p})();return this._clientStarting=n,n.catch(()=>{this._clientStarting=void 0}),n}_createThinkingLevelConfigSchema(e,n){if(!e?.length)return;let r=e.map(o=>{switch(o){case"low":return g(1836,null);case"medium":return g(1837,null);case"high":return g(1835,null);case"xhigh":return g(1839,null);default:return o}});return{type:"object",properties:{[Bf]:{type:"string",title:g(1838,null),description:g(1834,null),default:n,enum:[...e],enumLabels:r}}}}_getReasoningEffort(e){let n=e?.config?.[Bf];return Y1(n)?n:void 0}_serializeModelSelection(e){return JSON.stringify(e)}_parseModelSelection(e){if(e){try{let n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.id=="string"){let r={id:n.id};if(n.config&&typeof n.config=="object"){let o={};for(let[s,a]of Object.entries(n.config))typeof a=="string"&&(o[s]=a);Object.keys(o).length>0&&(r.config=o)}return r}}catch{}return{id:e}}}async listSessions(){this._logService.info("[Copilot] Listing sessions...");let n=await(await this._ensureClient()).listSessions(),r=new ui(4),o=new Map,a=(await Promise.all(n.map(async l=>{let c=ce.uri(this.id,l.sessionId),p=await this._readStoredSessionMetadata(c);if(!p)return;let{project:u,resolved:f}=p;f||(u=await this._resolveSessionProject(l.context,r,o),this._storeSessionProjectResolution(c,u));let m=p.workingDirectory??(typeof l.context?.cwd=="string"?b.file(l.context.cwd):void 0);return{session:c,startTime:l.startTime.getTime(),modifiedTime:l.modifiedTime.getTime(),project:u,summary:l.summary,model:p.model,workingDirectory:m}}))).filter(l=>l!==void 0);return this._logService.info(`[Copilot] Found ${a.length} sessions`),a}async _listModels(){this._logService.info("[Copilot] Listing models...");let r=(await(await this._ensureClient()).listModels()).map(o=>({provider:this.id,id:o.id,name:o.name,maxContextWindow:o.capabilities.limits.max_context_window_tokens,supportsVision:o.capabilities.supports.vision,configSchema:this._createThinkingLevelConfigSchema(o.supportedReasoningEfforts,o.defaultReasoningEffort),policyState:o.policy?.state}));return this._logService.info(`[Copilot] Found ${r.length} models`),r}async createSession(e){if(!e?.workingDirectory)throw new Error("workingDirectory is required to create a Copilot session");this._logService.info(`[Copilot] Creating session... ${e?.model?`model=${e.model.id}`:""}`);let n=await this._ensureClient();if(e?.fork){let h=ce.id(e.fork.session);return this._sessionSequencer.queue(h,async()=>{this._logService.info(`[Copilot] Forking session ${h} at turnId=${e.fork.turnId}`);let y=await(this._sessions.get(h)??await this._resumeSession(h)).getNextTurnEventId(e.fork.turnId),C=(await n.rpc.sessions.fork({sessionId:h,...y?{toEventId:y}:{}})).sessionId,X=this._sessionDataService.getSessionDataDir(e.fork.session),Fe=this._sessionDataService.getSessionDataDirById(C),rt=b.joinPath(X,Nr),P=b.joinPath(Fe,Nr);try{await ji.mkdir(Fe.fsPath,{recursive:!0}),await ji.copyFile(rt.fsPath,P.fsPath)}catch(ie){this._logService.warn(`[Copilot] Failed to copy session database for fork: ${ie instanceof Error?ie.message:String(ie)}`)}let F=await this._resumeSession(C);e.fork.turnIdMapping&&await F.remapTurnIds(e.fork.turnIdMapping);let A=F.sessionUri;this._logService.info(`[Copilot] Forked session created: ${A.toString()}`);let Z=await Js({cwd:e.workingDirectory?.fsPath},this._gitService);return await this._storeSessionMetadata(A,e.model,e.workingDirectory,Z,!0),{session:A,workingDirectory:e.workingDirectory,...Z?{project:Z}:{}}})}let r=e?.session?ce.id(e.session):ne(),o=ce.uri(this.id,r),s=this._activeClients.get(o),a=s?await s.snapshot():void 0,l=await this._resolveSessionWorkingDirectory(e,r),c=this._instantiationService.createInstance($n,o,l),p=this._buildSessionConfig(a,c),u=async h=>{let I=await n.createSession({model:e?.model?.id,reasoningEffort:this._getReasoningEffort(e?.model),sessionId:r,streaming:!0,workingDirectory:l?.fsPath,...await p(h)});return new qr(I)},f;try{f=this._createAgentSession(u,r,c,a),await f.initializeSession()}catch(h){throw await this._removeCreatedWorktree(r),h}let m=f.sessionUri;this._logService.info(`[Copilot] Session created: ${m.toString()}`);let v=await Js({cwd:l?.fsPath},this._gitService);return await this._storeSessionMetadata(f.sessionUri,e?.model,l,v,!0),{session:m,workingDirectory:l,...v?{project:v}:{}}}async resolveSessionConfig(e){let n=e.workingDirectory?await this._getGitInfo(e.workingDirectory):void 0,r=e.config?.isolation==="folder"||e.config?.isolation==="worktree"?e.config.isolation:n?"worktree":"folder",o=e.config?.autoApprove==="default"||e.config?.autoApprove==="autoApprove"||e.config?.autoApprove==="autopilot"?e.config.autoApprove:"default",s={isolation:r,autoApprove:o};if(n){let l=r==="worktree"?n.defaultBranch:n.currentBranch;s.branch=typeof e.config?.branch=="string"&&r==="worktree"?e.config.branch:l}let a={isolation:{type:"string",title:g(1828,null),description:g(1833,null),enum:n?["folder","worktree"]:["folder"],enumLabels:n?[g(1829,null),g(1831,null)]:[g(1829,null)],enumDescriptions:n?[g(1830,null),g(1832,null)]:[g(1830,null)],default:n?"worktree":"folder",readOnly:!n},autoApprove:{type:"string",title:g(1818,null),description:g(1825,null),enum:["default","autoApprove","autopilot"],enumLabels:[g(1823,null),g(1821,null),g(1819,null)],enumDescriptions:[g(1824,null),g(1822,null),g(1820,null)],default:"default",sessionMutable:!0}};if(n){let l=r==="folder",c=r==="worktree"?n.defaultBranch:n.currentBranch;a.branch={type:"string",title:g(1826,null),description:g(1827,null),enum:[c],enumLabels:[c],default:c,enumDynamic:!l,readOnly:l}}return{schema:{type:"object",properties:a},values:s}}async sessionConfigCompletions(e){return e.property!=="branch"||!e.workingDirectory?{items:[]}:{items:(await this._getBranches(e.workingDirectory,e.query)).map(r=>({value:r,label:r}))}}async setClientCustomizations(e,n,r){return this._plugins.sync(e,n,r)}setClientTools(e,n,r){this._getOrCreateActiveClient(e).updateTools(n,r),this._logService.info(`[Copilot:${ce.id(e)}] Client tools updated: ${r.map(s=>s.name).join(", ")||"(none)"}`)}onClientToolCallComplete(e,n,r){this._sessions.get(ce.id(e))?.handleClientToolCallComplete(n,r)}setCustomizationEnabled(e,n){this._plugins.setEnabled(e,n)}async sendMessage(e,n,r,o){let s=ce.id(e);await this._sessionSequencer.queue(s,async()=>{let a=this._sessions.get(s),l=this._activeClients.get(e);a&&l&&await l.isOutdated(a.appliedSnapshot)&&(this._logService.info(`[Copilot:${s}] Session config changed, refreshing session`),this._sessions.deleteAndDispose(s),a=void 0),a??=await this._resumeSession(s);let c=this._pendingFirstTurnAnnouncements.get(s);if(c){this._pendingFirstTurnAnnouncements.delete(s);let p=`copilot-announcement-${ne()}`,u={type:"delta",session:e,messageId:p,content:c};this._onDidSessionProgress.fire(u)}await a.send(n,r,o)})}setPendingMessages(e,n,r){let o=ce.id(e),s=this._sessions.get(o);if(!s){this._logService.warn(`[Copilot:${o}] setPendingMessages: session not found`);return}n&&s.sendSteering(n)}async getSessionMessages(e){let n=ce.id(e),r=this._sessions.get(n)??await this._resumeSession(n).catch(a=>{this._logService.warn(`[Copilot:${n}] Failed to resume session for message lookup`,a)});if(!r)return[];let o=await r.getMessages(),s=await this._readWorktreeBranchMetadata(e).catch(a=>{this._logService.warn(`[Copilot:${n}] Failed to read worktree branch metadata`,a)});return s?[...tb(o,$f(s))]:o}async disposeSession(e){let n=ce.id(e);await this._sessionSequencer.queue(n,async()=>{await this._destroyAndDisposeSession(n)})}async abortSession(e){let n=ce.id(e);await this._sessionSequencer.queue(n,async()=>{let r=this._sessions.get(n);r&&await r.abort()})}async truncateSession(e,n){let r=ce.id(e);await this._sessionSequencer.queue(r,async()=>{this._logService.info(`[Copilot:${r}] Truncating session${n!==void 0?` at turnId=${n}`:" (all turns)"}`);let o=this._sessions.get(r)??await this._resumeSession(r),s;n?s=await o.getNextTurnEventId(n):s=await o.getFirstTurnEventId(),s?await o.truncateAtEventId(s,n):this._logService.info(`[Copilot:${r}] No event ID found for truncation, nothing to truncate`),this._logService.info(`[Copilot:${r}] Session truncated`)})}async changeModel(e,n){let r=ce.id(e),o=this._sessions.get(r);o&&await o.setModel(n.id,this._getReasoningEffort(n)),await this._storeSessionMetadata(e,n,void 0,void 0)}async shutdown(){return this._shutdownPromise??=(async()=>{this._logService.info("[Copilot] Shutting down...");let e=new Set([...this._sessions.keys(),...this._createdWorktrees.keys()]);for(let n of e)await this._sessionSequencer.queue(n,()=>this._destroyAndDisposeSession(n));await this._client?.stop(),this._client=void 0})(),this._shutdownPromise}respondToPermissionRequest(e,n){for(let[,r]of this._sessions)if(r.respondToPermissionRequest(e,n))return}respondToUserInputRequest(e,n,r){for(let[,o]of this._sessions)if(o.respondToUserInputRequest(e,n,r))return}hasSession(e){return this._sessions.has(ce.id(e))}_getOrCreateActiveClient(e){let n=this._activeClients.get(e);return n||(n=new xc(()=>this._plugins.getAppliedPlugins()),this._activeClients.set(e,n)),n}_createAgentSession(e,n,r,o){let s=ce.uri(this.id,n),a=this._instantiationService.createInstance($r,{sessionUri:s,rawSessionId:n,onDidSessionProgress:this._onDidSessionProgress,wrapperFactory:e,shellManager:r,clientSnapshot:o});return this._sessions.set(n,a),a}async _destroyAndDisposeSession(e){let n=this._sessions.get(e);if(n)try{await n.destroySession()}catch(r){this._logService.warn(`[Copilot:${e}] Failed to destroy session before cleanup: ${r instanceof Error?r.message:String(r)}`)}this._sessions.deleteAndDispose(e),await this._removeCreatedWorktree(e)}_buildSessionConfig(e,n){let r=Wf(n,this._terminalManager,this._logService),o=e?.plugins??[];return async s=>{let a=await Of(o.flatMap(l=>l.agents),this._fileService);return{onPermissionRequest:s.onPermissionRequest,onUserInputRequest:s.onUserInputRequest,hooks:Ff(o.flatMap(l=>l.hooks),s.hooks),mcpServers:Df(o.flatMap(l=>l.mcpServers)),customAgents:a,skillDirectories:Lf(o.flatMap(l=>l.skills)),tools:[...r,...s.clientTools]}}}async _resumeSession(e){this._logService.info(`[Copilot:${e}] Session not in memory, resuming...`);let n=await this._ensureClient(),r=ce.uri(this.id,e),o=this._activeClients.get(r),s=o?await o.snapshot():void 0,a=await this._readSessionMetadata(r),l=await n.getSessionMetadata(e).catch(v=>{this._logService.warn(`[Copilot:${e}] getSessionMetadata failed`,v)}),c=a.workingDirectory??(typeof l?.context?.cwd=="string"?b.file(l.context.cwd):void 0);if(!c)throw new Error(`workingDirectory is required to resume Copilot session '${e}'`);let p=this._instantiationService.createInstance($n,r,c),u=this._buildSessionConfig(s,p),f=async v=>{let h=await u(v);try{let I=await n.resumeSession(e,{...h,workingDirectory:c?.fsPath});return new qr(I)}catch(I){if(!I||I.code!==-32603)throw I;this._logService.warn(`[Copilot:${e}] Resume failed (session not found in SDK), recreating`);let y=await n.createSession({...h,sessionId:e,streaming:!0,model:a.model?.id,reasoningEffort:this._getReasoningEffort(a.model),workingDirectory:c?.fsPath});return new qr(y)}},m=this._createAgentSession(f,e,p,s);return await m.initializeSession(),m}async _getGitInfo(e){if(!await this._gitService.isInsideWorkTree(e))return;let n=await this._gitService.getCurrentBranch(e)??"HEAD",r=await this._gitService.getDefaultBranch(e)??n;return{currentBranch:n,defaultBranch:r}}async _getBranches(e,n){return this._gitService.getBranches(e,{query:n,limit:Ie._BRANCH_COMPLETION_LIMIT})}async _resolveSessionWorkingDirectory(e,n){if(e?.config?.isolation!=="worktree"||!e.workingDirectory||typeof e.config.branch!="string")return e?.workingDirectory;let r=await this._gitService.getRepositoryRoot(e.workingDirectory);if(!r)return e.workingDirectory;let o=X1(r),s=e.config[ku],a=eb(n,s),l=b.joinPath(o,Z1(a));await ji.mkdir(o.fsPath,{recursive:!0}),await this._gitService.addWorktree(r,l,a,e.config.branch),this._createdWorktrees.set(n,{repositoryRoot:r,worktree:l}),this._pendingFirstTurnAnnouncements.set(n,$f(a));let c=ce.uri(this.id,n);try{await this._writeWorktreeBranchMetadata(c,a)}catch(p){this._logService.warn(`[Copilot:${n}] Failed to persist worktree branch metadata: ${p instanceof Error?p.message:String(p)}`)}return l}async _removeCreatedWorktree(e){let n=this._createdWorktrees.get(e);if(n)try{await this._gitService.removeWorktree(n.repositoryRoot,n.worktree)}catch(r){this._logService.warn(`[Copilot:${e}] Failed to remove worktree '${n.worktree.fsPath}': ${r instanceof Error?r.message:String(r)}`)}finally{this._createdWorktrees.delete(e)}}static{this._META_MODEL="copilot.model"}static{this._META_CWD="copilot.workingDirectory"}static{this._META_PROJECT_RESOLVED="copilot.project.resolved"}static{this._META_PROJECT_URI="copilot.project.uri"}static{this._META_PROJECT_DISPLAY_NAME="copilot.project.displayName"}static{this._META_WORKTREE_BRANCH="copilot.worktree.branchName"}async _writeWorktreeBranchMetadata(e,n){let r=this._sessionDataService.openDatabase(e);try{await r.object.setMetadata(Ie._META_WORKTREE_BRANCH,n)}finally{r.dispose()}}async _readWorktreeBranchMetadata(e){let n=await this._sessionDataService.tryOpenDatabase(e);if(n)try{return await n.object.getMetadata(Ie._META_WORKTREE_BRANCH)??void 0}finally{n.dispose()}}async _storeSessionMetadata(e,n,r,o,s=o!==void 0){let a=this._sessionDataService.openDatabase(e),l=a.object;try{let c=[];n&&c.push(l.setMetadata(Ie._META_MODEL,this._serializeModelSelection(n))),r&&c.push(l.setMetadata(Ie._META_CWD,r.toString())),s&&c.push(l.setMetadata(Ie._META_PROJECT_RESOLVED,"true")),o&&(c.push(l.setMetadata(Ie._META_PROJECT_URI,o.uri.toString())),c.push(l.setMetadata(Ie._META_PROJECT_DISPLAY_NAME,o.displayName))),await Promise.all(c)}finally{a.dispose()}}async _readSessionMetadata(e){let n=await this._sessionDataService.tryOpenDatabase(e);if(!n)return{};try{let[r,o]=await Promise.all([n.object.getMetadata(Ie._META_MODEL),n.object.getMetadata(Ie._META_CWD)]);return{model:this._parseModelSelection(r),workingDirectory:o?b.parse(o):void 0}}finally{n.dispose()}}async _readStoredSessionMetadata(e){let n=await this._sessionDataService.tryOpenDatabase(e);if(n)try{let[r,o,s,a,l]=await Promise.all([n.object.getMetadata(Ie._META_MODEL),n.object.getMetadata(Ie._META_CWD),n.object.getMetadata(Ie._META_PROJECT_RESOLVED),n.object.getMetadata(Ie._META_PROJECT_URI),n.object.getMetadata(Ie._META_PROJECT_DISPLAY_NAME)]),c=o?b.parse(o):void 0,p=a&&l?{uri:b.parse(a),displayName:l}:void 0;return{model:this._parseModelSelection(r),workingDirectory:c,project:p,resolved:s==="true"||p!==void 0}}finally{n.dispose()}}async _storeSessionProjectResolution(e,n){await this._storeSessionMetadata(e,void 0,void 0,n,!0)}_resolveSessionProject(e,n,r){let o=this._projectContextKey(e);if(!o)return Promise.resolve(void 0);let s=r.get(o);return s||(s=n.queue(()=>Js(e,this._gitService)),r.set(o,s)),s}_projectContextKey(e){if(e?.cwd)return`cwd:${e.cwd}`;if(e?.gitRoot)return`gitRoot:${e.gitRoot}`;if(e?.repository)return`repository:${e.repository}`}dispose(){this.shutdown().catch(e=>{this._logService.warn("[Copilot] Shutdown failed during dispose",e)}).finally(()=>super.dispose())}};Ie=O([K(0,ue),K(1,pr),K(2,tt),K(3,Ur),K(4,Ws),K(5,kr)],Ie);var zi=class{constructor(t,e,n){this._pluginManager=t;this._logService=e;this._fileService=n;this._enablement=new Map;this._lastSynced=Promise.resolve({synced:[],parsed:[]})}async getAppliedPlugins(){let{parsed:t}=await this._lastSynced;return t}setEnabled(t,e){this._enablement.set(t,e)}sync(t,e,n){let r=this._lastSynced;return(this._lastSynced=r.catch(s=>{this._logService.warn("[Copilot:PluginController] Previous customization sync failed",s)}).then(async()=>{let s=await this._pluginManager.syncCustomizations(t,e,c=>{n?.(c.map(p=>({customization:p})))}),a=[],l=[];for(let c of s)if(c.pluginDir)try{a.push(await xf(c.pluginDir,this._fileService,void 0,this._getUserHome())),l.push(c)}catch(p){this._logService.warn(`[Copilot:PluginController] Error parsing plugin: ${p}`),l.push({customization:{...c.customization,status:"error",statusMessage:`Error parsing plugin: ${p}`}})}else l.push(c);return{synced:l,parsed:a}})).then(s=>s.synced)}_getUserHome(){return process.env.HOME??process.env.USERPROFILE??""}};zi=O([K(0,Ns),K(1,ue),K(2,tt)],zi);var xc=class{constructor(t){this._resolvePlugins=t;this._tools=[];this._clientId=""}updateTools(t,e){this._clientId=t,this._tools=e}async snapshot(){return{clientId:this._clientId,tools:this._tools,plugins:await this._resolvePlugins()}}async isOutdated(t){let e=await this._resolvePlugins();if(!Uf(t.plugins,e)||t.tools.length!==this._tools.length)return!0;let n=new Map(t.tools.map(r=>[r.name,r]));for(let r of this._tools){let o=n.get(r.name);if(!o||o.description!==r.description||!An(o.inputSchema,r.inputSchema))return!0}return!1}};var Qs=class extends Error{constructor(e,n,r){super(n);this.code=e;this.data=r}},Vf=class i extends L{constructor(e,n){super();this._send=e;this._handlers=n;this._nextRequestId=1;this._pendingRequests=new Map}static{this.ParseError=-32700}static{this.MethodNotFound=-32601}static{this.InternalError=-32603}sendNotification(e){this._send({jsonrpc:"2.0",...e})}sendRequest(e,n=Ze.None,r){if(this._store.isDisposed)return Promise.reject(new Ae);let o=this._nextRequestId++,s=new Be,a=new _e;this._pendingRequests.set(o,{promise:s,cts:a});let l=n.onCancellationRequested(()=>{s.isSettled||(this._pendingRequests.delete(o),a.cancel(),r?.(o),s.cancel()),l.dispose()});return this._send({jsonrpc:"2.0",id:o,...e}),s.p.finally(()=>{l.dispose(),this._pendingRequests.delete(o),a.dispose(!0)})}async handleMessage(e){if(Array.isArray(e)){let r=[];for(let o of e){let s=await this._handleMessage(o);s&&r.push(s)}return r}let n=await this._handleMessage(e);return n?[n]:[]}cancelPendingRequest(e){let n=this._pendingRequests.get(e);n&&(this._pendingRequests.delete(e),n.cts.cancel(),n.promise.cancel(),n.cts.dispose(!0))}cancelAllRequests(){for(let[e,n]of this._pendingRequests)this._pendingRequests.delete(e),n.cts.cancel(),n.promise.cancel(),n.cts.dispose(!0)}async _handleMessage(e){if(_c(e)){We(e,{result:!0})?this._handleResult(e):this._handleError(e);return}if(nb(e))return this._handleRequest(e);rb(e)&&this._handlers.handleNotification?.(e)}_handleResult(e){let n=this._pendingRequests.get(e.id);n&&(this._pendingRequests.delete(e.id),n.promise.complete(e.result),n.cts.dispose(!0))}_handleError(e){if(e.id===void 0)return;let n=this._pendingRequests.get(e.id);n&&(this._pendingRequests.delete(e.id),n.promise.error(new Qs(e.error.code,e.error.message,e.error.data)),n.cts.dispose(!0))}async _handleRequest(e){if(!this._handlers.handleRequest){let r={jsonrpc:"2.0",id:e.id,error:{code:i.MethodNotFound,message:`Method not found: ${e.method}`}};return this._send(r),r}let n=new _e;this._register(w(()=>n.dispose(!0)));try{let r=this._handlers.handleRequest(e,n.token),o=ib(r)?await r:r,s={jsonrpc:"2.0",id:e.id,result:o};return this._send(s),s}catch(r){let o;return r instanceof Qs?o={jsonrpc:"2.0",id:e.id,error:{code:r.code,message:r.message,data:r.data}}:o={jsonrpc:"2.0",id:e.id,error:{code:i.InternalError,message:r instanceof Error?r.message:"Internal error"}},this._send(o),o}finally{n.dispose(!0)}}dispose(){this.cancelAllRequests(),super.dispose()}static createParseError(e,n){return{jsonrpc:"2.0",error:{code:i.ParseError,message:e,data:n}}}};function nb(i){return"method"in i&&"id"in i&&(typeof i.id=="string"||typeof i.id=="number")}function _c(i){return We(i,{id:!0,result:!0})||We(i,{id:!0,error:!0})}function rb(i){return We(i,{method:!0})&&!We(i,{id:!0})}function ib(i){return typeof i=="object"&&i!==null&&"then"in i&&typeof i.then=="function"}var ob=1e3;function Ys(i,t){return{jsonrpc:"2.0",id:i,result:t}}function Ec(i,t,e,n){return{jsonrpc:"2.0",id:i,error:{code:t,message:e,...n!==void 0?{data:n}:{}}}}function Xs(i,t){if(t instanceof H)return Ec(i,t.code,t.message,t.data);let e=t instanceof Error?t.stack??t.message:String(t);return Ec(i,Tr,e)}var qn=class extends L{constructor(e,n,r,o,s,a){super();this._agentService=e;this._stateManager=n;this._server=r;this._config=o;this._clientFileSystemProvider=s;this._logService=a;this._clients=new Map;this._replayBuffer=[];this._onDidChangeConnectionCount=this._register(new x);this.onDidChangeConnectionCount=this._onDidChangeConnectionCount.event;this._requestHandlers={subscribe:async(e,n)=>{try{let r=await this._agentService.subscribe(b.parse(n.resource));return e.subscriptions.add(n.resource),{snapshot:r}}catch(r){throw r instanceof H?r:new H(cn,`Resource not found: ${n.resource}`)}},createSession:async(e,n)=>{let r,o;if(n.fork){let s=this._stateManager.getSessionState(n.fork.session);if(!s)throw new H(cn,`Fork source session not found: ${n.fork.session}`);let a=s.turns.findIndex(l=>l.id===n.fork.turnId);if(a<0)throw new H(cn,`Fork turn ID ${n.fork.turnId} not found in session ${n.fork.session}`);o={session:b.parse(n.fork.session),turnIndex:a,turnId:n.fork.turnId}}try{r=await this._agentService.createSession({provider:n.provider,model:n.model,workingDirectory:n.workingDirectory?b.parse(n.workingDirectory):void 0,session:b.parse(n.session),fork:o,config:n.config})}catch(s){throw s instanceof H?s:new H(cp,s instanceof Error?s.message:String(s))}return r.toString()!==b.parse(n.session).toString()&&this._logService.warn(`[ProtocolServer] createSession: provider returned URI ${r.toString()} but client requested ${n.session}`),null},disposeSession:async(e,n)=>(await this._agentService.disposeSession(b.parse(n.session)),null),resourceWrite:async(e,n)=>this._agentService.resourceWrite(n),listSessions:async()=>({items:(await this._agentService.listSessions()).map(r=>({resource:r.session.toString(),provider:ce.provider(r.session)??"copilot",title:r.summary??"Session",status:r.status??1,createdAt:r.startTime,modifiedAt:r.modifiedTime,...r.project?{project:{uri:r.project.uri.toString(),displayName:r.project.displayName}}:{},model:r.model,workingDirectory:r.workingDirectory?.toString(),isRead:r.isRead,isDone:r.isDone}))}),resolveSessionConfig:async(e,n)=>this._agentService.resolveSessionConfig({provider:n.provider,workingDirectory:n.workingDirectory?b.parse(n.workingDirectory):void 0,config:n.config}),sessionConfigCompletions:async(e,n)=>this._agentService.sessionConfigCompletions({provider:n.provider,workingDirectory:n.workingDirectory?b.parse(n.workingDirectory):void 0,config:n.config,property:n.property,query:n.query}),fetchTurns:async(e,n)=>{let r=this._stateManager.getSessionState(n.session);if(!r)throw new H(cn,`Session not found: ${n.session}`);let o=r.turns,s=Math.min(n.limit??50,100),a=o.length;if(n.before){let c=o.findIndex(p=>p.id===n.before);c!==-1&&(a=c)}let l=Math.max(0,a-s);return{turns:o.slice(l,a),hasMore:l>0}},resourceList:async(e,n)=>this._agentService.resourceList(b.parse(n.uri)),resourceRead:async(e,n)=>this._agentService.resourceRead(b.parse(n.uri)),resourceCopy:async(e,n)=>this._agentService.resourceCopy(n),resourceDelete:async(e,n)=>this._agentService.resourceDelete(n),resourceMove:async(e,n)=>this._agentService.resourceMove(n),authenticate:async(e,n)=>{if(!(await this._agentService.authenticate(n)).authenticated)throw new H(ns,"Authentication failed for resource: "+n.resource);return{}},createTerminal:async(e,n)=>(await this._agentService.createTerminal(n),null),disposeTerminal:async(e,n)=>(await this._agentService.disposeTerminal(b.parse(n.terminal)),null)};this._reverseRequestId=0;this._pendingReverseRequests=new Map;this._register(this._server.onConnection(l=>{this._handleNewConnection(l)})),this._register(this._stateManager.onDidEmitEnvelope(l=>{this._replayBuffer.push(l),this._replayBuffer.length>ob&&this._replayBuffer.shift(),this._broadcastAction(l)})),this._register(this._stateManager.onDidEmitNotification(l=>{this._broadcastNotification(l)}))}_handleNewConnection(e){let n=new N,r;n.add(e.onMessage(o=>{if(up(o)){if(this._logService.trace(`[ProtocolServer] request: method=${o.method} id=${o.id}`),!r&&o.method==="initialize"){try{let s=this._handleInitialize(o.params,e,n);r=s.client,e.send(Ys(o.id,s.response))}catch(s){e.send(Xs(o.id,s))}return}if(!r&&o.method==="reconnect"){try{let s=this._handleReconnect(o.params,e,n);r=s.client,e.send(Ys(o.id,s.response))}catch(s){e.send(Xs(o.id,s))}return}if(!r)return;this._handleRequest(r,o.method,o.params,o.id)}else if(pp(o))switch(this._logService.trace(`[ProtocolServer] notification: method=${o.method}`),o.method){case"unsubscribe":r&&r.subscriptions.delete(o.params.resource);break;case"dispatchAction":if(r){this._logService.trace(`[ProtocolServer] dispatchAction: ${JSON.stringify(o.params.action.type)}`);let s=o.params.action;this._agentService.dispatchAction(s,r.clientId,o.params.clientSeq)}break}else if(_c(o)){let s=this._pendingReverseRequests.get(o.id);s&&(this._pendingReverseRequests.delete(o.id),We(o,{error:!0})?s.reject(new Error(o.error?.message??"Reverse RPC error")):s.resolve(o.result))}})),n.add(e.onClose(()=>{r&&this._clients.get(r.clientId)===r&&(this._logService.info(`[ProtocolServer] Client disconnected: ${r.clientId}`),this._clients.delete(r.clientId),this._rejectPendingReverseRequests(r.clientId),this._onDidChangeConnectionCount.fire(this._clients.size)),n.dispose()})),n.add(e)}_handleInitialize(e,n,r){if(this._logService.info(`[ProtocolServer] Initialize: clientId=${e.clientId}, version=${e.protocolVersion}`),e.protocolVersion<1)throw new H(dp,`Client protocol version ${e.protocolVersion} is below minimum ${1}`);let o={clientId:e.clientId,protocolVersion:e.protocolVersion,transport:n,subscriptions:new Set,disposables:r};this._clients.set(e.clientId,o),this._onDidChangeConnectionCount.fire(this._clients.size),r.add(this._clientFileSystemProvider.registerAuthority(e.clientId,{resourceList:a=>this._sendReverseRequest(e.clientId,"resourceList",{uri:a.toString()}),resourceRead:a=>this._sendReverseRequest(e.clientId,"resourceRead",{uri:a.toString()}),resourceWrite:a=>this._sendReverseRequest(e.clientId,"resourceWrite",a),resourceDelete:a=>this._sendReverseRequest(e.clientId,"resourceDelete",a),resourceMove:a=>this._sendReverseRequest(e.clientId,"resourceMove",a)}));let s=[];if(e.initialSubscriptions)for(let a of e.initialSubscriptions){let l=this._stateManager.getSnapshot(a);l&&(s.push(l),o.subscriptions.add(a.toString()))}return{client:o,response:{protocolVersion:1,serverSeq:this._stateManager.serverSeq,snapshots:s,defaultDirectory:this._config.defaultDirectory}}}_handleReconnect(e,n,r){this._logService.info(`[ProtocolServer] Reconnect: clientId=${e.clientId}, lastSeenSeq=${e.lastSeenServerSeq}`);let o={clientId:e.clientId,protocolVersion:1,transport:n,subscriptions:new Set,disposables:r};this._clients.set(e.clientId,o),this._onDidChangeConnectionCount.fire(this._clients.size);let s=this._replayBuffer.length>0?this._replayBuffer[0].serverSeq:this._stateManager.serverSeq;if(e.lastSeenServerSeq>=s){let l=[];for(let c of e.subscriptions)o.subscriptions.add(c.toString());for(let c of this._replayBuffer)c.serverSeq>e.lastSeenServerSeq&&this._isRelevantToClient(o,c)&&l.push(c);return{client:o,response:{type:"replay",actions:l}}}else{let l=[];for(let c of e.subscriptions){let p=this._stateManager.getSnapshot(c);p&&(l.push(p),o.subscriptions.add(c))}return{client:o,response:{type:"snapshot",snapshots:l}}}}_sendReverseRequest(e,n,r){let o=this._clients.get(e);if(!o)return Promise.reject(new Error(`Client ${e} is not connected`));let s=++this._reverseRequestId;return new Promise((a,l)=>{this._pendingReverseRequests.set(s,{clientId:e,resolve:a,reject:l});let c={jsonrpc:"2.0",id:s,method:n,params:r};o.transport.send(c)})}_rejectPendingReverseRequests(e){for(let[n,r]of this._pendingReverseRequests)r.clientId===e&&(this._pendingReverseRequests.delete(n),r.reject(new Error(`Client ${e} disconnected`)))}_handleRequest(e,n,r,o){let s=this._requestHandlers.hasOwnProperty(n)?this._requestHandlers[n]:void 0;if(s){s(e,r).then(l=>{this._logService.trace(`[ProtocolServer] Request '${n}' id=${o} succeeded`),e.transport.send(Ys(o,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Request '${n}' failed`,l),e.transport.send(Xs(o,l))});return}let a=this._handleExtensionRequest(n,r);if(a){a.then(l=>{e.transport.send(Ys(o,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Extension request '${n}' failed`,l),e.transport.send(Xs(o,l))});return}e.transport.send(Ec(o,Tr,`Unknown method: ${n}`))}_handleExtensionRequest(e,n){if(e==="shutdown")return this._agentService.shutdown()}_broadcastAction(e){this._logService.trace(`[ProtocolServer] Broadcasting action: ${e.action.type}`);let n={jsonrpc:"2.0",method:"action",params:e};for(let r of this._clients.values())this._isRelevantToClient(r,e)&&r.transport.send(n)}_broadcastNotification(e){let n={jsonrpc:"2.0",method:"notification",params:{notification:e}};for(let r of this._clients.values())r.transport.send(n)}_isRelevantToClient(e,n){let r=n.action;return r.type.startsWith("root/")?e.subscriptions.has(os):Sr(r)?e.subscriptions.has(r.session):ts(r)?e.subscriptions.has(r.terminal):!1}dispose(){for(let e of this._clients.values())e.disposables.dispose();this._clients.clear();for(let[,e]of this._pendingReverseRequests)e.reject(new Error("ProtocolServerHandler disposed"));this._pendingReverseRequests.clear(),this._replayBuffer.length=0,super.dispose()}};qn=O([K(5,ue)],qn);var Cc=class extends L{constructor(e,n){super();this._ws=e;this._WebSocket=n;this._onMessage=this._register(new x);this.onMessage=this._onMessage.event;this._onClose=this._register(new x);this.onClose=this._onClose.event;this._ws.on("message",r=>{try{let o=typeof r=="string"?r:r.toString("utf-8"),s=JSON.parse(o);this._onMessage.fire(s)}catch{this.send({jsonrpc:"2.0",id:null,error:{code:lp,message:"Parse error"}})}}),this._ws.on("close",()=>{this._onClose.fire()}),this._ws.on("error",()=>{this._onClose.fire()})}send(e){this._ws.readyState===this._WebSocket.OPEN&&this._ws.send(JSON.stringify(e))}dispose(){this._ws.close(),super.dispose()}},Hi=class i extends L{constructor(e,n,r,o,s){super();this._logService=n;this._onConnection=this._register(new x);this.onConnection=this._onConnection.event;this._WebSocket=r.WebSocket;let a=typeof e=="number"?{port:e}:e,l=a.host??"127.0.0.1",c=a.connectionTokenValidate?(p,u)=>{let m=s.parse(p.req.url??"",!0).query[Za];if(!a.connectionTokenValidate(m)){this._logService.warn("[WebSocketProtocol] Connection rejected: invalid connection token"),u(!1,403,"Forbidden");return}u(!0)}:void 0;a.socketPath?(this._httpServer=o.createServer(),this._wss=new r.WebSocketServer({server:this._httpServer,verifyClient:c}),this._httpServer.listen(a.socketPath,()=>{this._logService.info(`[WebSocketProtocol] Server listening on socket ${a.socketPath}`)})):(this._wss=new r.WebSocketServer({port:a.port,host:l,verifyClient:c}),this._logService.info(`[WebSocketProtocol] Server listening on ${l}:${a.port}`)),this._wss.on("connection",p=>{this._logService.trace("[WebSocketProtocol] New client connection");let u=new Cc(p,this._WebSocket);this._onConnection.fire(u)}),this._wss.on("error",p=>{this._logService.error("[WebSocketProtocol] Server error",p)})}get address(){let e=this._wss.address();return!e||typeof e=="string"?e??void 0:`${e.address}:${e.port}`}static async create(e,n){let[r,o,s]=await Promise.all([import("ws"),import("http"),import("url")]);return new i(e,n,r,o,s)}dispose(){this._wss.close(),this._httpServer?.close(),super.dispose()}};import{homedir as fb,tmpdir as gb}from"os";var sb=60,ab=sb*60,Rc=ab*24,AA=Rc*7,kA=Rc*30,DA=Rc*365;function zf(i){return i.getFullYear()+"-"+String(i.getMonth()+1).padStart(2,"0")+"-"+String(i.getDate()).padStart(2,"0")+"T"+String(i.getHours()).padStart(2,"0")+":"+String(i.getMinutes()).padStart(2,"0")+":"+String(i.getSeconds()).padStart(2,"0")+"."+(i.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var jf=/^([^.]+\..+)[:=](.+)$/,G=class{constructor(t,e,n){this._args=t;this.paths=e;this.productService=n}get appRoot(){return me(Xe.asFileUri("").fsPath)}get userHome(){return b.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return b.file(q(this.userDataPath,"User"))}get tmpDir(){return b.file(this.paths.tmpDir)}get cacheHome(){return b.file(this.userDataPath)}get stateResource(){return te(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:ee.vscodeUserData})}get userDataSyncHome(){return te(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let t=zf(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=q(this.userDataPath,"logs",t)}return b.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return te(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return te(this.appSettingsHome,"History")}get keyboardLayoutResource(){return te(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let t=be.VSCODE_PORTABLE;return t?b.file(q(t,"argv.json")):te(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return b.file(q(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let t=this.args["builtin-extensions-dir"];return t?xn(t):ot(q(Xe.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let t=this.args["extensions-download-dir"];return t?b.file(xn(t)):b.file(q(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let t=this.args["extensions-dir"];if(t)return xn(t);let e=be.VSCODE_EXTENSIONS;if(e)return e;let n=be.VSCODE_PORTABLE;return n?q(n,"extensions"):te(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let t=this.args["agent-plugins-dir"];if(t)return xn(t);let e=be.VSCODE_AGENT_PLUGINS;if(e)return e;let n=be.VSCODE_PORTABLE;return n?q(n,"agent-plugins"):te(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let t=this.args.extensionDevelopmentPath;if(Array.isArray(t))return t.map(e=>/^[^:/?#]+?:\/\//.test(e)?b.parse(e):b.file(ot(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(t=>t==="ui"||t==="workspace"||t==="web"?t:"workspace")}get extensionTestsLocationURI(){let t=this.args.extensionTestsPath;if(t)return/^[^:/?#]+?:\/\//.test(t)?b.parse(t):b.file(ot(t))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let t=this.args["disable-extension"];if(t){if(typeof t=="string")return[t];if(Array.isArray(t)&&t.length>0)return t}return!1}get skipBuiltinExtensions(){let t=be.VSCODE_SKIP_BUILTIN_EXTENSIONS;return t?t.split(",").map(e=>e.trim()).filter(e=>e):[]}get debugExtensionHost(){return lb(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!be.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(t=>!jf.test(t))}get extensionLogLevel(){let t=[];for(let e of this.args.log||[]){let n=jf.exec(e);n?.[1]&&n[2]&&t.push([n[1],n[2]])}return t.length?t:void 0}get serviceMachineIdResource(){return te(b.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let t=be.VSCODE_PORTABLE;return t?b.file(q(t,"policy.json")):te(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return te(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(t){this.args.continueOn=t}get args(){return this._args}};O([J],G.prototype,"appRoot",1),O([J],G.prototype,"userHome",1),O([J],G.prototype,"userDataPath",1),O([J],G.prototype,"appSettingsHome",1),O([J],G.prototype,"tmpDir",1),O([J],G.prototype,"cacheHome",1),O([J],G.prototype,"stateResource",1),O([J],G.prototype,"userRoamingDataHome",1),O([J],G.prototype,"userDataSyncHome",1),O([J],G.prototype,"sync",1),O([J],G.prototype,"workspaceStorageHome",1),O([J],G.prototype,"localHistoryHome",1),O([J],G.prototype,"keyboardLayoutResource",1),O([J],G.prototype,"argvResource",1),O([J],G.prototype,"isExtensionDevelopment",1),O([J],G.prototype,"untitledWorkspacesHome",1),O([J],G.prototype,"builtinExtensionsPath",1),O([J],G.prototype,"extensionsDownloadLocation",1),O([J],G.prototype,"extensionsPath",1),O([J],G.prototype,"agentPluginsPath",1),O([J],G.prototype,"extensionDevelopmentLocationURI",1),O([J],G.prototype,"extensionDevelopmentKind",1),O([J],G.prototype,"extensionTestsLocationURI",1),O([J],G.prototype,"debugExtensionHost",1),O([J],G.prototype,"logLevel",1),O([J],G.prototype,"extensionLogLevel",1),O([J],G.prototype,"serviceMachineIdResource",1),O([J],G.prototype,"disableTelemetry",1),O([J],G.prototype,"disableExperiments",1),O([J],G.prototype,"disableWorkspaceTrust",1),O([J],G.prototype,"useInMemorySecretStorage",1),O([J],G.prototype,"policyFile",1),O([J],G.prototype,"agentSessionsWorkspace",1);function lb(i,t){return Hf(i["inspect-extensions"],i["inspect-brk-extensions"],5870,t,i.debugId,i.extensionEnvironment)}function Hf(i,t,e,n,r,o){let a=Number(t||i)||(n?null:e),l=a?!!t:!1,c;if(o)try{c=JSON.parse(o)}catch{}return{port:a,break:l,debugId:r,env:c}}import{homedir as Gf}from"os";import{resolve as cb,isAbsolute as db,join as Kr}from"path";var ub=process.env.VSCODE_CWD||process.cwd();function Jf(i,t){let e=pb(i,t),n=[e];return db(e)||n.unshift(ub),cb(...n)}function pb(i,t){process.env.VSCODE_DEV&&(process.isEmbeddedApp?t="agents-oss-dev":t="code-oss-dev");let e=process.env.VSCODE_PORTABLE;if(e)return Kr(e,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Kr(n,t);let r=i["user-data-dir"];if(r)return r;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let o=process.env.USERPROFILE;if(typeof o!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Kr(o,"AppData","Roaming")}break;case"darwin":n=Kr(Gf(),"Library","Application Support");break;case"linux":n=process.env.XDG_CONFIG_HOME||Kr(Gf(),".config");break;default:throw new Error("Platform not supported")}return Kr(n,t)}var Zs=class extends G{constructor(t,e){super(t,{homeDir:fb(),tmpDir:gb(),userDataDir:Jf(t,e.nameShort)},e)}};import mb from"minimist";var ZA={o:g(1966,null),e:g(1950,null),t:g(1980,null),m:g(1961,null)};var Qf={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:g(1970,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:g(1937,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:g(1932,null)},maximize:{type:"boolean",cat:"o",description:g(1936,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1973,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1964,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",alias:"h",description:g(1952,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(1942,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(1962,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(1931,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(1971,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1963,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1972,null)},agents:{type:"boolean",cat:"o",deprecates:["sessions"],description:g(1934,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(1990,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(1958,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(1987,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(1952,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:g(1939,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(1949,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(1957,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:g(1974,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(1935,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(1956,null)},"pre-release":{type:"boolean",cat:"e",description:g(1955,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(1982,null)},"update-extensions":{type:"boolean",cat:"e",description:g(1985,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(1948,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:g(1933,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(1989,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(1988,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(1960,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(1975,null)},"prof-startup":{type:"boolean",cat:"t",description:g(1968,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(1945,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(1944,null)},sync:{type:"string",cat:"t",description:g(1981,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(1954,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(1953,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(1947,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(1946,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(1943,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(1959,null)},telemetry:{type:"boolean",cat:"t",description:g(1978,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},"share-secrets-with-agents-app":{type:"boolean"},transient:{type:"boolean",cat:"t",description:g(1979,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},hb={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function wc(i,t,e=hb){let n=i.find((f,m)=>f.length>0&&f[0]!=="-"&&t.hasOwnProperty(f)&&t[f].type==="subcommand"),r={},o=["_"],s=[],a={},l;for(let f in t){let m=t[f];m.type==="subcommand"?f===n&&(l=m):(m.alias&&(r[f]=m.alias),m.type==="string"||m.type==="string[]"?(o.push(f),m.deprecates&&o.push(...m.deprecates)):m.type==="boolean"&&(s.push(f),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[f]=m))}if(l&&n){let f=a;for(let I in l.options)f[I]=l.options[I];let m=i.filter(I=>I!==n),v=e.getSubcommandReporter?e.getSubcommandReporter(n):void 0,h=wc(m,f,v);return{[n]:h,_:[]}}let c=mb(i,{string:o,boolean:s,alias:r}),p={},u=c;p._=c._.map(f=>String(f)).filter(f=>f.length>0),delete u._;for(let f in t){let m=t[f];if(m.type==="subcommand")continue;m.alias&&delete u[m.alias];let v=u[f];if(m.deprecates)for(let h of m.deprecates)u.hasOwnProperty(h)&&(v||(v=u[h],v&&e.onDeprecatedOption(h,m.deprecationMessage||g(1941,null,f))),delete u[h]);if(typeof v<"u"){if(m.type==="string[]"){if(Array.isArray(v)||(v=[v]),!m.allowEmptyValue){let h=v.filter(I=>I.length>0);h.length!==v.length&&(e.onEmptyValue(f),v=h.length>0?h:void 0)}}else m.type==="string"&&(Array.isArray(v)?(v=v.pop(),e.onMultipleValues(f,v)):!v&&!m.allowEmptyValue&&(e.onEmptyValue(f),v=void 0));p[f]=v,m.deprecationMessage&&e.onDeprecatedOption(f,m.deprecationMessage)}delete u[f]}for(let f in u)e.onUnknownOption(f);return p}var ea=class extends L{constructor(t,e=[]){super(),this.logger=new vs([t,...e]),this._register(t.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(t){this.logger.setLevel(t)}getLevel(){return this.logger.getLevel()}trace(t,...e){this.logger.trace(t,...e)}debug(t,...e){this.logger.debug(t,...e)}info(t,...e){this.logger.info(t,...e)}warn(t,...e){this.logger.warn(t,...e)}error(t,...e){this.logger.error(t,...e)}flush(){this.logger.flush()}};async function bb(i,t,e,n,r){try{let o=await import("@vscode/spdlog");o.setFlushOn(0);let s=await o.createAsyncRotatingLogger(i,t,e,n);return r?s.clearFormatters():s.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),s}catch(o){console.error(o)}return null}function Yf(i,t,e){switch(t){case 1:i.trace(e);break;case 2:i.debug(e);break;case 3:i.info(e);break;case 4:i.warn(e);break;case 5:i.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${t}`)}}function Xf(i,t){switch(t){case 1:i.setLevel(0);break;case 2:i.setLevel(1);break;case 3:i.setLevel(2);break;case 4:i.setLevel(3);break;case 5:i.setLevel(4);break;case 0:i.setLevel(6);break;default:throw new Error(`Invalid log level ${t}`)}}var ta=class extends Fi{constructor(e,n,r,o,s){super();this.buffer=[];this.setLevel(s),this._loggerCreationPromise=this._createSpdLogLogger(e,n,r,o),this._register(this.onDidChangeLogLevel(a=>{this._logger&&Xf(this._logger,a)}))}async _createSpdLogLogger(e,n,r,o){let s=r?6:1,a=30/s*Yo.MB,l=await bb(e,n,a,s,o);if(l){this._logger=l,Xf(this._logger,this.getLevel());for(let{level:c,message:p}of this.buffer)Yf(this._logger,c,p);this.buffer=[]}}log(e,n){this._logger?Yf(this._logger,e,n):this.getLevel()<=e&&this.buffer.push({level:e,message:n})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}};var na=class extends Ui{doCreateLogger(t,e,n){return new ta(ne(),t.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,e)}};var ra=class{constructor(t,e){this.loggerService=t;this.getUriTransformer=e}listen(t,e){let n=this.getUriTransformer(t);switch(e){case"onDidChangeLoggers":return Q.map(this.loggerService.onDidChangeLoggers,r=>({added:[...r.added].map(o=>this.transformLogger(o,n)),removed:[...r.removed].map(o=>this.transformLogger(o,n))}));case"onDidChangeVisibility":return Q.map(this.loggerService.onDidChangeVisibility,r=>[n.transformOutgoingURI(r[0]),r[1]]);case"onDidChangeLogLevel":return Q.map(this.loggerService.onDidChangeLogLevel,r=>Yl(r)?r:[n.transformOutgoingURI(r[0]),r[1]])}throw new Error(`Event not found: ${e}`)}async call(t,e,n){let r=this.getUriTransformer(t);switch(e){case"setLogLevel":return Yl(n[0])?this.loggerService.setLogLevel(n[0]):this.loggerService.setLogLevel(b.revive(r.transformIncoming(n[0][0])),n[0][1]);case"getRegisteredLoggers":return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(o=>this.transformLogger(o,r)))}throw new Error(`Call not found: ${e}`)}transformLogger(t,e){return{...t,resource:e.transformOutgoingURI(t.resource)}}};var Zf=new class{transformIncoming(i){return i}transformOutgoing(i){return i}transformOutgoingURI(i){return i}transformOutgoingScheme(i){return i}};var Ve,Pc=globalThis.vscode;if(typeof Pc<"u"&&typeof Pc.context<"u"){let i=Pc.context.configuration();if(i)Ve=i.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(Ve=globalThis._VSCODE_PRODUCT_JSON,be.VSCODE_DEV&&Object.assign(Ve,{nameShort:`${Ve.nameShort} Dev`,nameLong:`${Ve.nameLong} Dev`,dataFolderName:`${Ve.dataFolderName}-dev`,serverDataFolderName:Ve.serverDataFolderName?`${Ve.serverDataFolderName}-dev`:void 0}),!Ve.version){let i=globalThis._VSCODE_PACKAGE_JSON;Object.assign(Ve,{version:i.version})}Object.assign(Ve,{extensionsGallery:be.EXTENSIONS_GALLERY?JSON.parse(be.EXTENSIONS_GALLERY):Ve.extensionsGallery||{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item",extensionUrlTemplate:"https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",resourceUrlTemplate:"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",controlUrl:"",recommendationsUrl:""},telemetryEndpoint:be.CS_TELEMETRY_URL||Ve.telemetryEndpoint||"https://v1.telemetry.coder.com/track"})}else Ve={nameShort:"code-server",nameLong:"code-server",applicationName:"code-server",dataFolderName:".code-server",win32MutexName:"codeserver",licenseName:"MIT",licenseUrl:"https://github.com/coder/code-server/blob/main/LICENSE",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"code-server",win32NameVersion:"code-server",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"coder.code-server",win32ShellNameShort:"c&ode-server",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.coder.code.server",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"com.coder.code.server",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/coder/code-server/issues/new",nodejsRepository:"https://nodejs.org",urlProtocol:"code-oss",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.117.0",sha256:"854eeb8a785b1f41ba2bd02d7ccd4fdbe10021b61473293973c7e96d036c7fb8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",completionsRefreshTokenCommand:"github.copilot.signIn",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry"},trustedExtensionAuthAccess:["vscode.git","vscode.github","github.vscode-pull-request-github","github.copilot","github.copilot-chat"],onboardingKeymaps:[{id:"vscode",label:"VS Code",description:"Default keyboard mapping"},{id:"sublime",label:"Sublime Text",extensionId:"ms-vscode.sublime-keybindings",description:"Keyboard mapping from Sublime Text"},{id:"intellij",label:"IntelliJ / JetBrains",extensionId:"k--kato.intellij-idea-keybindings",description:"Keyboard mapping from IntelliJ IDEA"},{id:"vim",label:"Vim",extensionId:"vscodevim.vim",description:"Vim modal editing"},{id:"eclipse",label:"Eclipse",extensionId:"alphabotsec.vscode-eclipse-keybindings",description:"Keyboard mapping from Eclipse"},{id:"notepadpp",label:"Notepad++",extensionId:"ms-vscode.notepadplusplus-keybindings",description:"Keyboard mapping from Notepad++"}],onboardingThemes:[{id:"dark-2026",label:"Dark 2026",themeId:"Dark 2026",type:"dark"},{id:"hc-dark",label:"Dark High Contrast",themeId:"Default High Contrast",type:"hcDark"},{id:"solarized-dark",label:"Solarized Dark",themeId:"Solarized Dark",type:"dark"},{id:"light-2026",label:"Light 2026",themeId:"Light 2026",type:"light"},{id:"hc-light",label:"Light High Contrast",themeId:"Default High Contrast Light",type:"hcLight"},{id:"solarized-light",label:"Solarized Light",themeId:"Solarized Light",type:"light"}],builtInExtensionsEnabledWithAutoUpdates:["GitHub.copilot-chat"],enableTelemetry:!0,quality:"stable",codeServerVersion:"4.117.0",documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",linkProtectionTrustedDomains:["https://open-vsx.org"],aiConfig:{ariaKey:"code-server"},version:"1.117.0",commit:"ddeb0a3de0321412c0633dffa85d35770005ae0f",date:"2026-04-21T16:12:14-07:00"},Object.keys(Ve).length===0&&Object.assign(Ve,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var eg=Ve;function Ac(i){let t=[];typeof i=="number"&&t.push("code/timeOrigin",i);function e(o,s){t.push(o,s?.startTime??Date.now())}function n(){let o=[];for(let s=0;s"u"){let s=t.length>=2&&t[0]==="code/timeOrigin",a=s?t[1]:void 0;t.length=0,s&&t.push("code/timeOrigin",a)}else for(let s=t.length-2;s>=0;s-=2)t[s]===o&&t.splice(s,2)}return{mark:e,getMarks:n,clearMarks:r}}function yb(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?Ac():{mark(i,t){performance.mark(i,t)},clearMarks(i){performance.clearMarks(i)},getMarks(){let i=performance.timeOrigin;typeof i!="number"&&(i=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let t=[{name:"code/timeOrigin",startTime:Math.round(i)}];for(let e of performance.getEntriesByType("mark"))t.push({name:e.name,startTime:Math.round(i+e.startTime)});return t}};if(typeof process=="object"){let i=performance?.timeOrigin;return Ac(i)}else return console.trace("perf-util loaded in UNKNOWN environment"),Ac()}function Ib(i){return i.MonacoPerformanceMarks||(i.MonacoPerformanceMarks=yb()),i.MonacoPerformanceMarks}var kc=Ib(globalThis),tg=kc.mark,W8=kc.clearMarks,B8=kc.getMarks;async function ia(i,t,e,n,r,o){let s;try{await Sb(i,t,e,n,r,o)}catch(a){s=a}finally{s&&r.errorTransformer&&(s=r.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function Sb(i,t,e,n,r,o){Dc(o);let s=await i.open(t,{create:!1});try{Dc(o);let a=0,l=0,c=r&&typeof r.length=="number"?r.length:void 0,p=_.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),u=r&&typeof r.position=="number"?r.position:0,f=0;do l=await i.read(s,u,p.buffer,f,p.byteLength-f),u+=l,f+=l,a+=l,typeof c=="number"&&(c-=l),f===p.byteLength&&(await e.write(n(p)),p=_.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),f=0);while(l>0&&(typeof c!="number"||c>0)&&Dc(o)&&Tb(a,r));if(f>0){let m=f;typeof c=="number"&&(m=Math.min(f,c)),e.write(n(p.slice(0,m)))}}catch(a){throw Kt(a)}finally{await i.close(s)}}function Dc(i){if(i.isCancellationRequested)throw eo();return!0}function Tb(i,t){if(typeof t?.limits?.size=="number"&&i>t.limits.size)throw Y(g(2152,null),"EntryTooLarge");return!0}var mn=class extends L{constructor(e){super();this.logService=e;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new x);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new x);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new x);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new x);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new x);this._onDidUncorrelatedFilesChange=this._register(new x);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new x);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new tr)}registerProvider(e,n){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);tg(`code/registerFilesystem/${e}`);let r=new N;return this.provider.set(e,n),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:n}),r.add(n.onDidChangeFile(o=>{let s=new Qo(o,!this.isPathCaseSensitive(n));this.internalOnDidFilesChange.fire(s),s.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(s)})),typeof n.onDidWatchError=="function"&&r.add(n.onDidWatchError(o=>this._onDidWatchError.fire(new Error(o)))),r.add(n.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:n,scheme:e}))),w(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:n}),this.provider.delete(e),Ke(r)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){let n=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(r){n.push(r)}}),!this.provider.has(e)&&await wn.settled(n)}async canHandleResource(e){return await this.activateProvider(e.scheme),this.hasProvider(e)}hasProvider(e){return this.provider.has(e.scheme)}hasCapability(e,n){let r=this.provider.get(e.scheme);return!!(r&&r.capabilities&n)}listCapabilities(){return ei.map(this.provider,([e,n])=>({scheme:e,capabilities:n.capabilities}))}async withProvider(e){if(!eu(e))throw new Ce(g(2141,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let n=this.provider.get(e.scheme);if(!n){let r=new vt;throw r.message=g(2143,null,e.toString()),r}return n}async withReadProvider(e){let n=await this.withProvider(e);if(qt(n)||nt(n)||Xo(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(e){let n=await this.withProvider(e);if(qt(n)||nt(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(e,n){try{return await this.doResolveFile(e,n)}catch(r){throw xt(r)==="EntryNotFound"?new Ce(g(2138,null,this.resourceForError(e)),1):Kt(r)}}async doResolveFile(e,n){let r=await this.withProvider(e),o=this.isPathCaseSensitive(r),s=n?.resolveTo,a=n?.resolveSingleChildDescendants,l=n?.resolveMetadata,c=await r.stat(e),p;return this.toFileStat(r,e,c,void 0,!!l,(u,f)=>(p||(p=ln.forUris(()=>!o),p.set(e,!0),s&&p.fill(!0,s)),p.get(u.resource)||p.findSuperstr(u.resource.with({query:null,fragment:null}))?!0:u.isDirectory&&a?f===1:!1))}async toFileStat(e,n,r,o,s,a){let{providerExtUri:l}=this.getExtUri(e),c={resource:n,name:l.basename(n),isFile:(r.type&1)!==0,isDirectory:(r.type&2)!==0,isSymbolicLink:(r.type&64)!==0,mtime:r.mtime,ctime:r.ctime,size:r.size,readonly:!!((r.permissions??0)&1)||!!(e.capabilities&2048),locked:!!((r.permissions??0)&2),executable:!!((r.permissions??0)&4),etag:Fl({mtime:r.mtime,size:r.size}),children:void 0};if(c.isDirectory&&a(c,o)){try{let p=await e.readdir(n),u=await wn.settled(p.map(async([f,m])=>{try{let v=l.joinPath(n,f),h=s?await e.stat(v):{type:m};return await this.toFileStat(e,v,h,p.length,s,a)}catch(v){return this.logService.trace(v),null}}));c.children=no(u)}catch(p){this.logService.trace(p),c.children=[]}return c}return c}async resolveAll(e){return wn.settled(e.map(async n=>{try{return{stat:await this.doResolveFile(n.resource,n.options),success:!0}}catch(r){return this.logService.trace(r),{stat:void 0,success:!1}}}))}async stat(e){let n=await this.withProvider(e),r=await n.stat(e);return this.toFileStat(n,e,r,void 0,!0,()=>!1)}async realpath(e){let n=await this.withProvider(e);if(rp(n)){let r=await n.realpath(e);return e.with({path:r})}}async exists(e){let n=await this.withProvider(e);try{return!!await n.stat(e)}catch{return!1}}async canCreateFile(e,n){try{await this.doValidateCreateFile(e,n)}catch(r){return r}return!0}async doValidateCreateFile(e,n){if(!n?.overwrite&&await this.exists(e))throw new Ce(g(2134,null,this.resourceForError(e)),3,n)}async createFile(e,n=_.fromString(""),r){await this.doValidateCreateFile(e,r);let o=await this.writeFile(e,n);return this._onDidRunOperation.fire(new $t(e,0,o)),o}async writeFile(e,n,r){let o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:s}=this.getExtUri(o),a=r;if(Ol(o)&&!a?.atomic){let l=o.enforceAtomicWriteFile?.(e);l&&(a={...r,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(o,e,n,a);l||await this.mkdirp(o,s.dirname(e)),c||(c=await this.peekBufferForWriting(o,n)),!qt(o)||nt(o)&&c instanceof _||nt(o)&&Ol(o)&&a?.atomic?await this.doWriteUnbuffered(o,e,a,c):await this.doWriteBuffered(o,e,a,c instanceof _?gu(c):c),this._onDidRunOperation.fire(new $t(e,4))}catch(l){throw new Ce(g(2133,null,this.resourceForError(e),Kt(l).toString()),Ll(l),a)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,n){let r;if(nt(e)&&!(n instanceof _))if(pi(n)){let o=await cu(n,3);o.ended?r=_.concat(o.buffer):r=o}else r=lu(n,o=>_.concat(o),3);else r=n;return r}async validateWriteFile(e,n,r,o){let s=!!o?.unlock;if(s&&!(e.capabilities&8192))throw new Error(g(2151,null,this.resourceForError(n)));if(o?.append&&!tp(e))throw new Ce(g(2130,null,this.resourceForError(n)),6);if(!!o?.atomic){if(!(e.capabilities&32768))throw new Error(g(2149,null,this.resourceForError(n)));if(!(e.capabilities&2))throw new Error(g(2150,null,this.resourceForError(n)));if(s)throw new Error(g(2148,null,this.resourceForError(n)))}let l;try{l=await e.stat(n)}catch{return Object.create(null)}if((l.type&2)!==0)throw new Ce(g(2136,null,this.resourceForError(n)),0,o);this.throwIfFileIsReadonly(n,l);let c;if(typeof o?.mtime=="number"&&typeof o.etag=="string"&&o.etag!==es&&typeof l.mtime=="number"&&typeof l.size=="number"&&o.mtime{this.writeQueue.queueFor(n,async()=>{try{let l=await this.doReadFile(e,n,r,o);s(l)}catch(l){a(l)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,n,r,o){let s=await this.doReadFileStream(e,n,{...r,preferUnbuffered:!0},o);return{...s,value:await gi(s.value)}}async readFileStream(e,n,r){let o=await this.withReadProvider(e);return this.doReadFileStream(o,e,n,r)}async doReadFileStream(e,n,r,o){let s=new _e(o),a=r;Zo(e)&&e.enforceAtomicReadFile?.(n)&&(a={...r,atomic:!0});let l=this.validateReadFile(n,a).then(p=>p,p=>{throw s.dispose(!0),p}),c;try{return typeof a?.etag=="string"&&a.etag!==es&&await l,a?.atomic&&Zo(e)||!(qt(e)||Xo(e))||nt(e)&&a?.preferUnbuffered?c=this.readFileUnbuffered(e,n,a):Xo(e)?c=this.readFileStreamed(e,n,s.token,a):c=this.readFileBuffered(e,n,s.token,a),c.on("end",()=>s.dispose()),c.on("error",()=>s.dispose()),{...await l,value:c}}catch(p){throw c&&await Ao(c),this.restoreReadError(p,n,a)}}restoreReadError(e,n,r){let o=g(2131,null,this.resourceForError(n),Kt(e).toString());return e instanceof Ir?new Ir(o,e.stat,r):e instanceof yr?new yr(o,e.fileOperationResult,e.size,e.options):new Ce(o,Ll(e),r)}readFileStreamed(e,n,r,o=Object.create(null)){let s=e.readFileStream(n,o,r);return al(s,{data:a=>a instanceof _?a:_.wrap(a),error:a=>this.restoreReadError(a,n,o)},a=>_.concat(a))}readFileBuffered(e,n,r,o=Object.create(null)){let s=hu();return ia(e,n,s,a=>a,{...o,bufferSize:this.BUFFER_SIZE,errorTransformer:a=>this.restoreReadError(a,n,o)},r),s}readFileUnbuffered(e,n,r){let o=Nt(s=>_.concat(s));return(async()=>{try{let s;r?.atomic&&Zo(e)?s=await e.readFile(n,{atomic:!0}):s=await e.readFile(n),typeof r?.position=="number"&&(s=s.slice(r.position)),typeof r?.length=="number"&&(s=s.slice(0,r.length)),this.validateReadFileLimits(n,s.byteLength,r),o.end(_.wrap(s))}catch(s){o.error(s),o.end()}})(),o}async validateReadFile(e,n){let r=await this.resolve(e,{resolveMetadata:!0});if(r.isDirectory)throw new Ce(g(2135,null,this.resourceForError(e)),0,n);if(typeof n?.etag=="string"&&n.etag!==es&&n.etag===r.etag)throw new Ir(g(2139,null),r,n);return this.validateReadFileLimits(e,r.size,n),r}validateReadFileLimits(e,n,r){if(typeof r?.limits?.size=="number"&&n>r.limits.size)throw new yr(g(2140,null,this.resourceForError(e)),7,n,r)}async canMove(e,n,r){return this.doCanMoveCopy(e,n,"move",r)}async canCopy(e,n,r){return this.doCanMoveCopy(e,n,"copy",r)}async doCanMoveCopy(e,n,r,o){if(e.toString()!==n.toString())try{let s=r==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),a=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);await this.doValidateMoveCopy(s,e,a,n,r,o)}catch(s){return s}return!0}async move(e,n,r){let o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(o,e,s,n,"move",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new $t(e,a==="move"?2:3,l)),l}async copy(e,n,r){let o=await this.withReadProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(o,e,s,n,"copy",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new $t(e,a==="copy"?3:2,l)),l}async doMoveCopy(e,n,r,o,s,a){if(n.toString()===o.toString())return s;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(e,n,r,o,s,a);if(l&&!c&&a&&await this.del(o,{recursive:!0}),await this.mkdirp(r,this.getExtUri(r).providerExtUri.dirname(o)),s==="copy"){if(e===r&&Dl(e))await e.copy(n,o,{overwrite:a});else{let p=await this.resolve(n);p.isDirectory?await this.doCopyFolder(e,p,r,o):await this.doCopyFile(e,n,r,o)}return s}else return e===r?(await e.rename(n,o,{overwrite:a}),s):(await this.doMoveCopy(e,n,r,o,"copy",a),await this.del(n,{recursive:!0}),"copy")}async doCopyFile(e,n,r,o){if(qt(e)&&qt(r))return this.doPipeBuffered(e,n,r,o);if(qt(e)&&nt(r))return this.doPipeBufferedToUnbuffered(e,n,r,o);if(nt(e)&&qt(r))return this.doPipeUnbufferedToBuffered(e,n,r,o);if(nt(e)&&nt(r))return this.doPipeUnbuffered(e,n,r,o)}async doCopyFolder(e,n,r,o){await r.mkdir(o),Array.isArray(n.children)&&await wn.settled(n.children.map(async s=>{let a=this.getExtUri(r).providerExtUri.joinPath(o,s.name);return s.isDirectory?this.doCopyFolder(e,await this.resolve(s.resource),r,a):this.doCopyFile(e,s.resource,r,a)}))}async doValidateMoveCopy(e,n,r,o,s,a){let l=!1;if(e===r){let{providerExtUri:p,isPathCaseSensitive:u}=this.getExtUri(e);if(u||(l=p.isEqual(n,o)),l&&s==="copy")throw new Error(g(2144,null,this.resourceForError(n),this.resourceForError(o)));if(!l&&p.isEqualOrParent(o,n))throw new Error(g(2145,null,this.resourceForError(n),this.resourceForError(o)))}let c=await this.exists(o);if(c&&!l){if(!a)throw new Ce(g(2146,null,this.resourceForError(n),this.resourceForError(o)),4);if(e===r){let{providerExtUri:p}=this.getExtUri(e);if(p.isEqualOrParent(n,o))throw new Error(g(2147,null,this.resourceForError(n),this.resourceForError(o)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let n=this.isPathCaseSensitive(e);return{providerExtUri:n?j:el,isPathCaseSensitive:n}}isPathCaseSensitive(e){return!!(e.capabilities&1024)}async createFolder(e){let n=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e);await this.mkdirp(n,e);let r=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new $t(e,0,r)),r}async mkdirp(e,n){let r=[],{providerExtUri:o}=this.getExtUri(e);for(;!o.isEqual(n,o.dirname(n));)try{if(((await e.stat(n)).type&2)===0)throw new Error(g(2142,null,this.resourceForError(n)));break}catch(s){if(xt(s)!=="EntryNotFound")throw s;r.push(o.basename(n)),n=o.dirname(n)}for(let s=r.length-1;s>=0;s--){n=o.joinPath(n,r[s]);try{await e.mkdir(n)}catch(a){if(xt(a)!=="EntryExists")throw a}}}async canDelete(e,n){try{await this.doValidateDelete(e,n)}catch(r){return r}return!0}async doValidateDelete(e,n){let r=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),o=!!n?.useTrash;if(o&&!(r.capabilities&4096))throw new Error(g(2129,null,this.resourceForError(e)));let s=n?.atomic;if(s&&!(r.capabilities&65536))throw new Error(g(2125,null,this.resourceForError(e)));if(o&&s)throw new Error(g(2128,null,this.resourceForError(e)));let a;try{a=await r.stat(e)}catch{}if(a)this.throwIfFileIsReadonly(e,a);else throw new Ce(g(2127,null,this.resourceForError(e)),1);if(!!!n?.recursive){let c=await this.resolve(e);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(g(2126,null,this.resourceForError(e)))}return r}async del(e,n){let r=await this.doValidateDelete(e,n),o=n;if(ip(r)&&!o?.atomic){let c=r.enforceAtomicDelete?.(e);c&&(o={...n,atomic:c})}let s=!!o?.useTrash,a=!!o?.recursive,l=o?.atomic??!1;await r.delete(e,{recursive:a,useTrash:s,atomic:l}),this._onDidRunOperation.fire(new $t(e,1))}async cloneFile(e,n){let r=await this.withProvider(e),o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);if(!(r===o&&this.getExtUri(r).providerExtUri.isEqual(e,n)))return r===o&&np(r)?r.cloneFile(e,n):(await this.mkdirp(o,this.getExtUri(o).providerExtUri.dirname(n)),r===o&&Dl(r)?this.writeQueue.queueFor(e,()=>r.copy(e,n,{overwrite:!0}),this.getExtUri(r).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(r,e,o,n),this.getExtUri(r).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,n){return this.watch(e,{...n,correlationId:mn.WATCHER_CORRELATION_IDS++})}watch(e,n={recursive:!1,excludes:[]}){let r=new N,o=!1,s=()=>{o=!0};r.add(w(()=>s())),(async()=>{try{let l=await this.doWatch(e,n);o?Ke(l):s=()=>Ke(l)}catch(l){this.logService.error(l)}})();let a=n.correlationId;if(typeof a=="number"){let l=r.add(new x);return r.add(this.internalOnDidFilesChange.event(p=>{p.correlates(a)&&l.fire(p)})),{onDidChange:l.event,dispose:()=>r.dispose()}}return r}async doWatch(e,n){let r=await this.withProvider(e),o=Er([this.getExtUri(r).providerExtUri.getComparisonKey(e),n]),s=this.activeWatchers.get(o);return s||(s={count:0,disposable:r.watch(e,n)},this.activeWatchers.set(o,s)),s.count+=1,w(()=>{s&&(s.count--,s.count===0&&(Ke(s.disposable),this.activeWatchers.delete(o)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)Ke(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,n,r,o){return this.writeQueue.queueFor(n,async()=>{let s=await e.open(n,{create:!0,unlock:r?.unlock??!1,append:r?.append??!1});try{pi(o)||Po(o)?await this.doWriteStreamBufferedQueued(e,s,o):await this.doWriteReadableBufferedQueued(e,s,o)}catch(a){throw Kt(a)}finally{await e.close(s)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,n,r){let o=0,s;if(Po(r)){if(r.buffer.length>0){let a=_.concat(r.buffer);await this.doWriteBuffer(e,n,a,a.byteLength,o,0),o+=a.byteLength}if(r.ended)return;s=r.stream}else s=r;return new Promise((a,l)=>{ko(s,{onData:async c=>{s.pause();try{await this.doWriteBuffer(e,n,c,c.byteLength,o,0)}catch(p){return l(p)}o+=c.byteLength,setTimeout(()=>s.resume())},onError:c=>l(c),onEnd:()=>a()})})}async doWriteReadableBufferedQueued(e,n,r){let o=0,s;for(;(s=r.read())!==null;)await this.doWriteBuffer(e,n,s,s.byteLength,o,0),o+=s.byteLength}async doWriteBuffer(e,n,r,o,s,a){let l=0;for(;lthis.doWriteUnbufferedQueued(e,n,r,o),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,n,r,o){let s;o instanceof _?s=o:pi(o)?s=await gi(o):Po(o)?s=await mu(o):s=fu(o),await e.writeFile(n,s.buffer,{create:!0,overwrite:!0,unlock:r?.unlock??!1,atomic:r?.atomic??!1,append:r?.append??!1})}async doPipeBuffered(e,n,r,o){return this.writeQueue.queueFor(o,()=>this.doPipeBufferedQueued(e,n,r,o),this.getExtUri(r).providerExtUri)}async doPipeBufferedQueued(e,n,r,o){let s,a;try{s=await e.open(n,{create:!1}),a=await r.open(o,{create:!0,unlock:!1});let l=_.alloc(this.BUFFER_SIZE),c=0,p=0,u=0;do u=await e.read(s,c,l.buffer,p,l.byteLength-p),await this.doWriteBuffer(r,a,l,u,c,p),c+=u,p+=u,p===l.byteLength&&(p=0);while(u>0)}catch(l){throw Kt(l)}finally{await wn.settled([typeof s=="number"?e.close(s):Promise.resolve(),typeof a=="number"?r.close(a):Promise.resolve()])}}async doPipeUnbuffered(e,n,r,o){return this.writeQueue.queueFor(o,()=>this.doPipeUnbufferedQueued(e,n,r,o),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedQueued(e,n,r,o){return r.writeFile(o,await e.readFile(n),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,n,r,o){return this.writeQueue.queueFor(o,()=>this.doPipeUnbufferedToBufferedQueued(e,n,r,o),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,n,r,o){let s=await r.open(o,{create:!0,unlock:!1});try{let a=await e.readFile(n);await this.doWriteBuffer(r,s,_.wrap(a),a.byteLength,0,0)}catch(a){throw Kt(a)}finally{await r.close(s)}}async doPipeBufferedToUnbuffered(e,n,r,o){let s=await gi(this.readFileBuffered(e,n,Ze.None));await this.doWriteUnbuffered(r,o,void 0,s)}throwIfFileSystemIsReadonly(e,n){if(e.capabilities&2048)throw new Ce(g(2132,null,this.resourceForError(n)),6);return e}throwIfFileIsReadonly(e,n){if((n.permissions??0)&1)throw new Ce(g(2132,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===ee.file?e.fsPath:e.toString(!0)}};mn=O([K(0,ue)],mn);import{constants as Uc,promises as Kn}from"fs";function la(i){return typeof i.correlationId=="number"}function rg(i){return i.recursive===!0}var oa=class i extends L{constructor(e,n,r,o){super();this.onFileChanges=e;this.onLogMessage=n;this.verboseLogging=r;this.options=o;this.watcherDisposables=this._register(new Qt);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new N;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),e.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),e.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(e,n){this.canRestart(e,n)?this.restartCounter({type:t.type,resource:b.revive(t.resource),cId:t.cId}))}function ig(i){let t=new Oc;for(let e of i)t.processEvent(e);return t.coalesce()}function xb(i,t){return typeof t=="string"&&!t.startsWith(_r)&&!Xn(t)?{base:i,pattern:t}:t}function Fc(i,t,e){let n=[];for(let r of t)n.push(ql(xb(i,r),{ignoreCase:e}));return n}var Oc=class{constructor(){this.coalesced=new Set;this.mapPathToChange=new Map}toKey(t){return ve?t.resource.fsPath:t.resource.fsPath.toLowerCase()}processEvent(t){let e=this.mapPathToChange.get(this.toKey(t)),n=!1;if(e){let r=e.type,o=t.type;e.resource.fsPath!==t.resource.fsPath&&(t.type===2||t.type===1)?n=!0:r===1&&o===2?(this.mapPathToChange.delete(this.toKey(t)),this.coalesced.delete(e)):r===2&&o===1?e.type=0:r===1&&o===0||(e.type=o)}else n=!0;n&&(this.coalesced.add(t),this.mapPathToChange.set(this.toKey(t),t))}coalesce(){let t=[],e=[];return Array.from(this.coalesced).filter(n=>n.type!==2?(t.push(n),!1):!0).sort((n,r)=>n.resource.fsPath.length-r.resource.fsPath.length).filter(n=>e.some(r=>op(n.resource.fsPath,r,!ve))?!1:(e.push(n.resource.fsPath),!0)).concat(t)}};function og(i,t){if(typeof t=="number")switch(i.type){case 1:return(t&4)===0;case 2:return(t&8)===0;case 0:return(t&2)===0}return!1}function sg(i){if(typeof i=="number"){let t=[];return i&4&&t.push("Added"),i&8&&t.push("Deleted"),i&2&&t.push("Updated"),t.length===0?"":`[${t.join(", ")}]`}return""}var ca=class extends L{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new x);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new x);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new Rn(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new Rn(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let r=this.toWatchRequest(e,n),o=Ta(this.universalWatchRequests,r);return this.refreshUniversalWatchers(),w(()=>{o(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(rg(r)){let o=this.options?.watcher?.recursive?.usePolling;o===!0?r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(o)&&o.includes(r.path)&&(r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return r}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>fe(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(Lc(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},o=Ta(this.nonRecursiveWatchRequests,r);return this.refreshNonRecursiveWatchers(),w(()=>{o(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>fe(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(Lc(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return ot(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return Vd(n)}};var da=class extends aa{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new Mo(Xe.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:r})=>this.onError(`terminated by itself with code ${n}, signal: ${r} (ETERM)`))),dr.toService(bu(e.getChannel("watcher")))}};import{watchFile as _b,unwatchFile as Eb}from"fs";var ua=class extends L{constructor(){super();this._onDidChangeFile=this._register(new x);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new x);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new x);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new it);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Rn(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Be;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return la(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:Er(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Be;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[r,o]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(r)||n.push(o);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(r=>fe(r))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new N;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let r=this.recursiveWatcher?.subscribe(e.path,(o,s)=>{n.isDisposed||(o?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return r?(n.add(r),!0):!1}doMonitorWithNodeJS(e,n){let r=!1,o=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),c=this.isPathNotFound(a),p=r;r=l,!l&&(c||p)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{_b(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},o)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(w(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{Eb(e.path,o)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:b.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let r=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(r,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${sg(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}};import{watch as Cb,promises as Rb}from"fs";var pa=class i extends L{constructor(e,n,r,o,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=r;this.onDidWatchFail=o;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new rr({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new Co(e=>this.handleFileChanges(e),i.FILE_CHANGES_HANDLER_DELAY));this.cts=new _e;this.realPath=new He(async()=>{let e=this.request.path;try{e=await he.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!ve;this.excludes=Fc(this.request.path,this.request.excludes,l),this.includes=this.request.includes?Fc(this.request.path,this.request.includes,l):void 0,this.filter=la(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await Rb.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new N;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let r=b.file(this.request.path),o=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await cd(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:a.type,cId:this.request.correlationId},!0))});return o?(n.add(o),!0):!1}async doWatchWithNodeJS(e,n){let r=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(Je&&Ot(r,"/Volumes/",!0)){this.error(`Refusing to watch ${r} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let o=new _e(this.cts.token);n.add(w(()=>o.dispose(!0)));let s=new N;n.add(s);try{let a=b.file(this.request.path),l=Te(r),c=Cb(r);s.add(w(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${r}'`);let p=new Set;if(e)try{for(let f of await he.readdir(r))p.add(f)}catch(f){this.error(f)}if(o.token.isCancellationRequested)return;let u=new Map;s.add(w(()=>{for(let[,f]of u)f.dispose();u.clear()})),c.on("error",(f,m)=>{o.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${f}, ${m})`),this.notifyWatchFailed())}),c.on("change",(f,m)=>{if(o.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${f}"] ${m}`);let v="";if(m&&(v=m.toString(),Je&&(v=yi(v))),!(!v||f!=="change"&&f!=="rename"))if(e)if(f==="rename"){u.get(v)?.dispose();let h=setTimeout(async()=>{if(u.delete(v),er(v,l,!ve)&&!await he.exists(r)){this.onWatchedPathDeleted(a);return}if(o.token.isCancellationRequested)return;let I=await this.existsChildStrictCase(q(r,v));if(o.token.isCancellationRequested)return;let y;I?p.has(v)?y=0:(y=1,p.add(v)):(p.delete(v),y=2),this.onFileChange({resource:te(a,v),type:y,cId:this.request.correlationId})},i.FILE_DELETE_HANDLER_DELAY);u.set(v,w(()=>clearTimeout(h)))}else{let h;p.has(v)?h=0:(h=1,p.add(v)),this.onFileChange({resource:te(a,v),type:h,cId:this.request.correlationId})}else if(f==="rename"||!er(v,l,!ve)){let h=setTimeout(async()=>{let I=await he.exists(r);o.token.isCancellationRequested||(I?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},i.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(w(()=>clearTimeout(h)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(o.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=ig(e),r=[];for(let s of n){if(og(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}r.push(s)}if(r.length===0)return;if(this.verboseLogging)for(let s of r)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(r)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${r.length}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(ve)return he.exists(e);try{let n=Te(e);return(await he.readdir(me(e))).some(o=>o===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}};var fa=class extends ua{constructor(e){super();this.recursiveWatcher=e;this.onDidError=Q.None;this._watchers=new Map;this.worker=this._register(new Qt)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],r=new Set(Array.from(this.watchers));for(let o of e){let s=this._watchers.get(this.requestToWatcherKey(o));s&&Kl(s.request.excludes,o.excludes)&&Kl(s.request.includes,o.includes)?r.delete(s):n.push(o)}n.length&&this.trace(`Request to start watching: ${n.map(o=>this.requestToString(o)).join(",")}`),r.size&&this.trace(`Request to stop watching: ${Array.from(r).map(o=>this.requestToString(o.request)).join(",")}`),this.worker.clear();for(let o of r)this.stopWatching(o);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new rr({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return ve?e:e.toLowerCase()}startWatching(e){let n=new pa(e,this.recursiveWatcher,o=>this._onDidChangeFile.fire(o),()=>this._onDidWatchFail.fire(e),o=>this._onDidLogMessage.fire(o),this.verboseLogging),r={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),r)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let r of e){let o=n.get(r.correlationId);o||(o=new Map,n.set(r.correlationId,o));let s=this.pathToWatcherKey(r.path);o.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(r)}`),o.set(s,r)}return Array.from(n.values()).flatMap(r=>Array.from(r.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}};var ga=class extends sa{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new fa(void 0))}};var ma=class i extends ca{constructor(){super(...arguments);this.onDidChangeCapabilities=Q.None;this.resourceLocks=new ut(e=>It.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,ve&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:r}=await Tt.stat(this.toFilePath(e)),o;return(n.mode&128)===0&&(o=2),(n.mode&Uc.S_IXUSR||n.mode&Uc.S_IXGRP||n.mode&Uc.S_IXOTH)&&(o=(o??0)|4),{type:this.toType(n,r),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:o}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return he.realpath(n)}async readdir(e){try{let n=await he.readdir(this.toFilePath(e),{withFileTypes:!0}),r=[];return await Promise.all(n.map(async o=>{try{let s;o.isSymbolicLink()?s=(await this.stat(te(e,o.name))).type:s=this.toType(o),r.push([o.name,s])}catch(s){this.logService.trace(s)}})),r}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let r;return n?.dangling?r=0:e.isFile()?r=1:e.isDirectory()?r=2:r=0,n&&(r|=64),r}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let r;for(;r=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await r.wait();let o=new Eo;return this.resourceLocks.set(e,o),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),w(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===o&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),o.open()})}async readFile(e,n){let r;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),r=await this.createResourceLock(e));let o=this.toFilePath(e);return await Kn.readFile(o)}catch(o){throw this.toFileSystemProviderError(o)}finally{r?.dispose()}}traceLock(e){i.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,r){let o=Nt(s=>_.concat(s.map(a=>_.wrap(a))).buffer);return ia(this,e,o,s=>s.buffer,{...n,bufferSize:256*1024},r),o}async writeFile(e,n,r){return r?.atomic!==!1&&r?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,te(on(e),`${Ee(e)}${r.atomic.postfix}`),n,r):this.doWriteFile(e,n,r)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:r}=await Tt.stat(n);if(r)return!1}catch{}return!0}async doWriteFileAtomic(e,n,r,o){let s=new N;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,r,{...o,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,r,o){let s;try{let a=this.toFilePath(e);if(!r.create||!r.overwrite){if(await he.exists(a)){if(!r.overwrite)throw Y(g(2155,null),"EntryExists")}else if(!r.create)throw Y(g(2158,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:r.append,unlock:r.unlock},o),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){i.canFlush=e}async open(e,n,r){let o=this.toFilePath(e),s;Vt(n)&&!r&&(s=await this.createResourceLock(e));let a;try{if(Vt(n)&&n.unlock)try{let{stat:l}=await Tt.stat(o);l.mode&128||await Kn.chmod(o,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(B&&Vt(n)&&!n.append)try{a=await he.open(o,"r+"),await he.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await he.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await he.open(o,Vt(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),Vt(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),Vt(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${o})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${o})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&i.canFlush)try{await he.fdatasync(e)}catch(r){i.configureFlushOnWrite(!1),this.logService.error(r)}return await he.close(e)}catch(r){throw this.toFileSystemProviderError(r)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,r,o,s){let a=this.normalizePos(e,n),l=null;try{l=(await he.read(e,r,o,s,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,r){let o=this.mapHandleToPos.get(e);typeof o=="number"&&(typeof n=="number"||(typeof r=="number"?this.mapHandleToPos.set(e,o+r):this.mapHandleToPos.delete(e)))}async write(e,n,r,o,s){return su(()=>this.doWrite(e,n,r,o,s),100,3)}async doWrite(e,n,r,o,s){let a=this.normalizePos(e,n),l=null;try{l=(await he.write(e,r,o,s,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),c)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Kn.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let r=this.toFilePath(e);if(n.recursive){let o;n?.atomic!==!1&&n.atomic.postfix&&(o=q(me(r),`${Te(r)}${n.atomic.postfix}`)),await he.rm(r,1,o)}else try{await Kn.unlink(r)}catch(o){if(o.code==="EPERM"||o.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await Tt.stat(r);s=a.isDirectory()&&!l}catch{}if(s)await Kn.rmdir(r);else throw o}else throw o}}catch(r){throw this.toFileSystemProviderError(r)}}async rename(e,n,r){let o=this.toFilePath(e),s=this.toFilePath(n);if(o!==s)try{await this.validateMoveCopy(e,n,"move",r.overwrite),await he.rename(o,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(g(2159,null,Te(o),Te(me(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,r){let o=this.toFilePath(e),s=this.toFilePath(n);if(o!==s)try{await this.validateMoveCopy(e,n,"copy",r.overwrite),await he.copy(o,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(g(2153,null,Te(o),Te(me(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,r,o){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=er(s,a,!0)),l){if(r==="copy")throw Y(g(2154,null),"EntryExists");if(r==="move")return}let p=await this.statIgnoreError(e);if(!p)throw Y(g(2157,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!o)throw Y(g(2156,null),"EntryExists");(p.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,r){let o=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(er(o,s,!a))return;let l=new N;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),r&&await Kn.mkdir(me(s),{recursive:!0}),await Kn.copyFile(o,s)}catch(c){if(c.code==="ENOENT"&&!r)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(e,n,r){return new da(o=>e(o),o=>n(o),r)}createNonRecursiveWatcher(e,n,r){return new ga(o=>e(o),o=>n(o),r)}toFileSystemProviderError(e){if(e instanceof br)return e;let n=e,r;switch(e.code){case"ENOENT":r="EntryNotFound";break;case"EISDIR":r="EntryIsADirectory";break;case"ENOTDIR":r="EntryNotADirectory";break;case"EEXIST":r="EntryExists";break;case"EPERM":case"EACCES":r="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,r="Unknown";break;default:r="Unknown"}return Y(n,r)}async toFileSystemProviderWriteError(e,n){let r=this.toFileSystemProviderError(n);if(e&&r.code==="NoPermissions")try{let{stat:o}=await Tt.stat(this.toFilePath(e));o.mode&128||(r=Y(n,"EntryWriteLocked"))}catch(o){this.logService.trace(o)}return r}};var Gt=class{constructor(t,e=[],n=!1){this.ctor=t,this.staticArguments=e,this.supportsDelayedInstantiation=n}};var Nc=class{constructor(t,e){this.key=t;this.data=e;this.incoming=new Map;this.outgoing=new Map}},Gi=class{constructor(t){this._hashFn=t;this._nodes=new Map}roots(){let t=[];for(let e of this._nodes.values())e.outgoing.size===0&&t.push(e);return t}insertEdge(t,e){let n=this.lookupOrInsertNode(t),r=this.lookupOrInsertNode(e);n.outgoing.set(r.key,r),r.incoming.set(n.key,n)}removeNode(t){let e=this._hashFn(t);this._nodes.delete(e);for(let n of this._nodes.values())n.outgoing.delete(e),n.incoming.delete(e)}lookupOrInsertNode(t){let e=this._hashFn(t),n=this._nodes.get(e);return n||(n=new Nc(e,t),this._nodes.set(e,n)),n}lookup(t){return this._nodes.get(this._hashFn(t))}isEmpty(){return this._nodes.size===0}toString(){let t=[];for(let[e,n]of this._nodes)t.push(`${e} ++`}function tb(i,t){let e=i.findIndex(o=>o.type==="message"&&o.role==="assistant"&&!o.parentToolCallId);if(e===-1)return i;let n=i[e],r={...n,content:t+n.content};return[...i.slice(0,e),r,...i.slice(e+1)]}var Ie=class extends L{constructor(e,n,r,o,s,a){super();this._logService=e;this._instantiationService=n;this._fileService=r;this._sessionDataService=o;this._gitService=s;this._terminalManager=a;this.id="copilot";this._onDidSessionProgress=this._register(new x);this.onDidSessionProgress=this._onDidSessionProgress.event;this._models=Ln(this,[]);this.models=this._models;this._sessions=this._register(new it);this._createdWorktrees=new Map;this._pendingFirstTurnAnnouncements=new Map;this._sessionSequencer=new St;this._activeClients=new ut;this._plugins=this._instantiationService.createInstance(zi)}static{this._BRANCH_COMPLETION_LIMIT=25}_createCopilotClient(e){return new G1(e)}getDescriptor(){return{provider:"copilot",displayName:"Copilot CLI",description:"Copilot SDK agent running in a dedicated process"}}getProtectedResources(){return[{resource:"https://api.github.com",resource_name:"GitHub Copilot",authorization_servers:["https://github.com/login/oauth"],scopes_supported:["read:user","user:email"],required:!0}]}async authenticate(e,n){if(e!=="https://api.github.com")return!1;let r=this._githubToken!==n;return this._githubToken=n,this._logService.info(`[Copilot] Auth token ${r?"updated":"unchanged"}`),r&&this._client&&this._sessions.size===0&&(this._logService.info("[Copilot] Restarting CopilotClient with new token"),await this._stopClient()),r&&this._refreshModels(),!0}async _refreshModels(){let e=this._githubToken;if(!e){this._models.set([],void 0);return}try{let n=await this._listModels();this._githubToken===e&&this._models.set(n,void 0)}catch(n){this._logService.error(n,"[Copilot] Failed to refresh models"),this._githubToken===e&&this._models.set([],void 0)}}async _stopClient(){let e=this._client;this._client=void 0,this._clientStarting=void 0,await e?.stop()}async _ensureClient(){let e=this._githubToken;if(!e)throw new H(ns,"Authentication is required to use Copilot");if(this._client)return this._client;if(this._clientStarting)return this._clientStarting;let n=(async()=>{this._logService.info("[Copilot] Starting CopilotClient... (with token)");let r=Object.assign({},process.env,{ELECTRON_RUN_AS_NODE:"1"});delete r.NODE_OPTIONS,delete r.VSCODE_INSPECTOR_OPTIONS,delete r.VSCODE_ESM_ENTRYPOINT,delete r.VSCODE_HANDLES_UNCAUGHT_ERRORS;for(let u of Object.keys(r))u!=="ELECTRON_RUN_AS_NODE"&&(u.startsWith("VSCODE_")||u.startsWith("ELECTRON_"))&&delete r[u];r.COPILOT_CLI_RUN_AS_NODE="1",r.USE_BUILTIN_RIPGREP="false";let o=b.joinPath(Xe.asFileUri(""),"..","node_modules","@github","copilot","index.js").fsPath,s=J1.replace(/\bnode_modules\.asar\b/,"node_modules.asar.unpacked"),a=me(s),l=Object.keys(r).find(u=>u.toUpperCase()==="PATH")??"PATH",c=r[l];r[l]=c?`${c}${Va}${a}`:a,this._logService.info(`[Copilot] Resolved CLI path: ${o}`);let p=this._createCopilotClient({githubToken:e,useLoggedInUser:!1,useStdio:!0,autoStart:!0,env:r,cliPath:o});if(await p.start(),this._githubToken!==e)throw await p.stop(),new Error("Copilot authentication changed while the client was starting");return this._logService.info("[Copilot] CopilotClient started successfully"),this._client=p,this._clientStarting=void 0,p})();return this._clientStarting=n,n.catch(()=>{this._clientStarting=void 0}),n}_createThinkingLevelConfigSchema(e,n){if(!e?.length)return;let r=e.map(o=>{switch(o){case"low":return g(1836,null);case"medium":return g(1837,null);case"high":return g(1835,null);case"xhigh":return g(1839,null);default:return o}});return{type:"object",properties:{[Bf]:{type:"string",title:g(1838,null),description:g(1834,null),default:n,enum:[...e],enumLabels:r}}}}_getReasoningEffort(e){let n=e?.config?.[Bf];return Y1(n)?n:void 0}_serializeModelSelection(e){return JSON.stringify(e)}_parseModelSelection(e){if(e){try{let n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.id=="string"){let r={id:n.id};if(n.config&&typeof n.config=="object"){let o={};for(let[s,a]of Object.entries(n.config))typeof a=="string"&&(o[s]=a);Object.keys(o).length>0&&(r.config=o)}return r}}catch{}return{id:e}}}async listSessions(){this._logService.info("[Copilot] Listing sessions...");let n=await(await this._ensureClient()).listSessions(),r=new ui(4),o=new Map,a=(await Promise.all(n.map(async l=>{let c=ce.uri(this.id,l.sessionId),p=await this._readStoredSessionMetadata(c);if(!p)return;let{project:u,resolved:f}=p;f||(u=await this._resolveSessionProject(l.context,r,o),this._storeSessionProjectResolution(c,u));let m=p.workingDirectory??(typeof l.context?.cwd=="string"?b.file(l.context.cwd):void 0);return{session:c,startTime:l.startTime.getTime(),modifiedTime:l.modifiedTime.getTime(),project:u,summary:l.summary,model:p.model,workingDirectory:m}}))).filter(l=>l!==void 0);return this._logService.info(`[Copilot] Found ${a.length} sessions`),a}async _listModels(){this._logService.info("[Copilot] Listing models...");let r=(await(await this._ensureClient()).listModels()).map(o=>({provider:this.id,id:o.id,name:o.name,maxContextWindow:o.capabilities.limits.max_context_window_tokens,supportsVision:o.capabilities.supports.vision,configSchema:this._createThinkingLevelConfigSchema(o.supportedReasoningEfforts,o.defaultReasoningEffort),policyState:o.policy?.state}));return this._logService.info(`[Copilot] Found ${r.length} models`),r}async createSession(e){if(!e?.workingDirectory)throw new Error("workingDirectory is required to create a Copilot session");this._logService.info(`[Copilot] Creating session... ${e?.model?`model=${e.model.id}`:""}`);let n=await this._ensureClient();if(e?.fork){let h=ce.id(e.fork.session);return this._sessionSequencer.queue(h,async()=>{this._logService.info(`[Copilot] Forking session ${h} at turnId=${e.fork.turnId}`);let y=await(this._sessions.get(h)??await this._resumeSession(h)).getNextTurnEventId(e.fork.turnId),C=(await n.rpc.sessions.fork({sessionId:h,...y?{toEventId:y}:{}})).sessionId,X=this._sessionDataService.getSessionDataDir(e.fork.session),Fe=this._sessionDataService.getSessionDataDirById(C),rt=b.joinPath(X,Nr),P=b.joinPath(Fe,Nr);try{await ji.mkdir(Fe.fsPath,{recursive:!0}),await ji.copyFile(rt.fsPath,P.fsPath)}catch(ie){this._logService.warn(`[Copilot] Failed to copy session database for fork: ${ie instanceof Error?ie.message:String(ie)}`)}let F=await this._resumeSession(C);e.fork.turnIdMapping&&await F.remapTurnIds(e.fork.turnIdMapping);let A=F.sessionUri;this._logService.info(`[Copilot] Forked session created: ${A.toString()}`);let Z=await Js({cwd:e.workingDirectory?.fsPath},this._gitService);return await this._storeSessionMetadata(A,e.model,e.workingDirectory,Z,!0),{session:A,workingDirectory:e.workingDirectory,...Z?{project:Z}:{}}})}let r=e?.session?ce.id(e.session):ne(),o=ce.uri(this.id,r),s=this._activeClients.get(o),a=s?await s.snapshot():void 0,l=await this._resolveSessionWorkingDirectory(e,r),c=this._instantiationService.createInstance($n,o,l),p=this._buildSessionConfig(a,c),u=async h=>{let I=await n.createSession({model:e?.model?.id,reasoningEffort:this._getReasoningEffort(e?.model),sessionId:r,streaming:!0,workingDirectory:l?.fsPath,...await p(h)});return new qr(I)},f;try{f=this._createAgentSession(u,r,c,a),await f.initializeSession()}catch(h){throw await this._removeCreatedWorktree(r),h}let m=f.sessionUri;this._logService.info(`[Copilot] Session created: ${m.toString()}`);let v=await Js({cwd:l?.fsPath},this._gitService);return await this._storeSessionMetadata(f.sessionUri,e?.model,l,v,!0),{session:m,workingDirectory:l,...v?{project:v}:{}}}async resolveSessionConfig(e){let n=e.workingDirectory?await this._getGitInfo(e.workingDirectory):void 0,r=e.config?.isolation==="folder"||e.config?.isolation==="worktree"?e.config.isolation:n?"worktree":"folder",o=e.config?.autoApprove==="default"||e.config?.autoApprove==="autoApprove"||e.config?.autoApprove==="autopilot"?e.config.autoApprove:"default",s={isolation:r,autoApprove:o};if(n){let l=r==="worktree"?n.defaultBranch:n.currentBranch;s.branch=typeof e.config?.branch=="string"&&r==="worktree"?e.config.branch:l}let a={isolation:{type:"string",title:g(1828,null),description:g(1833,null),enum:n?["folder","worktree"]:["folder"],enumLabels:n?[g(1829,null),g(1831,null)]:[g(1829,null)],enumDescriptions:n?[g(1830,null),g(1832,null)]:[g(1830,null)],default:n?"worktree":"folder",readOnly:!n},autoApprove:{type:"string",title:g(1818,null),description:g(1825,null),enum:["default","autoApprove","autopilot"],enumLabels:[g(1823,null),g(1821,null),g(1819,null)],enumDescriptions:[g(1824,null),g(1822,null),g(1820,null)],default:"default",sessionMutable:!0}};if(n){let l=r==="folder",c=r==="worktree"?n.defaultBranch:n.currentBranch;a.branch={type:"string",title:g(1826,null),description:g(1827,null),enum:[c],enumLabels:[c],default:c,enumDynamic:!l,readOnly:l}}return{schema:{type:"object",properties:a},values:s}}async sessionConfigCompletions(e){return e.property!=="branch"||!e.workingDirectory?{items:[]}:{items:(await this._getBranches(e.workingDirectory,e.query)).map(r=>({value:r,label:r}))}}async setClientCustomizations(e,n,r){return this._plugins.sync(e,n,r)}setClientTools(e,n,r){this._getOrCreateActiveClient(e).updateTools(n,r),this._logService.info(`[Copilot:${ce.id(e)}] Client tools updated: ${r.map(s=>s.name).join(", ")||"(none)"}`)}onClientToolCallComplete(e,n,r){this._sessions.get(ce.id(e))?.handleClientToolCallComplete(n,r)}setCustomizationEnabled(e,n){this._plugins.setEnabled(e,n)}async sendMessage(e,n,r,o){let s=ce.id(e);await this._sessionSequencer.queue(s,async()=>{let a=this._sessions.get(s),l=this._activeClients.get(e);a&&l&&await l.isOutdated(a.appliedSnapshot)&&(this._logService.info(`[Copilot:${s}] Session config changed, refreshing session`),this._sessions.deleteAndDispose(s),a=void 0),a??=await this._resumeSession(s);let c=this._pendingFirstTurnAnnouncements.get(s);if(c){this._pendingFirstTurnAnnouncements.delete(s);let p=`copilot-announcement-${ne()}`,u={type:"delta",session:e,messageId:p,content:c};this._onDidSessionProgress.fire(u)}await a.send(n,r,o)})}setPendingMessages(e,n,r){let o=ce.id(e),s=this._sessions.get(o);if(!s){this._logService.warn(`[Copilot:${o}] setPendingMessages: session not found`);return}n&&s.sendSteering(n)}async getSessionMessages(e){let n=ce.id(e),r=this._sessions.get(n)??await this._resumeSession(n).catch(a=>{this._logService.warn(`[Copilot:${n}] Failed to resume session for message lookup`,a)});if(!r)return[];let o=await r.getMessages(),s=await this._readWorktreeBranchMetadata(e).catch(a=>{this._logService.warn(`[Copilot:${n}] Failed to read worktree branch metadata`,a)});return s?[...tb(o,$f(s))]:o}async disposeSession(e){let n=ce.id(e);await this._sessionSequencer.queue(n,async()=>{await this._destroyAndDisposeSession(n)})}async abortSession(e){let n=ce.id(e);await this._sessionSequencer.queue(n,async()=>{let r=this._sessions.get(n);r&&await r.abort()})}async truncateSession(e,n){let r=ce.id(e);await this._sessionSequencer.queue(r,async()=>{this._logService.info(`[Copilot:${r}] Truncating session${n!==void 0?` at turnId=${n}`:" (all turns)"}`);let o=this._sessions.get(r)??await this._resumeSession(r),s;n?s=await o.getNextTurnEventId(n):s=await o.getFirstTurnEventId(),s?await o.truncateAtEventId(s,n):this._logService.info(`[Copilot:${r}] No event ID found for truncation, nothing to truncate`),this._logService.info(`[Copilot:${r}] Session truncated`)})}async changeModel(e,n){let r=ce.id(e),o=this._sessions.get(r);o&&await o.setModel(n.id,this._getReasoningEffort(n)),await this._storeSessionMetadata(e,n,void 0,void 0)}async shutdown(){return this._shutdownPromise??=(async()=>{this._logService.info("[Copilot] Shutting down...");let e=new Set([...this._sessions.keys(),...this._createdWorktrees.keys()]);for(let n of e)await this._sessionSequencer.queue(n,()=>this._destroyAndDisposeSession(n));await this._client?.stop(),this._client=void 0})(),this._shutdownPromise}respondToPermissionRequest(e,n){for(let[,r]of this._sessions)if(r.respondToPermissionRequest(e,n))return}respondToUserInputRequest(e,n,r){for(let[,o]of this._sessions)if(o.respondToUserInputRequest(e,n,r))return}hasSession(e){return this._sessions.has(ce.id(e))}_getOrCreateActiveClient(e){let n=this._activeClients.get(e);return n||(n=new xc(()=>this._plugins.getAppliedPlugins()),this._activeClients.set(e,n)),n}_createAgentSession(e,n,r,o){let s=ce.uri(this.id,n),a=this._instantiationService.createInstance($r,{sessionUri:s,rawSessionId:n,onDidSessionProgress:this._onDidSessionProgress,wrapperFactory:e,shellManager:r,clientSnapshot:o});return this._sessions.set(n,a),a}async _destroyAndDisposeSession(e){let n=this._sessions.get(e);if(n)try{await n.destroySession()}catch(r){this._logService.warn(`[Copilot:${e}] Failed to destroy session before cleanup: ${r instanceof Error?r.message:String(r)}`)}this._sessions.deleteAndDispose(e),await this._removeCreatedWorktree(e)}_buildSessionConfig(e,n){let r=Wf(n,this._terminalManager,this._logService),o=e?.plugins??[];return async s=>{let a=await Of(o.flatMap(l=>l.agents),this._fileService);return{onPermissionRequest:s.onPermissionRequest,onUserInputRequest:s.onUserInputRequest,hooks:Ff(o.flatMap(l=>l.hooks),s.hooks),mcpServers:Df(o.flatMap(l=>l.mcpServers)),customAgents:a,skillDirectories:Lf(o.flatMap(l=>l.skills)),tools:[...r,...s.clientTools]}}}async _resumeSession(e){this._logService.info(`[Copilot:${e}] Session not in memory, resuming...`);let n=await this._ensureClient(),r=ce.uri(this.id,e),o=this._activeClients.get(r),s=o?await o.snapshot():void 0,a=await this._readSessionMetadata(r),l=await n.getSessionMetadata(e).catch(v=>{this._logService.warn(`[Copilot:${e}] getSessionMetadata failed`,v)}),c=a.workingDirectory??(typeof l?.context?.cwd=="string"?b.file(l.context.cwd):void 0);if(!c)throw new Error(`workingDirectory is required to resume Copilot session '${e}'`);let p=this._instantiationService.createInstance($n,r,c),u=this._buildSessionConfig(s,p),f=async v=>{let h=await u(v);try{let I=await n.resumeSession(e,{...h,workingDirectory:c?.fsPath});return new qr(I)}catch(I){if(!I||I.code!==-32603)throw I;this._logService.warn(`[Copilot:${e}] Resume failed (session not found in SDK), recreating`);let y=await n.createSession({...h,sessionId:e,streaming:!0,model:a.model?.id,reasoningEffort:this._getReasoningEffort(a.model),workingDirectory:c?.fsPath});return new qr(y)}},m=this._createAgentSession(f,e,p,s);return await m.initializeSession(),m}async _getGitInfo(e){if(!await this._gitService.isInsideWorkTree(e))return;let n=await this._gitService.getCurrentBranch(e)??"HEAD",r=await this._gitService.getDefaultBranch(e)??n;return{currentBranch:n,defaultBranch:r}}async _getBranches(e,n){return this._gitService.getBranches(e,{query:n,limit:Ie._BRANCH_COMPLETION_LIMIT})}async _resolveSessionWorkingDirectory(e,n){if(e?.config?.isolation!=="worktree"||!e.workingDirectory||typeof e.config.branch!="string")return e?.workingDirectory;let r=await this._gitService.getRepositoryRoot(e.workingDirectory);if(!r)return e.workingDirectory;let o=X1(r),s=e.config[ku],a=eb(n,s),l=b.joinPath(o,Z1(a));await ji.mkdir(o.fsPath,{recursive:!0}),await this._gitService.addWorktree(r,l,a,e.config.branch),this._createdWorktrees.set(n,{repositoryRoot:r,worktree:l}),this._pendingFirstTurnAnnouncements.set(n,$f(a));let c=ce.uri(this.id,n);try{await this._writeWorktreeBranchMetadata(c,a)}catch(p){this._logService.warn(`[Copilot:${n}] Failed to persist worktree branch metadata: ${p instanceof Error?p.message:String(p)}`)}return l}async _removeCreatedWorktree(e){let n=this._createdWorktrees.get(e);if(n)try{await this._gitService.removeWorktree(n.repositoryRoot,n.worktree)}catch(r){this._logService.warn(`[Copilot:${e}] Failed to remove worktree '${n.worktree.fsPath}': ${r instanceof Error?r.message:String(r)}`)}finally{this._createdWorktrees.delete(e)}}static{this._META_MODEL="copilot.model"}static{this._META_CWD="copilot.workingDirectory"}static{this._META_PROJECT_RESOLVED="copilot.project.resolved"}static{this._META_PROJECT_URI="copilot.project.uri"}static{this._META_PROJECT_DISPLAY_NAME="copilot.project.displayName"}static{this._META_WORKTREE_BRANCH="copilot.worktree.branchName"}async _writeWorktreeBranchMetadata(e,n){let r=this._sessionDataService.openDatabase(e);try{await r.object.setMetadata(Ie._META_WORKTREE_BRANCH,n)}finally{r.dispose()}}async _readWorktreeBranchMetadata(e){let n=await this._sessionDataService.tryOpenDatabase(e);if(n)try{return await n.object.getMetadata(Ie._META_WORKTREE_BRANCH)??void 0}finally{n.dispose()}}async _storeSessionMetadata(e,n,r,o,s=o!==void 0){let a=this._sessionDataService.openDatabase(e),l=a.object;try{let c=[];n&&c.push(l.setMetadata(Ie._META_MODEL,this._serializeModelSelection(n))),r&&c.push(l.setMetadata(Ie._META_CWD,r.toString())),s&&c.push(l.setMetadata(Ie._META_PROJECT_RESOLVED,"true")),o&&(c.push(l.setMetadata(Ie._META_PROJECT_URI,o.uri.toString())),c.push(l.setMetadata(Ie._META_PROJECT_DISPLAY_NAME,o.displayName))),await Promise.all(c)}finally{a.dispose()}}async _readSessionMetadata(e){let n=await this._sessionDataService.tryOpenDatabase(e);if(!n)return{};try{let[r,o]=await Promise.all([n.object.getMetadata(Ie._META_MODEL),n.object.getMetadata(Ie._META_CWD)]);return{model:this._parseModelSelection(r),workingDirectory:o?b.parse(o):void 0}}finally{n.dispose()}}async _readStoredSessionMetadata(e){let n=await this._sessionDataService.tryOpenDatabase(e);if(n)try{let[r,o,s,a,l]=await Promise.all([n.object.getMetadata(Ie._META_MODEL),n.object.getMetadata(Ie._META_CWD),n.object.getMetadata(Ie._META_PROJECT_RESOLVED),n.object.getMetadata(Ie._META_PROJECT_URI),n.object.getMetadata(Ie._META_PROJECT_DISPLAY_NAME)]),c=o?b.parse(o):void 0,p=a&&l?{uri:b.parse(a),displayName:l}:void 0;return{model:this._parseModelSelection(r),workingDirectory:c,project:p,resolved:s==="true"||p!==void 0}}finally{n.dispose()}}async _storeSessionProjectResolution(e,n){await this._storeSessionMetadata(e,void 0,void 0,n,!0)}_resolveSessionProject(e,n,r){let o=this._projectContextKey(e);if(!o)return Promise.resolve(void 0);let s=r.get(o);return s||(s=n.queue(()=>Js(e,this._gitService)),r.set(o,s)),s}_projectContextKey(e){if(e?.cwd)return`cwd:${e.cwd}`;if(e?.gitRoot)return`gitRoot:${e.gitRoot}`;if(e?.repository)return`repository:${e.repository}`}dispose(){this.shutdown().catch(e=>{this._logService.warn("[Copilot] Shutdown failed during dispose",e)}).finally(()=>super.dispose())}};Ie=O([K(0,ue),K(1,pr),K(2,tt),K(3,Ur),K(4,Ws),K(5,kr)],Ie);var zi=class{constructor(t,e,n){this._pluginManager=t;this._logService=e;this._fileService=n;this._enablement=new Map;this._lastSynced=Promise.resolve({synced:[],parsed:[]})}async getAppliedPlugins(){let{parsed:t}=await this._lastSynced;return t}setEnabled(t,e){this._enablement.set(t,e)}sync(t,e,n){let r=this._lastSynced;return(this._lastSynced=r.catch(s=>{this._logService.warn("[Copilot:PluginController] Previous customization sync failed",s)}).then(async()=>{let s=await this._pluginManager.syncCustomizations(t,e,c=>{n?.(c.map(p=>({customization:p})))}),a=[],l=[];for(let c of s)if(c.pluginDir)try{a.push(await xf(c.pluginDir,this._fileService,void 0,this._getUserHome())),l.push(c)}catch(p){this._logService.warn(`[Copilot:PluginController] Error parsing plugin: ${p}`),l.push({customization:{...c.customization,status:"error",statusMessage:`Error parsing plugin: ${p}`}})}else l.push(c);return{synced:l,parsed:a}})).then(s=>s.synced)}_getUserHome(){return process.env.HOME??process.env.USERPROFILE??""}};zi=O([K(0,Ns),K(1,ue),K(2,tt)],zi);var xc=class{constructor(t){this._resolvePlugins=t;this._tools=[];this._clientId=""}updateTools(t,e){this._clientId=t,this._tools=e}async snapshot(){return{clientId:this._clientId,tools:this._tools,plugins:await this._resolvePlugins()}}async isOutdated(t){let e=await this._resolvePlugins();if(!Uf(t.plugins,e)||t.tools.length!==this._tools.length)return!0;let n=new Map(t.tools.map(r=>[r.name,r]));for(let r of this._tools){let o=n.get(r.name);if(!o||o.description!==r.description||!An(o.inputSchema,r.inputSchema))return!0}return!1}};var Qs=class extends Error{constructor(e,n,r){super(n);this.code=e;this.data=r}},Vf=class i extends L{constructor(e,n){super();this._send=e;this._handlers=n;this._nextRequestId=1;this._pendingRequests=new Map}static{this.ParseError=-32700}static{this.MethodNotFound=-32601}static{this.InternalError=-32603}sendNotification(e){this._send({jsonrpc:"2.0",...e})}sendRequest(e,n=Ze.None,r){if(this._store.isDisposed)return Promise.reject(new Ae);let o=this._nextRequestId++,s=new Be,a=new _e;this._pendingRequests.set(o,{promise:s,cts:a});let l=n.onCancellationRequested(()=>{s.isSettled||(this._pendingRequests.delete(o),a.cancel(),r?.(o),s.cancel()),l.dispose()});return this._send({jsonrpc:"2.0",id:o,...e}),s.p.finally(()=>{l.dispose(),this._pendingRequests.delete(o),a.dispose(!0)})}async handleMessage(e){if(Array.isArray(e)){let r=[];for(let o of e){let s=await this._handleMessage(o);s&&r.push(s)}return r}let n=await this._handleMessage(e);return n?[n]:[]}cancelPendingRequest(e){let n=this._pendingRequests.get(e);n&&(this._pendingRequests.delete(e),n.cts.cancel(),n.promise.cancel(),n.cts.dispose(!0))}cancelAllRequests(){for(let[e,n]of this._pendingRequests)this._pendingRequests.delete(e),n.cts.cancel(),n.promise.cancel(),n.cts.dispose(!0)}async _handleMessage(e){if(_c(e)){We(e,{result:!0})?this._handleResult(e):this._handleError(e);return}if(nb(e))return this._handleRequest(e);rb(e)&&this._handlers.handleNotification?.(e)}_handleResult(e){let n=this._pendingRequests.get(e.id);n&&(this._pendingRequests.delete(e.id),n.promise.complete(e.result),n.cts.dispose(!0))}_handleError(e){if(e.id===void 0)return;let n=this._pendingRequests.get(e.id);n&&(this._pendingRequests.delete(e.id),n.promise.error(new Qs(e.error.code,e.error.message,e.error.data)),n.cts.dispose(!0))}async _handleRequest(e){if(!this._handlers.handleRequest){let r={jsonrpc:"2.0",id:e.id,error:{code:i.MethodNotFound,message:`Method not found: ${e.method}`}};return this._send(r),r}let n=new _e;this._register(w(()=>n.dispose(!0)));try{let r=this._handlers.handleRequest(e,n.token),o=ib(r)?await r:r,s={jsonrpc:"2.0",id:e.id,result:o};return this._send(s),s}catch(r){let o;return r instanceof Qs?o={jsonrpc:"2.0",id:e.id,error:{code:r.code,message:r.message,data:r.data}}:o={jsonrpc:"2.0",id:e.id,error:{code:i.InternalError,message:r instanceof Error?r.message:"Internal error"}},this._send(o),o}finally{n.dispose(!0)}}dispose(){this.cancelAllRequests(),super.dispose()}static createParseError(e,n){return{jsonrpc:"2.0",error:{code:i.ParseError,message:e,data:n}}}};function nb(i){return"method"in i&&"id"in i&&(typeof i.id=="string"||typeof i.id=="number")}function _c(i){return We(i,{id:!0,result:!0})||We(i,{id:!0,error:!0})}function rb(i){return We(i,{method:!0})&&!We(i,{id:!0})}function ib(i){return typeof i=="object"&&i!==null&&"then"in i&&typeof i.then=="function"}var ob=1e3;function Ys(i,t){return{jsonrpc:"2.0",id:i,result:t}}function Ec(i,t,e,n){return{jsonrpc:"2.0",id:i,error:{code:t,message:e,...n!==void 0?{data:n}:{}}}}function Xs(i,t){if(t instanceof H)return Ec(i,t.code,t.message,t.data);let e=t instanceof Error?t.stack??t.message:String(t);return Ec(i,Tr,e)}var qn=class extends L{constructor(e,n,r,o,s,a){super();this._agentService=e;this._stateManager=n;this._server=r;this._config=o;this._clientFileSystemProvider=s;this._logService=a;this._clients=new Map;this._replayBuffer=[];this._onDidChangeConnectionCount=this._register(new x);this.onDidChangeConnectionCount=this._onDidChangeConnectionCount.event;this._requestHandlers={subscribe:async(e,n)=>{try{let r=await this._agentService.subscribe(b.parse(n.resource));return e.subscriptions.add(n.resource),{snapshot:r}}catch(r){throw r instanceof H?r:new H(cn,`Resource not found: ${n.resource}`)}},createSession:async(e,n)=>{let r,o;if(n.fork){let s=this._stateManager.getSessionState(n.fork.session);if(!s)throw new H(cn,`Fork source session not found: ${n.fork.session}`);let a=s.turns.findIndex(l=>l.id===n.fork.turnId);if(a<0)throw new H(cn,`Fork turn ID ${n.fork.turnId} not found in session ${n.fork.session}`);o={session:b.parse(n.fork.session),turnIndex:a,turnId:n.fork.turnId}}try{r=await this._agentService.createSession({provider:n.provider,model:n.model,workingDirectory:n.workingDirectory?b.parse(n.workingDirectory):void 0,session:b.parse(n.session),fork:o,config:n.config})}catch(s){throw s instanceof H?s:new H(cp,s instanceof Error?s.message:String(s))}return r.toString()!==b.parse(n.session).toString()&&this._logService.warn(`[ProtocolServer] createSession: provider returned URI ${r.toString()} but client requested ${n.session}`),null},disposeSession:async(e,n)=>(await this._agentService.disposeSession(b.parse(n.session)),null),resourceWrite:async(e,n)=>this._agentService.resourceWrite(n),listSessions:async()=>({items:(await this._agentService.listSessions()).map(r=>({resource:r.session.toString(),provider:ce.provider(r.session)??"copilot",title:r.summary??"Session",status:r.status??1,createdAt:r.startTime,modifiedAt:r.modifiedTime,...r.project?{project:{uri:r.project.uri.toString(),displayName:r.project.displayName}}:{},model:r.model,workingDirectory:r.workingDirectory?.toString(),isRead:r.isRead,isDone:r.isDone}))}),resolveSessionConfig:async(e,n)=>this._agentService.resolveSessionConfig({provider:n.provider,workingDirectory:n.workingDirectory?b.parse(n.workingDirectory):void 0,config:n.config}),sessionConfigCompletions:async(e,n)=>this._agentService.sessionConfigCompletions({provider:n.provider,workingDirectory:n.workingDirectory?b.parse(n.workingDirectory):void 0,config:n.config,property:n.property,query:n.query}),fetchTurns:async(e,n)=>{let r=this._stateManager.getSessionState(n.session);if(!r)throw new H(cn,`Session not found: ${n.session}`);let o=r.turns,s=Math.min(n.limit??50,100),a=o.length;if(n.before){let c=o.findIndex(p=>p.id===n.before);c!==-1&&(a=c)}let l=Math.max(0,a-s);return{turns:o.slice(l,a),hasMore:l>0}},resourceList:async(e,n)=>this._agentService.resourceList(b.parse(n.uri)),resourceRead:async(e,n)=>this._agentService.resourceRead(b.parse(n.uri)),resourceCopy:async(e,n)=>this._agentService.resourceCopy(n),resourceDelete:async(e,n)=>this._agentService.resourceDelete(n),resourceMove:async(e,n)=>this._agentService.resourceMove(n),authenticate:async(e,n)=>{if(!(await this._agentService.authenticate(n)).authenticated)throw new H(ns,"Authentication failed for resource: "+n.resource);return{}},createTerminal:async(e,n)=>(await this._agentService.createTerminal(n),null),disposeTerminal:async(e,n)=>(await this._agentService.disposeTerminal(b.parse(n.terminal)),null)};this._reverseRequestId=0;this._pendingReverseRequests=new Map;this._register(this._server.onConnection(l=>{this._handleNewConnection(l)})),this._register(this._stateManager.onDidEmitEnvelope(l=>{this._replayBuffer.push(l),this._replayBuffer.length>ob&&this._replayBuffer.shift(),this._broadcastAction(l)})),this._register(this._stateManager.onDidEmitNotification(l=>{this._broadcastNotification(l)}))}_handleNewConnection(e){let n=new N,r;n.add(e.onMessage(o=>{if(up(o)){if(this._logService.trace(`[ProtocolServer] request: method=${o.method} id=${o.id}`),!r&&o.method==="initialize"){try{let s=this._handleInitialize(o.params,e,n);r=s.client,e.send(Ys(o.id,s.response))}catch(s){e.send(Xs(o.id,s))}return}if(!r&&o.method==="reconnect"){try{let s=this._handleReconnect(o.params,e,n);r=s.client,e.send(Ys(o.id,s.response))}catch(s){e.send(Xs(o.id,s))}return}if(!r)return;this._handleRequest(r,o.method,o.params,o.id)}else if(pp(o))switch(this._logService.trace(`[ProtocolServer] notification: method=${o.method}`),o.method){case"unsubscribe":r&&r.subscriptions.delete(o.params.resource);break;case"dispatchAction":if(r){this._logService.trace(`[ProtocolServer] dispatchAction: ${JSON.stringify(o.params.action.type)}`);let s=o.params.action;this._agentService.dispatchAction(s,r.clientId,o.params.clientSeq)}break}else if(_c(o)){let s=this._pendingReverseRequests.get(o.id);s&&(this._pendingReverseRequests.delete(o.id),We(o,{error:!0})?s.reject(new Error(o.error?.message??"Reverse RPC error")):s.resolve(o.result))}})),n.add(e.onClose(()=>{r&&this._clients.get(r.clientId)===r&&(this._logService.info(`[ProtocolServer] Client disconnected: ${r.clientId}`),this._clients.delete(r.clientId),this._rejectPendingReverseRequests(r.clientId),this._onDidChangeConnectionCount.fire(this._clients.size)),n.dispose()})),n.add(e)}_handleInitialize(e,n,r){if(this._logService.info(`[ProtocolServer] Initialize: clientId=${e.clientId}, version=${e.protocolVersion}`),e.protocolVersion<1)throw new H(dp,`Client protocol version ${e.protocolVersion} is below minimum ${1}`);let o={clientId:e.clientId,protocolVersion:e.protocolVersion,transport:n,subscriptions:new Set,disposables:r};this._clients.set(e.clientId,o),this._onDidChangeConnectionCount.fire(this._clients.size),r.add(this._clientFileSystemProvider.registerAuthority(e.clientId,{resourceList:a=>this._sendReverseRequest(e.clientId,"resourceList",{uri:a.toString()}),resourceRead:a=>this._sendReverseRequest(e.clientId,"resourceRead",{uri:a.toString()}),resourceWrite:a=>this._sendReverseRequest(e.clientId,"resourceWrite",a),resourceDelete:a=>this._sendReverseRequest(e.clientId,"resourceDelete",a),resourceMove:a=>this._sendReverseRequest(e.clientId,"resourceMove",a)}));let s=[];if(e.initialSubscriptions)for(let a of e.initialSubscriptions){let l=this._stateManager.getSnapshot(a);l&&(s.push(l),o.subscriptions.add(a.toString()))}return{client:o,response:{protocolVersion:1,serverSeq:this._stateManager.serverSeq,snapshots:s,defaultDirectory:this._config.defaultDirectory}}}_handleReconnect(e,n,r){this._logService.info(`[ProtocolServer] Reconnect: clientId=${e.clientId}, lastSeenSeq=${e.lastSeenServerSeq}`);let o={clientId:e.clientId,protocolVersion:1,transport:n,subscriptions:new Set,disposables:r};this._clients.set(e.clientId,o),this._onDidChangeConnectionCount.fire(this._clients.size);let s=this._replayBuffer.length>0?this._replayBuffer[0].serverSeq:this._stateManager.serverSeq;if(e.lastSeenServerSeq>=s){let l=[];for(let c of e.subscriptions)o.subscriptions.add(c.toString());for(let c of this._replayBuffer)c.serverSeq>e.lastSeenServerSeq&&this._isRelevantToClient(o,c)&&l.push(c);return{client:o,response:{type:"replay",actions:l}}}else{let l=[];for(let c of e.subscriptions){let p=this._stateManager.getSnapshot(c);p&&(l.push(p),o.subscriptions.add(c))}return{client:o,response:{type:"snapshot",snapshots:l}}}}_sendReverseRequest(e,n,r){let o=this._clients.get(e);if(!o)return Promise.reject(new Error(`Client ${e} is not connected`));let s=++this._reverseRequestId;return new Promise((a,l)=>{this._pendingReverseRequests.set(s,{clientId:e,resolve:a,reject:l});let c={jsonrpc:"2.0",id:s,method:n,params:r};o.transport.send(c)})}_rejectPendingReverseRequests(e){for(let[n,r]of this._pendingReverseRequests)r.clientId===e&&(this._pendingReverseRequests.delete(n),r.reject(new Error(`Client ${e} disconnected`)))}_handleRequest(e,n,r,o){let s=this._requestHandlers.hasOwnProperty(n)?this._requestHandlers[n]:void 0;if(s){s(e,r).then(l=>{this._logService.trace(`[ProtocolServer] Request '${n}' id=${o} succeeded`),e.transport.send(Ys(o,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Request '${n}' failed`,l),e.transport.send(Xs(o,l))});return}let a=this._handleExtensionRequest(n,r);if(a){a.then(l=>{e.transport.send(Ys(o,l??null))}).catch(l=>{this._logService.error(`[ProtocolServer] Extension request '${n}' failed`,l),e.transport.send(Xs(o,l))});return}e.transport.send(Ec(o,Tr,`Unknown method: ${n}`))}_handleExtensionRequest(e,n){if(e==="shutdown")return this._agentService.shutdown()}_broadcastAction(e){this._logService.trace(`[ProtocolServer] Broadcasting action: ${e.action.type}`);let n={jsonrpc:"2.0",method:"action",params:e};for(let r of this._clients.values())this._isRelevantToClient(r,e)&&r.transport.send(n)}_broadcastNotification(e){let n={jsonrpc:"2.0",method:"notification",params:{notification:e}};for(let r of this._clients.values())r.transport.send(n)}_isRelevantToClient(e,n){let r=n.action;return r.type.startsWith("root/")?e.subscriptions.has(os):Sr(r)?e.subscriptions.has(r.session):ts(r)?e.subscriptions.has(r.terminal):!1}dispose(){for(let e of this._clients.values())e.disposables.dispose();this._clients.clear();for(let[,e]of this._pendingReverseRequests)e.reject(new Error("ProtocolServerHandler disposed"));this._pendingReverseRequests.clear(),this._replayBuffer.length=0,super.dispose()}};qn=O([K(5,ue)],qn);var Cc=class extends L{constructor(e,n){super();this._ws=e;this._WebSocket=n;this._onMessage=this._register(new x);this.onMessage=this._onMessage.event;this._onClose=this._register(new x);this.onClose=this._onClose.event;this._ws.on("message",r=>{try{let o=typeof r=="string"?r:r.toString("utf-8"),s=JSON.parse(o);this._onMessage.fire(s)}catch{this.send({jsonrpc:"2.0",id:null,error:{code:lp,message:"Parse error"}})}}),this._ws.on("close",()=>{this._onClose.fire()}),this._ws.on("error",()=>{this._onClose.fire()})}send(e){this._ws.readyState===this._WebSocket.OPEN&&this._ws.send(JSON.stringify(e))}dispose(){this._ws.close(),super.dispose()}},Hi=class i extends L{constructor(e,n,r,o,s){super();this._logService=n;this._onConnection=this._register(new x);this.onConnection=this._onConnection.event;this._WebSocket=r.WebSocket;let a=typeof e=="number"?{port:e}:e,l=a.host??"127.0.0.1",c=a.connectionTokenValidate?(p,u)=>{let m=s.parse(p.req.url??"",!0).query[Za];if(!a.connectionTokenValidate(m)){this._logService.warn("[WebSocketProtocol] Connection rejected: invalid connection token"),u(!1,403,"Forbidden");return}u(!0)}:void 0;a.socketPath?(this._httpServer=o.createServer(),this._wss=new r.WebSocketServer({server:this._httpServer,verifyClient:c}),this._httpServer.listen(a.socketPath,()=>{this._logService.info(`[WebSocketProtocol] Server listening on socket ${a.socketPath}`)})):(this._wss=new r.WebSocketServer({port:a.port,host:l,verifyClient:c}),this._logService.info(`[WebSocketProtocol] Server listening on ${l}:${a.port}`)),this._wss.on("connection",p=>{this._logService.trace("[WebSocketProtocol] New client connection");let u=new Cc(p,this._WebSocket);this._onConnection.fire(u)}),this._wss.on("error",p=>{this._logService.error("[WebSocketProtocol] Server error",p)})}get address(){let e=this._wss.address();return!e||typeof e=="string"?e??void 0:`${e.address}:${e.port}`}static async create(e,n){let[r,o,s]=await Promise.all([import("ws"),import("http"),import("url")]);return new i(e,n,r,o,s)}dispose(){this._wss.close(),this._httpServer?.close(),super.dispose()}};import{homedir as fb,tmpdir as gb}from"os";var sb=60,ab=sb*60,Rc=ab*24,AA=Rc*7,kA=Rc*30,DA=Rc*365;function zf(i){return i.getFullYear()+"-"+String(i.getMonth()+1).padStart(2,"0")+"-"+String(i.getDate()).padStart(2,"0")+"T"+String(i.getHours()).padStart(2,"0")+":"+String(i.getMinutes()).padStart(2,"0")+":"+String(i.getSeconds()).padStart(2,"0")+"."+(i.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var jf=/^([^.]+\..+)[:=](.+)$/,G=class{constructor(t,e,n){this._args=t;this.paths=e;this.productService=n}get appRoot(){return me(Xe.asFileUri("").fsPath)}get userHome(){return b.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return b.file(q(this.userDataPath,"User"))}get tmpDir(){return b.file(this.paths.tmpDir)}get cacheHome(){return b.file(this.userDataPath)}get stateResource(){return te(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:ee.vscodeUserData})}get userDataSyncHome(){return te(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let t=zf(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=q(this.userDataPath,"logs",t)}return b.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return te(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return te(this.appSettingsHome,"History")}get keyboardLayoutResource(){return te(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let t=be.VSCODE_PORTABLE;return t?b.file(q(t,"argv.json")):te(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return b.file(q(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let t=this.args["builtin-extensions-dir"];return t?xn(t):ot(q(Xe.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let t=this.args["extensions-download-dir"];return t?b.file(xn(t)):b.file(q(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let t=this.args["extensions-dir"];if(t)return xn(t);let e=be.VSCODE_EXTENSIONS;if(e)return e;let n=be.VSCODE_PORTABLE;return n?q(n,"extensions"):te(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let t=this.args["agent-plugins-dir"];if(t)return xn(t);let e=be.VSCODE_AGENT_PLUGINS;if(e)return e;let n=be.VSCODE_PORTABLE;return n?q(n,"agent-plugins"):te(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let t=this.args.extensionDevelopmentPath;if(Array.isArray(t))return t.map(e=>/^[^:/?#]+?:\/\//.test(e)?b.parse(e):b.file(ot(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(t=>t==="ui"||t==="workspace"||t==="web"?t:"workspace")}get extensionTestsLocationURI(){let t=this.args.extensionTestsPath;if(t)return/^[^:/?#]+?:\/\//.test(t)?b.parse(t):b.file(ot(t))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let t=this.args["disable-extension"];if(t){if(typeof t=="string")return[t];if(Array.isArray(t)&&t.length>0)return t}return!1}get skipBuiltinExtensions(){let t=be.VSCODE_SKIP_BUILTIN_EXTENSIONS;return t?t.split(",").map(e=>e.trim()).filter(e=>e):[]}get debugExtensionHost(){return lb(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!be.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(t=>!jf.test(t))}get extensionLogLevel(){let t=[];for(let e of this.args.log||[]){let n=jf.exec(e);n?.[1]&&n[2]&&t.push([n[1],n[2]])}return t.length?t:void 0}get serviceMachineIdResource(){return te(b.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let t=be.VSCODE_PORTABLE;return t?b.file(q(t,"policy.json")):te(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return te(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(t){this.args.continueOn=t}get args(){return this._args}};O([J],G.prototype,"appRoot",1),O([J],G.prototype,"userHome",1),O([J],G.prototype,"userDataPath",1),O([J],G.prototype,"appSettingsHome",1),O([J],G.prototype,"tmpDir",1),O([J],G.prototype,"cacheHome",1),O([J],G.prototype,"stateResource",1),O([J],G.prototype,"userRoamingDataHome",1),O([J],G.prototype,"userDataSyncHome",1),O([J],G.prototype,"sync",1),O([J],G.prototype,"workspaceStorageHome",1),O([J],G.prototype,"localHistoryHome",1),O([J],G.prototype,"keyboardLayoutResource",1),O([J],G.prototype,"argvResource",1),O([J],G.prototype,"isExtensionDevelopment",1),O([J],G.prototype,"untitledWorkspacesHome",1),O([J],G.prototype,"builtinExtensionsPath",1),O([J],G.prototype,"extensionsDownloadLocation",1),O([J],G.prototype,"extensionsPath",1),O([J],G.prototype,"agentPluginsPath",1),O([J],G.prototype,"extensionDevelopmentLocationURI",1),O([J],G.prototype,"extensionDevelopmentKind",1),O([J],G.prototype,"extensionTestsLocationURI",1),O([J],G.prototype,"debugExtensionHost",1),O([J],G.prototype,"logLevel",1),O([J],G.prototype,"extensionLogLevel",1),O([J],G.prototype,"serviceMachineIdResource",1),O([J],G.prototype,"disableTelemetry",1),O([J],G.prototype,"disableExperiments",1),O([J],G.prototype,"disableWorkspaceTrust",1),O([J],G.prototype,"useInMemorySecretStorage",1),O([J],G.prototype,"policyFile",1),O([J],G.prototype,"agentSessionsWorkspace",1);function lb(i,t){return Hf(i["inspect-extensions"],i["inspect-brk-extensions"],5870,t,i.debugId,i.extensionEnvironment)}function Hf(i,t,e,n,r,o){let a=Number(t||i)||(n?null:e),l=a?!!t:!1,c;if(o)try{c=JSON.parse(o)}catch{}return{port:a,break:l,debugId:r,env:c}}import{homedir as Gf}from"os";import{resolve as cb,isAbsolute as db,join as Kr}from"path";var ub=process.env.VSCODE_CWD||process.cwd();function Jf(i,t){let e=pb(i,t),n=[e];return db(e)||n.unshift(ub),cb(...n)}function pb(i,t){process.env.VSCODE_DEV&&(process.isEmbeddedApp?t="agents-oss-dev":t="code-oss-dev");let e=process.env.VSCODE_PORTABLE;if(e)return Kr(e,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Kr(n,t);let r=i["user-data-dir"];if(r)return r;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let o=process.env.USERPROFILE;if(typeof o!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Kr(o,"AppData","Roaming")}break;case"darwin":n=Kr(Gf(),"Library","Application Support");break;case"linux":default:n=process.env.XDG_CONFIG_HOME||Kr(Gf(),".config");break}return Kr(n,t)}var Zs=class extends G{constructor(t,e){super(t,{homeDir:fb(),tmpDir:gb(),userDataDir:Jf(t,e.nameShort)},e)}};import mb from"minimist";var ZA={o:g(1966,null),e:g(1950,null),t:g(1980,null),m:g(1961,null)};var Qf={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:g(1970,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:g(1937,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:g(1932,null)},maximize:{type:"boolean",cat:"o",description:g(1936,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1973,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1964,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",alias:"h",description:g(1952,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(1942,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(1962,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(1931,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(1971,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1963,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1972,null)},agents:{type:"boolean",cat:"o",deprecates:["sessions"],description:g(1934,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(1990,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(1958,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(1987,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(1952,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:g(1939,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(1949,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(1957,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:g(1974,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(1935,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(1956,null)},"pre-release":{type:"boolean",cat:"e",description:g(1955,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(1982,null)},"update-extensions":{type:"boolean",cat:"e",description:g(1985,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(1948,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:g(1933,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(1989,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(1988,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(1960,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(1975,null)},"prof-startup":{type:"boolean",cat:"t",description:g(1968,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(1945,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(1944,null)},sync:{type:"string",cat:"t",description:g(1981,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(1954,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(1953,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(1947,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(1946,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(1943,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(1959,null)},telemetry:{type:"boolean",cat:"t",description:g(1978,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},"share-secrets-with-agents-app":{type:"boolean"},transient:{type:"boolean",cat:"t",description:g(1979,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},hb={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function wc(i,t,e=hb){let n=i.find((f,m)=>f.length>0&&f[0]!=="-"&&t.hasOwnProperty(f)&&t[f].type==="subcommand"),r={},o=["_"],s=[],a={},l;for(let f in t){let m=t[f];m.type==="subcommand"?f===n&&(l=m):(m.alias&&(r[f]=m.alias),m.type==="string"||m.type==="string[]"?(o.push(f),m.deprecates&&o.push(...m.deprecates)):m.type==="boolean"&&(s.push(f),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[f]=m))}if(l&&n){let f=a;for(let I in l.options)f[I]=l.options[I];let m=i.filter(I=>I!==n),v=e.getSubcommandReporter?e.getSubcommandReporter(n):void 0,h=wc(m,f,v);return{[n]:h,_:[]}}let c=mb(i,{string:o,boolean:s,alias:r}),p={},u=c;p._=c._.map(f=>String(f)).filter(f=>f.length>0),delete u._;for(let f in t){let m=t[f];if(m.type==="subcommand")continue;m.alias&&delete u[m.alias];let v=u[f];if(m.deprecates)for(let h of m.deprecates)u.hasOwnProperty(h)&&(v||(v=u[h],v&&e.onDeprecatedOption(h,m.deprecationMessage||g(1941,null,f))),delete u[h]);if(typeof v<"u"){if(m.type==="string[]"){if(Array.isArray(v)||(v=[v]),!m.allowEmptyValue){let h=v.filter(I=>I.length>0);h.length!==v.length&&(e.onEmptyValue(f),v=h.length>0?h:void 0)}}else m.type==="string"&&(Array.isArray(v)?(v=v.pop(),e.onMultipleValues(f,v)):!v&&!m.allowEmptyValue&&(e.onEmptyValue(f),v=void 0));p[f]=v,m.deprecationMessage&&e.onDeprecatedOption(f,m.deprecationMessage)}delete u[f]}for(let f in u)e.onUnknownOption(f);return p}var ea=class extends L{constructor(t,e=[]){super(),this.logger=new vs([t,...e]),this._register(t.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(t){this.logger.setLevel(t)}getLevel(){return this.logger.getLevel()}trace(t,...e){this.logger.trace(t,...e)}debug(t,...e){this.logger.debug(t,...e)}info(t,...e){this.logger.info(t,...e)}warn(t,...e){this.logger.warn(t,...e)}error(t,...e){this.logger.error(t,...e)}flush(){this.logger.flush()}};async function bb(i,t,e,n,r){try{let o=await import("@vscode/spdlog");o.setFlushOn(0);let s=await o.createAsyncRotatingLogger(i,t,e,n);return r?s.clearFormatters():s.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),s}catch(o){console.error(o)}return null}function Yf(i,t,e){switch(t){case 1:i.trace(e);break;case 2:i.debug(e);break;case 3:i.info(e);break;case 4:i.warn(e);break;case 5:i.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${t}`)}}function Xf(i,t){switch(t){case 1:i.setLevel(0);break;case 2:i.setLevel(1);break;case 3:i.setLevel(2);break;case 4:i.setLevel(3);break;case 5:i.setLevel(4);break;case 0:i.setLevel(6);break;default:throw new Error(`Invalid log level ${t}`)}}var ta=class extends Fi{constructor(e,n,r,o,s){super();this.buffer=[];this.setLevel(s),this._loggerCreationPromise=this._createSpdLogLogger(e,n,r,o),this._register(this.onDidChangeLogLevel(a=>{this._logger&&Xf(this._logger,a)}))}async _createSpdLogLogger(e,n,r,o){let s=r?6:1,a=30/s*Yo.MB,l=await bb(e,n,a,s,o);if(l){this._logger=l,Xf(this._logger,this.getLevel());for(let{level:c,message:p}of this.buffer)Yf(this._logger,c,p);this.buffer=[]}}log(e,n){this._logger?Yf(this._logger,e,n):this.getLevel()<=e&&this.buffer.push({level:e,message:n})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}};var na=class extends Ui{doCreateLogger(t,e,n){return new ta(ne(),t.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,e)}};var ra=class{constructor(t,e){this.loggerService=t;this.getUriTransformer=e}listen(t,e){let n=this.getUriTransformer(t);switch(e){case"onDidChangeLoggers":return Q.map(this.loggerService.onDidChangeLoggers,r=>({added:[...r.added].map(o=>this.transformLogger(o,n)),removed:[...r.removed].map(o=>this.transformLogger(o,n))}));case"onDidChangeVisibility":return Q.map(this.loggerService.onDidChangeVisibility,r=>[n.transformOutgoingURI(r[0]),r[1]]);case"onDidChangeLogLevel":return Q.map(this.loggerService.onDidChangeLogLevel,r=>Yl(r)?r:[n.transformOutgoingURI(r[0]),r[1]])}throw new Error(`Event not found: ${e}`)}async call(t,e,n){let r=this.getUriTransformer(t);switch(e){case"setLogLevel":return Yl(n[0])?this.loggerService.setLogLevel(n[0]):this.loggerService.setLogLevel(b.revive(r.transformIncoming(n[0][0])),n[0][1]);case"getRegisteredLoggers":return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(o=>this.transformLogger(o,r)))}throw new Error(`Call not found: ${e}`)}transformLogger(t,e){return{...t,resource:e.transformOutgoingURI(t.resource)}}};var Zf=new class{transformIncoming(i){return i}transformOutgoing(i){return i}transformOutgoingURI(i){return i}transformOutgoingScheme(i){return i}};var Ve,Pc=globalThis.vscode;if(typeof Pc<"u"&&typeof Pc.context<"u"){let i=Pc.context.configuration();if(i)Ve=i.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(Ve=globalThis._VSCODE_PRODUCT_JSON,be.VSCODE_DEV&&Object.assign(Ve,{nameShort:`${Ve.nameShort} Dev`,nameLong:`${Ve.nameLong} Dev`,dataFolderName:`${Ve.dataFolderName}-dev`,serverDataFolderName:Ve.serverDataFolderName?`${Ve.serverDataFolderName}-dev`:void 0}),!Ve.version){let i=globalThis._VSCODE_PACKAGE_JSON;Object.assign(Ve,{version:i.version})}Object.assign(Ve,{extensionsGallery:be.EXTENSIONS_GALLERY?JSON.parse(be.EXTENSIONS_GALLERY):Ve.extensionsGallery||{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item",extensionUrlTemplate:"https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",resourceUrlTemplate:"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",controlUrl:"",recommendationsUrl:""},telemetryEndpoint:be.CS_TELEMETRY_URL||Ve.telemetryEndpoint||"https://v1.telemetry.coder.com/track"})}else Ve={nameShort:"code-server",nameLong:"code-server",applicationName:"code-server",dataFolderName:".code-server",win32MutexName:"codeserver",licenseName:"MIT",licenseUrl:"https://github.com/coder/code-server/blob/main/LICENSE",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"code-server",win32NameVersion:"code-server",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"coder.code-server",win32ShellNameShort:"c&ode-server",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.coder.code.server",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"com.coder.code.server",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/coder/code-server/issues/new",nodejsRepository:"https://nodejs.org",urlProtocol:"code-oss",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.117.0",sha256:"854eeb8a785b1f41ba2bd02d7ccd4fdbe10021b61473293973c7e96d036c7fb8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",completionsRefreshTokenCommand:"github.copilot.signIn",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry"},trustedExtensionAuthAccess:["vscode.git","vscode.github","github.vscode-pull-request-github","github.copilot","github.copilot-chat"],onboardingKeymaps:[{id:"vscode",label:"VS Code",description:"Default keyboard mapping"},{id:"sublime",label:"Sublime Text",extensionId:"ms-vscode.sublime-keybindings",description:"Keyboard mapping from Sublime Text"},{id:"intellij",label:"IntelliJ / JetBrains",extensionId:"k--kato.intellij-idea-keybindings",description:"Keyboard mapping from IntelliJ IDEA"},{id:"vim",label:"Vim",extensionId:"vscodevim.vim",description:"Vim modal editing"},{id:"eclipse",label:"Eclipse",extensionId:"alphabotsec.vscode-eclipse-keybindings",description:"Keyboard mapping from Eclipse"},{id:"notepadpp",label:"Notepad++",extensionId:"ms-vscode.notepadplusplus-keybindings",description:"Keyboard mapping from Notepad++"}],onboardingThemes:[{id:"dark-2026",label:"Dark 2026",themeId:"Dark 2026",type:"dark"},{id:"hc-dark",label:"Dark High Contrast",themeId:"Default High Contrast",type:"hcDark"},{id:"solarized-dark",label:"Solarized Dark",themeId:"Solarized Dark",type:"dark"},{id:"light-2026",label:"Light 2026",themeId:"Light 2026",type:"light"},{id:"hc-light",label:"Light High Contrast",themeId:"Default High Contrast Light",type:"hcLight"},{id:"solarized-light",label:"Solarized Light",themeId:"Solarized Light",type:"light"}],builtInExtensionsEnabledWithAutoUpdates:["GitHub.copilot-chat"],enableTelemetry:!0,quality:"stable",codeServerVersion:"4.117.0",documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",linkProtectionTrustedDomains:["https://open-vsx.org"],aiConfig:{ariaKey:"code-server"},version:"1.117.0",commit:"ddeb0a3de0321412c0633dffa85d35770005ae0f",date:"2026-04-21T16:12:14-07:00"},Object.keys(Ve).length===0&&Object.assign(Ve,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var eg=Ve;function Ac(i){let t=[];typeof i=="number"&&t.push("code/timeOrigin",i);function e(o,s){t.push(o,s?.startTime??Date.now())}function n(){let o=[];for(let s=0;s"u"){let s=t.length>=2&&t[0]==="code/timeOrigin",a=s?t[1]:void 0;t.length=0,s&&t.push("code/timeOrigin",a)}else for(let s=t.length-2;s>=0;s-=2)t[s]===o&&t.splice(s,2)}return{mark:e,getMarks:n,clearMarks:r}}function yb(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?Ac():{mark(i,t){performance.mark(i,t)},clearMarks(i){performance.clearMarks(i)},getMarks(){let i=performance.timeOrigin;typeof i!="number"&&(i=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let t=[{name:"code/timeOrigin",startTime:Math.round(i)}];for(let e of performance.getEntriesByType("mark"))t.push({name:e.name,startTime:Math.round(i+e.startTime)});return t}};if(typeof process=="object"){let i=performance?.timeOrigin;return Ac(i)}else return console.trace("perf-util loaded in UNKNOWN environment"),Ac()}function Ib(i){return i.MonacoPerformanceMarks||(i.MonacoPerformanceMarks=yb()),i.MonacoPerformanceMarks}var kc=Ib(globalThis),tg=kc.mark,W8=kc.clearMarks,B8=kc.getMarks;async function ia(i,t,e,n,r,o){let s;try{await Sb(i,t,e,n,r,o)}catch(a){s=a}finally{s&&r.errorTransformer&&(s=r.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function Sb(i,t,e,n,r,o){Dc(o);let s=await i.open(t,{create:!1});try{Dc(o);let a=0,l=0,c=r&&typeof r.length=="number"?r.length:void 0,p=_.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),u=r&&typeof r.position=="number"?r.position:0,f=0;do l=await i.read(s,u,p.buffer,f,p.byteLength-f),u+=l,f+=l,a+=l,typeof c=="number"&&(c-=l),f===p.byteLength&&(await e.write(n(p)),p=_.alloc(Math.min(r.bufferSize,typeof c=="number"?c:r.bufferSize)),f=0);while(l>0&&(typeof c!="number"||c>0)&&Dc(o)&&Tb(a,r));if(f>0){let m=f;typeof c=="number"&&(m=Math.min(f,c)),e.write(n(p.slice(0,m)))}}catch(a){throw Kt(a)}finally{await i.close(s)}}function Dc(i){if(i.isCancellationRequested)throw eo();return!0}function Tb(i,t){if(typeof t?.limits?.size=="number"&&i>t.limits.size)throw Y(g(2152,null),"EntryTooLarge");return!0}var mn=class extends L{constructor(e){super();this.logService=e;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new x);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new x);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new x);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new x);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new x);this._onDidUncorrelatedFilesChange=this._register(new x);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new x);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new tr)}registerProvider(e,n){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);tg(`code/registerFilesystem/${e}`);let r=new N;return this.provider.set(e,n),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:n}),r.add(n.onDidChangeFile(o=>{let s=new Qo(o,!this.isPathCaseSensitive(n));this.internalOnDidFilesChange.fire(s),s.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(s)})),typeof n.onDidWatchError=="function"&&r.add(n.onDidWatchError(o=>this._onDidWatchError.fire(new Error(o)))),r.add(n.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:n,scheme:e}))),w(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:n}),this.provider.delete(e),Ke(r)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){let n=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(r){n.push(r)}}),!this.provider.has(e)&&await wn.settled(n)}async canHandleResource(e){return await this.activateProvider(e.scheme),this.hasProvider(e)}hasProvider(e){return this.provider.has(e.scheme)}hasCapability(e,n){let r=this.provider.get(e.scheme);return!!(r&&r.capabilities&n)}listCapabilities(){return ei.map(this.provider,([e,n])=>({scheme:e,capabilities:n.capabilities}))}async withProvider(e){if(!eu(e))throw new Ce(g(2141,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let n=this.provider.get(e.scheme);if(!n){let r=new vt;throw r.message=g(2143,null,e.toString()),r}return n}async withReadProvider(e){let n=await this.withProvider(e);if(qt(n)||nt(n)||Xo(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(e){let n=await this.withProvider(e);if(qt(n)||nt(n))return n;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(e,n){try{return await this.doResolveFile(e,n)}catch(r){throw xt(r)==="EntryNotFound"?new Ce(g(2138,null,this.resourceForError(e)),1):Kt(r)}}async doResolveFile(e,n){let r=await this.withProvider(e),o=this.isPathCaseSensitive(r),s=n?.resolveTo,a=n?.resolveSingleChildDescendants,l=n?.resolveMetadata,c=await r.stat(e),p;return this.toFileStat(r,e,c,void 0,!!l,(u,f)=>(p||(p=ln.forUris(()=>!o),p.set(e,!0),s&&p.fill(!0,s)),p.get(u.resource)||p.findSuperstr(u.resource.with({query:null,fragment:null}))?!0:u.isDirectory&&a?f===1:!1))}async toFileStat(e,n,r,o,s,a){let{providerExtUri:l}=this.getExtUri(e),c={resource:n,name:l.basename(n),isFile:(r.type&1)!==0,isDirectory:(r.type&2)!==0,isSymbolicLink:(r.type&64)!==0,mtime:r.mtime,ctime:r.ctime,size:r.size,readonly:!!((r.permissions??0)&1)||!!(e.capabilities&2048),locked:!!((r.permissions??0)&2),executable:!!((r.permissions??0)&4),etag:Fl({mtime:r.mtime,size:r.size}),children:void 0};if(c.isDirectory&&a(c,o)){try{let p=await e.readdir(n),u=await wn.settled(p.map(async([f,m])=>{try{let v=l.joinPath(n,f),h=s?await e.stat(v):{type:m};return await this.toFileStat(e,v,h,p.length,s,a)}catch(v){return this.logService.trace(v),null}}));c.children=no(u)}catch(p){this.logService.trace(p),c.children=[]}return c}return c}async resolveAll(e){return wn.settled(e.map(async n=>{try{return{stat:await this.doResolveFile(n.resource,n.options),success:!0}}catch(r){return this.logService.trace(r),{stat:void 0,success:!1}}}))}async stat(e){let n=await this.withProvider(e),r=await n.stat(e);return this.toFileStat(n,e,r,void 0,!0,()=>!1)}async realpath(e){let n=await this.withProvider(e);if(rp(n)){let r=await n.realpath(e);return e.with({path:r})}}async exists(e){let n=await this.withProvider(e);try{return!!await n.stat(e)}catch{return!1}}async canCreateFile(e,n){try{await this.doValidateCreateFile(e,n)}catch(r){return r}return!0}async doValidateCreateFile(e,n){if(!n?.overwrite&&await this.exists(e))throw new Ce(g(2134,null,this.resourceForError(e)),3,n)}async createFile(e,n=_.fromString(""),r){await this.doValidateCreateFile(e,r);let o=await this.writeFile(e,n);return this._onDidRunOperation.fire(new $t(e,0,o)),o}async writeFile(e,n,r){let o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:s}=this.getExtUri(o),a=r;if(Ol(o)&&!a?.atomic){let l=o.enforceAtomicWriteFile?.(e);l&&(a={...r,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(o,e,n,a);l||await this.mkdirp(o,s.dirname(e)),c||(c=await this.peekBufferForWriting(o,n)),!qt(o)||nt(o)&&c instanceof _||nt(o)&&Ol(o)&&a?.atomic?await this.doWriteUnbuffered(o,e,a,c):await this.doWriteBuffered(o,e,a,c instanceof _?gu(c):c),this._onDidRunOperation.fire(new $t(e,4))}catch(l){throw new Ce(g(2133,null,this.resourceForError(e),Kt(l).toString()),Ll(l),a)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,n){let r;if(nt(e)&&!(n instanceof _))if(pi(n)){let o=await cu(n,3);o.ended?r=_.concat(o.buffer):r=o}else r=lu(n,o=>_.concat(o),3);else r=n;return r}async validateWriteFile(e,n,r,o){let s=!!o?.unlock;if(s&&!(e.capabilities&8192))throw new Error(g(2151,null,this.resourceForError(n)));if(o?.append&&!tp(e))throw new Ce(g(2130,null,this.resourceForError(n)),6);if(!!o?.atomic){if(!(e.capabilities&32768))throw new Error(g(2149,null,this.resourceForError(n)));if(!(e.capabilities&2))throw new Error(g(2150,null,this.resourceForError(n)));if(s)throw new Error(g(2148,null,this.resourceForError(n)))}let l;try{l=await e.stat(n)}catch{return Object.create(null)}if((l.type&2)!==0)throw new Ce(g(2136,null,this.resourceForError(n)),0,o);this.throwIfFileIsReadonly(n,l);let c;if(typeof o?.mtime=="number"&&typeof o.etag=="string"&&o.etag!==es&&typeof l.mtime=="number"&&typeof l.size=="number"&&o.mtime{this.writeQueue.queueFor(n,async()=>{try{let l=await this.doReadFile(e,n,r,o);s(l)}catch(l){a(l)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,n,r,o){let s=await this.doReadFileStream(e,n,{...r,preferUnbuffered:!0},o);return{...s,value:await gi(s.value)}}async readFileStream(e,n,r){let o=await this.withReadProvider(e);return this.doReadFileStream(o,e,n,r)}async doReadFileStream(e,n,r,o){let s=new _e(o),a=r;Zo(e)&&e.enforceAtomicReadFile?.(n)&&(a={...r,atomic:!0});let l=this.validateReadFile(n,a).then(p=>p,p=>{throw s.dispose(!0),p}),c;try{return typeof a?.etag=="string"&&a.etag!==es&&await l,a?.atomic&&Zo(e)||!(qt(e)||Xo(e))||nt(e)&&a?.preferUnbuffered?c=this.readFileUnbuffered(e,n,a):Xo(e)?c=this.readFileStreamed(e,n,s.token,a):c=this.readFileBuffered(e,n,s.token,a),c.on("end",()=>s.dispose()),c.on("error",()=>s.dispose()),{...await l,value:c}}catch(p){throw c&&await Ao(c),this.restoreReadError(p,n,a)}}restoreReadError(e,n,r){let o=g(2131,null,this.resourceForError(n),Kt(e).toString());return e instanceof Ir?new Ir(o,e.stat,r):e instanceof yr?new yr(o,e.fileOperationResult,e.size,e.options):new Ce(o,Ll(e),r)}readFileStreamed(e,n,r,o=Object.create(null)){let s=e.readFileStream(n,o,r);return al(s,{data:a=>a instanceof _?a:_.wrap(a),error:a=>this.restoreReadError(a,n,o)},a=>_.concat(a))}readFileBuffered(e,n,r,o=Object.create(null)){let s=hu();return ia(e,n,s,a=>a,{...o,bufferSize:this.BUFFER_SIZE,errorTransformer:a=>this.restoreReadError(a,n,o)},r),s}readFileUnbuffered(e,n,r){let o=Nt(s=>_.concat(s));return(async()=>{try{let s;r?.atomic&&Zo(e)?s=await e.readFile(n,{atomic:!0}):s=await e.readFile(n),typeof r?.position=="number"&&(s=s.slice(r.position)),typeof r?.length=="number"&&(s=s.slice(0,r.length)),this.validateReadFileLimits(n,s.byteLength,r),o.end(_.wrap(s))}catch(s){o.error(s),o.end()}})(),o}async validateReadFile(e,n){let r=await this.resolve(e,{resolveMetadata:!0});if(r.isDirectory)throw new Ce(g(2135,null,this.resourceForError(e)),0,n);if(typeof n?.etag=="string"&&n.etag!==es&&n.etag===r.etag)throw new Ir(g(2139,null),r,n);return this.validateReadFileLimits(e,r.size,n),r}validateReadFileLimits(e,n,r){if(typeof r?.limits?.size=="number"&&n>r.limits.size)throw new yr(g(2140,null,this.resourceForError(e)),7,n,r)}async canMove(e,n,r){return this.doCanMoveCopy(e,n,"move",r)}async canCopy(e,n,r){return this.doCanMoveCopy(e,n,"copy",r)}async doCanMoveCopy(e,n,r,o){if(e.toString()!==n.toString())try{let s=r==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),a=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);await this.doValidateMoveCopy(s,e,a,n,r,o)}catch(s){return s}return!0}async move(e,n,r){let o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(o,e,s,n,"move",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new $t(e,a==="move"?2:3,l)),l}async copy(e,n,r){let o=await this.withReadProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n),a=await this.doMoveCopy(o,e,s,n,"copy",!!r),l=await this.resolve(n,{resolveMetadata:!0});return this._onDidRunOperation.fire(new $t(e,a==="copy"?3:2,l)),l}async doMoveCopy(e,n,r,o,s,a){if(n.toString()===o.toString())return s;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(e,n,r,o,s,a);if(l&&!c&&a&&await this.del(o,{recursive:!0}),await this.mkdirp(r,this.getExtUri(r).providerExtUri.dirname(o)),s==="copy"){if(e===r&&Dl(e))await e.copy(n,o,{overwrite:a});else{let p=await this.resolve(n);p.isDirectory?await this.doCopyFolder(e,p,r,o):await this.doCopyFile(e,n,r,o)}return s}else return e===r?(await e.rename(n,o,{overwrite:a}),s):(await this.doMoveCopy(e,n,r,o,"copy",a),await this.del(n,{recursive:!0}),"copy")}async doCopyFile(e,n,r,o){if(qt(e)&&qt(r))return this.doPipeBuffered(e,n,r,o);if(qt(e)&&nt(r))return this.doPipeBufferedToUnbuffered(e,n,r,o);if(nt(e)&&qt(r))return this.doPipeUnbufferedToBuffered(e,n,r,o);if(nt(e)&&nt(r))return this.doPipeUnbuffered(e,n,r,o)}async doCopyFolder(e,n,r,o){await r.mkdir(o),Array.isArray(n.children)&&await wn.settled(n.children.map(async s=>{let a=this.getExtUri(r).providerExtUri.joinPath(o,s.name);return s.isDirectory?this.doCopyFolder(e,await this.resolve(s.resource),r,a):this.doCopyFile(e,s.resource,r,a)}))}async doValidateMoveCopy(e,n,r,o,s,a){let l=!1;if(e===r){let{providerExtUri:p,isPathCaseSensitive:u}=this.getExtUri(e);if(u||(l=p.isEqual(n,o)),l&&s==="copy")throw new Error(g(2144,null,this.resourceForError(n),this.resourceForError(o)));if(!l&&p.isEqualOrParent(o,n))throw new Error(g(2145,null,this.resourceForError(n),this.resourceForError(o)))}let c=await this.exists(o);if(c&&!l){if(!a)throw new Ce(g(2146,null,this.resourceForError(n),this.resourceForError(o)),4);if(e===r){let{providerExtUri:p}=this.getExtUri(e);if(p.isEqualOrParent(n,o))throw new Error(g(2147,null,this.resourceForError(n),this.resourceForError(o)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let n=this.isPathCaseSensitive(e);return{providerExtUri:n?j:el,isPathCaseSensitive:n}}isPathCaseSensitive(e){return!!(e.capabilities&1024)}async createFolder(e){let n=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e);await this.mkdirp(n,e);let r=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new $t(e,0,r)),r}async mkdirp(e,n){let r=[],{providerExtUri:o}=this.getExtUri(e);for(;!o.isEqual(n,o.dirname(n));)try{if(((await e.stat(n)).type&2)===0)throw new Error(g(2142,null,this.resourceForError(n)));break}catch(s){if(xt(s)!=="EntryNotFound")throw s;r.push(o.basename(n)),n=o.dirname(n)}for(let s=r.length-1;s>=0;s--){n=o.joinPath(n,r[s]);try{await e.mkdir(n)}catch(a){if(xt(a)!=="EntryExists")throw a}}}async canDelete(e,n){try{await this.doValidateDelete(e,n)}catch(r){return r}return!0}async doValidateDelete(e,n){let r=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),o=!!n?.useTrash;if(o&&!(r.capabilities&4096))throw new Error(g(2129,null,this.resourceForError(e)));let s=n?.atomic;if(s&&!(r.capabilities&65536))throw new Error(g(2125,null,this.resourceForError(e)));if(o&&s)throw new Error(g(2128,null,this.resourceForError(e)));let a;try{a=await r.stat(e)}catch{}if(a)this.throwIfFileIsReadonly(e,a);else throw new Ce(g(2127,null,this.resourceForError(e)),1);if(!!!n?.recursive){let c=await this.resolve(e);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(g(2126,null,this.resourceForError(e)))}return r}async del(e,n){let r=await this.doValidateDelete(e,n),o=n;if(ip(r)&&!o?.atomic){let c=r.enforceAtomicDelete?.(e);c&&(o={...n,atomic:c})}let s=!!o?.useTrash,a=!!o?.recursive,l=o?.atomic??!1;await r.delete(e,{recursive:a,useTrash:s,atomic:l}),this._onDidRunOperation.fire(new $t(e,1))}async cloneFile(e,n){let r=await this.withProvider(e),o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(n),n);if(!(r===o&&this.getExtUri(r).providerExtUri.isEqual(e,n)))return r===o&&np(r)?r.cloneFile(e,n):(await this.mkdirp(o,this.getExtUri(o).providerExtUri.dirname(n)),r===o&&Dl(r)?this.writeQueue.queueFor(e,()=>r.copy(e,n,{overwrite:!0}),this.getExtUri(r).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(r,e,o,n),this.getExtUri(r).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,n){return this.watch(e,{...n,correlationId:mn.WATCHER_CORRELATION_IDS++})}watch(e,n={recursive:!1,excludes:[]}){let r=new N,o=!1,s=()=>{o=!0};r.add(w(()=>s())),(async()=>{try{let l=await this.doWatch(e,n);o?Ke(l):s=()=>Ke(l)}catch(l){this.logService.error(l)}})();let a=n.correlationId;if(typeof a=="number"){let l=r.add(new x);return r.add(this.internalOnDidFilesChange.event(p=>{p.correlates(a)&&l.fire(p)})),{onDidChange:l.event,dispose:()=>r.dispose()}}return r}async doWatch(e,n){let r=await this.withProvider(e),o=Er([this.getExtUri(r).providerExtUri.getComparisonKey(e),n]),s=this.activeWatchers.get(o);return s||(s={count:0,disposable:r.watch(e,n)},this.activeWatchers.set(o,s)),s.count+=1,w(()=>{s&&(s.count--,s.count===0&&(Ke(s.disposable),this.activeWatchers.delete(o)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)Ke(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,n,r,o){return this.writeQueue.queueFor(n,async()=>{let s=await e.open(n,{create:!0,unlock:r?.unlock??!1,append:r?.append??!1});try{pi(o)||Po(o)?await this.doWriteStreamBufferedQueued(e,s,o):await this.doWriteReadableBufferedQueued(e,s,o)}catch(a){throw Kt(a)}finally{await e.close(s)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,n,r){let o=0,s;if(Po(r)){if(r.buffer.length>0){let a=_.concat(r.buffer);await this.doWriteBuffer(e,n,a,a.byteLength,o,0),o+=a.byteLength}if(r.ended)return;s=r.stream}else s=r;return new Promise((a,l)=>{ko(s,{onData:async c=>{s.pause();try{await this.doWriteBuffer(e,n,c,c.byteLength,o,0)}catch(p){return l(p)}o+=c.byteLength,setTimeout(()=>s.resume())},onError:c=>l(c),onEnd:()=>a()})})}async doWriteReadableBufferedQueued(e,n,r){let o=0,s;for(;(s=r.read())!==null;)await this.doWriteBuffer(e,n,s,s.byteLength,o,0),o+=s.byteLength}async doWriteBuffer(e,n,r,o,s,a){let l=0;for(;lthis.doWriteUnbufferedQueued(e,n,r,o),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,n,r,o){let s;o instanceof _?s=o:pi(o)?s=await gi(o):Po(o)?s=await mu(o):s=fu(o),await e.writeFile(n,s.buffer,{create:!0,overwrite:!0,unlock:r?.unlock??!1,atomic:r?.atomic??!1,append:r?.append??!1})}async doPipeBuffered(e,n,r,o){return this.writeQueue.queueFor(o,()=>this.doPipeBufferedQueued(e,n,r,o),this.getExtUri(r).providerExtUri)}async doPipeBufferedQueued(e,n,r,o){let s,a;try{s=await e.open(n,{create:!1}),a=await r.open(o,{create:!0,unlock:!1});let l=_.alloc(this.BUFFER_SIZE),c=0,p=0,u=0;do u=await e.read(s,c,l.buffer,p,l.byteLength-p),await this.doWriteBuffer(r,a,l,u,c,p),c+=u,p+=u,p===l.byteLength&&(p=0);while(u>0)}catch(l){throw Kt(l)}finally{await wn.settled([typeof s=="number"?e.close(s):Promise.resolve(),typeof a=="number"?r.close(a):Promise.resolve()])}}async doPipeUnbuffered(e,n,r,o){return this.writeQueue.queueFor(o,()=>this.doPipeUnbufferedQueued(e,n,r,o),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedQueued(e,n,r,o){return r.writeFile(o,await e.readFile(n),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,n,r,o){return this.writeQueue.queueFor(o,()=>this.doPipeUnbufferedToBufferedQueued(e,n,r,o),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,n,r,o){let s=await r.open(o,{create:!0,unlock:!1});try{let a=await e.readFile(n);await this.doWriteBuffer(r,s,_.wrap(a),a.byteLength,0,0)}catch(a){throw Kt(a)}finally{await r.close(s)}}async doPipeBufferedToUnbuffered(e,n,r,o){let s=await gi(this.readFileBuffered(e,n,Ze.None));await this.doWriteUnbuffered(r,o,void 0,s)}throwIfFileSystemIsReadonly(e,n){if(e.capabilities&2048)throw new Ce(g(2132,null,this.resourceForError(n)),6);return e}throwIfFileIsReadonly(e,n){if((n.permissions??0)&1)throw new Ce(g(2132,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===ee.file?e.fsPath:e.toString(!0)}};mn=O([K(0,ue)],mn);import{constants as Uc,promises as Kn}from"fs";function la(i){return typeof i.correlationId=="number"}function rg(i){return i.recursive===!0}var oa=class i extends L{constructor(e,n,r,o){super();this.onFileChanges=e;this.onLogMessage=n;this.verboseLogging=r;this.options=o;this.watcherDisposables=this._register(new Qt);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new N;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),e.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),e.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(e,n){this.canRestart(e,n)?this.restartCounter({type:t.type,resource:b.revive(t.resource),cId:t.cId}))}function ig(i){let t=new Oc;for(let e of i)t.processEvent(e);return t.coalesce()}function xb(i,t){return typeof t=="string"&&!t.startsWith(_r)&&!Xn(t)?{base:i,pattern:t}:t}function Fc(i,t,e){let n=[];for(let r of t)n.push(ql(xb(i,r),{ignoreCase:e}));return n}var Oc=class{constructor(){this.coalesced=new Set;this.mapPathToChange=new Map}toKey(t){return ve?t.resource.fsPath:t.resource.fsPath.toLowerCase()}processEvent(t){let e=this.mapPathToChange.get(this.toKey(t)),n=!1;if(e){let r=e.type,o=t.type;e.resource.fsPath!==t.resource.fsPath&&(t.type===2||t.type===1)?n=!0:r===1&&o===2?(this.mapPathToChange.delete(this.toKey(t)),this.coalesced.delete(e)):r===2&&o===1?e.type=0:r===1&&o===0||(e.type=o)}else n=!0;n&&(this.coalesced.add(t),this.mapPathToChange.set(this.toKey(t),t))}coalesce(){let t=[],e=[];return Array.from(this.coalesced).filter(n=>n.type!==2?(t.push(n),!1):!0).sort((n,r)=>n.resource.fsPath.length-r.resource.fsPath.length).filter(n=>e.some(r=>op(n.resource.fsPath,r,!ve))?!1:(e.push(n.resource.fsPath),!0)).concat(t)}};function og(i,t){if(typeof t=="number")switch(i.type){case 1:return(t&4)===0;case 2:return(t&8)===0;case 0:return(t&2)===0}return!1}function sg(i){if(typeof i=="number"){let t=[];return i&4&&t.push("Added"),i&8&&t.push("Deleted"),i&2&&t.push("Updated"),t.length===0?"":`[${t.join(", ")}]`}return""}var ca=class extends L{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new x);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new x);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new Rn(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new Rn(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let r=this.toWatchRequest(e,n),o=Ta(this.universalWatchRequests,r);return this.refreshUniversalWatchers(),w(()=>{o(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(rg(r)){let o=this.options?.watcher?.recursive?.usePolling;o===!0?r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(o)&&o.includes(r.path)&&(r.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return r}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>fe(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(Lc(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let r={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},o=Ta(this.nonRecursiveWatchRequests,r);return this.refreshNonRecursiveWatchers(),w(()=>{o(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>fe(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(Lc(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return ot(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return Vd(n)}};var da=class extends aa{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new Mo(Xe.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:r})=>this.onError(`terminated by itself with code ${n}, signal: ${r} (ETERM)`))),dr.toService(bu(e.getChannel("watcher")))}};import{watchFile as _b,unwatchFile as Eb}from"fs";var ua=class extends L{constructor(){super();this._onDidChangeFile=this._register(new x);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new x);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new x);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new it);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Rn(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Be;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return la(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:Er(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Be;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[r,o]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(r)||n.push(o);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(r=>fe(r))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new N;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let r=this.recursiveWatcher?.subscribe(e.path,(o,s)=>{n.isDisposed||(o?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return r?(n.add(r),!0):!1}doMonitorWithNodeJS(e,n){let r=!1,o=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),c=this.isPathNotFound(a),p=r;r=l,!l&&(c||p)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{_b(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},o)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(w(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{Eb(e.path,o)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:b.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let r=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(r,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${sg(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}};import{watch as Cb,promises as Rb}from"fs";var pa=class i extends L{constructor(e,n,r,o,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=r;this.onDidWatchFail=o;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new rr({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new Co(e=>this.handleFileChanges(e),i.FILE_CHANGES_HANDLER_DELAY));this.cts=new _e;this.realPath=new He(async()=>{let e=this.request.path;try{e=await he.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!ve;this.excludes=Fc(this.request.path,this.request.excludes,l),this.includes=this.request.includes?Fc(this.request.path,this.request.includes,l):void 0,this.filter=la(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await Rb.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new N;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let r=b.file(this.request.path),o=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await cd(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:a.type,cId:this.request.correlationId},!0))});return o?(n.add(o),!0):!1}async doWatchWithNodeJS(e,n){let r=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(Je&&Ot(r,"/Volumes/",!0)){this.error(`Refusing to watch ${r} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let o=new _e(this.cts.token);n.add(w(()=>o.dispose(!0)));let s=new N;n.add(s);try{let a=b.file(this.request.path),l=Te(r),c=Cb(r);s.add(w(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${r}'`);let p=new Set;if(e)try{for(let f of await he.readdir(r))p.add(f)}catch(f){this.error(f)}if(o.token.isCancellationRequested)return;let u=new Map;s.add(w(()=>{for(let[,f]of u)f.dispose();u.clear()})),c.on("error",(f,m)=>{o.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${f}, ${m})`),this.notifyWatchFailed())}),c.on("change",(f,m)=>{if(o.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${f}"] ${m}`);let v="";if(m&&(v=m.toString(),Je&&(v=yi(v))),!(!v||f!=="change"&&f!=="rename"))if(e)if(f==="rename"){u.get(v)?.dispose();let h=setTimeout(async()=>{if(u.delete(v),er(v,l,!ve)&&!await he.exists(r)){this.onWatchedPathDeleted(a);return}if(o.token.isCancellationRequested)return;let I=await this.existsChildStrictCase(q(r,v));if(o.token.isCancellationRequested)return;let y;I?p.has(v)?y=0:(y=1,p.add(v)):(p.delete(v),y=2),this.onFileChange({resource:te(a,v),type:y,cId:this.request.correlationId})},i.FILE_DELETE_HANDLER_DELAY);u.set(v,w(()=>clearTimeout(h)))}else{let h;p.has(v)?h=0:(h=1,p.add(v)),this.onFileChange({resource:te(a,v),type:h,cId:this.request.correlationId})}else if(f==="rename"||!er(v,l,!ve)){let h=setTimeout(async()=>{let I=await he.exists(r);o.token.isCancellationRequested||(I?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},i.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(w(()=>clearTimeout(h)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(o.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=ig(e),r=[];for(let s of n){if(og(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}r.push(s)}if(r.length===0)return;if(this.verboseLogging)for(let s of r)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(r)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${r.length}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(ve)return he.exists(e);try{let n=Te(e);return(await he.readdir(me(e))).some(o=>o===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}};var fa=class extends ua{constructor(e){super();this.recursiveWatcher=e;this.onDidError=Q.None;this._watchers=new Map;this.worker=this._register(new Qt)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],r=new Set(Array.from(this.watchers));for(let o of e){let s=this._watchers.get(this.requestToWatcherKey(o));s&&Kl(s.request.excludes,o.excludes)&&Kl(s.request.includes,o.includes)?r.delete(s):n.push(o)}n.length&&this.trace(`Request to start watching: ${n.map(o=>this.requestToString(o)).join(",")}`),r.size&&this.trace(`Request to stop watching: ${Array.from(r).map(o=>this.requestToString(o.request)).join(",")}`),this.worker.clear();for(let o of r)this.stopWatching(o);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new rr({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return ve?e:e.toLowerCase()}startWatching(e){let n=new pa(e,this.recursiveWatcher,o=>this._onDidChangeFile.fire(o),()=>this._onDidWatchFail.fire(e),o=>this._onDidLogMessage.fire(o),this.verboseLogging),r={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),r)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let r of e){let o=n.get(r.correlationId);o||(o=new Map,n.set(r.correlationId,o));let s=this.pathToWatcherKey(r.path);o.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(r)}`),o.set(s,r)}return Array.from(n.values()).flatMap(r=>Array.from(r.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}};var ga=class extends sa{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new fa(void 0))}};var ma=class i extends ca{constructor(){super(...arguments);this.onDidChangeCapabilities=Q.None;this.resourceLocks=new ut(e=>It.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,ve&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:r}=await Tt.stat(this.toFilePath(e)),o;return(n.mode&128)===0&&(o=2),(n.mode&Uc.S_IXUSR||n.mode&Uc.S_IXGRP||n.mode&Uc.S_IXOTH)&&(o=(o??0)|4),{type:this.toType(n,r),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:o}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return he.realpath(n)}async readdir(e){try{let n=await he.readdir(this.toFilePath(e),{withFileTypes:!0}),r=[];return await Promise.all(n.map(async o=>{try{let s;o.isSymbolicLink()?s=(await this.stat(te(e,o.name))).type:s=this.toType(o),r.push([o.name,s])}catch(s){this.logService.trace(s)}})),r}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let r;return n?.dangling?r=0:e.isFile()?r=1:e.isDirectory()?r=2:r=0,n&&(r|=64),r}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let r;for(;r=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await r.wait();let o=new Eo;return this.resourceLocks.set(e,o),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),w(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===o&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),o.open()})}async readFile(e,n){let r;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),r=await this.createResourceLock(e));let o=this.toFilePath(e);return await Kn.readFile(o)}catch(o){throw this.toFileSystemProviderError(o)}finally{r?.dispose()}}traceLock(e){i.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,r){let o=Nt(s=>_.concat(s.map(a=>_.wrap(a))).buffer);return ia(this,e,o,s=>s.buffer,{...n,bufferSize:256*1024},r),o}async writeFile(e,n,r){return r?.atomic!==!1&&r?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,te(on(e),`${Ee(e)}${r.atomic.postfix}`),n,r):this.doWriteFile(e,n,r)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:r}=await Tt.stat(n);if(r)return!1}catch{}return!0}async doWriteFileAtomic(e,n,r,o){let s=new N;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,r,{...o,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,r,o){let s;try{let a=this.toFilePath(e);if(!r.create||!r.overwrite){if(await he.exists(a)){if(!r.overwrite)throw Y(g(2155,null),"EntryExists")}else if(!r.create)throw Y(g(2158,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:r.append,unlock:r.unlock},o),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){i.canFlush=e}async open(e,n,r){let o=this.toFilePath(e),s;Vt(n)&&!r&&(s=await this.createResourceLock(e));let a;try{if(Vt(n)&&n.unlock)try{let{stat:l}=await Tt.stat(o);l.mode&128||await Kn.chmod(o,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(B&&Vt(n)&&!n.append)try{a=await he.open(o,"r+"),await he.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await he.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await he.open(o,Vt(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),Vt(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),Vt(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${o})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${o})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&i.canFlush)try{await he.fdatasync(e)}catch(r){i.configureFlushOnWrite(!1),this.logService.error(r)}return await he.close(e)}catch(r){throw this.toFileSystemProviderError(r)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,r,o,s){let a=this.normalizePos(e,n),l=null;try{l=(await he.read(e,r,o,s,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,r){let o=this.mapHandleToPos.get(e);typeof o=="number"&&(typeof n=="number"||(typeof r=="number"?this.mapHandleToPos.set(e,o+r):this.mapHandleToPos.delete(e)))}async write(e,n,r,o,s){return su(()=>this.doWrite(e,n,r,o,s),100,3)}async doWrite(e,n,r,o,s){let a=this.normalizePos(e,n),l=null;try{l=(await he.write(e,r,o,s,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),c)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Kn.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let r=this.toFilePath(e);if(n.recursive){let o;n?.atomic!==!1&&n.atomic.postfix&&(o=q(me(r),`${Te(r)}${n.atomic.postfix}`)),await he.rm(r,1,o)}else try{await Kn.unlink(r)}catch(o){if(o.code==="EPERM"||o.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await Tt.stat(r);s=a.isDirectory()&&!l}catch{}if(s)await Kn.rmdir(r);else throw o}else throw o}}catch(r){throw this.toFileSystemProviderError(r)}}async rename(e,n,r){let o=this.toFilePath(e),s=this.toFilePath(n);if(o!==s)try{await this.validateMoveCopy(e,n,"move",r.overwrite),await he.rename(o,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(g(2159,null,Te(o),Te(me(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,r){let o=this.toFilePath(e),s=this.toFilePath(n);if(o!==s)try{await this.validateMoveCopy(e,n,"copy",r.overwrite),await he.copy(o,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(g(2153,null,Te(o),Te(me(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,r,o){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=er(s,a,!0)),l){if(r==="copy")throw Y(g(2154,null),"EntryExists");if(r==="move")return}let p=await this.statIgnoreError(e);if(!p)throw Y(g(2157,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!o)throw Y(g(2156,null),"EntryExists");(p.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,r){let o=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(er(o,s,!a))return;let l=new N;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),r&&await Kn.mkdir(me(s),{recursive:!0}),await Kn.copyFile(o,s)}catch(c){if(c.code==="ENOENT"&&!r)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(e,n,r){return new da(o=>e(o),o=>n(o),r)}createNonRecursiveWatcher(e,n,r){return new ga(o=>e(o),o=>n(o),r)}toFileSystemProviderError(e){if(e instanceof br)return e;let n=e,r;switch(e.code){case"ENOENT":r="EntryNotFound";break;case"EISDIR":r="EntryIsADirectory";break;case"ENOTDIR":r="EntryNotADirectory";break;case"EEXIST":r="EntryExists";break;case"EPERM":case"EACCES":r="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,r="Unknown";break;default:r="Unknown"}return Y(n,r)}async toFileSystemProviderWriteError(e,n){let r=this.toFileSystemProviderError(n);if(e&&r.code==="NoPermissions")try{let{stat:o}=await Tt.stat(this.toFilePath(e));o.mode&128||(r=Y(n,"EntryWriteLocked"))}catch(o){this.logService.trace(o)}return r}};var Gt=class{constructor(t,e=[],n=!1){this.ctor=t,this.staticArguments=e,this.supportsDelayedInstantiation=n}};var Nc=class{constructor(t,e){this.key=t;this.data=e;this.incoming=new Map;this.outgoing=new Map}},Gi=class{constructor(t){this._hashFn=t;this._nodes=new Map}roots(){let t=[];for(let e of this._nodes.values())e.outgoing.size===0&&t.push(e);return t}insertEdge(t,e){let n=this.lookupOrInsertNode(t),r=this.lookupOrInsertNode(e);n.outgoing.set(r.key,r),r.incoming.set(n.key,n)}removeNode(t){let e=this._hashFn(t);this._nodes.delete(e);for(let n of this._nodes.values())n.outgoing.delete(e),n.incoming.delete(e)}lookupOrInsertNode(t){let e=this._hashFn(t),n=this._nodes.get(e);return n||(n=new Nc(e,t),this._nodes.set(e,n)),n}lookup(t){return this._nodes.get(this._hashFn(t))}isEmpty(){return this._nodes.size===0}toString(){let t=[];for(let[e,n]of this._nodes)t.push(`${e} (-> incoming)[${[...n.incoming.keys()].join(", ")}] (outgoing ->)[${[...n.outgoing.keys()].join(",")}] - `);return e.join(` + `);return t.join(` diff --git a/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js b/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js -index d3f04169921158e7b438036ff4856f3ebad5a4ce..bae3810d7000130c5a2db0dfd546d5a465a36869 100644 +index 6c69f9e5fb26a30a16eeafa45e0bb8275fd8c589..b460b7809be5b87db9dd9791b8ed26efd29ab244 100644 --- a/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js +++ b/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js @@ -401,7 +401,7 @@ ${p.join(` `).slice(2).join(` - `))}},Ai=class extends Error{constructor(e,t,n){super(`potential listener LEAK detected, ${e}`),this.name="ListenerLeakError",this.details=t,this.stack=n}},Oi=class extends Error{constructor(e,t,n){super(`potential listener LEAK detected, ${e} (REFUSED to add)`),this.name="ListenerRefusalError",this.details=t,this.stack=n}},pu=0,Ft=class{constructor(e){this.value=e;this.id=pu++}},mu=2,fu=(r,e)=>{if(r instanceof Ft)e(r);else for(let t=0;t0||this._options?.leakWarningThreshold?new Di(e?.onListenerError??De,this._options?.leakWarningThreshold??Os):void 0,this._perfMon=this._options?._profName?new Li(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ls){let e=this._listeners;queueMicrotask(()=>{fu(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=u[1]/this._size>.3?"dominated":"popular",c=new Oi(p,`${l}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||De)(c),C.None}if(this._disposed)return C.None;t&&(e=e.bind(t));let i=new Ft(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Nt.create(),o=this._leakageMon.check(i.stack,this._size+1)),Ls&&(i.stack=s??Nt.create()),this._listeners?this._listeners instanceof Ft?(this._deliveryQueue??=new Mi,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;let a=Y(()=>{o?.(),this._removeListener(i)});return Ui(a,n),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*mu<=t.length){let o=0;for(let s=0;s0}};var Mi=class{constructor(){this.i=-1;this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var cr=class{constructor(){this.hasListeners=!1;this.events=[];this.emitter=new y({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){let t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),Y(on(()=>{this.hasListeners&&this.unhook(t);let i=this.events.indexOf(t);this.events.splice(i,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(let e of this.events)e.listener?.dispose();this.events=[]}};var dr=class{constructor(){this.listening=!1;this.inputEvent=w.None;this.inputEventListener=C.None;this.emitter=new y({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}});this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}};function Ui(r,e){e instanceof he?e.add(r):Array.isArray(e)&&e.push(r)}function Ms(r,e){if(e instanceof he)e.delete(r);else if(Array.isArray(e)){let t=e.indexOf(r);t!==-1&&e.splice(t,1)}r.dispose()}var Us=Object.freeze(function(r,e){let t=setTimeout(r.bind(e),0);return{dispose(){clearTimeout(t)}}}),bt;(n=>{function r(i){return i===n.None||i===n.Cancelled||i instanceof Bt?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}n.isCancellationToken=r,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:w.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Us})})(bt||={});var Bt=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Us:(this._emitter||(this._emitter=new y),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ue=class{constructor(e){this._token=void 0;this._parentListener=void 0;this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new Bt),this._token}cancel(){this._token?this._token instanceof Bt&&this._token.cancel():this._token=bt.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof Bt&&this._token.dispose():this._token=bt.None}};function hu(r){return r}var pr=class{constructor(e,t){this.lastCache=void 0;this.lastArgKey=void 0;typeof e=="function"?(this._fn=e,this._computeKey=hu):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){let t=this._computeKey(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this._fn(e)),this.lastCache}};function Ks(r){return!r||typeof r!="string"?!0:r.trim().length===0}var gu=/{(\d+)}/g;function _t(r,...e){return e.length===0?r:r.replace(gu,function(t,n){let i=parseInt(n,10);return isNaN(i)||i<0||i>=e.length?t:e[i]})}function Fi(r,e){if(!r||!e)return r;let t=e.length,n=r.length;if(t===1){let o=n,s=e.charCodeAt(0);for(;o>0&&r.charCodeAt(o-1)===s;)o--;return r.substring(0,o)}let i=n;for(;i>0&&r.endsWith(e,i);)i-=t;return r.substring(0,i)}function mn(r,e){return re?1:0}function mr(r,e,t=0,n=r.length,i=0,o=e.length){for(;tu)return 1}let s=n-t,a=o-i;return sa?1:0}function Ni(r,e){return Vt(r,e,0,r.length,0,e.length)}function Vt(r,e,t=0,n=r.length,i=0,o=e.length){for(;t=128||u>=128)return mr(r.toLowerCase(),e.toLowerCase(),t,n,i,o);Fs(l)&&(l-=32),Fs(u)&&(u-=32);let p=l-u;if(p!==0)return p}let s=n-t,a=o-i;return sa?1:0}function Fs(r){return r>=97&&r<=122}function Bi(r){return r>=65&&r<=90}function fr(r,e){return r.length===e.length&&Vt(r,e)===0}function hr(r,e){let t=e.length;return t<=r.length&&Vt(r,e,0,t)===0}function Ws(r){return 55296<=r&&r<=56319}function Vi(r){return 56320<=r&&r<=57343}function $s(r,e){return(r-55296<<10)+(e-56320)+65536}var yu=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,vu=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,bu=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,_u=new RegExp("(?:"+[yu.source,vu.source,bu.source].join("|")+")","g");function xu(r){return r&&(r=r.replace(_u,"")),r}var Iu=/\\\[.*?\\\]/g;function qs(r){return xu(r).replace(Iu,"")}var Zp=String.fromCharCode(65279);var Ns=class r{static{this._INSTANCE=null}static getInstance(){return r._INSTANCE||(r._INSTANCE=new r),r._INSTANCE}constructor(){this._data=Tu()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;let t=this._data,n=t.length/3,i=1;for(;i<=n;)if(et[3*i+1])i=2*i+1;else return t[3*i+2];return 0}};function Tu(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}var Bs=class r{constructor(e){this.confusableDictionary=e}static{this.ambiguousCharacterData=new Ee(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,1523,96,8242,96,1370,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,118002,50,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,118003,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,118004,52,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,118005,53,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,118006,54,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,118007,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,118008,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,118009,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,117974,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,117975,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71913,67,71922,67,65315,67,8557,67,8450,67,8493,67,117976,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,117977,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,117978,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,117979,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,117980,71,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,117981,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,117983,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,117984,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,118001,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,117982,108,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,117985,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,117986,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,117987,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,118000,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,117988,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,117989,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,117990,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,117991,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,117992,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,117993,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,117994,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,117995,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71910,87,71919,87,117996,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,117997,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,117998,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,71909,90,66293,90,65338,90,8484,90,8488,90,117999,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65283,35,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"cs":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"es":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"fr":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"it":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ja":[8211,45,8218,44,65281,33,8216,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65292,44,65297,49,65307,59],"ko":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pt-BR":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ru":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"zh-hans":[160,32,65374,126,8218,44,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65297,49],"zh-hant":[8211,45,65374,126,8218,44,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89]}'))}static{this.cache=new pr(e=>{let t=e.split(",");function n(c){let d=new Map;for(let m=0;m!c.startsWith("_")&&Object.hasOwn(s,c));a.length===0&&(a=["_default"]);let l;for(let c of a){let d=n(s[c]);l=o(l,d)}let u=n(s._common),p=i(u,l);return new r(p)})}static getInstance(e){return r.cache.get(Array.from(e).join(","))}static{this._locales=new Ee(()=>Object.keys(r.ambiguousCharacterData.value).filter(e=>!e.startsWith("_")))}static getLocales(){return r._locales.value}isAmbiguous(e){return this.confusableDictionary.has(e)}containsAmbiguousCharacter(e){for(let t=0;tr.length)return!1;if(t){if(!hr(r,e))return!1;if(e.length===r.length)return!0;let o=e.length;return e.charAt(e.length-1)===n&&o--,r.charAt(o)===n}return e.charAt(e.length-1)!==n&&(e+=n),r.indexOf(e)===0}function js(r){return r>=65&&r<=90||r>=97&&r<=122}function $i(r){let e=Me(r);return E?r.length>3?!1:Eu(e)&&(r.length===2||e.charCodeAt(2)===92):e===W.sep}function Eu(r,e=E){return e?js(r.charCodeAt(0))&&r.charCodeAt(1)===58:!1}var wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Su="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function Gs(r,e,t=8){let n="";for(let o=0;o(D.inMemory="inmemory",D.vscode="vscode",D.internal="private",D.walkThrough="walkThrough",D.walkThroughSnippet="walkThroughSnippet",D.http="http",D.https="https",D.file="file",D.mailto="mailto",D.untitled="untitled",D.data="data",D.command="command",D.vscodeRemote="vscode-remote",D.vscodeRemoteResource="vscode-remote-resource",D.vscodeManagedRemoteResource="vscode-managed-remote-resource",D.vscodeUserData="vscode-userdata",D.vscodeCustomEditor="vscode-custom-editor",D.vscodeNotebookCell="vscode-notebook-cell",D.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",D.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",D.vscodeNotebookCellOutput="vscode-notebook-cell-output",D.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",D.vscodeNotebookMetadata="vscode-notebook-metadata",D.vscodeInteractiveInput="vscode-interactive-input",D.vscodeSettings="vscode-settings",D.vscodeWorkspaceTrust="vscode-workspace-trust",D.vscodeTerminal="vscode-terminal",D.vscodeImageCarousel="vscode-image-carousel",D.vscodeChatCodeBlock="vscode-chat-code-block",D.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",D.vscodeChatEditor="vscode-chat-editor",D.vscodeChatInput="chatSessionInput",D.vscodeLocalChatSession="vscode-chat-session",D.webviewPanel="webview-panel",D.vscodeWebview="vscode-webview",D.vscodeBrowser="vscode-browser",D.extension="extension",D.vscodeFileResource="vscode-file",D.tmp="tmp",D.vsls="vsls",D.vscodeSourceControl="vscode-scm",D.commentsInput="comment",D.codeSetting="code-setting",D.outputChannel="output",D.accessibleView="accessible-view",D.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",D.chatEditingModel="chat-editing-text-model",D.copilotPr="copilot-pr"))(te||={});var Cu="tkn",qi=class{constructor(){this._hosts=Object.create(null);this._ports=Object.create(null);this._connectionTokens=Object.create(null);this._preferredWebSchema="http";this._delegate=null;this._serverRootPath="/"}setPreferredWebSchema(e){this._preferredWebSchema=e}setDelegate(e){this._delegate=e}setServerRootPath(e,t){this._serverRootPath=W.join(t??"/",Ru(e))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return W.join(this._serverRootPath,te.vscodeRemoteResource)}set(e,t,n){this._hosts[e]=t,this._ports[e]=n}setConnectionToken(e,t){this._connectionTokens[e]=t}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(e){if(this._delegate)try{return this._delegate(e)}catch(a){return De(a),e}let t=e.authority,n=this._hosts[t];n&&n.indexOf(":")!==-1&&n.indexOf("[")===-1&&(n=`[${n}]`);let i=this._ports[t],o=this._connectionTokens[t],s=`path=${encodeURIComponent(e.path)}`;return typeof o=="string"&&(s+=`&${Cu}=${encodeURIComponent(o)}`),O.from({scheme:pt?this._preferredWebSchema:te.vscodeRemoteResource,authority:`${n}:${i}`,path:pt?(window.location.pathname+"/"+this._remoteResourcesPath).replace(/\/\/+/g,"/"):this._remoteResourcesPath,query:s})}},ku=new qi;function Ru(r){return`${r.quality??"oss"}-${r.commit??"dev"}`}var Lu="vscode-app",zi=class r{static{this.FALLBACK_AUTHORITY=Lu}asBrowserUri(e){let t=this.toUri(e);return this.uriToBrowserUri(t)}uriToBrowserUri(e){return e.scheme===te.vscodeRemote?ku.rewrite(e):e.scheme===te.file&&(ms||fs===`${te.vscodeFileResource}://${r.FALLBACK_AUTHORITY}`)?e.with({scheme:te.vscodeFileResource,authority:e.authority||r.FALLBACK_AUTHORITY,query:null,fragment:null}):e}asFileUri(e){let t=this.toUri(e);return this.uriToFileUri(t)}uriToFileUri(e){return e.scheme===te.vscodeFileResource?e.with({scheme:te.file,authority:e.authority!==r.FALLBACK_AUTHORITY?e.authority:null,query:null,fragment:null}):e}toUri(e){if(O.isUri(e))return e;if(globalThis._VSCODE_FILE_ROOT){let t=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(t))return O.joinPath(O.parse(t,!0),e);let n=A(t,e);return O.file(n)}throw new Error("Cannot determine URI for module id!")}},qe=new zi,sm=Object.freeze({"Cache-Control":"no-cache, no-store"}),am=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),Du;(o=>{let r=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);o.CoopAndCoep=Object.freeze(r.get("3"));let t="vscode-coi";function n(s){let a;typeof s=="string"?a=new URL(s).searchParams:s instanceof URL?a=s.searchParams:O.isUri(s)&&(a=new URL(s.toString(!0)).searchParams);let l=a?.get(t);if(l)return r.get(l)}o.getHeadersFromQuery=n;function i(s,a,l){if(!globalThis.crossOriginIsolated)return;let u=a&&l?"3":l?"2":"1";s instanceof URLSearchParams?s.set(t,u):s[t]=u}o.addSearchParam=i})(Du||={});function ze(r){return pn(r,!0)}var hn=class{constructor(e){this._ignorePathCasing=e}compare(e,t,n=!1){return e===t?0:mn(this.getComparisonKey(e,n),this.getComparisonKey(t,n))}isEqual(e,t,n=!1){return e===t?!0:!e||!t?!1:this.getComparisonKey(e,n)===this.getComparisonKey(t,n)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:t?null:void 0}).toString()}ignorePathCasing(e){return this._ignorePathCasing(e)}isEqualOrParent(e,t,n=!1){if(e.scheme===t.scheme){if(e.scheme===te.file)return fn(ze(e),ze(t),this._ignorePathCasing(e))&&e.query===t.query&&(n||e.fragment===t.fragment);if(Xs(e.authority,t.authority))return fn(e.path,t.path,this._ignorePathCasing(e),"/")&&e.query===t.query&&(n||e.fragment===t.fragment)}return!1}joinPath(e,...t){return O.joinPath(e,...t)}basenameOrAuthority(e){return Au(e)||e.authority}basename(e,t){return W.basename(e.path,t)}extname(e){return W.extname(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===te.file?t=O.file(ke(ze(e))).path:(t=W.dirname(e.path),e.authority&&t.length&&t.charCodeAt(0)!==47&&(console.error(`dirname("${e.toString})) resulted in a relative path`),t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return e.scheme===te.file?t=O.file(Me(ze(e))).path:t=W.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!Xs(e.authority,t.authority))return;if(e.scheme===te.file){let o=xs(ze(e),ze(t));return E?Ki(o):o}let n=e.path||"/",i=t.path||"/";if(this._ignorePathCasing(e)){let o=0;for(let s=Math.min(n.length,i.length);oWi(n).length&&n[n.length-1]===t}else{let n=e.path;return n.length>1&&n.charCodeAt(n.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=$e){return Qs(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=$e){let n=!1;if(e.scheme===te.file){let i=ze(e);n=i!==void 0&&i.length===Wi(i).length&&i[i.length-1]===t}else{t="/";let i=e.path;n=i.length===1&&i.charCodeAt(i.length-1)===47}return!n&&!Qs(e,t)?e.with({path:e.path+"/"}):e}},$=new hn(()=>!1),Ys=new hn(r=>r.scheme===te.file?!Ce:!0),fm=new hn(r=>!0),hm=$.isEqual.bind($),gm=$.isEqualOrParent.bind($),ym=$.getComparisonKey.bind($),vm=$.basenameOrAuthority.bind($),Au=$.basename.bind($),bm=$.extname.bind($),_m=$.dirname.bind($),xe=$.joinPath.bind($),xm=$.normalizePath.bind($),Im=$.relativePath.bind($),Tm=$.resolvePath.bind($),Em=$.isAbsolutePath.bind($),Xs=$.isEqualAuthority.bind($),Qs=$.hasTrailingPathSeparator.bind($),wm=$.removeTrailingPathSeparator.bind($),Sm=$.addTrailingPathSeparator.bind($);var Ou;(o=>{o.META_DATA_LABEL="label",o.META_DATA_DESCRIPTION="description",o.META_DATA_SIZE="size",o.META_DATA_MIME="mime";function i(s){let a=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(p=>{let[c,d]=p.split(":");c&&d&&a.set(c,d)});let u=s.path.substring(0,s.path.indexOf(";"));return u&&a.set(o.META_DATA_MIME,u),a}o.parseMetaData=i})(Ou||={});function bn(r){let e=new Ue,t=r(e.token),n=!1,i=new Promise((o,s)=>{let a=e.token.onCancellationRequested(()=>{n=!0,a.dispose(),s(new we)});Promise.resolve(t).then(l=>{a.dispose(),e.dispose(),n?is(l)&&l.dispose():o(l)},l=>{a.dispose(),e.dispose(),s(l)})});return new class{cancel(){e.cancel(),e.dispose()}then(o,s){return i.then(o,s)}catch(o){return this.then(void 0,o)}finally(o){return i.finally(o)}}}var ji=class{constructor(){this._isOpen=!1,this._promise=new Promise((e,t)=>{this._completePromise=e})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}},gr=class extends ji{constructor(e){super(),this._timeout=setTimeout(()=>this.open(),e)}open(){clearTimeout(this._timeout),super.open()}};function me(r,e){return e?new Promise((t,n)=>{let i=setTimeout(()=>{o.dispose(),t()},r),o=e.onCancellationRequested(()=>{clearTimeout(i),o.dispose(),n(new we)})}):bn(t=>me(r,t))}var Gi=class{constructor(e){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new y}whenIdle(){return this.size>0?w.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(e){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((t,n)=>{this.outstandingPromises.push({factory:e,c:t,e:n}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromisesthis.consumed(),()=>this.consumed())}}consumed(){this._isDisposed||(this.runningPromises--,--this._size===0&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}},gn=class extends Gi{constructor(){super(1)}};var yr=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let e=new vn;return this.drainers.add(e),e.p}isDrained(){for(let[,e]of this.queues)if(e.size>0)return!1;return!0}queueSize(e,t=$){let n=t.getComparisonKey(e);return this.queues.get(n)?.size??0}queueFor(e,t,n=$){let i=n.getComparisonKey(e),o=this.queues.get(i);if(!o){o=new gn;let s=this.drainListenerCount++,a=w.once(o.onDrained)(()=>{o?.dispose(),this.queues.delete(i),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(s),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new Mt),this.drainListeners.set(s,a),this.queues.set(i,o)}return o.queue(t)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let e of this.drainers)e.complete();this.drainers.clear()}dispose(){for(let[,e]of this.queues)e.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}};var vr=class{constructor(e,t){this.timeoutToken=void 0,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=void 0)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==void 0}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=void 0,this.runner&&this.doRun()}doRun(){this.runner?.()}},yn=class{constructor(e,t){t%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${t}ms is not a multiple of 1000ms.`),this.runner=e,this.timeout=t,this.counter=0,this.intervalToken=void 0,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=void 0)}schedule(e=this.timeout){e%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(e/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return this.intervalToken!==void 0}onInterval(){this.counter--,!(this.counter>0)&&(clearInterval(this.intervalToken),this.intervalToken=void 0,this.runner?.())}};var Mu,Hi;(function(){let r=globalThis;typeof r.requestIdleCallback!="function"||typeof r.cancelIdleCallback!="function"?Hi=(e,t,n)=>{gs(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Hi=(e,t,n)=>{let i=e.requestIdleCallback(t,typeof n=="number"?{timeout:n}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Mu=(e,t)=>Hi(globalThis,e,t)})();var vn=class r{static fromPromise(e){let t=new r;return t.settleWith(e),t}get isRejected(){return this.outcome?.outcome===1}get isResolved(){return this.outcome?.outcome===0}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===0?this.outcome?.value:void 0}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.completeCallback(e),this.outcome={outcome:0,value:e},t()})}error(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.errorCallback(e),this.outcome={outcome:1,value:e},t()})}settleWith(e){return e.then(t=>this.complete(t),t=>this.error(t))}cancel(){return this.error(new we)}},Qi;(t=>{async function r(n){let i,o=await Promise.all(n.map(s=>s.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return o}t.settled=r;function e(n){return new Promise(async(i,o)=>{try{await n(i,o)}catch(s){o(s)}})}t.withAsyncBody=e})(Qi||={});var Zs=class r{static fromArray(e){return new r(t=>{t.emitMany(e)})}static fromPromise(e){return new r(async t=>{t.emitMany(await e)})}static fromPromisesResolveOrder(e){return new r(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new r(async t=>{await Promise.all(e.map(async n=>{for await(let i of n)t.emitOne(i)}))})}static{this.EMPTY=r.fromArray([])}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new y,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(e(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new r(async n=>{for await(let i of e)n.emitOne(t(i))})}map(e){return r.map(this,e)}static filter(e,t){return new r(async n=>{for await(let i of e)t(i)&&n.emitOne(i)})}filter(e){return r.filter(this,e)}static coalesce(e){return r.filter(e,t=>!!t)}coalesce(){return r.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return r.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};var Xi=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(e){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let t=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(t,e)}else this._unconsumedValues.push(e)}produceFinal(e){this._ensureNoFinalValue(),this._finalValue=e;for(let t of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(t,e);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new Qe("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(e,t){t.ok?e.complete(t.value):e.error(t.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let e=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return e.ok?Promise.resolve(e.value):Promise.reject(e.error)}else{let e=new vn;return this._unsatisfiedConsumers.push(e),e.p}}},Js=class r{constructor(e,t){this._onReturn=t;this._producerConsumer=new Xi;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async e=>(this._finishError(e),{done:!0,value:void 0})};queueMicrotask(async()=>{let n=e({emitOne:i=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:i}}),emitMany:i=>{for(let o of i)this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}})},reject:i=>this._finishError(i)});if(!this._producerConsumer.hasFinalValue)try{await n,this._finishOk()}catch(i){this._finishError(i)}})}static fromArray(e){return new r(t=>{t.emitMany(e)})}static fromPromise(e){return new r(async t=>{t.emitMany(await e)})}static fromPromisesResolveOrder(e){return new r(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new r(async t=>{await Promise.all(e.map(async n=>{for await(let i of n)t.emitOne(i)}))})}static{this.EMPTY=r.fromArray([])}static map(e,t){return new r(async n=>{for await(let i of e)n.emitOne(t(i))})}static tee(e){let t,n,i=new vn,o=async()=>{if(!(!t||!n))try{for await(let l of e)t.emitOne(l),n.emitOne(l)}catch(l){t.reject(l),n.reject(l)}finally{i.complete()}},s=new r(async l=>(t=l,o(),i.p)),a=new r(async l=>(n=l,o(),i.p));return[s,a]}map(e){return r.map(this,e)}static coalesce(e){return r.filter(e,t=>!!t)}coalesce(){return r.coalesce(this)}static filter(e,t){return new r(async n=>{for await(let i of e)t(i)&&n.emitOne(i)})}filter(e){return r.filter(this,e)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(e){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:e})}[Symbol.asyncIterator](){return this._iterator}};function ea(r){return(e,t,n)=>{let i=null,o=null;if(typeof n.value=="function"?(i="value",o=n.value):typeof n.get=="function"&&(i="get",o=n.get),!o||typeof t=="symbol")throw new Error("not supported");n[i]=r(o,t)}}function R(r,e,t){let n=null,i=null;if(typeof t.value=="function"?(n="value",i=t.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(n="get",i=t.get),!i)throw new Error("not supported");let o=`$memoize$${e}`;t[n]=function(...s){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,s)}),this[o]}}function Kt(r,e,t){return ea((n,i)=>{let o=`$debounce$${i}`,s=`$debounce$result$${i}`;return function(...a){this[s]||(this[s]=t?t():void 0),clearTimeout(this[o]),e&&(this[s]=e(this[s],...a),a=[this[s]]),this[o]=setTimeout(()=>{n.apply(this,a),this[s]=t?t():void 0},r)}})}function br(r,e,t){return ea((n,i)=>{let o=`$throttle$timer$${i}`,s=`$throttle$result$${i}`,a=`$throttle$lastRun$${i}`,l=`$throttle$pending$${i}`;return function(...u){if(this[s]||(this[s]=t?t():void 0),(this[a]===null||this[a]===void 0)&&(this[a]=-Number.MAX_VALUE),e&&(this[s]=e(this[s],...u)),this[l])return;let p=this[a]+r;p<=Date.now()?(this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=t?t():void 0):(this[l]=!0,this[o]=setTimeout(()=>{this[l]=!1,this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=t?t():void 0},p-Date.now()))}})}function _n(r,e=0){if(!r||e>200)return r;if(typeof r=="object"){switch(r.$mid){case 1:return O.revive(r);case 2:return new RegExp(r.source,r.flags);case 17:return new Date(r.source)}if(r instanceof ee||r instanceof Uint8Array)return r;if(Array.isArray(r))for(let t=0;t>>7)t++;let n=ee.alloc(t);for(let i=0;e!==0;i++)n.buffer[i]=e&127,e=e>>>7,e>0&&(n.buffer[i]|=128);r.write(n)}var In=class{constructor(e){this.buffer=e;this.pos=0}read(e){let t=this.buffer.slice(this.pos,this.pos+e);return this.pos+=t.byteLength,t}},xr=class{constructor(){this.buffers=[]}get buffer(){return ee.concat(this.buffers)}write(e){this.buffers.push(e)}};function et(r){let e=ee.alloc(1);return e.writeUInt8(r,0),e}var xt={Undefined:et(0),String:et(1),Buffer:et(2),VSBuffer:et(3),Array:et(4),Object:et(5),Uint:et(6)};function Tn(r,e){if(typeof e>"u")r.write(xt.Undefined);else if(typeof e=="string"){let t=ee.fromString(e);r.write(xt.String),$t(r,t.byteLength),r.write(t)}else if(ee.isNativeBuffer(e)){let t=ee.wrap(e);r.write(xt.Buffer),$t(r,t.byteLength),r.write(t)}else if(e instanceof ee)r.write(xt.VSBuffer),$t(r,e.byteLength),r.write(e);else if(Array.isArray(e)){r.write(xt.Array),$t(r,e.length);for(let t of e)Tn(r,t)}else if(typeof e=="number"&&(e|0)===e)r.write(xt.Uint),$t(r,e);else{let t=ee.fromString(JSON.stringify(e));r.write(xt.Object),$t(r,t.byteLength),r.write(t)}}function zt(r){switch(r.read(1).readUInt8(0)){case 0:return;case 1:return r.read(Wt(r)).toString();case 2:return r.read(Wt(r)).buffer;case 3:return r.read(Wt(r));case 4:{let t=Wt(r),n=[];for(let i=0;ithis.onRawMessage(o)),this.sendResponse({type:200})}registerChannel(e,t){this.channels.set(e,t),setTimeout(()=>this.flushPendingRequests(e),0)}sendResponse(e){switch(e.type){case 200:{let t=this.send([e.type]);this.logger?.logOutgoing(t,0,1,_r(e.type));return}case 201:case 202:case 204:case 203:{let t=this.send([e.type,e.id],e.data);this.logger?.logOutgoing(t,e.id,1,_r(e.type),e.data);return}}}send(e,t=void 0){let n=new xr;return Tn(n,e),Tn(n,t),this.sendBuffer(n.buffer)}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onRawMessage(e){let t=new In(e),n=zt(t),i=zt(t),o=n[0];switch(o){case 100:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}: ${n[2]}.${n[3]}`,i),this.onPromise({type:o,id:n[1],channelName:n[2],name:n[3],arg:i});case 102:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}: ${n[2]}.${n[3]}`,i),this.onEventListen({type:o,id:n[1],channelName:n[2],name:n[3],arg:i});case 101:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}`),this.disposeActiveRequest({type:o,id:n[1]});case 103:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}`),this.disposeActiveRequest({type:o,id:n[1]})}}onPromise(e){let t=this.channels.get(e.channelName);if(!t){this.collectPendingRequest(e);return}let n=new Ue,i;try{i=t.call(this.ctx,e.name,e.arg,n.token)}catch(a){i=Promise.reject(a)}let o=e.id;i.then(a=>{this.sendResponse({id:o,data:a,type:201})},a=>{a instanceof Error?this.sendResponse({id:o,data:{message:a.message,name:a.name,stack:a.stack?a.stack.split(` + `))}},cr=class r extends Error{constructor(e,t,n,i){super(`potential listener LEAK detected, ${e}`),this.name="ListenerLeakError",this.kind=e,this.listenerCount=i,this.details=t,this.stack=n}static is(e){return e instanceof r||e instanceof Error&&typeof e.kind=="string"&&typeof e.listenerCount=="number"}},Mi=class extends cr{constructor(e,t,n,i){super(e,t,n,i),this.name="ListenerRefusalError"}},pu=0,Ft=class{constructor(e){this.value=e;this.id=pu++}},mu=2,fu=(r,e)=>{if(r instanceof Ft)e(r);else for(let t=0;t0||this._options?.leakWarningThreshold?new Oi(e?.onListenerError??De,this._options?.leakWarningThreshold??Os):void 0,this._perfMon=this._options?._profName?new Ai(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ls){let e=this._listeners;queueMicrotask(()=>{fu(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=u[1]/this._size>.3?"dominated":"popular",c=new Mi(p,`${l}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0],this._size);return(this._options?.onListenerError||De)(c),C.None}if(this._disposed)return C.None;t&&(e=e.bind(t));let i=new Ft(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Nt.create(),o=this._leakageMon.check(i.stack,this._size+1)),Ls&&(i.stack=s??Nt.create()),this._listeners?this._listeners instanceof Ft?(this._deliveryQueue??=new Ui,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;let a=Y(()=>{o?.(),this._removeListener(i)});return Fi(a,n),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*mu<=t.length){let o=0;for(let s=0;s0}};var Ui=class{constructor(){this.i=-1;this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var dr=class{constructor(){this.hasListeners=!1;this.events=[];this.emitter=new y({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){let t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),Y(on(()=>{this.hasListeners&&this.unhook(t);let i=this.events.indexOf(t);this.events.splice(i,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(let e of this.events)e.listener?.dispose();this.events=[]}};var pr=class{constructor(){this.listening=!1;this.inputEvent=w.None;this.inputEventListener=C.None;this.emitter=new y({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}});this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}};function Fi(r,e){e instanceof he?e.add(r):Array.isArray(e)&&e.push(r)}function Ms(r,e){if(e instanceof he)e.delete(r);else if(Array.isArray(e)){let t=e.indexOf(r);t!==-1&&e.splice(t,1)}r.dispose()}var Us=Object.freeze(function(r,e){let t=setTimeout(r.bind(e),0);return{dispose(){clearTimeout(t)}}}),bt;(n=>{function r(i){return i===n.None||i===n.Cancelled||i instanceof Bt?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}n.isCancellationToken=r,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:w.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Us})})(bt||={});var Bt=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Us:(this._emitter||(this._emitter=new y),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ue=class{constructor(e){this._token=void 0;this._parentListener=void 0;this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new Bt),this._token}cancel(){this._token?this._token instanceof Bt&&this._token.cancel():this._token=bt.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof Bt&&this._token.dispose():this._token=bt.None}};function hu(r){return r}var mr=class{constructor(e,t){this.lastCache=void 0;this.lastArgKey=void 0;typeof e=="function"?(this._fn=e,this._computeKey=hu):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){let t=this._computeKey(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this._fn(e)),this.lastCache}};function Ks(r){return!r||typeof r!="string"?!0:r.trim().length===0}var gu=/{(\d+)}/g;function _t(r,...e){return e.length===0?r:r.replace(gu,function(t,n){let i=parseInt(n,10);return isNaN(i)||i<0||i>=e.length?t:e[i]})}function Ni(r,e){if(!r||!e)return r;let t=e.length,n=r.length;if(t===1){let o=n,s=e.charCodeAt(0);for(;o>0&&r.charCodeAt(o-1)===s;)o--;return r.substring(0,o)}let i=n;for(;i>0&&r.endsWith(e,i);)i-=t;return r.substring(0,i)}function mn(r,e){return re?1:0}function fr(r,e,t=0,n=r.length,i=0,o=e.length){for(;tu)return 1}let s=n-t,a=o-i;return sa?1:0}function Bi(r,e){return Vt(r,e,0,r.length,0,e.length)}function Vt(r,e,t=0,n=r.length,i=0,o=e.length){for(;t=128||u>=128)return fr(r.toLowerCase(),e.toLowerCase(),t,n,i,o);Fs(l)&&(l-=32),Fs(u)&&(u-=32);let p=l-u;if(p!==0)return p}let s=n-t,a=o-i;return sa?1:0}function Fs(r){return r>=97&&r<=122}function Vi(r){return r>=65&&r<=90}function hr(r,e){return r.length===e.length&&Vt(r,e)===0}function gr(r,e){let t=e.length;return t<=r.length&&Vt(r,e,0,t)===0}function Ws(r){return 55296<=r&&r<=56319}function Ki(r){return 56320<=r&&r<=57343}function $s(r,e){return(r-55296<<10)+(e-56320)+65536}var yu=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,vu=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,bu=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,_u=new RegExp("(?:"+[yu.source,vu.source,bu.source].join("|")+")","g");function xu(r){return r&&(r=r.replace(_u,"")),r}var Iu=/\\\[.*?\\\]/g;function qs(r){return xu(r).replace(Iu,"")}var Jp=String.fromCharCode(65279);var Ns=class r{static{this._INSTANCE=null}static getInstance(){return r._INSTANCE||(r._INSTANCE=new r),r._INSTANCE}constructor(){this._data=Tu()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;let t=this._data,n=t.length/3,i=1;for(;i<=n;)if(et[3*i+1])i=2*i+1;else return t[3*i+2];return 0}};function Tu(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}var Bs=class r{constructor(e){this.confusableDictionary=e}static{this.ambiguousCharacterData=new Ee(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,1523,96,8242,96,1370,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,118002,50,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,118003,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,118004,52,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,118005,53,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,118006,54,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,118007,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,118008,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,118009,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,117974,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,117975,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71913,67,71922,67,65315,67,8557,67,8450,67,8493,67,117976,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,117977,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,117978,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,117979,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,117980,71,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,117981,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,117983,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,117984,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,118001,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,117982,108,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,117985,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,117986,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,117987,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,118000,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,117988,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,117989,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,117990,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,117991,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,117992,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,117993,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,117994,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,117995,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71910,87,71919,87,117996,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,117997,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,117998,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,71909,90,66293,90,65338,90,8484,90,8488,90,117999,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65283,35,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"cs":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"es":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"fr":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"it":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ja":[8211,45,8218,44,65281,33,8216,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65292,44,65297,49,65307,59],"ko":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pt-BR":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ru":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"zh-hans":[160,32,65374,126,8218,44,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65297,49],"zh-hant":[8211,45,65374,126,8218,44,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89]}'))}static{this.cache=new mr(e=>{let t=e.split(",");function n(c){let d=new Map;for(let m=0;m!c.startsWith("_")&&Object.hasOwn(s,c));a.length===0&&(a=["_default"]);let l;for(let c of a){let d=n(s[c]);l=o(l,d)}let u=n(s._common),p=i(u,l);return new r(p)})}static getInstance(e){return r.cache.get(Array.from(e).join(","))}static{this._locales=new Ee(()=>Object.keys(r.ambiguousCharacterData.value).filter(e=>!e.startsWith("_")))}static getLocales(){return r._locales.value}isAmbiguous(e){return this.confusableDictionary.has(e)}containsAmbiguousCharacter(e){for(let t=0;tr.length)return!1;if(t){if(!gr(r,e))return!1;if(e.length===r.length)return!0;let o=e.length;return e.charAt(e.length-1)===n&&o--,r.charAt(o)===n}return e.charAt(e.length-1)!==n&&(e+=n),r.indexOf(e)===0}function js(r){return r>=65&&r<=90||r>=97&&r<=122}function qi(r){let e=Me(r);return E?r.length>3?!1:Eu(e)&&(r.length===2||e.charCodeAt(2)===92):e===W.sep}function Eu(r,e=E){return e?js(r.charCodeAt(0))&&r.charCodeAt(1)===58:!1}var wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Su="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function Gs(r,e,t=8){let n="";for(let o=0;o(D.inMemory="inmemory",D.vscode="vscode",D.internal="private",D.walkThrough="walkThrough",D.walkThroughSnippet="walkThroughSnippet",D.http="http",D.https="https",D.file="file",D.mailto="mailto",D.untitled="untitled",D.data="data",D.command="command",D.vscodeRemote="vscode-remote",D.vscodeRemoteResource="vscode-remote-resource",D.vscodeManagedRemoteResource="vscode-managed-remote-resource",D.vscodeUserData="vscode-userdata",D.vscodeCustomEditor="vscode-custom-editor",D.vscodeNotebookCell="vscode-notebook-cell",D.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",D.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",D.vscodeNotebookCellOutput="vscode-notebook-cell-output",D.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",D.vscodeNotebookMetadata="vscode-notebook-metadata",D.vscodeInteractiveInput="vscode-interactive-input",D.vscodeSettings="vscode-settings",D.vscodeWorkspaceTrust="vscode-workspace-trust",D.vscodeTerminal="vscode-terminal",D.vscodeImageCarousel="vscode-image-carousel",D.vscodeChatCodeBlock="vscode-chat-code-block",D.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",D.vscodeChatEditor="vscode-chat-editor",D.vscodeChatInput="chatSessionInput",D.vscodeLocalChatSession="vscode-chat-session",D.webviewPanel="webview-panel",D.vscodeWebview="vscode-webview",D.vscodeBrowser="vscode-browser",D.extension="extension",D.vscodeFileResource="vscode-file",D.tmp="tmp",D.vsls="vsls",D.vscodeSourceControl="vscode-scm",D.commentsInput="comment",D.codeSetting="code-setting",D.outputChannel="output",D.accessibleView="accessible-view",D.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",D.chatEditingModel="chat-editing-text-model",D.copilotPr="copilot-pr"))(ne||={});var Cu="tkn",zi=class{constructor(){this._hosts=Object.create(null);this._ports=Object.create(null);this._connectionTokens=Object.create(null);this._preferredWebSchema="http";this._delegate=null;this._serverRootPath="/"}setPreferredWebSchema(e){this._preferredWebSchema=e}setDelegate(e){this._delegate=e}setServerRootPath(e,t){this._serverRootPath=W.join(t??"/",Ru(e))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return W.join(this._serverRootPath,ne.vscodeRemoteResource)}set(e,t,n){this._hosts[e]=t,this._ports[e]=n}setConnectionToken(e,t){this._connectionTokens[e]=t}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(e){if(this._delegate)try{return this._delegate(e)}catch(a){return De(a),e}let t=e.authority,n=this._hosts[t];n&&n.indexOf(":")!==-1&&n.indexOf("[")===-1&&(n=`[${n}]`);let i=this._ports[t],o=this._connectionTokens[t],s=`path=${encodeURIComponent(e.path)}`;return typeof o=="string"&&(s+=`&${Cu}=${encodeURIComponent(o)}`),O.from({scheme:pt?this._preferredWebSchema:ne.vscodeRemoteResource,authority:`${n}:${i}`,path:pt?(window.location.pathname+"/"+this._remoteResourcesPath).replace(/\/\/+/g,"/"):this._remoteResourcesPath,query:s})}},ku=new zi;function Ru(r){return`${r.quality??"oss"}-${r.commit??"dev"}`}var Lu="vscode-app",Hi=class r{static{this.FALLBACK_AUTHORITY=Lu}asBrowserUri(e){let t=this.toUri(e);return this.uriToBrowserUri(t)}uriToBrowserUri(e){return e.scheme===ne.vscodeRemote?ku.rewrite(e):e.scheme===ne.file&&(ms||fs===`${ne.vscodeFileResource}://${r.FALLBACK_AUTHORITY}`)?e.with({scheme:ne.vscodeFileResource,authority:e.authority||r.FALLBACK_AUTHORITY,query:null,fragment:null}):e}asFileUri(e){let t=this.toUri(e);return this.uriToFileUri(t)}uriToFileUri(e){return e.scheme===ne.vscodeFileResource?e.with({scheme:ne.file,authority:e.authority!==r.FALLBACK_AUTHORITY?e.authority:null,query:null,fragment:null}):e}toUri(e){if(O.isUri(e))return e;if(globalThis._VSCODE_FILE_ROOT){let t=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(t))return O.joinPath(O.parse(t,!0),e);let n=A(t,e);return O.file(n)}throw new Error("Cannot determine URI for module id!")}},qe=new Hi,am=Object.freeze({"Cache-Control":"no-cache, no-store"}),lm=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),Du;(o=>{let r=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);o.CoopAndCoep=Object.freeze(r.get("3"));let t="vscode-coi";function n(s){let a;typeof s=="string"?a=new URL(s).searchParams:s instanceof URL?a=s.searchParams:O.isUri(s)&&(a=new URL(s.toString(!0)).searchParams);let l=a?.get(t);if(l)return r.get(l)}o.getHeadersFromQuery=n;function i(s,a,l){if(!globalThis.crossOriginIsolated)return;let u=a&&l?"3":l?"2":"1";s instanceof URLSearchParams?s.set(t,u):s[t]=u}o.addSearchParam=i})(Du||={});function ze(r){return pn(r,!0)}var hn=class{constructor(e){this._ignorePathCasing=e}compare(e,t,n=!1){return e===t?0:mn(this.getComparisonKey(e,n),this.getComparisonKey(t,n))}isEqual(e,t,n=!1){return e===t?!0:!e||!t?!1:this.getComparisonKey(e,n)===this.getComparisonKey(t,n)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:t?null:void 0}).toString()}ignorePathCasing(e){return this._ignorePathCasing(e)}isEqualOrParent(e,t,n=!1){if(e.scheme===t.scheme){if(e.scheme===ne.file)return fn(ze(e),ze(t),this._ignorePathCasing(e))&&e.query===t.query&&(n||e.fragment===t.fragment);if(Xs(e.authority,t.authority))return fn(e.path,t.path,this._ignorePathCasing(e),"/")&&e.query===t.query&&(n||e.fragment===t.fragment)}return!1}joinPath(e,...t){return O.joinPath(e,...t)}basenameOrAuthority(e){return Au(e)||e.authority}basename(e,t){return W.basename(e.path,t)}extname(e){return W.extname(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===ne.file?t=O.file(ke(ze(e))).path:(t=W.dirname(e.path),e.authority&&t.length&&t.charCodeAt(0)!==47&&(console.error(`dirname("${e.toString})) resulted in a relative path`),t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return e.scheme===ne.file?t=O.file(Me(ze(e))).path:t=W.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!Xs(e.authority,t.authority))return;if(e.scheme===ne.file){let o=xs(ze(e),ze(t));return E?Wi(o):o}let n=e.path||"/",i=t.path||"/";if(this._ignorePathCasing(e)){let o=0;for(let s=Math.min(n.length,i.length);o$i(n).length&&n[n.length-1]===t}else{let n=e.path;return n.length>1&&n.charCodeAt(n.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=$e){return Qs(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=$e){let n=!1;if(e.scheme===ne.file){let i=ze(e);n=i!==void 0&&i.length===$i(i).length&&i[i.length-1]===t}else{t="/";let i=e.path;n=i.length===1&&i.charCodeAt(i.length-1)===47}return!n&&!Qs(e,t)?e.with({path:e.path+"/"}):e}},$=new hn(()=>!1),Ys=new hn(r=>r.scheme===ne.file?!Ce:!0),hm=new hn(r=>!0),gm=$.isEqual.bind($),ym=$.isEqualOrParent.bind($),vm=$.getComparisonKey.bind($),bm=$.basenameOrAuthority.bind($),Au=$.basename.bind($),_m=$.extname.bind($),xm=$.dirname.bind($),xe=$.joinPath.bind($),Im=$.normalizePath.bind($),Tm=$.relativePath.bind($),Em=$.resolvePath.bind($),wm=$.isAbsolutePath.bind($),Xs=$.isEqualAuthority.bind($),Qs=$.hasTrailingPathSeparator.bind($),Sm=$.removeTrailingPathSeparator.bind($),Pm=$.addTrailingPathSeparator.bind($);var Ou;(o=>{o.META_DATA_LABEL="label",o.META_DATA_DESCRIPTION="description",o.META_DATA_SIZE="size",o.META_DATA_MIME="mime";function i(s){let a=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(p=>{let[c,d]=p.split(":");c&&d&&a.set(c,d)});let u=s.path.substring(0,s.path.indexOf(";"));return u&&a.set(o.META_DATA_MIME,u),a}o.parseMetaData=i})(Ou||={});function bn(r){let e=new Ue,t=r(e.token),n=!1,i=new Promise((o,s)=>{let a=e.token.onCancellationRequested(()=>{n=!0,a.dispose(),s(new we)});Promise.resolve(t).then(l=>{a.dispose(),e.dispose(),n?is(l)&&l.dispose():o(l)},l=>{a.dispose(),e.dispose(),s(l)})});return new class{cancel(){e.cancel(),e.dispose()}then(o,s){return i.then(o,s)}catch(o){return this.then(void 0,o)}finally(o){return i.finally(o)}}}var Gi=class{constructor(){this._isOpen=!1,this._promise=new Promise((e,t)=>{this._completePromise=e})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}},yr=class extends Gi{constructor(e){super(),this._timeout=setTimeout(()=>this.open(),e)}open(){clearTimeout(this._timeout),super.open()}};function me(r,e){return e?new Promise((t,n)=>{let i=setTimeout(()=>{o.dispose(),t()},r),o=e.onCancellationRequested(()=>{clearTimeout(i),o.dispose(),n(new we)})}):bn(t=>me(r,t))}var Xi=class{constructor(e){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new y}whenIdle(){return this.size>0?w.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(e){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((t,n)=>{this.outstandingPromises.push({factory:e,c:t,e:n}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromisesthis.consumed(),()=>this.consumed())}}consumed(){this._isDisposed||(this.runningPromises--,--this._size===0&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}},gn=class extends Xi{constructor(){super(1)}};var vr=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let e=new vn;return this.drainers.add(e),e.p}isDrained(){for(let[,e]of this.queues)if(e.size>0)return!1;return!0}queueSize(e,t=$){let n=t.getComparisonKey(e);return this.queues.get(n)?.size??0}queueFor(e,t,n=$){let i=n.getComparisonKey(e),o=this.queues.get(i);if(!o){o=new gn;let s=this.drainListenerCount++,a=w.once(o.onDrained)(()=>{o?.dispose(),this.queues.delete(i),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(s),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new Mt),this.drainListeners.set(s,a),this.queues.set(i,o)}return o.queue(t)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let e of this.drainers)e.complete();this.drainers.clear()}dispose(){for(let[,e]of this.queues)e.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}};var br=class{constructor(e,t){this.timeoutToken=void 0,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=void 0)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==void 0}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=void 0,this.runner&&this.doRun()}doRun(){this.runner?.()}},yn=class{constructor(e,t){t%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${t}ms is not a multiple of 1000ms.`),this.runner=e,this.timeout=t,this.counter=0,this.intervalToken=void 0,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=void 0)}schedule(e=this.timeout){e%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(e/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return this.intervalToken!==void 0}onInterval(){this.counter--,!(this.counter>0)&&(clearInterval(this.intervalToken),this.intervalToken=void 0,this.runner?.())}};var Mu,ji;(function(){let r=globalThis;typeof r.requestIdleCallback!="function"||typeof r.cancelIdleCallback!="function"?ji=(e,t,n)=>{gs(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:ji=(e,t,n)=>{let i=e.requestIdleCallback(t,typeof n=="number"?{timeout:n}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Mu=(e,t)=>ji(globalThis,e,t)})();var vn=class r{static fromPromise(e){let t=new r;return t.settleWith(e),t}get isRejected(){return this.outcome?.outcome===1}get isResolved(){return this.outcome?.outcome===0}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===0?this.outcome?.value:void 0}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.completeCallback(e),this.outcome={outcome:0,value:e},t()})}error(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.errorCallback(e),this.outcome={outcome:1,value:e},t()})}settleWith(e){return e.then(t=>this.complete(t),t=>this.error(t))}cancel(){return this.error(new we)}},Yi;(t=>{async function r(n){let i,o=await Promise.all(n.map(s=>s.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return o}t.settled=r;function e(n){return new Promise(async(i,o)=>{try{await n(i,o)}catch(s){o(s)}})}t.withAsyncBody=e})(Yi||={});var Zs=class r{static fromArray(e){return new r(t=>{t.emitMany(e)})}static fromPromise(e){return new r(async t=>{t.emitMany(await e)})}static fromPromisesResolveOrder(e){return new r(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new r(async t=>{await Promise.all(e.map(async n=>{for await(let i of n)t.emitOne(i)}))})}static{this.EMPTY=r.fromArray([])}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new y,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(e(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new r(async n=>{for await(let i of e)n.emitOne(t(i))})}map(e){return r.map(this,e)}static filter(e,t){return new r(async n=>{for await(let i of e)t(i)&&n.emitOne(i)})}filter(e){return r.filter(this,e)}static coalesce(e){return r.filter(e,t=>!!t)}coalesce(){return r.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return r.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};var Qi=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(e){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let t=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(t,e)}else this._unconsumedValues.push(e)}produceFinal(e){this._ensureNoFinalValue(),this._finalValue=e;for(let t of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(t,e);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new Qe("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(e,t){t.ok?e.complete(t.value):e.error(t.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let e=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return e.ok?Promise.resolve(e.value):Promise.reject(e.error)}else{let e=new vn;return this._unsatisfiedConsumers.push(e),e.p}}},Js=class r{constructor(e,t){this._onReturn=t;this._producerConsumer=new Qi;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async e=>(this._finishError(e),{done:!0,value:void 0})};queueMicrotask(async()=>{let n=e({emitOne:i=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:i}}),emitMany:i=>{for(let o of i)this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}})},reject:i=>this._finishError(i)});if(!this._producerConsumer.hasFinalValue)try{await n,this._finishOk()}catch(i){this._finishError(i)}})}static fromArray(e){return new r(t=>{t.emitMany(e)})}static fromPromise(e){return new r(async t=>{t.emitMany(await e)})}static fromPromisesResolveOrder(e){return new r(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new r(async t=>{await Promise.all(e.map(async n=>{for await(let i of n)t.emitOne(i)}))})}static{this.EMPTY=r.fromArray([])}static map(e,t){return new r(async n=>{for await(let i of e)n.emitOne(t(i))})}static tee(e){let t,n,i=new vn,o=async()=>{if(!(!t||!n))try{for await(let l of e)t.emitOne(l),n.emitOne(l)}catch(l){t.reject(l),n.reject(l)}finally{i.complete()}},s=new r(async l=>(t=l,o(),i.p)),a=new r(async l=>(n=l,o(),i.p));return[s,a]}map(e){return r.map(this,e)}static coalesce(e){return r.filter(e,t=>!!t)}coalesce(){return r.coalesce(this)}static filter(e,t){return new r(async n=>{for await(let i of e)t(i)&&n.emitOne(i)})}filter(e){return r.filter(this,e)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(e){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:e})}[Symbol.asyncIterator](){return this._iterator}};function ea(r){return(e,t,n)=>{let i=null,o=null;if(typeof n.value=="function"?(i="value",o=n.value):typeof n.get=="function"&&(i="get",o=n.get),!o||typeof t=="symbol")throw new Error("not supported");n[i]=r(o,t)}}function R(r,e,t){let n=null,i=null;if(typeof t.value=="function"?(n="value",i=t.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(n="get",i=t.get),!i)throw new Error("not supported");let o=`$memoize$${e}`;t[n]=function(...s){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,s)}),this[o]}}function Kt(r,e,t){return ea((n,i)=>{let o=`$debounce$${i}`,s=`$debounce$result$${i}`;return function(...a){this[s]||(this[s]=t?t():void 0),clearTimeout(this[o]),e&&(this[s]=e(this[s],...a),a=[this[s]]),this[o]=setTimeout(()=>{n.apply(this,a),this[s]=t?t():void 0},r)}})}function _r(r,e,t){return ea((n,i)=>{let o=`$throttle$timer$${i}`,s=`$throttle$result$${i}`,a=`$throttle$lastRun$${i}`,l=`$throttle$pending$${i}`;return function(...u){if(this[s]||(this[s]=t?t():void 0),(this[a]===null||this[a]===void 0)&&(this[a]=-Number.MAX_VALUE),e&&(this[s]=e(this[s],...u)),this[l])return;let p=this[a]+r;p<=Date.now()?(this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=t?t():void 0):(this[l]=!0,this[o]=setTimeout(()=>{this[l]=!1,this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=t?t():void 0},p-Date.now()))}})}function _n(r,e=0){if(!r||e>200)return r;if(typeof r=="object"){switch(r.$mid){case 1:return O.revive(r);case 2:return new RegExp(r.source,r.flags);case 17:return new Date(r.source)}if(r instanceof ee||r instanceof Uint8Array)return r;if(Array.isArray(r))for(let t=0;t>>7)t++;let n=ee.alloc(t);for(let i=0;e!==0;i++)n.buffer[i]=e&127,e=e>>>7,e>0&&(n.buffer[i]|=128);r.write(n)}var In=class{constructor(e){this.buffer=e;this.pos=0}read(e){let t=this.buffer.slice(this.pos,this.pos+e);return this.pos+=t.byteLength,t}},Ir=class{constructor(){this.buffers=[]}get buffer(){return ee.concat(this.buffers)}write(e){this.buffers.push(e)}};function et(r){let e=ee.alloc(1);return e.writeUInt8(r,0),e}var xt={Undefined:et(0),String:et(1),Buffer:et(2),VSBuffer:et(3),Array:et(4),Object:et(5),Uint:et(6)};function Tn(r,e){if(typeof e>"u")r.write(xt.Undefined);else if(typeof e=="string"){let t=ee.fromString(e);r.write(xt.String),$t(r,t.byteLength),r.write(t)}else if(ee.isNativeBuffer(e)){let t=ee.wrap(e);r.write(xt.Buffer),$t(r,t.byteLength),r.write(t)}else if(e instanceof ee)r.write(xt.VSBuffer),$t(r,e.byteLength),r.write(e);else if(Array.isArray(e)){r.write(xt.Array),$t(r,e.length);for(let t of e)Tn(r,t)}else if(typeof e=="number"&&(e|0)===e)r.write(xt.Uint),$t(r,e);else{let t=ee.fromString(JSON.stringify(e));r.write(xt.Object),$t(r,t.byteLength),r.write(t)}}function zt(r){switch(r.read(1).readUInt8(0)){case 0:return;case 1:return r.read(Wt(r)).toString();case 2:return r.read(Wt(r)).buffer;case 3:return r.read(Wt(r));case 4:{let t=Wt(r),n=[];for(let i=0;ithis.onRawMessage(o)),this.sendResponse({type:200})}registerChannel(e,t){this.channels.set(e,t),setTimeout(()=>this.flushPendingRequests(e),0)}sendResponse(e){switch(e.type){case 200:{let t=this.send([e.type]);this.logger?.logOutgoing(t,0,1,xr(e.type));return}case 201:case 202:case 204:case 203:{let t=this.send([e.type,e.id],e.data);this.logger?.logOutgoing(t,e.id,1,xr(e.type),e.data);return}}}send(e,t=void 0){let n=new Ir;return Tn(n,e),Tn(n,t),this.sendBuffer(n.buffer)}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onRawMessage(e){let t=new In(e),n=zt(t),i=zt(t),o=n[0];switch(o){case 100:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}: ${n[2]}.${n[3]}`,i),this.onPromise({type:o,id:n[1],channelName:n[2],name:n[3],arg:i});case 102:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}: ${n[2]}.${n[3]}`,i),this.onEventListen({type:o,id:n[1],channelName:n[2],name:n[3],arg:i});case 101:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}`),this.disposeActiveRequest({type:o,id:n[1]});case 103:return this.logger?.logIncoming(e.byteLength,n[1],1,`${qt(o)}`),this.disposeActiveRequest({type:o,id:n[1]})}}onPromise(e){let t=this.channels.get(e.channelName);if(!t){this.collectPendingRequest(e);return}let n=new Ue,i;try{i=t.call(this.ctx,e.name,e.arg,n.token)}catch(a){i=Promise.reject(a)}let o=e.id;i.then(a=>{this.sendResponse({id:o,data:a,type:201})},a=>{a instanceof Error?this.sendResponse({id:o,data:{message:a.message,name:a.name,stack:a.stack?a.stack.split(` `):void 0},type:202}):this.sendResponse({id:o,data:a,type:203})}).finally(()=>{s.dispose(),this.activeRequests.delete(e.id)});let s=Y(()=>n.cancel());this.activeRequests.set(e.id,s)}onEventListen(e){let t=this.channels.get(e.channelName);if(!t){this.collectPendingRequest(e);return}let n=e.id,o=t.listen(this.ctx,e.name,e.arg)(s=>this.sendResponse({id:n,data:s,type:204}));this.activeRequests.set(e.id,o)}disposeActiveRequest(e){let t=this.activeRequests.get(e.id);t&&(t.dispose(),this.activeRequests.delete(e.id))}collectPendingRequest(e){let t=this.pendingRequests.get(e.channelName);t||(t=[],this.pendingRequests.set(e.channelName,t));let n=setTimeout(()=>{console.error(`Unknown channel: ${e.channelName}`),e.type===100&&this.sendResponse({id:e.id,data:{name:"Unknown channel",message:`Channel name '${e.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);t.push({request:e,timeoutTimer:n})}flushPendingRequests(e){let t=this.pendingRequests.get(e);if(t){for(let n of t)switch(clearTimeout(n.timeoutTimer),n.request.type){case 100:this.onPromise(n.request);break;case 102:this.onEventListen(n.request);break}this.pendingRequests.delete(e)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Pe(this.activeRequests.values()),this.activeRequests.clear()}};var xn=class{constructor(e,t=null){this.protocol=e;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new y;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(n=>this.onBuffer(n)),this.logger=t}getChannel(e){let t=this;return{call(n,i,o){return t.isDisposed?Promise.reject(new we):t.requestPromise(e,n,i,o)},listen(n,i){return t.isDisposed?w.None:t.requestEvent(e,n,i)}}}requestPromise(e,t,n,i=bt.None){let o=this.lastRequestId++,a={id:o,type:100,channelName:e,name:t,arg:n};if(i.isCancellationRequested)return Promise.reject(new we);let l,u;return new Promise((c,d)=>{if(i.isCancellationRequested)return d(new we);let m=()=>{let S=H=>{switch(H.type){case 201:this.handlers.delete(o),c(H.data);break;case 202:{this.handlers.delete(o);let z=new Error(H.data.message);z.stack=Array.isArray(H.data.stack)?H.data.stack.join(` --`):H.data.stack,z.name=H.data.name,d(z);break}case 203:this.handlers.delete(o),d(H.data);break}};this.handlers.set(o,S),this.sendRequest(a)},h=null;this.state===1?m():(h=bn(S=>this.whenInitialized()),h.then(()=>{h=null,m()}));let b=()=>{h?(h.cancel(),h=null):this.sendRequest({id:o,type:101}),d(new we)};l=i.onCancellationRequested(b),u={dispose:on(()=>{b(),l.dispose()})},this.activeRequests.add(u)}).finally(()=>{l?.dispose(),this.activeRequests.delete(u)})}requestEvent(e,t,n){let i=this.lastRequestId++,s={id:i,type:102,channelName:e,name:t,arg:n},a=null,l=new y({onWillAddFirstListener:()=>{let p=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?p():(a=bn(c=>this.whenInitialized()),a.then(()=>{a=null,p()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:i,type:103})),this.handlers.delete(i)}}),u=p=>l.fire(p.data);return this.handlers.set(i,u),l.event}sendRequest(e){switch(e.type){case 100:case 102:{let t=this.send([e.type,e.id,e.channelName,e.name],e.arg);this.logger?.logOutgoing(t,e.id,0,`${qt(e.type)}: ${e.channelName}.${e.name}`,e.arg);return}case 101:case 103:{let t=this.send([e.type,e.id]);this.logger?.logOutgoing(t,e.id,0,qt(e.type));return}}}send(e,t=void 0){let n=new xr;return Tn(n,e),Tn(n,t),this.sendBuffer(n.buffer)}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onBuffer(e){let t=new In(e),n=zt(t),i=zt(t),o=n[0];switch(o){case 200:return this.logger?.logIncoming(e.byteLength,0,0,_r(o)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(e.byteLength,n[1],0,_r(o),i),this.onResponse({type:n[0],id:n[1],data:i})}}onResponse(e){if(e.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(e.id)?.(e)}get onDidInitializePromise(){return w.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Pe(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};f([R],xn.prototype,"onDidInitializePromise",1);var Ir=class{constructor(e,t,n){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new y;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new y;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new he;this.disposables.add(e(({protocol:i,onDidClientDisconnect:o})=>{let s=w.once(i.onMessage);this.disposables.add(s(a=>{let l=new In(a),u=zt(l),p=new En(i,u,t,n),c=new xn(i,t);this.channels.forEach((m,h)=>p.registerChannel(h,m));let d={channelServer:p,channelClient:c,ctx:u};this._connections.add(d),this._onDidAddConnection.fire(d),this.disposables.add(o(()=>{p.dispose(),c.dispose(),this._connections.delete(d),this._onDidRemoveConnection.fire(d)}))}))}))}get connections(){let e=[];return this._connections.forEach(t=>e.push(t)),e}getChannel(e,t){let n=this;return{call(i,o,s){let a;if(ut(t)){let u=Wo(n.connections.filter(t));a=u?Promise.resolve(u):w.toPromise(w.filter(n.onDidAddConnection,t))}else a=t.routeCall(n,i,o);let l=a.then(u=>u.channelClient.getChannel(e));return ta(l).call(i,o,s)},listen(i,o){if(ut(t))return n.getMulticastEvent(e,t,i,o);let s=t.routeEvent(n,i,o).then(a=>a.channelClient.getChannel(e));return ta(s).listen(i,o)}}}getMulticastEvent(e,t,n,i){let o=this,s,a=new y({onWillAddFirstListener:()=>{s=new he;let l=new cr,u=new Map,p=d=>{let h=d.channelClient.getChannel(e).listen(n,i),b=l.add(h);u.set(d,b)},c=d=>{let m=u.get(d);m&&(m.dispose(),u.delete(d))};o.connections.filter(t).forEach(p),w.filter(o.onDidAddConnection,t)(p,void 0,s),o.onDidRemoveConnection(c,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return o.disposables.add(a),a.event}registerChannel(e,t){this.channels.set(e,t);for(let n of this._connections)n.channelServer.registerChannel(e,t)}dispose(){this.disposables.dispose();for(let e of this._connections)e.channelClient.dispose(),e.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}};function ta(r){return{call(e,t,n){return r.then(i=>i.call(e,t,n))},listen(e,t){let n=new dr;return r.then(i=>n.input=i.listen(e,t)),n.event}}}var Tr;(i=>{function r(o,s,a){let l=o,u=a?.disableMarshalling,p=new Map;for(let c in l)t(c)&&p.set(c,w.buffer(l[c],c,!0,void 0,s));return new class{listen(c,d,m){let h=p.get(d);if(h)return h;let b=l[d];if(typeof b=="function"){if(n(d))return b.call(l,m);if(t(d))return p.set(d,w.buffer(l[d],d,!0,void 0,s)),p.get(d)}throw new Le(`Event not found: ${d}`)}call(c,d,m){let h=l[d];if(typeof h=="function"){if(!u&&Array.isArray(m))for(let S=0;Si.toLowerCase()===t);return n?r[n]:r[e]}import*as rc from"child_process";import{promises as da}from"fs";import*as L from"fs";import{tmpdir as Ku}from"os";import{promisify as Sn}from"util";var Fu=new Dt(1e4);function Zi(r){return na(r,"NFC",Fu)}var Nu=new Dt(1e4);function Bu(r){return na(r,"NFD",Nu)}var Vu=/[^\u0000-\u0080]/;function na(r,e,t){if(!r)return r;let n=t.get(r);if(n)return n;let i;return Vu.test(r)?i=r.normalize(e):i=r,t.set(r,i),i}var Rf=(function(){let r=new Dt(1e4),e=/[\u0300-\u036f]/g;return function(t){let n=r.get(t);if(n)return n;let i=Bu(t).replace(e,""),o=(i.length===t.length?i:t).toLowerCase();return r.set(t,o),o}})();async function oa(r,e=0,t){if($i(r))throw new Error("rimraf - will refuse to recursively delete root");return e===0?Ji(r):Wu(r,t)}async function Wu(r,e=Gs(Ku())){try{try{await L.promises.rename(r,e)}catch(t){return t.code==="ENOENT"?void 0:Ji(r)}Ji(e).catch(()=>{})}catch(t){if(t.code!=="ENOENT")throw t}}async function Ji(r){return L.promises.rm(r,{recursive:!0,force:!0,maxRetries:3})}async function Er(r,e){try{return await ra(r,e)}catch(t){if(t.code==="ENOENT"&&E&&$i(r))try{return await ra(`${r}.`,e)}catch{}throw t}}async function ra(r,e){return qu(await(e?$u(r):L.promises.readdir(r)))}async function $u(r){try{return await L.promises.readdir(r,{withFileTypes:!0})}catch(n){n.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",n)}let e=[],t=await Er(r);for(let n of t){let i=!1,o=!1,s=!1;try{let a=await L.promises.lstat(A(r,n));i=a.isFile(),o=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}e.push({name:n,isFile:()=>i,isDirectory:()=>o,isSymbolicLink:()=>s})}return e}function qu(r){return r.map(e=>typeof e=="string"?ve?Zi(e):e:(e.name=ve?Zi(e.name):e.name,e))}async function zu(r){let e=await Er(r),t=[];for(let n of e)await He.existsDirectory(A(r,n))&&t.push(n);return t}var He;(n=>{async function r(i){let o;try{if(o=await L.promises.lstat(i),!o.isSymbolicLink())return{stat:o}}catch{}try{return{stat:await L.promises.stat(i),symbolicLink:o?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};if(E&&s.code==="EACCES")try{return{stat:await L.promises.stat(await L.promises.readlink(i)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};throw a}throw s}}n.stat=r;async function e(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isFile()&&s?.dangling!==!0}catch{}return!1}n.existsFile=e;async function t(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isDirectory()&&s?.dangling!==!0}catch{}return!1}n.existsDirectory=t})(He||={});var Hu=new yr;function ju(r,e,t){return Hu.queueFor(O.file(r),()=>{let n=Qu(t);return new Promise((i,o)=>Xu(r,e,n,s=>s?o(s):i()))},Ys)}var sa=!0;function Gu(r){sa=r}function Xu(r,e,t,n){if(!sa)return L.writeFile(r,e,{mode:t.mode,flag:t.flag},n);L.open(r,t.flag,t.mode,(i,o)=>{if(i)return n(i);L.writeFile(o,e,s=>{if(s)return L.close(o,()=>n(s));L.fdatasync(o,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),Gu(!1)),L.close(o,l=>n(l))))})})}function Qu(r){return r?{mode:typeof r.mode=="number"?r.mode:438,flag:typeof r.flag=="string"?r.flag:"w"}:{mode:438,flag:"w"}}async function Yu(r,e,t=6e4){if(r!==e)try{E&&typeof t=="number"?await aa(r,e,Date.now(),t):await L.promises.rename(r,e)}catch(n){if(r.toLowerCase()!==e.toLowerCase()&&n.code==="EXDEV"||r.endsWith("."))await la(r,e,{preserveSymlinks:!1}),await oa(r,1);else throw n}}async function aa(r,e,t,n,i=0){try{return await L.promises.rename(r,e)}catch(o){if(o.code!=="EACCES"&&o.code!=="EPERM"&&o.code!=="EBUSY")throw o;if(Date.now()-t>=n)throw console.error(`[node.js fs] rename failed after ${i} retries with error: ${o}`),o;if(i===0){let s=!1;try{let{stat:a}=await He.stat(e);a.isFile()||(s=!0)}catch{}if(s)throw o}return await me(Math.min(100,i*10)),aa(r,e,t,n,i+1)}}async function la(r,e,t){return ua(r,e,{root:{source:r,target:e},options:t,handledSourcePaths:new Set})}var ia=511;async function ua(r,e,t){if(t.handledSourcePaths.has(r))return;t.handledSourcePaths.add(r);let{stat:n,symbolicLink:i}=await He.stat(r);if(i){if(t.options.preserveSymlinks)try{return await ec(r,e,t)}catch{}if(i.dangling)return}return n.isDirectory()?Zu(r,e,n.mode&ia,t):Ju(r,e,n.mode&ia)}async function Zu(r,e,t,n){await L.promises.mkdir(e,{recursive:!0,mode:t});let i=await Er(r);for(let o of i)await ua(A(r,o),A(e,o),n)}async function Ju(r,e,t){await L.promises.copyFile(r,e),await L.promises.chmod(e,t)}async function ec(r,e,t){let n=await L.promises.readlink(r);fn(n,t.root.source,!Ce)&&(n=A(t.root.target,n.substr(t.root.source.length+1))),await L.promises.symlink(n,e)}async function tc(r){try{return await Sn(L.realpath)(r)}catch{let e=nc(r);return await L.promises.access(e,L.constants.R_OK),e}}function nc(r){return Fi(Me(r),$e)}var Pn=new class{get read(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.read(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesRead:l,buffer:u}))})}get write(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.write(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesWritten:l,buffer:u}))})}get fdatasync(){return Sn(L.fdatasync)}get open(){return Sn(L.open)}get close(){return Sn(L.close)}get ftruncate(){return Sn(L.ftruncate)}async exists(r){try{return await L.promises.access(r),!0}catch{return!1}}get readdir(){return Er}get readDirsInDir(){return zu}get writeFile(){return ju}get rm(){return oa}get rename(){return Yu}get copy(){return la}get realpath(){return tc}};function pa(r=ne){return r.comspec||"cmd.exe"}async function ic(r){if(await Pn.exists(r)){let e;try{e=await da.stat(r)}catch(t){t.message.startsWith("EACCES")&&(e=await da.lstat(r))}return e?!e.isDirectory():!1}return!1}async function ma(r,e,t,n=ne,i=ic){if(sr(r))return await i(r)?r:void 0;if(e===void 0&&(e=ft()),ke(r)!=="."){let l=A(e,r);return await i(l)?l:void 0}let s=Yi(n,"PATH");if(t===void 0&&G(s)&&(t=s.split(ar)),t===void 0||t.length===0){let l=A(e,r);return await i(l)?l:void 0}for(let l of t){let u;if(sr(l)?u=A(l,r):u=A(e,l,r),E){let c=(Yi(n,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async d=>{let m=u+d;return await i(m)?m:void 0});for(let d of c){let m=await d;if(m)return m}}if(await i(u))return u}let a=A(e,r);return await i(a)?a:void 0}var wr=class extends En{constructor(e){super({send:t=>{try{process.send?.(t.buffer.toString("base64"))}catch{}},onMessage:w.fromNodeEventEmitter(process,"message",t=>ee.wrap(Buffer.from(t,"base64")))},e),process.once("disconnect",()=>this.dispose())}};function Sr(r){return!!r.parentPort}var eo=class{constructor(e){this.port=e;this.onMessage=w.fromNodeEventEmitter(this.port,"message",t=>t.data?ee.wrap(t.data):ee.alloc(0)),e.start()}send(e){this.port.postMessage(e.buffer)}disconnect(){this.port.close()}},Pr=class r extends Ir{static getOnDidClientConnect(e){ns(Sr(process),"Electron Utility Process");let t=new y;return process.parentPort.on("message",n=>{if(e?.handledClientConnection(n))return;let i=n.ports.at(0);i&&t.fire(i)}),w.map(t.event,n=>({protocol:new eo(n),onDidClientDisconnect:w.fromNodeEventEmitter(n,"close")}))}constructor(e){super(r.getOnDidClientConnect(e))}};import sc from"minimist";var B1={o:g(1944,null),e:g(1928,null),t:g(1959,null),m:g(1939,null)};var fa={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:g(1948,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:g(1915,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:g(1911,null)},maximize:{type:"boolean",cat:"o",description:g(1914,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1942,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1947,null)},help:{type:"boolean",alias:"h",description:g(1930,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(1920,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(1940,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(1910,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(1949,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(1929,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1941,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1950,null)},sessions:{type:"boolean",cat:"o",description:g(1952,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(1969,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(1936,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(1966,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1947,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(1930,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:g(1917,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(1927,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(1935,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:g(1953,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(1913,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(1934,null)},"pre-release":{type:"boolean",cat:"e",description:g(1933,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(1961,null)},"update-extensions":{type:"boolean",cat:"e",description:g(1964,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(1926,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:g(1912,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(1968,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(1967,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(1938,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(1954,null)},"prof-startup":{type:"boolean",cat:"t",description:g(1946,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(1923,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(1922,null)},sync:{type:"string",cat:"t",description:g(1960,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(1932,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(1931,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(1925,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(1924,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(1921,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(1937,null)},telemetry:{type:"boolean",cat:"t",description:g(1957,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},transient:{type:"boolean",cat:"t",description:g(1958,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},ac={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function to(r,e,t=ac){let n=r.find((d,m)=>d.length>0&&d[0]!=="-"&&e.hasOwnProperty(d)&&e[d].type==="subcommand"),i={},o=["_"],s=[],a={},l;for(let d in e){let m=e[d];m.type==="subcommand"?d===n&&(l=m):(m.alias&&(i[d]=m.alias),m.type==="string"||m.type==="string[]"?(o.push(d),m.deprecates&&o.push(...m.deprecates)):m.type==="boolean"&&(s.push(d),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[d]=m))}if(l&&n){let d=a;for(let S in l.options)d[S]=l.options[S];let m=r.filter(S=>S!==n),h=t.getSubcommandReporter?t.getSubcommandReporter(n):void 0,b=to(m,d,h);return{[n]:b,_:[]}}let u=sc(r,{string:o,boolean:s,alias:i}),p={},c=u;p._=u._.map(d=>String(d)).filter(d=>d.length>0),delete c._;for(let d in e){let m=e[d];if(m.type==="subcommand")continue;m.alias&&delete c[m.alias];let h=c[d];if(m.deprecates)for(let b of m.deprecates)c.hasOwnProperty(b)&&(h||(h=c[b],h&&t.onDeprecatedOption(b,m.deprecationMessage||g(1919,null,d))),delete c[b]);if(typeof h<"u"){if(m.type==="string[]"){if(Array.isArray(h)||(h=[h]),!m.allowEmptyValue){let b=h.filter(S=>S.length>0);b.length!==h.length&&(t.onEmptyValue(d),h=b.length>0?b:void 0)}}else m.type==="string"&&(Array.isArray(h)?(h=h.pop(),t.onMultipleValues(d,h)):!h&&!m.allowEmptyValue&&(t.onEmptyValue(d),h=void 0));p[d]=h,m.deprecationMessage&&t.onDeprecatedOption(d,m.deprecationMessage)}delete c[d]}for(let d in c)t.onUnknownOption(d);return p}import{homedir as hc,tmpdir as gc}from"os";var lc=60,uc=lc*60,no=uc*24,q1=no*7,z1=no*30,H1=no*365;function ha(r){return r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+(r.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var ga=/^([^.]+\..+)[:=](.+)$/,K=class{constructor(e,t,n){this._args=e;this.paths=t;this.productService=n}get appRoot(){return ke(qe.asFileUri("").fsPath)}get userHome(){return O.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return O.file(A(this.userDataPath,"User"))}get tmpDir(){return O.file(this.paths.tmpDir)}get cacheHome(){return O.file(this.userDataPath)}get stateResource(){return xe(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:te.vscodeUserData})}get userDataSyncHome(){return xe(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let e=ha(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=A(this.userDataPath,"logs",e)}return O.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return xe(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return xe(this.appSettingsHome,"History")}get keyboardLayoutResource(){return xe(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let e=ne.VSCODE_PORTABLE;return e?O.file(A(e,"argv.json")):xe(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return O.file(A(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let e=this.args["builtin-extensions-dir"];return e?gt(e):Me(A(qe.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let e=this.args["extensions-download-dir"];return e?O.file(gt(e)):O.file(A(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let e=this.args["extensions-dir"];if(e)return gt(e);let t=ne.VSCODE_EXTENSIONS;if(t)return t;let n=ne.VSCODE_PORTABLE;return n?A(n,"extensions"):xe(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let e=this.args["agent-plugins-dir"];if(e)return gt(e);let t=ne.VSCODE_AGENT_PLUGINS;if(t)return t;let n=ne.VSCODE_PORTABLE;return n?A(n,"agent-plugins"):xe(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let e=this.args.extensionDevelopmentPath;if(Array.isArray(e))return e.map(t=>/^[^:/?#]+?:\/\//.test(t)?O.parse(t):O.file(Me(t)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(e=>e==="ui"||e==="workspace"||e==="web"?e:"workspace")}get extensionTestsLocationURI(){let e=this.args.extensionTestsPath;if(e)return/^[^:/?#]+?:\/\//.test(e)?O.parse(e):O.file(Me(e))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let e=this.args["disable-extension"];if(e){if(typeof e=="string")return[e];if(Array.isArray(e)&&e.length>0)return e}return!1}get debugExtensionHost(){return cc(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!ne.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(e=>!ga.test(e))}get extensionLogLevel(){let e=[];for(let t of this.args.log||[]){let n=ga.exec(t);n?.[1]&&n[2]&&e.push([n[1],n[2]])}return e.length?e:void 0}get serviceMachineIdResource(){return xe(O.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let e=ne.VSCODE_PORTABLE;return e?O.file(A(e,"policy.json")):xe(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return xe(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(e){this.args.continueOn=e}get args(){return this._args}};f([R],K.prototype,"appRoot",1),f([R],K.prototype,"userHome",1),f([R],K.prototype,"userDataPath",1),f([R],K.prototype,"appSettingsHome",1),f([R],K.prototype,"tmpDir",1),f([R],K.prototype,"cacheHome",1),f([R],K.prototype,"stateResource",1),f([R],K.prototype,"userRoamingDataHome",1),f([R],K.prototype,"userDataSyncHome",1),f([R],K.prototype,"sync",1),f([R],K.prototype,"workspaceStorageHome",1),f([R],K.prototype,"localHistoryHome",1),f([R],K.prototype,"keyboardLayoutResource",1),f([R],K.prototype,"argvResource",1),f([R],K.prototype,"isExtensionDevelopment",1),f([R],K.prototype,"untitledWorkspacesHome",1),f([R],K.prototype,"builtinExtensionsPath",1),f([R],K.prototype,"extensionsDownloadLocation",1),f([R],K.prototype,"extensionsPath",1),f([R],K.prototype,"agentPluginsPath",1),f([R],K.prototype,"extensionDevelopmentLocationURI",1),f([R],K.prototype,"extensionDevelopmentKind",1),f([R],K.prototype,"extensionTestsLocationURI",1),f([R],K.prototype,"debugExtensionHost",1),f([R],K.prototype,"logLevel",1),f([R],K.prototype,"extensionLogLevel",1),f([R],K.prototype,"serviceMachineIdResource",1),f([R],K.prototype,"disableTelemetry",1),f([R],K.prototype,"disableExperiments",1),f([R],K.prototype,"disableWorkspaceTrust",1),f([R],K.prototype,"useInMemorySecretStorage",1),f([R],K.prototype,"policyFile",1),f([R],K.prototype,"agentSessionsWorkspace",1);function cc(r,e){return ya(r["inspect-extensions"],r["inspect-brk-extensions"],5870,e,r.debugId,r.extensionEnvironment)}function ya(r,e,t,n,i,o){let a=Number(e||r)||(n?null:t),l=a?!!e:!1,u;if(o)try{u=JSON.parse(o)}catch{}return{port:a,break:l,debugId:i,env:u}}import{homedir as va}from"os";import{resolve as dc,isAbsolute as pc,join as Ht}from"path";var mc=process.env.VSCODE_CWD||process.cwd();function ba(r,e){let t=fc(r,e),n=[t];return pc(t)||n.unshift(mc),dc(...n)}function fc(r,e){process.env.VSCODE_DEV&&(process.isEmbeddedApp?e="sessions-oss-dev":e="code-oss-dev");let t=process.env.VSCODE_PORTABLE;if(t)return Ht(t,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Ht(n,e);let i=r["user-data-dir"];if(i)return i;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let o=process.env.USERPROFILE;if(typeof o!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Ht(o,"AppData","Roaming")}break;case"darwin":n=Ht(va(),"Library","Application Support");break;case"linux":n=process.env.XDG_CONFIG_HOME||Ht(va(),".config");break;default:throw new Error("Platform not supported")}return Ht(n,e)}var Cr=class extends K{constructor(e,t){super(e,{homeDir:hc(),tmpDir:gc(),userDataDir:ba(e,t.nameShort)},t)}};function ro(r,e){return e&&(r.stack||r.stacktrace)?g(116,null,xa(r),_a(r.stack)||_a(r.stacktrace)):xa(r)}function _a(r){return Array.isArray(r)?r.join(` -+`):H.data.stack,z.name=H.data.name,d(z);break}case 203:this.handlers.delete(o),d(H.data);break}};this.handlers.set(o,S),this.sendRequest(a)},h=null;this.state===1?m():(h=bn(S=>this.whenInitialized()),h.then(()=>{h=null,m()}));let b=()=>{h?(h.cancel(),h=null):this.sendRequest({id:o,type:101}),d(new we)};l=i.onCancellationRequested(b),u={dispose:on(()=>{b(),l.dispose()})},this.activeRequests.add(u)}).finally(()=>{l?.dispose(),this.activeRequests.delete(u)})}requestEvent(e,t,n){let i=this.lastRequestId++,s={id:i,type:102,channelName:e,name:t,arg:n},a=null,l=new y({onWillAddFirstListener:()=>{let p=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?p():(a=bn(c=>this.whenInitialized()),a.then(()=>{a=null,p()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:i,type:103})),this.handlers.delete(i)}}),u=p=>l.fire(p.data);return this.handlers.set(i,u),l.event}sendRequest(e){switch(e.type){case 100:case 102:{let t=this.send([e.type,e.id,e.channelName,e.name],e.arg);this.logger?.logOutgoing(t,e.id,0,`${qt(e.type)}: ${e.channelName}.${e.name}`,e.arg);return}case 101:case 103:{let t=this.send([e.type,e.id]);this.logger?.logOutgoing(t,e.id,0,qt(e.type));return}}}send(e,t=void 0){let n=new xr;return Tn(n,e),Tn(n,t),this.sendBuffer(n.buffer)}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onBuffer(e){let t=new In(e),n=zt(t),i=zt(t),o=n[0];switch(o){case 200:return this.logger?.logIncoming(e.byteLength,0,0,_r(o)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(e.byteLength,n[1],0,_r(o),i),this.onResponse({type:n[0],id:n[1],data:i})}}onResponse(e){if(e.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(e.id)?.(e)}get onDidInitializePromise(){return w.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Pe(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};f([R],xn.prototype,"onDidInitializePromise",1);var Ir=class{constructor(e,t,n){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new y;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new y;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new he;this.disposables.add(e(({protocol:i,onDidClientDisconnect:o})=>{let s=w.once(i.onMessage);this.disposables.add(s(a=>{let l=new In(a),u=zt(l),p=new En(i,u,t,n),c=new xn(i,t);this.channels.forEach((m,h)=>p.registerChannel(h,m));let d={channelServer:p,channelClient:c,ctx:u};this._connections.add(d),this._onDidAddConnection.fire(d),this.disposables.add(o(()=>{p.dispose(),c.dispose(),this._connections.delete(d),this._onDidRemoveConnection.fire(d)}))}))}))}get connections(){let e=[];return this._connections.forEach(t=>e.push(t)),e}getChannel(e,t){let n=this;return{call(i,o,s){let a;if(ut(t)){let u=Wo(n.connections.filter(t));a=u?Promise.resolve(u):w.toPromise(w.filter(n.onDidAddConnection,t))}else a=t.routeCall(n,i,o);let l=a.then(u=>u.channelClient.getChannel(e));return ta(l).call(i,o,s)},listen(i,o){if(ut(t))return n.getMulticastEvent(e,t,i,o);let s=t.routeEvent(n,i,o).then(a=>a.channelClient.getChannel(e));return ta(s).listen(i,o)}}}getMulticastEvent(e,t,n,i){let o=this,s,a=new y({onWillAddFirstListener:()=>{s=new he;let l=new cr,u=new Map,p=d=>{let h=d.channelClient.getChannel(e).listen(n,i),b=l.add(h);u.set(d,b)},c=d=>{let m=u.get(d);m&&(m.dispose(),u.delete(d))};o.connections.filter(t).forEach(p),w.filter(o.onDidAddConnection,t)(p,void 0,s),o.onDidRemoveConnection(c,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return o.disposables.add(a),a.event}registerChannel(e,t){this.channels.set(e,t);for(let n of this._connections)n.channelServer.registerChannel(e,t)}dispose(){this.disposables.dispose();for(let e of this._connections)e.channelClient.dispose(),e.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}};function ta(r){return{call(e,t,n){return r.then(i=>i.call(e,t,n))},listen(e,t){let n=new dr;return r.then(i=>n.input=i.listen(e,t)),n.event}}}var Tr;(i=>{function r(o,s,a){let l=o,u=a?.disableMarshalling,p=new Map;for(let c in l)t(c)&&p.set(c,w.buffer(l[c],c,!0,void 0,s));return new class{listen(c,d,m){let h=p.get(d);if(h)return h;let b=l[d];if(typeof b=="function"){if(n(d))return b.call(l,m);if(t(d))return p.set(d,w.buffer(l[d],d,!0,void 0,s)),p.get(d)}throw new Le(`Event not found: ${d}`)}call(c,d,m){let h=l[d];if(typeof h=="function"){if(!u&&Array.isArray(m))for(let S=0;Si.toLowerCase()===t);return n?r[n]:r[e]}import*as rc from"child_process";import{promises as da}from"fs";import*as L from"fs";import{tmpdir as Ku}from"os";import{promisify as Sn}from"util";var Fu=new Dt(1e4);function Zi(r){return na(r,"NFC",Fu)}var Nu=new Dt(1e4);function Bu(r){return na(r,"NFD",Nu)}var Vu=/[^\u0000-\u0080]/;function na(r,e,t){if(!r)return r;let n=t.get(r);if(n)return n;let i;return Vu.test(r)?i=r.normalize(e):i=r,t.set(r,i),i}var Rf=(function(){let r=new Dt(1e4),e=/[\u0300-\u036f]/g;return function(t){let n=r.get(t);if(n)return n;let i=Bu(t).replace(e,""),o=(i.length===t.length?i:t).toLowerCase();return r.set(t,o),o}})();async function oa(r,e=0,t){if($i(r))throw new Error("rimraf - will refuse to recursively delete root");return e===0?Ji(r):Wu(r,t)}async function Wu(r,e=Gs(Ku())){try{try{await L.promises.rename(r,e)}catch(t){return t.code==="ENOENT"?void 0:Ji(r)}Ji(e).catch(()=>{})}catch(t){if(t.code!=="ENOENT")throw t}}async function Ji(r){return L.promises.rm(r,{recursive:!0,force:!0,maxRetries:3})}async function Er(r,e){try{return await ra(r,e)}catch(t){if(t.code==="ENOENT"&&E&&$i(r))try{return await ra(`${r}.`,e)}catch{}throw t}}async function ra(r,e){return qu(await(e?$u(r):L.promises.readdir(r)))}async function $u(r){try{return await L.promises.readdir(r,{withFileTypes:!0})}catch(n){n.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",n)}let e=[],t=await Er(r);for(let n of t){let i=!1,o=!1,s=!1;try{let a=await L.promises.lstat(A(r,n));i=a.isFile(),o=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}e.push({name:n,isFile:()=>i,isDirectory:()=>o,isSymbolicLink:()=>s})}return e}function qu(r){return r.map(e=>typeof e=="string"?ve?Zi(e):e:(e.name=ve?Zi(e.name):e.name,e))}async function zu(r){let e=await Er(r),t=[];for(let n of e)await He.existsDirectory(A(r,n))&&t.push(n);return t}var He;(n=>{async function r(i){let o;try{if(o=await L.promises.lstat(i),!o.isSymbolicLink())return{stat:o}}catch{}try{return{stat:await L.promises.stat(i),symbolicLink:o?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};if(E&&s.code==="EACCES")try{return{stat:await L.promises.stat(await L.promises.readlink(i)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};throw a}throw s}}n.stat=r;async function e(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isFile()&&s?.dangling!==!0}catch{}return!1}n.existsFile=e;async function t(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isDirectory()&&s?.dangling!==!0}catch{}return!1}n.existsDirectory=t})(He||={});var Hu=new yr;function ju(r,e,t){return Hu.queueFor(O.file(r),()=>{let n=Qu(t);return new Promise((i,o)=>Xu(r,e,n,s=>s?o(s):i()))},Ys)}var sa=!0;function Gu(r){sa=r}function Xu(r,e,t,n){if(!sa)return L.writeFile(r,e,{mode:t.mode,flag:t.flag},n);L.open(r,t.flag,t.mode,(i,o)=>{if(i)return n(i);L.writeFile(o,e,s=>{if(s)return L.close(o,()=>n(s));L.fdatasync(o,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),Gu(!1)),L.close(o,l=>n(l))))})})}function Qu(r){return r?{mode:typeof r.mode=="number"?r.mode:438,flag:typeof r.flag=="string"?r.flag:"w"}:{mode:438,flag:"w"}}async function Yu(r,e,t=6e4){if(r!==e)try{E&&typeof t=="number"?await aa(r,e,Date.now(),t):await L.promises.rename(r,e)}catch(n){if(r.toLowerCase()!==e.toLowerCase()&&n.code==="EXDEV"||r.endsWith("."))await la(r,e,{preserveSymlinks:!1}),await oa(r,1);else throw n}}async function aa(r,e,t,n,i=0){try{return await L.promises.rename(r,e)}catch(o){if(o.code!=="EACCES"&&o.code!=="EPERM"&&o.code!=="EBUSY")throw o;if(Date.now()-t>=n)throw console.error(`[node.js fs] rename failed after ${i} retries with error: ${o}`),o;if(i===0){let s=!1;try{let{stat:a}=await He.stat(e);a.isFile()||(s=!0)}catch{}if(s)throw o}return await me(Math.min(100,i*10)),aa(r,e,t,n,i+1)}}async function la(r,e,t){return ua(r,e,{root:{source:r,target:e},options:t,handledSourcePaths:new Set})}var ia=511;async function ua(r,e,t){if(t.handledSourcePaths.has(r))return;t.handledSourcePaths.add(r);let{stat:n,symbolicLink:i}=await He.stat(r);if(i){if(t.options.preserveSymlinks)try{return await ec(r,e,t)}catch{}if(i.dangling)return}return n.isDirectory()?Zu(r,e,n.mode&ia,t):Ju(r,e,n.mode&ia)}async function Zu(r,e,t,n){await L.promises.mkdir(e,{recursive:!0,mode:t});let i=await Er(r);for(let o of i)await ua(A(r,o),A(e,o),n)}async function Ju(r,e,t){await L.promises.copyFile(r,e),await L.promises.chmod(e,t)}async function ec(r,e,t){let n=await L.promises.readlink(r);fn(n,t.root.source,!Ce)&&(n=A(t.root.target,n.substr(t.root.source.length+1))),await L.promises.symlink(n,e)}async function tc(r){try{return await Sn(L.realpath)(r)}catch{let e=nc(r);return await L.promises.access(e,L.constants.R_OK),e}}function nc(r){return Fi(Me(r),$e)}var Pn=new class{get read(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.read(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesRead:l,buffer:u}))})}get write(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.write(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesWritten:l,buffer:u}))})}get fdatasync(){return Sn(L.fdatasync)}get open(){return Sn(L.open)}get close(){return Sn(L.close)}get ftruncate(){return Sn(L.ftruncate)}async exists(r){try{return await L.promises.access(r),!0}catch{return!1}}get readdir(){return Er}get readDirsInDir(){return zu}get writeFile(){return ju}get rm(){return oa}get rename(){return Yu}get copy(){return la}get realpath(){return tc}};function pa(r=ne){return r.comspec||"cmd.exe"}async function ic(r){if(await Pn.exists(r)){let e;try{e=await da.stat(r)}catch(t){t.message.startsWith("EACCES")&&(e=await da.lstat(r))}return e?!e.isDirectory():!1}return!1}async function ma(r,e,t,n=ne,i=ic){if(sr(r))return await i(r)?r:void 0;if(e===void 0&&(e=ft()),ke(r)!=="."){let l=A(e,r);return await i(l)?l:void 0}let s=Yi(n,"PATH");if(t===void 0&&G(s)&&(t=s.split(ar)),t===void 0||t.length===0){let l=A(e,r);return await i(l)?l:void 0}for(let l of t){let u;if(sr(l)?u=A(l,r):u=A(e,l,r),E){let c=(Yi(n,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async d=>{let m=u+d;return await i(m)?m:void 0});for(let d of c){let m=await d;if(m)return m}}if(await i(u))return u}let a=A(e,r);return await i(a)?a:void 0}var wr=class extends En{constructor(e){super({send:t=>{try{process.send?.(t.buffer.toString("base64"))}catch{}},onMessage:w.fromNodeEventEmitter(process,"message",t=>ee.wrap(Buffer.from(t,"base64")))},e),process.once("disconnect",()=>this.dispose())}};function Sr(r){return!!r.parentPort}var eo=class{constructor(e){this.port=e;this.onMessage=w.fromNodeEventEmitter(this.port,"message",t=>t.data?ee.wrap(t.data):ee.alloc(0)),e.start()}send(e){this.port.postMessage(e.buffer)}disconnect(){this.port.close()}},Pr=class r extends Ir{static getOnDidClientConnect(e){ns(Sr(process),"Electron Utility Process");let t=new y;return process.parentPort.on("message",n=>{if(e?.handledClientConnection(n))return;let i=n.ports.at(0);i&&t.fire(i)}),w.map(t.event,n=>({protocol:new eo(n),onDidClientDisconnect:w.fromNodeEventEmitter(n,"close")}))}constructor(e){super(r.getOnDidClientConnect(e))}};import sc from"minimist";var B1={o:g(1944,null),e:g(1928,null),t:g(1959,null),m:g(1939,null)};var fa={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:g(1948,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:g(1915,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:g(1911,null)},maximize:{type:"boolean",cat:"o",description:g(1914,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1942,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1947,null)},help:{type:"boolean",alias:"h",description:g(1930,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1916,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(1920,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(1940,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(1910,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(1949,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(1929,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1941,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1950,null)},sessions:{type:"boolean",cat:"o",description:g(1952,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(1969,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(1936,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(1966,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1947,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(1930,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:g(1917,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(1927,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(1935,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:g(1953,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(1913,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(1934,null)},"pre-release":{type:"boolean",cat:"e",description:g(1933,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(1961,null)},"update-extensions":{type:"boolean",cat:"e",description:g(1964,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(1926,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:g(1912,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(1968,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(1967,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(1938,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(1954,null)},"prof-startup":{type:"boolean",cat:"t",description:g(1946,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(1923,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(1922,null)},sync:{type:"string",cat:"t",description:g(1960,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(1932,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(1931,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(1925,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(1924,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(1921,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(1937,null)},telemetry:{type:"boolean",cat:"t",description:g(1957,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},transient:{type:"boolean",cat:"t",description:g(1958,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},ac={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function to(r,e,t=ac){let n=r.find((d,m)=>d.length>0&&d[0]!=="-"&&e.hasOwnProperty(d)&&e[d].type==="subcommand"),i={},o=["_"],s=[],a={},l;for(let d in e){let m=e[d];m.type==="subcommand"?d===n&&(l=m):(m.alias&&(i[d]=m.alias),m.type==="string"||m.type==="string[]"?(o.push(d),m.deprecates&&o.push(...m.deprecates)):m.type==="boolean"&&(s.push(d),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[d]=m))}if(l&&n){let d=a;for(let S in l.options)d[S]=l.options[S];let m=r.filter(S=>S!==n),h=t.getSubcommandReporter?t.getSubcommandReporter(n):void 0,b=to(m,d,h);return{[n]:b,_:[]}}let u=sc(r,{string:o,boolean:s,alias:i}),p={},c=u;p._=u._.map(d=>String(d)).filter(d=>d.length>0),delete c._;for(let d in e){let m=e[d];if(m.type==="subcommand")continue;m.alias&&delete c[m.alias];let h=c[d];if(m.deprecates)for(let b of m.deprecates)c.hasOwnProperty(b)&&(h||(h=c[b],h&&t.onDeprecatedOption(b,m.deprecationMessage||g(1919,null,d))),delete c[b]);if(typeof h<"u"){if(m.type==="string[]"){if(Array.isArray(h)||(h=[h]),!m.allowEmptyValue){let b=h.filter(S=>S.length>0);b.length!==h.length&&(t.onEmptyValue(d),h=b.length>0?b:void 0)}}else m.type==="string"&&(Array.isArray(h)?(h=h.pop(),t.onMultipleValues(d,h)):!h&&!m.allowEmptyValue&&(t.onEmptyValue(d),h=void 0));p[d]=h,m.deprecationMessage&&t.onDeprecatedOption(d,m.deprecationMessage)}delete c[d]}for(let d in c)t.onUnknownOption(d);return p}import{homedir as hc,tmpdir as gc}from"os";var lc=60,uc=lc*60,no=uc*24,q1=no*7,z1=no*30,H1=no*365;function ha(r){return r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+(r.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var ga=/^([^.]+\..+)[:=](.+)$/,K=class{constructor(e,t,n){this._args=e;this.paths=t;this.productService=n}get appRoot(){return ke(qe.asFileUri("").fsPath)}get userHome(){return O.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return O.file(A(this.userDataPath,"User"))}get tmpDir(){return O.file(this.paths.tmpDir)}get cacheHome(){return O.file(this.userDataPath)}get stateResource(){return xe(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:te.vscodeUserData})}get userDataSyncHome(){return xe(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let e=ha(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=A(this.userDataPath,"logs",e)}return O.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return xe(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return xe(this.appSettingsHome,"History")}get keyboardLayoutResource(){return xe(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let e=ne.VSCODE_PORTABLE;return e?O.file(A(e,"argv.json")):xe(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return O.file(A(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let e=this.args["builtin-extensions-dir"];return e?gt(e):Me(A(qe.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let e=this.args["extensions-download-dir"];return e?O.file(gt(e)):O.file(A(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let e=this.args["extensions-dir"];if(e)return gt(e);let t=ne.VSCODE_EXTENSIONS;if(t)return t;let n=ne.VSCODE_PORTABLE;return n?A(n,"extensions"):xe(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let e=this.args["agent-plugins-dir"];if(e)return gt(e);let t=ne.VSCODE_AGENT_PLUGINS;if(t)return t;let n=ne.VSCODE_PORTABLE;return n?A(n,"agent-plugins"):xe(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let e=this.args.extensionDevelopmentPath;if(Array.isArray(e))return e.map(t=>/^[^:/?#]+?:\/\//.test(t)?O.parse(t):O.file(Me(t)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(e=>e==="ui"||e==="workspace"||e==="web"?e:"workspace")}get extensionTestsLocationURI(){let e=this.args.extensionTestsPath;if(e)return/^[^:/?#]+?:\/\//.test(e)?O.parse(e):O.file(Me(e))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let e=this.args["disable-extension"];if(e){if(typeof e=="string")return[e];if(Array.isArray(e)&&e.length>0)return e}return!1}get debugExtensionHost(){return cc(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!ne.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(e=>!ga.test(e))}get extensionLogLevel(){let e=[];for(let t of this.args.log||[]){let n=ga.exec(t);n?.[1]&&n[2]&&e.push([n[1],n[2]])}return e.length?e:void 0}get serviceMachineIdResource(){return xe(O.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let e=ne.VSCODE_PORTABLE;return e?O.file(A(e,"policy.json")):xe(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return xe(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(e){this.args.continueOn=e}get args(){return this._args}};f([R],K.prototype,"appRoot",1),f([R],K.prototype,"userHome",1),f([R],K.prototype,"userDataPath",1),f([R],K.prototype,"appSettingsHome",1),f([R],K.prototype,"tmpDir",1),f([R],K.prototype,"cacheHome",1),f([R],K.prototype,"stateResource",1),f([R],K.prototype,"userRoamingDataHome",1),f([R],K.prototype,"userDataSyncHome",1),f([R],K.prototype,"sync",1),f([R],K.prototype,"workspaceStorageHome",1),f([R],K.prototype,"localHistoryHome",1),f([R],K.prototype,"keyboardLayoutResource",1),f([R],K.prototype,"argvResource",1),f([R],K.prototype,"isExtensionDevelopment",1),f([R],K.prototype,"untitledWorkspacesHome",1),f([R],K.prototype,"builtinExtensionsPath",1),f([R],K.prototype,"extensionsDownloadLocation",1),f([R],K.prototype,"extensionsPath",1),f([R],K.prototype,"agentPluginsPath",1),f([R],K.prototype,"extensionDevelopmentLocationURI",1),f([R],K.prototype,"extensionDevelopmentKind",1),f([R],K.prototype,"extensionTestsLocationURI",1),f([R],K.prototype,"debugExtensionHost",1),f([R],K.prototype,"logLevel",1),f([R],K.prototype,"extensionLogLevel",1),f([R],K.prototype,"serviceMachineIdResource",1),f([R],K.prototype,"disableTelemetry",1),f([R],K.prototype,"disableExperiments",1),f([R],K.prototype,"disableWorkspaceTrust",1),f([R],K.prototype,"useInMemorySecretStorage",1),f([R],K.prototype,"policyFile",1),f([R],K.prototype,"agentSessionsWorkspace",1);function cc(r,e){return ya(r["inspect-extensions"],r["inspect-brk-extensions"],5870,e,r.debugId,r.extensionEnvironment)}function ya(r,e,t,n,i,o){let a=Number(e||r)||(n?null:t),l=a?!!e:!1,u;if(o)try{u=JSON.parse(o)}catch{}return{port:a,break:l,debugId:i,env:u}}import{homedir as va}from"os";import{resolve as dc,isAbsolute as pc,join as Ht}from"path";var mc=process.env.VSCODE_CWD||process.cwd();function ba(r,e){let t=fc(r,e),n=[t];return pc(t)||n.unshift(mc),dc(...n)}function fc(r,e){process.env.VSCODE_DEV&&(process.isEmbeddedApp?e="sessions-oss-dev":e="code-oss-dev");let t=process.env.VSCODE_PORTABLE;if(t)return Ht(t,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Ht(n,e);let i=r["user-data-dir"];if(i)return i;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let o=process.env.USERPROFILE;if(typeof o!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Ht(o,"AppData","Roaming")}break;case"darwin":n=Ht(va(),"Library","Application Support");break;case"linux":default:n=process.env.XDG_CONFIG_HOME||Ht(va(),".config");break}return Ht(n,e)}var Cr=class extends K{constructor(e,t){super(e,{homeDir:hc(),tmpDir:gc(),userDataDir:ba(e,t.nameShort)},t)}};function ro(r,e){return e&&(r.stack||r.stacktrace)?g(116,null,xa(r),_a(r.stack)||_a(r.stacktrace)):xa(r)}function _a(r){return Array.isArray(r)?r.join(` - `):r}function xa(r){return r.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${r.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof r.code=="string"&&typeof r.errno=="number"&&typeof r.syscall=="string"?g(115,null,r.message):r.message||g(113,null)}function io(r=null,e=!1){if(!r)return g(113,null);if(Array.isArray(r)){let t=Ko(r),n=io(t[0],e);return t.length>1?g(114,null,n,t.length):n}if(G(r))return r;if(r.detail){let t=r.detail;if(t.error)return ro(t.error,e);if(t.exception)return ro(t.exception,e)}return r.stack?ro(r,e):r.message?r.message:g(113,null)}function Ta(r){return so(r,0)}function so(r,e){switch(typeof r){case"object":return r===null?je(349,e):Array.isArray(r)?vc(r,e):bc(r,e);case"string":return Ea(r,e);case"boolean":return yc(r,e);case"number":return je(r,e);case"undefined":return je(937,e);default:return je(617,e)}}function je(r,e){return(e<<5)-e+r|0}function yc(r,e){return je(r?433:863,e)}function Ea(r,e){e=je(149417,e);for(let t=0,n=r.length;tso(n,t),e)}function bc(r,e){return e=je(181387,e),Object.keys(r).sort().reduce((t,n)=>(t=Ea(n,t),so(r[n],t)),e)}function oo(r,e,t=32){let n=t-e,i=~((1<>>n)>>>0}function Cn(r,e=32){return r instanceof ArrayBuffer?as(ee.wrap(new Uint8Array(r))):(r>>>0).toString(16).padStart(e/4,"0")}var Ia=class r{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}static{this._bigBlock32=new DataView(new ArrayBuffer(320))}update(e){let t=e.length;if(t===0)return;let n=this._buff,i=this._buffLen,o=this._leftoverHighSurrogate,s,a;for(o!==0?(s=o,a=-1,o=0):(s=e.charCodeAt(0),a=0);;){let l=s;if(Ws(s))if(a+1>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Cn(this._h0)+Cn(this._h1)+Cn(this._h2)+Cn(this._h3)+Cn(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,this._buff.subarray(this._buffLen).fill(0),this._buffLen>56&&(this._step(),this._buff.fill(0));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let e=r._bigBlock32,t=this._buffDV;for(let c=0;c<64;c+=4)e.setUint32(c,t.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)e.setUint32(c,oo(e.getUint32(c-12,!1)^e.getUint32(c-32,!1)^e.getUint32(c-56,!1)^e.getUint32(c-64,!1),1),!1);let n=this._h0,i=this._h1,o=this._h2,s=this._h3,a=this._h4,l,u,p;for(let c=0;c<80;c++)c<20?(l=i&o|~i&s,u=1518500249):c<40?(l=i^o^s,u=1859775393):c<60?(l=i&o|i&s|o&s,u=2400959708):(l=i^o^s,u=3395469782),p=oo(n,5)+l+a+u+e.getUint32(c*4,!1)&4294967295,a=s,s=o,o=oo(i,30),i=n,n=p;this._h0=this._h0+n&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+o&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};function ao(...r){switch(r.length){case 1:return g(1901,null,r[0]);case 2:return g(1902,null,r[0],r[1]);case 3:return g(1903,null,r[0],r[1],r[2]);default:return}}var _c=g(1900,null),xc=g(1899,null),tt=class r{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw Fo(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){let t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){let t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(ao("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(ao("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(ao("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){let t=this._start,n=this._input.substring(this._start,this._current),i={type:19,offset:this._start,lexeme:n};this._errors.push({offset:t,lexeme:n,additionalInfo:e}),this._tokens.push(i)}_string(){this.stringRe.lastIndex=this._start;let e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;let t=this._input.substring(this._start,this._current),n=r._keywords.get(t);n?this._addToken(n):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(_c);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,n=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(xc);return}let o=this._input.charCodeAt(e);if(t)t=!1;else if(o===47&&!n){e++;break}else o===91?n=!0:o===92?t=!0:o===93&&(n=!1);e++}for(;e=this._input.length}};var nt;(i=>{i.serviceIds=new Map,i.DI_TARGET="$di$target",i.DI_DEPENDENCIES="$di$dependencies";function n(o){return o[i.DI_DEPENDENCIES]||[]}i.getServiceDependencies=n})(nt||={});var yh=Ie("instantiationService");function Ic(r,e,t){e[nt.DI_TARGET]===e?e[nt.DI_DEPENDENCIES].push({id:r,index:t}):(e[nt.DI_DEPENDENCIES]=[{id:r,index:t}],e[nt.DI_TARGET]=e)}function Ie(r){if(nt.serviceIds.has(r))return nt.serviceIds.get(r);let e=function(t,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ic(e,t,i)};return e.toString=()=>r,nt.serviceIds.set(r,e),e}var re=new Map;re.set("false",!1);re.set("true",!0);re.set("isMac",ve);re.set("isLinux",Ce);re.set("isWindows",E);re.set("isWeb",pt);re.set("isMacNative",ve&&!pt);re.set("isEdge",bs);re.set("isFirefox",ys);re.set("isChrome",wi);re.set("isSafari",vs);var Tc=Object.prototype.hasOwnProperty;var Ec={regexParsingWithErrorRecovery:!0},wc=g(1880,null),Sc=g(1881,null),Pc=g(1883,null),wa=g(1879,null),Cc=g(1886,null),kc=g(1887,null),Rc=g(1884,null),Lc=g(1885,null),lo=class r{constructor(e=Ec){this._config=e;this._scanner=new tt;this._tokens=[];this._current=0;this._parsingErrors=[];this._flagsGYRe=/g|y/g}static{this._parseError=new Error}get lexingErrors(){return this._scanner.errors}get parsingErrors(){return this._parsingErrors}parse(e){if(e===""){this._parsingErrors.push({message:wc,offset:0,lexeme:"",additionalInfo:Sc});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{let t=this._expr();if(!this._isAtEnd()){let n=this._peek(),i=n.type===17?kc:void 0;throw this._parsingErrors.push({message:Cc,offset:n.offset,lexeme:tt.getLexeme(n),additionalInfo:i}),r._parseError}return t}catch(t){if(t!==r._parseError)throw t;return}}_expr(){return this._or()}_or(){let e=[this._and()];for(;this._matchOne(16);){let t=this._and();e.push(t)}return e.length===1?e[0]:ae.or(...e)}_and(){let e=[this._term()];for(;this._matchOne(15);){let t=this._term();e.push(t)}return e.length===1?e[0]:ae.and(...e)}_term(){if(this._matchOne(2)){let e=this._peek();switch(e.type){case 11:return this._advance(),ue.INSTANCE;case 12:return this._advance(),fe.INSTANCE;case 0:{this._advance();let t=this._expr();return this._consume(1,wa),t?.negate()}case 17:return this._advance(),Tt.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){let e=this._peek();switch(e.type){case 11:return this._advance(),ae.true();case 12:return this._advance(),ae.false();case 0:{this._advance();let t=this._expr();return this._consume(1,wa),t}case 17:{let t=e.lexeme;if(this._advance(),this._matchOne(9)){let i=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),i.type!==10)throw this._errExpectedButGot("REGEX",i);let o=i.lexeme,s=o.lastIndexOf("/"),a=s===o.length-1?void 0:this._removeFlagsGY(o.substring(s+1)),l;try{l=new RegExp(o.substring(1,s),a)}catch{throw this._errExpectedButGot("REGEX",i)}return Mn.create(t,l)}switch(i.type){case 10:case 19:{let o=[i.lexeme];this._advance();let s=this._peek(),a=0;for(let d=0;d=0){let u=o.slice(a+1,l),p=o[l+1]==="i"?"i":"";try{s=new RegExp(u,p)}catch{throw this._errExpectedButGot("REGEX",i)}}}if(s===null)throw this._errExpectedButGot("REGEX",i);return Mn.create(t,s)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,Pc);let i=this._value();return ae.notIn(t,i)}switch(this._peek().type){case 3:{this._advance();let i=this._value();if(this._previous().type===18)return ae.equals(t,i);switch(i){case"true":return ae.has(t);case"false":return ae.not(t);default:return ae.equals(t,i)}}case 4:{this._advance();let i=this._value();if(this._previous().type===18)return ae.notEquals(t,i);switch(i){case"true":return ae.not(t);case"false":return ae.has(t);default:return ae.notEquals(t,i)}}case 5:return this._advance(),An.create(t,this._value());case 6:return this._advance(),On.create(t,this._value());case 7:return this._advance(),jt.create(t,this._value());case 8:return this._advance(),Dn.create(t,this._value());case 13:return this._advance(),ae.in(t,this._value());default:return ae.has(t)}}case 20:throw this._parsingErrors.push({message:Rc,offset:e.offset,lexeme:"",additionalInfo:Lc}),r._parseError;default:throw this._errExpectedButGot(`true | false | KEY +-`):H.data.stack,z.name=H.data.name,d(z);break}case 203:this.handlers.delete(o),d(H.data);break}};this.handlers.set(o,S),this.sendRequest(a)},h=null;this.state===1?m():(h=bn(S=>this.whenInitialized()),h.then(()=>{h=null,m()}));let b=()=>{h?(h.cancel(),h=null):this.sendRequest({id:o,type:101}),d(new we)};l=i.onCancellationRequested(b),u={dispose:on(()=>{b(),l.dispose()})},this.activeRequests.add(u)}).finally(()=>{l?.dispose(),this.activeRequests.delete(u)})}requestEvent(e,t,n){let i=this.lastRequestId++,s={id:i,type:102,channelName:e,name:t,arg:n},a=null,l=new y({onWillAddFirstListener:()=>{let p=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?p():(a=bn(c=>this.whenInitialized()),a.then(()=>{a=null,p()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:i,type:103})),this.handlers.delete(i)}}),u=p=>l.fire(p.data);return this.handlers.set(i,u),l.event}sendRequest(e){switch(e.type){case 100:case 102:{let t=this.send([e.type,e.id,e.channelName,e.name],e.arg);this.logger?.logOutgoing(t,e.id,0,`${qt(e.type)}: ${e.channelName}.${e.name}`,e.arg);return}case 101:case 103:{let t=this.send([e.type,e.id]);this.logger?.logOutgoing(t,e.id,0,qt(e.type));return}}}send(e,t=void 0){let n=new Ir;return Tn(n,e),Tn(n,t),this.sendBuffer(n.buffer)}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onBuffer(e){let t=new In(e),n=zt(t),i=zt(t),o=n[0];switch(o){case 200:return this.logger?.logIncoming(e.byteLength,0,0,xr(o)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(e.byteLength,n[1],0,xr(o),i),this.onResponse({type:n[0],id:n[1],data:i})}}onResponse(e){if(e.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(e.id)?.(e)}get onDidInitializePromise(){return w.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Pe(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};f([R],xn.prototype,"onDidInitializePromise",1);var Tr=class{constructor(e,t,n){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new y;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new y;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new he;this.disposables.add(e(({protocol:i,onDidClientDisconnect:o})=>{let s=w.once(i.onMessage);this.disposables.add(s(a=>{let l=new In(a),u=zt(l),p=new En(i,u,t,n),c=new xn(i,t);this.channels.forEach((m,h)=>p.registerChannel(h,m));let d={channelServer:p,channelClient:c,ctx:u};this._connections.add(d),this._onDidAddConnection.fire(d),this.disposables.add(o(()=>{p.dispose(),c.dispose(),this._connections.delete(d),this._onDidRemoveConnection.fire(d)}))}))}))}get connections(){let e=[];return this._connections.forEach(t=>e.push(t)),e}getChannel(e,t){let n=this;return{call(i,o,s){let a;if(ut(t)){let u=Wo(n.connections.filter(t));a=u?Promise.resolve(u):w.toPromise(w.filter(n.onDidAddConnection,t))}else a=t.routeCall(n,i,o);let l=a.then(u=>u.channelClient.getChannel(e));return ta(l).call(i,o,s)},listen(i,o){if(ut(t))return n.getMulticastEvent(e,t,i,o);let s=t.routeEvent(n,i,o).then(a=>a.channelClient.getChannel(e));return ta(s).listen(i,o)}}}getMulticastEvent(e,t,n,i){let o=this,s,a=new y({onWillAddFirstListener:()=>{s=new he;let l=new dr,u=new Map,p=d=>{let h=d.channelClient.getChannel(e).listen(n,i),b=l.add(h);u.set(d,b)},c=d=>{let m=u.get(d);m&&(m.dispose(),u.delete(d))};o.connections.filter(t).forEach(p),w.filter(o.onDidAddConnection,t)(p,void 0,s),o.onDidRemoveConnection(c,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return o.disposables.add(a),a.event}registerChannel(e,t){this.channels.set(e,t);for(let n of this._connections)n.channelServer.registerChannel(e,t)}dispose(){this.disposables.dispose();for(let e of this._connections)e.channelClient.dispose(),e.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}};function ta(r){return{call(e,t,n){return r.then(i=>i.call(e,t,n))},listen(e,t){let n=new pr;return r.then(i=>n.input=i.listen(e,t)),n.event}}}var Er;(i=>{function r(o,s,a){let l=o,u=a?.disableMarshalling,p=new Map;for(let c in l)t(c)&&p.set(c,w.buffer(l[c],c,!0,void 0,s));return new class{listen(c,d,m){let h=p.get(d);if(h)return h;let b=l[d];if(typeof b=="function"){if(n(d))return b.call(l,m);if(t(d))return p.set(d,w.buffer(l[d],d,!0,void 0,s)),p.get(d)}throw new Le(`Event not found: ${d}`)}call(c,d,m){let h=l[d];if(typeof h=="function"){if(!u&&Array.isArray(m))for(let S=0;Si.toLowerCase()===t);return n?r[n]:r[e]}import*as rc from"child_process";import{promises as da}from"fs";import*as L from"fs";import{tmpdir as Ku}from"os";import{promisify as Sn}from"util";var Fu=new Dt(1e4);function Ji(r){return na(r,"NFC",Fu)}var Nu=new Dt(1e4);function Bu(r){return na(r,"NFD",Nu)}var Vu=/[^\u0000-\u0080]/;function na(r,e,t){if(!r)return r;let n=t.get(r);if(n)return n;let i;return Vu.test(r)?i=r.normalize(e):i=r,t.set(r,i),i}var Lf=(function(){let r=new Dt(1e4),e=/[\u0300-\u036f]/g;return function(t){let n=r.get(t);if(n)return n;let i=Bu(t).replace(e,""),o=(i.length===t.length?i:t).toLowerCase();return r.set(t,o),o}})();async function oa(r,e=0,t){if(qi(r))throw new Error("rimraf - will refuse to recursively delete root");return e===0?eo(r):Wu(r,t)}async function Wu(r,e=Gs(Ku())){try{try{await L.promises.rename(r,e)}catch(t){return t.code==="ENOENT"?void 0:eo(r)}eo(e).catch(()=>{})}catch(t){if(t.code!=="ENOENT")throw t}}async function eo(r){return L.promises.rm(r,{recursive:!0,force:!0,maxRetries:3})}async function wr(r,e){try{return await ra(r,e)}catch(t){if(t.code==="ENOENT"&&E&&qi(r))try{return await ra(`${r}.`,e)}catch{}throw t}}async function ra(r,e){return qu(await(e?$u(r):L.promises.readdir(r)))}async function $u(r){try{return await L.promises.readdir(r,{withFileTypes:!0})}catch(n){n.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",n)}let e=[],t=await wr(r);for(let n of t){let i=!1,o=!1,s=!1;try{let a=await L.promises.lstat(A(r,n));i=a.isFile(),o=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}e.push({name:n,isFile:()=>i,isDirectory:()=>o,isSymbolicLink:()=>s})}return e}function qu(r){return r.map(e=>typeof e=="string"?ve?Ji(e):e:(e.name=ve?Ji(e.name):e.name,e))}async function zu(r){let e=await wr(r),t=[];for(let n of e)await He.existsDirectory(A(r,n))&&t.push(n);return t}var He;(n=>{async function r(i){let o;try{if(o=await L.promises.lstat(i),!o.isSymbolicLink())return{stat:o}}catch{}try{return{stat:await L.promises.stat(i),symbolicLink:o?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};if(E&&s.code==="EACCES")try{return{stat:await L.promises.stat(await L.promises.readlink(i)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};throw a}throw s}}n.stat=r;async function e(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isFile()&&s?.dangling!==!0}catch{}return!1}n.existsFile=e;async function t(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isDirectory()&&s?.dangling!==!0}catch{}return!1}n.existsDirectory=t})(He||={});var Hu=new vr;function ju(r,e,t){return Hu.queueFor(O.file(r),()=>{let n=Qu(t);return new Promise((i,o)=>Xu(r,e,n,s=>s?o(s):i()))},Ys)}var sa=!0;function Gu(r){sa=r}function Xu(r,e,t,n){if(!sa)return L.writeFile(r,e,{mode:t.mode,flag:t.flag},n);L.open(r,t.flag,t.mode,(i,o)=>{if(i)return n(i);L.writeFile(o,e,s=>{if(s)return L.close(o,()=>n(s));L.fdatasync(o,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),Gu(!1)),L.close(o,l=>n(l))))})})}function Qu(r){return r?{mode:typeof r.mode=="number"?r.mode:438,flag:typeof r.flag=="string"?r.flag:"w"}:{mode:438,flag:"w"}}async function Yu(r,e,t=6e4){if(r!==e)try{E&&typeof t=="number"?await aa(r,e,Date.now(),t):await L.promises.rename(r,e)}catch(n){if(r.toLowerCase()!==e.toLowerCase()&&n.code==="EXDEV"||r.endsWith("."))await la(r,e,{preserveSymlinks:!1}),await oa(r,1);else throw n}}async function aa(r,e,t,n,i=0){try{return await L.promises.rename(r,e)}catch(o){if(o.code!=="EACCES"&&o.code!=="EPERM"&&o.code!=="EBUSY")throw o;if(Date.now()-t>=n)throw console.error(`[node.js fs] rename failed after ${i} retries with error: ${o}`),o;if(i===0){let s=!1;try{let{stat:a}=await He.stat(e);a.isFile()||(s=!0)}catch{}if(s)throw o}return await me(Math.min(100,i*10)),aa(r,e,t,n,i+1)}}async function la(r,e,t){return ua(r,e,{root:{source:r,target:e},options:t,handledSourcePaths:new Set})}var ia=511;async function ua(r,e,t){if(t.handledSourcePaths.has(r))return;t.handledSourcePaths.add(r);let{stat:n,symbolicLink:i}=await He.stat(r);if(i){if(t.options.preserveSymlinks)try{return await ec(r,e,t)}catch{}if(i.dangling)return}return n.isDirectory()?Zu(r,e,n.mode&ia,t):Ju(r,e,n.mode&ia)}async function Zu(r,e,t,n){await L.promises.mkdir(e,{recursive:!0,mode:t});let i=await wr(r);for(let o of i)await ua(A(r,o),A(e,o),n)}async function Ju(r,e,t){await L.promises.copyFile(r,e),await L.promises.chmod(e,t)}async function ec(r,e,t){let n=await L.promises.readlink(r);fn(n,t.root.source,!Ce)&&(n=A(t.root.target,n.substr(t.root.source.length+1))),await L.promises.symlink(n,e)}async function tc(r){try{return await Sn(L.realpath)(r)}catch{let e=nc(r);return await L.promises.access(e,L.constants.R_OK),e}}function nc(r){return Ni(Me(r),$e)}var Pn=new class{get read(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.read(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesRead:l,buffer:u}))})}get write(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.write(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesWritten:l,buffer:u}))})}get fdatasync(){return Sn(L.fdatasync)}get open(){return Sn(L.open)}get close(){return Sn(L.close)}get ftruncate(){return Sn(L.ftruncate)}async exists(r){try{return await L.promises.access(r),!0}catch{return!1}}get readdir(){return wr}get readDirsInDir(){return zu}get writeFile(){return ju}get rm(){return oa}get rename(){return Yu}get copy(){return la}get realpath(){return tc}};function pa(r=te){return r.comspec||"cmd.exe"}async function ic(r){if(await Pn.exists(r)){let e;try{e=await da.stat(r)}catch(t){t.message.startsWith("EACCES")&&(e=await da.lstat(r))}return e?!e.isDirectory():!1}return!1}async function ma(r,e,t,n=te,i=ic){if(sr(r))return await i(r)?r:void 0;if(e===void 0&&(e=ft()),ke(r)!=="."){let l=A(e,r);return await i(l)?l:void 0}let s=Zi(n,"PATH");if(t===void 0&&G(s)&&(t=s.split(ar)),t===void 0||t.length===0){let l=A(e,r);return await i(l)?l:void 0}for(let l of t){let u;if(sr(l)?u=A(l,r):u=A(e,l,r),E){let c=(Zi(n,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async d=>{let m=u+d;return await i(m)?m:void 0});for(let d of c){let m=await d;if(m)return m}}if(await i(u))return u}let a=A(e,r);return await i(a)?a:void 0}var Sr=class extends En{constructor(e){super({send:t=>{try{process.send?.(t.buffer.toString("base64"))}catch{}},onMessage:w.fromNodeEventEmitter(process,"message",t=>ee.wrap(Buffer.from(t,"base64")))},e),process.once("disconnect",()=>this.dispose())}};function Pr(r){return!!r.parentPort}var to=class{constructor(e){this.port=e;this.onMessage=w.fromNodeEventEmitter(this.port,"message",t=>t.data?ee.wrap(t.data):ee.alloc(0)),e.start()}send(e){this.port.postMessage(e.buffer)}disconnect(){this.port.close()}},Cr=class r extends Tr{static getOnDidClientConnect(e){ns(Pr(process),"Electron Utility Process");let t=new y;return process.parentPort.on("message",n=>{if(e?.handledClientConnection(n))return;let i=n.ports.at(0);i&&t.fire(i)}),w.map(t.event,n=>({protocol:new to(n),onDidClientDisconnect:w.fromNodeEventEmitter(n,"close")}))}constructor(e){super(r.getOnDidClientConnect(e))}};import sc from"minimist";var V1={o:g(1966,null),e:g(1950,null),t:g(1980,null),m:g(1961,null)};var fa={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:g(1970,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:g(1937,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:g(1932,null)},maximize:{type:"boolean",cat:"o",description:g(1936,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1973,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1964,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",alias:"h",description:g(1952,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(1942,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(1962,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(1931,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(1971,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1963,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1972,null)},agents:{type:"boolean",cat:"o",deprecates:["sessions"],description:g(1934,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(1990,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(1958,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(1987,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(1952,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:g(1939,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(1949,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(1957,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:g(1974,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(1935,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(1956,null)},"pre-release":{type:"boolean",cat:"e",description:g(1955,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(1982,null)},"update-extensions":{type:"boolean",cat:"e",description:g(1985,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(1948,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:g(1933,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(1989,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(1988,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(1960,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(1975,null)},"prof-startup":{type:"boolean",cat:"t",description:g(1968,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(1945,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(1944,null)},sync:{type:"string",cat:"t",description:g(1981,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(1954,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(1953,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(1947,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(1946,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(1943,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(1959,null)},telemetry:{type:"boolean",cat:"t",description:g(1978,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},"share-secrets-with-agents-app":{type:"boolean"},transient:{type:"boolean",cat:"t",description:g(1979,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},ac={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function no(r,e,t=ac){let n=r.find((d,m)=>d.length>0&&d[0]!=="-"&&e.hasOwnProperty(d)&&e[d].type==="subcommand"),i={},o=["_"],s=[],a={},l;for(let d in e){let m=e[d];m.type==="subcommand"?d===n&&(l=m):(m.alias&&(i[d]=m.alias),m.type==="string"||m.type==="string[]"?(o.push(d),m.deprecates&&o.push(...m.deprecates)):m.type==="boolean"&&(s.push(d),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[d]=m))}if(l&&n){let d=a;for(let S in l.options)d[S]=l.options[S];let m=r.filter(S=>S!==n),h=t.getSubcommandReporter?t.getSubcommandReporter(n):void 0,b=no(m,d,h);return{[n]:b,_:[]}}let u=sc(r,{string:o,boolean:s,alias:i}),p={},c=u;p._=u._.map(d=>String(d)).filter(d=>d.length>0),delete c._;for(let d in e){let m=e[d];if(m.type==="subcommand")continue;m.alias&&delete c[m.alias];let h=c[d];if(m.deprecates)for(let b of m.deprecates)c.hasOwnProperty(b)&&(h||(h=c[b],h&&t.onDeprecatedOption(b,m.deprecationMessage||g(1941,null,d))),delete c[b]);if(typeof h<"u"){if(m.type==="string[]"){if(Array.isArray(h)||(h=[h]),!m.allowEmptyValue){let b=h.filter(S=>S.length>0);b.length!==h.length&&(t.onEmptyValue(d),h=b.length>0?b:void 0)}}else m.type==="string"&&(Array.isArray(h)?(h=h.pop(),t.onMultipleValues(d,h)):!h&&!m.allowEmptyValue&&(t.onEmptyValue(d),h=void 0));p[d]=h,m.deprecationMessage&&t.onDeprecatedOption(d,m.deprecationMessage)}delete c[d]}for(let d in c)t.onUnknownOption(d);return p}import{homedir as hc,tmpdir as gc}from"os";var lc=60,uc=lc*60,ro=uc*24,z1=ro*7,H1=ro*30,j1=ro*365;function ha(r){return r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+(r.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var ga=/^([^.]+\..+)[:=](.+)$/,K=class{constructor(e,t,n){this._args=e;this.paths=t;this.productService=n}get appRoot(){return ke(qe.asFileUri("").fsPath)}get userHome(){return O.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return O.file(A(this.userDataPath,"User"))}get tmpDir(){return O.file(this.paths.tmpDir)}get cacheHome(){return O.file(this.userDataPath)}get stateResource(){return xe(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:ne.vscodeUserData})}get userDataSyncHome(){return xe(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let e=ha(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=A(this.userDataPath,"logs",e)}return O.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return xe(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return xe(this.appSettingsHome,"History")}get keyboardLayoutResource(){return xe(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let e=te.VSCODE_PORTABLE;return e?O.file(A(e,"argv.json")):xe(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return O.file(A(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let e=this.args["builtin-extensions-dir"];return e?gt(e):Me(A(qe.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let e=this.args["extensions-download-dir"];return e?O.file(gt(e)):O.file(A(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let e=this.args["extensions-dir"];if(e)return gt(e);let t=te.VSCODE_EXTENSIONS;if(t)return t;let n=te.VSCODE_PORTABLE;return n?A(n,"extensions"):xe(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let e=this.args["agent-plugins-dir"];if(e)return gt(e);let t=te.VSCODE_AGENT_PLUGINS;if(t)return t;let n=te.VSCODE_PORTABLE;return n?A(n,"agent-plugins"):xe(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let e=this.args.extensionDevelopmentPath;if(Array.isArray(e))return e.map(t=>/^[^:/?#]+?:\/\//.test(t)?O.parse(t):O.file(Me(t)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(e=>e==="ui"||e==="workspace"||e==="web"?e:"workspace")}get extensionTestsLocationURI(){let e=this.args.extensionTestsPath;if(e)return/^[^:/?#]+?:\/\//.test(e)?O.parse(e):O.file(Me(e))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let e=this.args["disable-extension"];if(e){if(typeof e=="string")return[e];if(Array.isArray(e)&&e.length>0)return e}return!1}get skipBuiltinExtensions(){let e=te.VSCODE_SKIP_BUILTIN_EXTENSIONS;return e?e.split(",").map(t=>t.trim()).filter(t=>t):[]}get debugExtensionHost(){return cc(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!te.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(e=>!ga.test(e))}get extensionLogLevel(){let e=[];for(let t of this.args.log||[]){let n=ga.exec(t);n?.[1]&&n[2]&&e.push([n[1],n[2]])}return e.length?e:void 0}get serviceMachineIdResource(){return xe(O.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let e=te.VSCODE_PORTABLE;return e?O.file(A(e,"policy.json")):xe(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return xe(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(e){this.args.continueOn=e}get args(){return this._args}};f([R],K.prototype,"appRoot",1),f([R],K.prototype,"userHome",1),f([R],K.prototype,"userDataPath",1),f([R],K.prototype,"appSettingsHome",1),f([R],K.prototype,"tmpDir",1),f([R],K.prototype,"cacheHome",1),f([R],K.prototype,"stateResource",1),f([R],K.prototype,"userRoamingDataHome",1),f([R],K.prototype,"userDataSyncHome",1),f([R],K.prototype,"sync",1),f([R],K.prototype,"workspaceStorageHome",1),f([R],K.prototype,"localHistoryHome",1),f([R],K.prototype,"keyboardLayoutResource",1),f([R],K.prototype,"argvResource",1),f([R],K.prototype,"isExtensionDevelopment",1),f([R],K.prototype,"untitledWorkspacesHome",1),f([R],K.prototype,"builtinExtensionsPath",1),f([R],K.prototype,"extensionsDownloadLocation",1),f([R],K.prototype,"extensionsPath",1),f([R],K.prototype,"agentPluginsPath",1),f([R],K.prototype,"extensionDevelopmentLocationURI",1),f([R],K.prototype,"extensionDevelopmentKind",1),f([R],K.prototype,"extensionTestsLocationURI",1),f([R],K.prototype,"debugExtensionHost",1),f([R],K.prototype,"logLevel",1),f([R],K.prototype,"extensionLogLevel",1),f([R],K.prototype,"serviceMachineIdResource",1),f([R],K.prototype,"disableTelemetry",1),f([R],K.prototype,"disableExperiments",1),f([R],K.prototype,"disableWorkspaceTrust",1),f([R],K.prototype,"useInMemorySecretStorage",1),f([R],K.prototype,"policyFile",1),f([R],K.prototype,"agentSessionsWorkspace",1);function cc(r,e){return ya(r["inspect-extensions"],r["inspect-brk-extensions"],5870,e,r.debugId,r.extensionEnvironment)}function ya(r,e,t,n,i,o){let a=Number(e||r)||(n?null:t),l=a?!!e:!1,u;if(o)try{u=JSON.parse(o)}catch{}return{port:a,break:l,debugId:i,env:u}}import{homedir as va}from"os";import{resolve as dc,isAbsolute as pc,join as Ht}from"path";var mc=process.env.VSCODE_CWD||process.cwd();function ba(r,e){let t=fc(r,e),n=[t];return pc(t)||n.unshift(mc),dc(...n)}function fc(r,e){process.env.VSCODE_DEV&&(process.isEmbeddedApp?e="agents-oss-dev":e="code-oss-dev");let t=process.env.VSCODE_PORTABLE;if(t)return Ht(t,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Ht(n,e);let i=r["user-data-dir"];if(i)return i;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let o=process.env.USERPROFILE;if(typeof o!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Ht(o,"AppData","Roaming")}break;case"darwin":n=Ht(va(),"Library","Application Support");break;case"linux":n=process.env.XDG_CONFIG_HOME||Ht(va(),".config");break;default:throw new Error("Platform not supported")}return Ht(n,e)}var kr=class extends K{constructor(e,t){super(e,{homeDir:hc(),tmpDir:gc(),userDataDir:ba(e,t.nameShort)},t)}};function io(r,e){return e&&(r.stack||r.stacktrace)?g(116,null,xa(r),_a(r.stack)||_a(r.stacktrace)):xa(r)}function _a(r){return Array.isArray(r)?r.join(` ++`):H.data.stack,z.name=H.data.name,d(z);break}case 203:this.handlers.delete(o),d(H.data);break}};this.handlers.set(o,S),this.sendRequest(a)},h=null;this.state===1?m():(h=bn(S=>this.whenInitialized()),h.then(()=>{h=null,m()}));let b=()=>{h?(h.cancel(),h=null):this.sendRequest({id:o,type:101}),d(new we)};l=i.onCancellationRequested(b),u={dispose:on(()=>{b(),l.dispose()})},this.activeRequests.add(u)}).finally(()=>{l?.dispose(),this.activeRequests.delete(u)})}requestEvent(e,t,n){let i=this.lastRequestId++,s={id:i,type:102,channelName:e,name:t,arg:n},a=null,l=new y({onWillAddFirstListener:()=>{let p=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?p():(a=bn(c=>this.whenInitialized()),a.then(()=>{a=null,p()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:i,type:103})),this.handlers.delete(i)}}),u=p=>l.fire(p.data);return this.handlers.set(i,u),l.event}sendRequest(e){switch(e.type){case 100:case 102:{let t=this.send([e.type,e.id,e.channelName,e.name],e.arg);this.logger?.logOutgoing(t,e.id,0,`${qt(e.type)}: ${e.channelName}.${e.name}`,e.arg);return}case 101:case 103:{let t=this.send([e.type,e.id]);this.logger?.logOutgoing(t,e.id,0,qt(e.type));return}}}send(e,t=void 0){let n=new Ir;return Tn(n,e),Tn(n,t),this.sendBuffer(n.buffer)}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onBuffer(e){let t=new In(e),n=zt(t),i=zt(t),o=n[0];switch(o){case 200:return this.logger?.logIncoming(e.byteLength,0,0,xr(o)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(e.byteLength,n[1],0,xr(o),i),this.onResponse({type:n[0],id:n[1],data:i})}}onResponse(e){if(e.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(e.id)?.(e)}get onDidInitializePromise(){return w.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Pe(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};f([R],xn.prototype,"onDidInitializePromise",1);var Tr=class{constructor(e,t,n){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new y;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new y;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new he;this.disposables.add(e(({protocol:i,onDidClientDisconnect:o})=>{let s=w.once(i.onMessage);this.disposables.add(s(a=>{let l=new In(a),u=zt(l),p=new En(i,u,t,n),c=new xn(i,t);this.channels.forEach((m,h)=>p.registerChannel(h,m));let d={channelServer:p,channelClient:c,ctx:u};this._connections.add(d),this._onDidAddConnection.fire(d),this.disposables.add(o(()=>{p.dispose(),c.dispose(),this._connections.delete(d),this._onDidRemoveConnection.fire(d)}))}))}))}get connections(){let e=[];return this._connections.forEach(t=>e.push(t)),e}getChannel(e,t){let n=this;return{call(i,o,s){let a;if(ut(t)){let u=Wo(n.connections.filter(t));a=u?Promise.resolve(u):w.toPromise(w.filter(n.onDidAddConnection,t))}else a=t.routeCall(n,i,o);let l=a.then(u=>u.channelClient.getChannel(e));return ta(l).call(i,o,s)},listen(i,o){if(ut(t))return n.getMulticastEvent(e,t,i,o);let s=t.routeEvent(n,i,o).then(a=>a.channelClient.getChannel(e));return ta(s).listen(i,o)}}}getMulticastEvent(e,t,n,i){let o=this,s,a=new y({onWillAddFirstListener:()=>{s=new he;let l=new dr,u=new Map,p=d=>{let h=d.channelClient.getChannel(e).listen(n,i),b=l.add(h);u.set(d,b)},c=d=>{let m=u.get(d);m&&(m.dispose(),u.delete(d))};o.connections.filter(t).forEach(p),w.filter(o.onDidAddConnection,t)(p,void 0,s),o.onDidRemoveConnection(c,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return o.disposables.add(a),a.event}registerChannel(e,t){this.channels.set(e,t);for(let n of this._connections)n.channelServer.registerChannel(e,t)}dispose(){this.disposables.dispose();for(let e of this._connections)e.channelClient.dispose(),e.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}};function ta(r){return{call(e,t,n){return r.then(i=>i.call(e,t,n))},listen(e,t){let n=new pr;return r.then(i=>n.input=i.listen(e,t)),n.event}}}var Er;(i=>{function r(o,s,a){let l=o,u=a?.disableMarshalling,p=new Map;for(let c in l)t(c)&&p.set(c,w.buffer(l[c],c,!0,void 0,s));return new class{listen(c,d,m){let h=p.get(d);if(h)return h;let b=l[d];if(typeof b=="function"){if(n(d))return b.call(l,m);if(t(d))return p.set(d,w.buffer(l[d],d,!0,void 0,s)),p.get(d)}throw new Le(`Event not found: ${d}`)}call(c,d,m){let h=l[d];if(typeof h=="function"){if(!u&&Array.isArray(m))for(let S=0;Si.toLowerCase()===t);return n?r[n]:r[e]}import*as rc from"child_process";import{promises as da}from"fs";import*as L from"fs";import{tmpdir as Ku}from"os";import{promisify as Sn}from"util";var Fu=new Dt(1e4);function Ji(r){return na(r,"NFC",Fu)}var Nu=new Dt(1e4);function Bu(r){return na(r,"NFD",Nu)}var Vu=/[^\u0000-\u0080]/;function na(r,e,t){if(!r)return r;let n=t.get(r);if(n)return n;let i;return Vu.test(r)?i=r.normalize(e):i=r,t.set(r,i),i}var Lf=(function(){let r=new Dt(1e4),e=/[\u0300-\u036f]/g;return function(t){let n=r.get(t);if(n)return n;let i=Bu(t).replace(e,""),o=(i.length===t.length?i:t).toLowerCase();return r.set(t,o),o}})();async function oa(r,e=0,t){if(qi(r))throw new Error("rimraf - will refuse to recursively delete root");return e===0?eo(r):Wu(r,t)}async function Wu(r,e=Gs(Ku())){try{try{await L.promises.rename(r,e)}catch(t){return t.code==="ENOENT"?void 0:eo(r)}eo(e).catch(()=>{})}catch(t){if(t.code!=="ENOENT")throw t}}async function eo(r){return L.promises.rm(r,{recursive:!0,force:!0,maxRetries:3})}async function wr(r,e){try{return await ra(r,e)}catch(t){if(t.code==="ENOENT"&&E&&qi(r))try{return await ra(`${r}.`,e)}catch{}throw t}}async function ra(r,e){return qu(await(e?$u(r):L.promises.readdir(r)))}async function $u(r){try{return await L.promises.readdir(r,{withFileTypes:!0})}catch(n){n.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",n)}let e=[],t=await wr(r);for(let n of t){let i=!1,o=!1,s=!1;try{let a=await L.promises.lstat(A(r,n));i=a.isFile(),o=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}e.push({name:n,isFile:()=>i,isDirectory:()=>o,isSymbolicLink:()=>s})}return e}function qu(r){return r.map(e=>typeof e=="string"?ve?Ji(e):e:(e.name=ve?Ji(e.name):e.name,e))}async function zu(r){let e=await wr(r),t=[];for(let n of e)await He.existsDirectory(A(r,n))&&t.push(n);return t}var He;(n=>{async function r(i){let o;try{if(o=await L.promises.lstat(i),!o.isSymbolicLink())return{stat:o}}catch{}try{return{stat:await L.promises.stat(i),symbolicLink:o?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};if(E&&s.code==="EACCES")try{return{stat:await L.promises.stat(await L.promises.readlink(i)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};throw a}throw s}}n.stat=r;async function e(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isFile()&&s?.dangling!==!0}catch{}return!1}n.existsFile=e;async function t(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isDirectory()&&s?.dangling!==!0}catch{}return!1}n.existsDirectory=t})(He||={});var Hu=new vr;function ju(r,e,t){return Hu.queueFor(O.file(r),()=>{let n=Qu(t);return new Promise((i,o)=>Xu(r,e,n,s=>s?o(s):i()))},Ys)}var sa=!0;function Gu(r){sa=r}function Xu(r,e,t,n){if(!sa)return L.writeFile(r,e,{mode:t.mode,flag:t.flag},n);L.open(r,t.flag,t.mode,(i,o)=>{if(i)return n(i);L.writeFile(o,e,s=>{if(s)return L.close(o,()=>n(s));L.fdatasync(o,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),Gu(!1)),L.close(o,l=>n(l))))})})}function Qu(r){return r?{mode:typeof r.mode=="number"?r.mode:438,flag:typeof r.flag=="string"?r.flag:"w"}:{mode:438,flag:"w"}}async function Yu(r,e,t=6e4){if(r!==e)try{E&&typeof t=="number"?await aa(r,e,Date.now(),t):await L.promises.rename(r,e)}catch(n){if(r.toLowerCase()!==e.toLowerCase()&&n.code==="EXDEV"||r.endsWith("."))await la(r,e,{preserveSymlinks:!1}),await oa(r,1);else throw n}}async function aa(r,e,t,n,i=0){try{return await L.promises.rename(r,e)}catch(o){if(o.code!=="EACCES"&&o.code!=="EPERM"&&o.code!=="EBUSY")throw o;if(Date.now()-t>=n)throw console.error(`[node.js fs] rename failed after ${i} retries with error: ${o}`),o;if(i===0){let s=!1;try{let{stat:a}=await He.stat(e);a.isFile()||(s=!0)}catch{}if(s)throw o}return await me(Math.min(100,i*10)),aa(r,e,t,n,i+1)}}async function la(r,e,t){return ua(r,e,{root:{source:r,target:e},options:t,handledSourcePaths:new Set})}var ia=511;async function ua(r,e,t){if(t.handledSourcePaths.has(r))return;t.handledSourcePaths.add(r);let{stat:n,symbolicLink:i}=await He.stat(r);if(i){if(t.options.preserveSymlinks)try{return await ec(r,e,t)}catch{}if(i.dangling)return}return n.isDirectory()?Zu(r,e,n.mode&ia,t):Ju(r,e,n.mode&ia)}async function Zu(r,e,t,n){await L.promises.mkdir(e,{recursive:!0,mode:t});let i=await wr(r);for(let o of i)await ua(A(r,o),A(e,o),n)}async function Ju(r,e,t){await L.promises.copyFile(r,e),await L.promises.chmod(e,t)}async function ec(r,e,t){let n=await L.promises.readlink(r);fn(n,t.root.source,!Ce)&&(n=A(t.root.target,n.substr(t.root.source.length+1))),await L.promises.symlink(n,e)}async function tc(r){try{return await Sn(L.realpath)(r)}catch{let e=nc(r);return await L.promises.access(e,L.constants.R_OK),e}}function nc(r){return Ni(Me(r),$e)}var Pn=new class{get read(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.read(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesRead:l,buffer:u}))})}get write(){return(r,e,t,n,i)=>new Promise((o,s)=>{L.write(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesWritten:l,buffer:u}))})}get fdatasync(){return Sn(L.fdatasync)}get open(){return Sn(L.open)}get close(){return Sn(L.close)}get ftruncate(){return Sn(L.ftruncate)}async exists(r){try{return await L.promises.access(r),!0}catch{return!1}}get readdir(){return wr}get readDirsInDir(){return zu}get writeFile(){return ju}get rm(){return oa}get rename(){return Yu}get copy(){return la}get realpath(){return tc}};function pa(r=te){return r.comspec||"cmd.exe"}async function ic(r){if(await Pn.exists(r)){let e;try{e=await da.stat(r)}catch(t){t.message.startsWith("EACCES")&&(e=await da.lstat(r))}return e?!e.isDirectory():!1}return!1}async function ma(r,e,t,n=te,i=ic){if(sr(r))return await i(r)?r:void 0;if(e===void 0&&(e=ft()),ke(r)!=="."){let l=A(e,r);return await i(l)?l:void 0}let s=Zi(n,"PATH");if(t===void 0&&G(s)&&(t=s.split(ar)),t===void 0||t.length===0){let l=A(e,r);return await i(l)?l:void 0}for(let l of t){let u;if(sr(l)?u=A(l,r):u=A(e,l,r),E){let c=(Zi(n,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async d=>{let m=u+d;return await i(m)?m:void 0});for(let d of c){let m=await d;if(m)return m}}if(await i(u))return u}let a=A(e,r);return await i(a)?a:void 0}var Sr=class extends En{constructor(e){super({send:t=>{try{process.send?.(t.buffer.toString("base64"))}catch{}},onMessage:w.fromNodeEventEmitter(process,"message",t=>ee.wrap(Buffer.from(t,"base64")))},e),process.once("disconnect",()=>this.dispose())}};function Pr(r){return!!r.parentPort}var to=class{constructor(e){this.port=e;this.onMessage=w.fromNodeEventEmitter(this.port,"message",t=>t.data?ee.wrap(t.data):ee.alloc(0)),e.start()}send(e){this.port.postMessage(e.buffer)}disconnect(){this.port.close()}},Cr=class r extends Tr{static getOnDidClientConnect(e){ns(Pr(process),"Electron Utility Process");let t=new y;return process.parentPort.on("message",n=>{if(e?.handledClientConnection(n))return;let i=n.ports.at(0);i&&t.fire(i)}),w.map(t.event,n=>({protocol:new to(n),onDidClientDisconnect:w.fromNodeEventEmitter(n,"close")}))}constructor(e){super(r.getOnDidClientConnect(e))}};import sc from"minimist";var V1={o:g(1966,null),e:g(1950,null),t:g(1980,null),m:g(1961,null)};var fa={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:g(1970,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:g(1937,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:g(1932,null)},maximize:{type:"boolean",cat:"o",description:g(1936,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1973,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1964,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",alias:"h",description:g(1952,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},"agent-host":{type:"subcommand",description:"Run a server that hosts agents.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1938,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(1942,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(1962,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(1931,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(1971,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(1951,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1963,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1972,null)},agents:{type:"boolean",cat:"o",deprecates:["sessions"],description:g(1934,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(1990,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(1958,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(1987,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1969,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(1952,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:g(1939,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(1949,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(1957,null)},"agent-plugins-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:g(1974,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(1935,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(1956,null)},"pre-release":{type:"boolean",cat:"e",description:g(1955,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(1982,null)},"update-extensions":{type:"boolean",cat:"e",description:g(1985,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(1948,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:g(1933,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(1989,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(1988,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(1960,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(1975,null)},"prof-startup":{type:"boolean",cat:"t",description:g(1968,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(1945,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(1944,null)},sync:{type:"string",cat:"t",description:g(1981,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(1954,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(1953,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(1947,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(1946,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(1943,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(1959,null)},telemetry:{type:"boolean",cat:"t",description:g(1978,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},"share-secrets-with-agents-app":{type:"boolean"},transient:{type:"boolean",cat:"t",description:g(1979,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},ac={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function no(r,e,t=ac){let n=r.find((d,m)=>d.length>0&&d[0]!=="-"&&e.hasOwnProperty(d)&&e[d].type==="subcommand"),i={},o=["_"],s=[],a={},l;for(let d in e){let m=e[d];m.type==="subcommand"?d===n&&(l=m):(m.alias&&(i[d]=m.alias),m.type==="string"||m.type==="string[]"?(o.push(d),m.deprecates&&o.push(...m.deprecates)):m.type==="boolean"&&(s.push(d),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[d]=m))}if(l&&n){let d=a;for(let S in l.options)d[S]=l.options[S];let m=r.filter(S=>S!==n),h=t.getSubcommandReporter?t.getSubcommandReporter(n):void 0,b=no(m,d,h);return{[n]:b,_:[]}}let u=sc(r,{string:o,boolean:s,alias:i}),p={},c=u;p._=u._.map(d=>String(d)).filter(d=>d.length>0),delete c._;for(let d in e){let m=e[d];if(m.type==="subcommand")continue;m.alias&&delete c[m.alias];let h=c[d];if(m.deprecates)for(let b of m.deprecates)c.hasOwnProperty(b)&&(h||(h=c[b],h&&t.onDeprecatedOption(b,m.deprecationMessage||g(1941,null,d))),delete c[b]);if(typeof h<"u"){if(m.type==="string[]"){if(Array.isArray(h)||(h=[h]),!m.allowEmptyValue){let b=h.filter(S=>S.length>0);b.length!==h.length&&(t.onEmptyValue(d),h=b.length>0?b:void 0)}}else m.type==="string"&&(Array.isArray(h)?(h=h.pop(),t.onMultipleValues(d,h)):!h&&!m.allowEmptyValue&&(t.onEmptyValue(d),h=void 0));p[d]=h,m.deprecationMessage&&t.onDeprecatedOption(d,m.deprecationMessage)}delete c[d]}for(let d in c)t.onUnknownOption(d);return p}import{homedir as hc,tmpdir as gc}from"os";var lc=60,uc=lc*60,ro=uc*24,z1=ro*7,H1=ro*30,j1=ro*365;function ha(r){return r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+(r.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var ga=/^([^.]+\..+)[:=](.+)$/,K=class{constructor(e,t,n){this._args=e;this.paths=t;this.productService=n}get appRoot(){return ke(qe.asFileUri("").fsPath)}get userHome(){return O.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return O.file(A(this.userDataPath,"User"))}get tmpDir(){return O.file(this.paths.tmpDir)}get cacheHome(){return O.file(this.userDataPath)}get stateResource(){return xe(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:ne.vscodeUserData})}get userDataSyncHome(){return xe(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let e=ha(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=A(this.userDataPath,"logs",e)}return O.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return xe(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return xe(this.appSettingsHome,"History")}get keyboardLayoutResource(){return xe(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let e=te.VSCODE_PORTABLE;return e?O.file(A(e,"argv.json")):xe(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return O.file(A(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let e=this.args["builtin-extensions-dir"];return e?gt(e):Me(A(qe.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let e=this.args["extensions-download-dir"];return e?O.file(gt(e)):O.file(A(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let e=this.args["extensions-dir"];if(e)return gt(e);let t=te.VSCODE_EXTENSIONS;if(t)return t;let n=te.VSCODE_PORTABLE;return n?A(n,"extensions"):xe(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let e=this.args["agent-plugins-dir"];if(e)return gt(e);let t=te.VSCODE_AGENT_PLUGINS;if(t)return t;let n=te.VSCODE_PORTABLE;return n?A(n,"agent-plugins"):xe(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let e=this.args.extensionDevelopmentPath;if(Array.isArray(e))return e.map(t=>/^[^:/?#]+?:\/\//.test(t)?O.parse(t):O.file(Me(t)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(e=>e==="ui"||e==="workspace"||e==="web"?e:"workspace")}get extensionTestsLocationURI(){let e=this.args.extensionTestsPath;if(e)return/^[^:/?#]+?:\/\//.test(e)?O.parse(e):O.file(Me(e))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let e=this.args["disable-extension"];if(e){if(typeof e=="string")return[e];if(Array.isArray(e)&&e.length>0)return e}return!1}get skipBuiltinExtensions(){let e=te.VSCODE_SKIP_BUILTIN_EXTENSIONS;return e?e.split(",").map(t=>t.trim()).filter(t=>t):[]}get debugExtensionHost(){return cc(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!te.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(e=>!ga.test(e))}get extensionLogLevel(){let e=[];for(let t of this.args.log||[]){let n=ga.exec(t);n?.[1]&&n[2]&&e.push([n[1],n[2]])}return e.length?e:void 0}get serviceMachineIdResource(){return xe(O.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let e=te.VSCODE_PORTABLE;return e?O.file(A(e,"policy.json")):xe(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return xe(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(e){this.args.continueOn=e}get args(){return this._args}};f([R],K.prototype,"appRoot",1),f([R],K.prototype,"userHome",1),f([R],K.prototype,"userDataPath",1),f([R],K.prototype,"appSettingsHome",1),f([R],K.prototype,"tmpDir",1),f([R],K.prototype,"cacheHome",1),f([R],K.prototype,"stateResource",1),f([R],K.prototype,"userRoamingDataHome",1),f([R],K.prototype,"userDataSyncHome",1),f([R],K.prototype,"sync",1),f([R],K.prototype,"workspaceStorageHome",1),f([R],K.prototype,"localHistoryHome",1),f([R],K.prototype,"keyboardLayoutResource",1),f([R],K.prototype,"argvResource",1),f([R],K.prototype,"isExtensionDevelopment",1),f([R],K.prototype,"untitledWorkspacesHome",1),f([R],K.prototype,"builtinExtensionsPath",1),f([R],K.prototype,"extensionsDownloadLocation",1),f([R],K.prototype,"extensionsPath",1),f([R],K.prototype,"agentPluginsPath",1),f([R],K.prototype,"extensionDevelopmentLocationURI",1),f([R],K.prototype,"extensionDevelopmentKind",1),f([R],K.prototype,"extensionTestsLocationURI",1),f([R],K.prototype,"debugExtensionHost",1),f([R],K.prototype,"logLevel",1),f([R],K.prototype,"extensionLogLevel",1),f([R],K.prototype,"serviceMachineIdResource",1),f([R],K.prototype,"disableTelemetry",1),f([R],K.prototype,"disableExperiments",1),f([R],K.prototype,"disableWorkspaceTrust",1),f([R],K.prototype,"useInMemorySecretStorage",1),f([R],K.prototype,"policyFile",1),f([R],K.prototype,"agentSessionsWorkspace",1);function cc(r,e){return ya(r["inspect-extensions"],r["inspect-brk-extensions"],5870,e,r.debugId,r.extensionEnvironment)}function ya(r,e,t,n,i,o){let a=Number(e||r)||(n?null:t),l=a?!!e:!1,u;if(o)try{u=JSON.parse(o)}catch{}return{port:a,break:l,debugId:i,env:u}}import{homedir as va}from"os";import{resolve as dc,isAbsolute as pc,join as Ht}from"path";var mc=process.env.VSCODE_CWD||process.cwd();function ba(r,e){let t=fc(r,e),n=[t];return pc(t)||n.unshift(mc),dc(...n)}function fc(r,e){process.env.VSCODE_DEV&&(process.isEmbeddedApp?e="agents-oss-dev":e="code-oss-dev");let t=process.env.VSCODE_PORTABLE;if(t)return Ht(t,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return Ht(n,e);let i=r["user-data-dir"];if(i)return i;switch(process.platform){case"win32":if(n=process.env.APPDATA,!n){let o=process.env.USERPROFILE;if(typeof o!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");n=Ht(o,"AppData","Roaming")}break;case"darwin":n=Ht(va(),"Library","Application Support");break;case"linux":default:n=process.env.XDG_CONFIG_HOME||Ht(va(),".config");break}return Ht(n,e)}var kr=class extends K{constructor(e,t){super(e,{homeDir:hc(),tmpDir:gc(),userDataDir:ba(e,t.nameShort)},t)}};function io(r,e){return e&&(r.stack||r.stacktrace)?g(116,null,xa(r),_a(r.stack)||_a(r.stacktrace)):xa(r)}function _a(r){return Array.isArray(r)?r.join(` + `):r}function xa(r){return r.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${r.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof r.code=="string"&&typeof r.errno=="number"&&typeof r.syscall=="string"?g(115,null,r.message):r.message||g(113,null)}function oo(r=null,e=!1){if(!r)return g(113,null);if(Array.isArray(r)){let t=Ko(r),n=oo(t[0],e);return t.length>1?g(114,null,n,t.length):n}if(G(r))return r;if(r.detail){let t=r.detail;if(t.error)return io(t.error,e);if(t.exception)return io(t.exception,e)}return r.stack?io(r,e):r.message?r.message:g(113,null)}function Ta(r){return ao(r,0)}function ao(r,e){switch(typeof r){case"object":return r===null?je(349,e):Array.isArray(r)?vc(r,e):bc(r,e);case"string":return Ea(r,e);case"boolean":return yc(r,e);case"number":return je(r,e);case"undefined":return je(937,e);default:return je(617,e)}}function je(r,e){return(e<<5)-e+r|0}function yc(r,e){return je(r?433:863,e)}function Ea(r,e){e=je(149417,e);for(let t=0,n=r.length;tao(n,t),e)}function bc(r,e){return e=je(181387,e),Object.keys(r).sort().reduce((t,n)=>(t=Ea(n,t),ao(r[n],t)),e)}function so(r,e,t=32){let n=t-e,i=~((1<>>n)>>>0}function Cn(r,e=32){return r instanceof ArrayBuffer?as(ee.wrap(new Uint8Array(r))):(r>>>0).toString(16).padStart(e/4,"0")}var Ia=class r{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}static{this._bigBlock32=new DataView(new ArrayBuffer(320))}update(e){let t=e.length;if(t===0)return;let n=this._buff,i=this._buffLen,o=this._leftoverHighSurrogate,s,a;for(o!==0?(s=o,a=-1,o=0):(s=e.charCodeAt(0),a=0);;){let l=s;if(Ws(s))if(a+1>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Cn(this._h0)+Cn(this._h1)+Cn(this._h2)+Cn(this._h3)+Cn(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,this._buff.subarray(this._buffLen).fill(0),this._buffLen>56&&(this._step(),this._buff.fill(0));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let e=r._bigBlock32,t=this._buffDV;for(let c=0;c<64;c+=4)e.setUint32(c,t.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)e.setUint32(c,so(e.getUint32(c-12,!1)^e.getUint32(c-32,!1)^e.getUint32(c-56,!1)^e.getUint32(c-64,!1),1),!1);let n=this._h0,i=this._h1,o=this._h2,s=this._h3,a=this._h4,l,u,p;for(let c=0;c<80;c++)c<20?(l=i&o|~i&s,u=1518500249):c<40?(l=i^o^s,u=1859775393):c<60?(l=i&o|i&s|o&s,u=2400959708):(l=i^o^s,u=3395469782),p=so(n,5)+l+a+u+e.getUint32(c*4,!1)&4294967295,a=s,s=o,o=so(i,30),i=n,n=p;this._h0=this._h0+n&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+o&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};function lo(...r){switch(r.length){case 1:return g(1922,null,r[0]);case 2:return g(1923,null,r[0],r[1]);case 3:return g(1924,null,r[0],r[1],r[2]);default:return}}var _c=g(1921,null),xc=g(1920,null),tt=class r{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw Fo(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){let t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){let t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(lo("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(lo("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(lo("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){let t=this._start,n=this._input.substring(this._start,this._current),i={type:19,offset:this._start,lexeme:n};this._errors.push({offset:t,lexeme:n,additionalInfo:e}),this._tokens.push(i)}_string(){this.stringRe.lastIndex=this._start;let e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;let t=this._input.substring(this._start,this._current),n=r._keywords.get(t);n?this._addToken(n):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(_c);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,n=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(xc);return}let o=this._input.charCodeAt(e);if(t)t=!1;else if(o===47&&!n){e++;break}else o===91?n=!0:o===92?t=!0:o===93&&(n=!1);e++}for(;e=this._input.length}};var nt;(i=>{i.serviceIds=new Map,i.DI_TARGET="$di$target",i.DI_DEPENDENCIES="$di$dependencies";function n(o){return o[i.DI_DEPENDENCIES]||[]}i.getServiceDependencies=n})(nt||={});var vh=Ie("instantiationService");function Ic(r,e,t){e[nt.DI_TARGET]===e?e[nt.DI_DEPENDENCIES].push({id:r,index:t}):(e[nt.DI_DEPENDENCIES]=[{id:r,index:t}],e[nt.DI_TARGET]=e)}function Ie(r){if(nt.serviceIds.has(r))return nt.serviceIds.get(r);let e=function(t,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ic(e,t,i)};return e.toString=()=>r,nt.serviceIds.set(r,e),e}var re=new Map;re.set("false",!1);re.set("true",!0);re.set("isMac",ve);re.set("isLinux",Ce);re.set("isWindows",E);re.set("isWeb",pt);re.set("isMacNative",ve&&!pt);re.set("isEdge",bs);re.set("isFirefox",ys);re.set("isChrome",Pi);re.set("isSafari",vs);var Tc=Object.prototype.hasOwnProperty;var Ec={regexParsingWithErrorRecovery:!0},wc=g(1901,null),Sc=g(1902,null),Pc=g(1904,null),wa=g(1900,null),Cc=g(1907,null),kc=g(1908,null),Rc=g(1905,null),Lc=g(1906,null),uo=class r{constructor(e=Ec){this._config=e;this._scanner=new tt;this._tokens=[];this._current=0;this._parsingErrors=[];this._flagsGYRe=/g|y/g}static{this._parseError=new Error}get lexingErrors(){return this._scanner.errors}get parsingErrors(){return this._parsingErrors}parse(e){if(e===""){this._parsingErrors.push({message:wc,offset:0,lexeme:"",additionalInfo:Sc});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{let t=this._expr();if(!this._isAtEnd()){let n=this._peek(),i=n.type===17?kc:void 0;throw this._parsingErrors.push({message:Cc,offset:n.offset,lexeme:tt.getLexeme(n),additionalInfo:i}),r._parseError}return t}catch(t){if(t!==r._parseError)throw t;return}}_expr(){return this._or()}_or(){let e=[this._and()];for(;this._matchOne(16);){let t=this._and();e.push(t)}return e.length===1?e[0]:ae.or(...e)}_and(){let e=[this._term()];for(;this._matchOne(15);){let t=this._term();e.push(t)}return e.length===1?e[0]:ae.and(...e)}_term(){if(this._matchOne(2)){let e=this._peek();switch(e.type){case 11:return this._advance(),ue.INSTANCE;case 12:return this._advance(),fe.INSTANCE;case 0:{this._advance();let t=this._expr();return this._consume(1,wa),t?.negate()}case 17:return this._advance(),Tt.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){let e=this._peek();switch(e.type){case 11:return this._advance(),ae.true();case 12:return this._advance(),ae.false();case 0:{this._advance();let t=this._expr();return this._consume(1,wa),t}case 17:{let t=e.lexeme;if(this._advance(),this._matchOne(9)){let i=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),i.type!==10)throw this._errExpectedButGot("REGEX",i);let o=i.lexeme,s=o.lastIndexOf("/"),a=s===o.length-1?void 0:this._removeFlagsGY(o.substring(s+1)),l;try{l=new RegExp(o.substring(1,s),a)}catch{throw this._errExpectedButGot("REGEX",i)}return Mn.create(t,l)}switch(i.type){case 10:case 19:{let o=[i.lexeme];this._advance();let s=this._peek(),a=0;for(let d=0;d=0){let u=o.slice(a+1,l),p=o[l+1]==="i"?"i":"";try{s=new RegExp(u,p)}catch{throw this._errExpectedButGot("REGEX",i)}}}if(s===null)throw this._errExpectedButGot("REGEX",i);return Mn.create(t,s)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,Pc);let i=this._value();return ae.notIn(t,i)}switch(this._peek().type){case 3:{this._advance();let i=this._value();if(this._previous().type===18)return ae.equals(t,i);switch(i){case"true":return ae.has(t);case"false":return ae.not(t);default:return ae.equals(t,i)}}case 4:{this._advance();let i=this._value();if(this._previous().type===18)return ae.notEquals(t,i);switch(i){case"true":return ae.not(t);case"false":return ae.has(t);default:return ae.notEquals(t,i)}}case 5:return this._advance(),An.create(t,this._value());case 6:return this._advance(),On.create(t,this._value());case 7:return this._advance(),jt.create(t,this._value());case 8:return this._advance(),Dn.create(t,this._value());case 13:return this._advance(),ae.in(t,this._value());default:return ae.has(t)}}case 20:throw this._parsingErrors.push({message:Rc,offset:e.offset,lexeme:"",additionalInfo:Lc}),r._parseError;default:throw this._errExpectedButGot(`true | false | KEY | KEY '=~' REGEX - | KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,n){let i=g(1882,null,e,tt.getLexeme(t)),o=t.offset,s=tt.getLexeme(t);return this._parsingErrors.push({message:i,offset:o,lexeme:s,additionalInfo:n}),r._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},ae=class{static false(){return ue.INSTANCE}static true(){return fe.INSTANCE}static has(e){return It.create(e)}static equals(e,t){return Rn.create(e,t)}static notEquals(e,t){return Ln.create(e,t)}static regex(e,t){return Mn.create(e,t)}static in(e,t){return kr.create(e,t)}static notIn(e,t){return Rr.create(e,t)}static not(e){return Tt.create(e)}static and(...e){return Lr.create(e,null,!0)}static or(...e){return Un.create(e,null,!0)}static greater(e,t){return jt.create(e,t)}static greaterEquals(e,t){return Dn.create(e,t)}static smaller(e,t){return An.create(e,t)}static smallerEquals(e,t){return On.create(e,t)}static{this._parser=new lo({regexParsingWithErrorRecovery:!1})}static deserialize(e){return e==null?void 0:this._parser.parse(e)}};function kn(r,e){return r.cmp(e)}var ue=class r{constructor(){this.type=0}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}map(e){return this}negate(){return fe.INSTANCE}},fe=class r{constructor(){this.type=1}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}map(e){return this}negate(){return ue.INSTANCE}},It=class r{constructor(e,t){this.key=e;this.negated=t;this.type=2}static create(e,t=null){let n=re.get(e);return typeof n=="boolean"?n?fe.INSTANCE:ue.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ca(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=re.get(this.key);return typeof e=="boolean"?e?fe.INSTANCE:ue.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(e){return e.mapDefined(this.key)}negate(){return this.negated||(this.negated=Tt.create(this.key,this)),this.negated}},Rn=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=4}static create(e,t,n=null){if(typeof t=="boolean")return t?It.create(e,n):Tt.create(e,n);let i=re.get(e);return typeof i=="boolean"?t===(i?"true":"false")?fe.INSTANCE:ue.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=re.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?fe.INSTANCE:ue.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(e){return e.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Ln.create(this.key,this.value,this)),this.negated}},kr=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=10;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.valueKey),n=e.getValue(this.key);if(Array.isArray(t)){if(t.includes(n))return!0;if(E&&typeof n=="string"&&n.startsWith("file:///")){let i=n.toLowerCase();return t.some(o=>typeof o=="string"&&o.toLowerCase()===i)}return!1}if(typeof n=="string"&&typeof t=="object"&&t!==null){if(Tc.call(t,n))return!0;if(E&&n.startsWith("file:///")){let i=n.toLowerCase();return Object.keys(t).some(o=>o.toLowerCase()===i)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(e){return e.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Rr.create(this.key,this.valueKey)),this.negated}},Rr=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=11;this._negated=kr.create(e,t)}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(e){return e.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Ln=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=5}static create(e,t,n=null){if(typeof t=="boolean")return t?Tt.create(e,n):It.create(e,n);let i=re.get(e);return typeof i=="boolean"?t===(i?"true":"false")?ue.INSTANCE:fe.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=re.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?ue.INSTANCE:fe.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(e){return e.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Rn.create(this.key,this.value,this)),this.negated}},Tt=class r{constructor(e,t){this.key=e;this.negated=t;this.type=3}static create(e,t=null){let n=re.get(e);return typeof n=="boolean"?n?ue.INSTANCE:fe.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ca(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=re.get(this.key);return typeof e=="boolean"?e?ue.INSTANCE:fe.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(e){return e.mapNot(this.key)}negate(){return this.negated||(this.negated=It.create(this.key,this)),this.negated}};function Ar(r,e){if(typeof r=="string"){let t=parseFloat(r);isNaN(t)||(r=t)}return typeof r=="string"||typeof r=="number"?e(r):ue.INSTANCE}var jt=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=12}static create(e,t,n=null){return Ar(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=On.create(this.key,this.value,this)),this.negated}},Dn=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=13}static create(e,t,n=null){return Ar(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=An.create(this.key,this.value,this)),this.negated}},An=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=14}static create(e,t,n=null){return Ar(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(e){return e.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=jt.create(this.key,this.value,this)),this.negated}},Mn=class r{constructor(e,t){this.key=e;this.regexp=t;this.type=7;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.keye.key)return 1;let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return tn?1:0}equals(e){if(e.type===this.type){let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return this.key===e.key&&t===n}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){let e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}map(e){return e.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=uo.create(this)),this.negated}},uo=class r{constructor(e){this._actual=e;this.type=8}static create(e){return new r(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(e){return new r(this._actual.map(e))}negate(){return this._actual}};function Pa(r){let e=null;for(let t=0,n=r.length;te.expr.length)return 1;for(let t=0,n=this.expr.length;t1;){let s=i[i.length-1];if(s.type!==9)break;i.pop();let a=i.pop(),l=i.length===0,u=Un.create(s.expr.map(p=>r.create([p,a],null,n)),null,l);u&&(i.push(u),i.sort(kn))}if(i.length===1)return i[0];if(n){for(let s=0;se.serialize()).join(" && ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());this.negated=Un.create(e,this,!0)}return this.negated}},Un=class r{constructor(e,t){this.expr=e;this.negated=t;this.type=9}static create(e,t,n){return r._normalizeArr(e,t,n)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,n=this.expr.length;te.serialize()).join(" || ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){let t=e.shift(),n=e.shift(),i=[];for(let o of Sa(t))for(let s of Sa(n))i.push(Lr.create([o,s],null,!1));e.unshift(r.create(i,null,!1))}this.negated=r.create(e,this,!0)}return this.negated}},Dr=class r extends It{static{this._info=[]}static all(){return r._info.values()}constructor(e,t,n){super(e,null),this._defaultValue=t,typeof n=="object"?r._info.push({...n,key:e}):n!==!0&&r._info.push({key:e,description:n,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return Rn.create(this.key,e)}notEqualsTo(e){return Ln.create(this.key,e)}greater(e){return jt.create(this.key,e)}},Rh=Ie("contextKeyService");function Ca(r,e){return re?1:0}function Et(r,e,t,n){return rt?1:en?1:0}function Sa(r){return r.type===9?r.expr:[r]}var Se=Ie("logService"),Hh=Ie("loggerService");function co(r){return Ae(r)}var ka=3;function Dc(r,e){return r!==0&&r<=e}function Gt(r,e=!1){let t="";for(let n=0;n0?" ":"")+i}return t}var Or=class extends C{constructor(){super(...arguments);this.level=ka;this._onDidChangeLogLevel=this._register(new y)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(t){this.level!==t&&(this.level=t,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(t){return Dc(this.level,t)}canLog(t){return this._store.isDisposed?!1:this.checkLogLevel(t)}},Fn=class extends Or{constructor(t){super();this.logAlways=t}checkLogLevel(t){return this.logAlways||super.checkLogLevel(t)}trace(t,...n){this.canLog(1)&&this.log(1,Gt([t,...n],!0))}debug(t,...n){this.canLog(2)&&this.log(2,Gt([t,...n]))}info(t,...n){this.canLog(3)&&this.log(3,Gt([t,...n]))}warn(t,...n){this.canLog(4)&&this.log(4,Gt([t,...n]))}error(t,...n){if(this.canLog(5))if(t instanceof Error){let i=Array.prototype.slice.call(arguments);i[0]=t.stack,this.log(5,Gt(i))}else this.log(5,Gt([t,...n]))}flush(){}};var Mr=class extends Or{constructor(t){super();this.loggers=t;t.length&&this.setLevel(t[0].getLevel())}setLevel(t){for(let n of this.loggers)n.setLevel(t);super.setLevel(t)}trace(t,...n){for(let i of this.loggers)i.trace(t,...n)}debug(t,...n){for(let i of this.loggers)i.debug(t,...n)}info(t,...n){for(let i of this.loggers)i.info(t,...n)}warn(t,...n){for(let i of this.loggers)i.warn(t,...n)}error(t,...n){for(let i of this.loggers)i.error(t,...n)}flush(){for(let t of this.loggers)t.flush()}dispose(){for(let t of this.loggers)t.dispose();super.dispose()}},Nn=class extends C{constructor(t,n,i){super();this.logLevel=t;this.logsHome=n;this._loggers=new lt;this._onDidChangeLoggers=this._register(new y);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new y);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new y);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(i)for(let o of i)this._loggers.set(o.resource,{logger:void 0,info:o})}getLoggerEntry(t){return G(t)?[...this._loggers.values()].find(n=>n.info.id===t):this._loggers.get(t)}getLogger(t){return this.getLoggerEntry(t)?.logger}createLogger(t,n){let i=this.toResource(t),o=G(t)?t:n?.id??Ta(i.toString()).toString(16),s=this._loggers.get(i)?.logger,a=n?.logLevel==="always"?1:n?.logLevel;s||(s=this.doCreateLogger(i,a??this.getLogLevel(i)??this.logLevel,{...n,id:o}));let l={logger:s,info:{resource:i,id:o,logLevel:a,name:n?.name,hidden:n?.hidden,group:n?.group,extensionId:n?.extensionId,when:n?.when}};return this.registerLogger(l.info),this._loggers.set(i,l),s}toResource(t){return G(t)?xe(this.logsHome,`${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):t}setLogLevel(t,n){if(O.isUri(t)){let i=t,o=n,s=this._loggers.get(i);s&&o!==s.info.logLevel&&(s.info.logLevel=o===this.logLevel?void 0:o,s.logger?.setLevel(o),this._loggers.set(s.info.resource,s),this._onDidChangeLogLevel.fire([i,o]))}else{this.logLevel=t;for(let[i,o]of this._loggers.entries())this._loggers.get(i)?.info.logLevel===void 0&&o.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(t,n){let i=this.getLoggerEntry(t);i&&n!==!i.info.hidden&&(i.info.hidden=!n,this._loggers.set(i.info.resource,i),this._onDidChangeVisibility.fire([i.info.resource,n]))}getLogLevel(t){let n;return t&&(n=this._loggers.get(t)?.info.logLevel),n??this.logLevel}registerLogger(t){let n=this._loggers.get(t.resource);n?n.info.hidden!==t.hidden&&this.setVisibility(t.resource,!t.hidden):(this._loggers.set(t.resource,{info:t,logger:void 0}),this._onDidChangeLoggers.fire({added:[t],removed:[]}))}deregisterLogger(t){let n=this.toResource(t),i=this._loggers.get(n);i&&(i.logger&&i.logger.dispose(),this._loggers.delete(n),this._onDidChangeLoggers.fire({added:[],removed:[i.info]}))}*getRegisteredLoggers(){for(let t of this._loggers.values())yield t.info}getRegisteredLogger(t){return this._loggers.get(t)?.info}dispose(){this._loggers.forEach(t=>t.logger?.dispose()),this._loggers.clear(),super.dispose()}};function Ra(r){if(r.verbose)return 1;if(typeof r.logLevel=="string"){let e=Oc(r.logLevel.toLowerCase());if(e!==void 0)return e}return ka}function Ac(r){switch(r){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}function Oc(r){switch(r){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warn":return 4;case"error":return 5;case"critical":return 5;case"off":return 0}}var jh=new Dr("logLevel",Ac(3));var Ur=class{constructor(e,t){this.loggerService=e;this.getUriTransformer=t}listen(e,t){let n=this.getUriTransformer(e);switch(t){case"onDidChangeLoggers":return w.map(this.loggerService.onDidChangeLoggers,i=>({added:[...i.added].map(o=>this.transformLogger(o,n)),removed:[...i.removed].map(o=>this.transformLogger(o,n))}));case"onDidChangeVisibility":return w.map(this.loggerService.onDidChangeVisibility,i=>[n.transformOutgoingURI(i[0]),i[1]]);case"onDidChangeLogLevel":return w.map(this.loggerService.onDidChangeLogLevel,i=>co(i)?i:[n.transformOutgoingURI(i[0]),i[1]])}throw new Error(`Event not found: ${t}`)}async call(e,t,n){let i=this.getUriTransformer(e);switch(t){case"setLogLevel":return co(n[0])?this.loggerService.setLogLevel(n[0]):this.loggerService.setLogLevel(O.revive(i.transformIncoming(n[0][0])),n[0][1]);case"getRegisteredLoggers":return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(o=>this.transformLogger(o,i)))}throw new Error(`Call not found: ${t}`)}transformLogger(e,t){return{...e,resource:t.transformOutgoingURI(e.resource)}}};var Fr=class extends C{constructor(e,t=[]){super(),this.logger=new Mr([e,...t]),this._register(e.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}flush(){this.logger.flush()}};var Nr=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let r=new Uint8Array(16),e=[];for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128;let n=0,i="";return i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i}})();var po=class{constructor(){this._value="";this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos=0;t--,this._valueLen--){let n=this._value.charCodeAt(t);if(!(n===47||this._splitOnBackslash&&n===92))break}return this.next()}hasNext(){return this._to!1,t=()=>!1){return new r(new fo(e,t))}static forPaths(e=!1){return new r(new Br(void 0,!e))}static forStrings(){return new r(new po)}static forConfigKeys(){return new r(new mo)}constructor(e){this._iter=e}clear(){this._root=void 0}fill(e,t){if(t){let n=t.slice(0);di(n);for(let i of n)this.set(i,e)}else{let n=e.slice(0);di(n);for(let i of n)this.set(i[0],i[1])}}set(e,t){let n=this._iter.reset(e),i;this._root||(this._root=new Xt,this._root.segment=n.value());let o=[];for(i=this._root;;){let a=n.cmp(i.segment);if(a>0)i.left||(i.left=new Xt,i.left.segment=n.value()),o.push([-1,i]),i=i.left;else if(a<0)i.right||(i.right=new Xt,i.right.segment=n.value()),o.push([1,i]),i=i.right;else if(n.hasNext())n.next(),i.mid||(i.mid=new Xt,i.mid.segment=n.value()),o.push([0,i]),i=i.mid;else break}let s=Ge.unwrap(i.value);i.value=Ge.wrap(t),i.key=e;for(let a=o.length-1;a>=0;a--){let l=o[a][1];l.updateHeight();let u=l.balanceFactor();if(u<-1||u>1){let p=o[a][0],c=o[a+1][0];if(p===1&&c===1)o[a][1]=l.rotateLeft();else if(p===-1&&c===-1)o[a][1]=l.rotateRight();else if(p===1&&c===-1)l.right=o[a+1][1]=o[a+1][1].rotateRight(),o[a][1]=l.rotateLeft();else if(p===-1&&c===1)l.left=o[a+1][1]=o[a+1][1].rotateLeft(),o[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(o[a-1][0]){case-1:o[a-1][1].left=o[a][1];break;case 1:o[a-1][1].right=o[a][1];break;case 0:o[a-1][1].mid=o[a][1];break}else this._root=o[0][1]}}return s}get(e){return Ge.unwrap(this._getNode(e)?.value)}_getNode(e){let t=this._iter.reset(e),n=this._root;for(;n;){let i=t.cmp(n.segment);if(i>0)n=n.left;else if(i<0)n=n.right;else if(t.hasNext())t.next(),n=n.mid;else break}return n}has(e){let t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){let n=this._iter.reset(e),i=[],o=this._root;for(;o;){let s=n.cmp(o.segment);if(s>0)i.push([-1,o]),o=o.left;else if(s<0)i.push([1,o]),o=o.right;else if(n.hasNext())n.next(),i.push([0,o]),o=o.mid;else break}if(o){if(t?(o.left=void 0,o.mid=void 0,o.right=void 0,o.height=1):(o.key=void 0,o.value=void 0),!o.mid&&!o.value)if(o.left&&o.right){let s=[[1,o]],a=this._min(o.right,s);if(a.key){o.key=a.key,o.value=a.value,o.segment=a.segment;let l=a.right;if(s.length>1){let[p,c]=s[s.length-1];switch(p){case-1:c.left=l;break;case 0:Qn(!1);case 1:Qn(!1)}}else o.right=l;let u=this._balanceByStack(s);if(i.length>0){let[p,c]=i[i.length-1];switch(p){case-1:c.left=u;break;case 0:c.mid=u;break;case 1:c.right=u;break}}else this._root=u}}else{let s=o.left??o.right;if(i.length>0){let[a,l]=i[i.length-1];switch(a){case-1:l.left=s;break;case 0:l.mid=s;break;case 1:l.right=s;break}}else this._root=s}this._root=this._balanceByStack(i)??this._root}}_min(e,t){for(;e.left;)t.push([-1,e]),e=e.left;return e}_balanceByStack(e){for(let t=e.length-1;t>=0;t--){let n=e[t][1];n.updateHeight();let i=n.balanceFactor();if(i>1?(n.right.balanceFactor()>=0||(n.right=n.right.rotateRight()),e[t][1]=n.rotateLeft()):i<-1&&(n.left.balanceFactor()<=0||(n.left=n.left.rotateLeft()),e[t][1]=n.rotateRight()),t>0)switch(e[t-1][0]){case-1:e[t-1][1].left=e[t][1];break;case 1:e[t-1][1].right=e[t][1];break;case 0:e[t-1][1].mid=e[t][1];break}else return e[0][1]}}findSubstr(e){let t=this._iter.reset(e),n=this._root,i;for(;n;){let o=t.cmp(n.segment);if(o>0)n=n.left;else if(o<0)n=n.right;else if(t.hasNext())t.next(),i=Ge.unwrap(n.value)||i,n=n.mid;else break}return n&&Ge.unwrap(n.value)||i}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){let n=this._iter.reset(e),i=this._root;for(;i;){let o=n.cmp(i.segment);if(o>0)i=i.left;else if(o<0)i=i.right;else if(n.hasNext())n.next(),i=i.mid;else return i.mid?this._entries(i.mid):t?Ge.unwrap(i.value):void 0}}hasElementOrSubtree(e){return this._findSuperstrOrElement(e,!0)!==void 0}forEach(e){for(let[t,n]of this)e(n,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){let t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value!==void 0&&t.push([e.key,Ge.unwrap(e.value)]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}_isBalanced(){let e=t=>{if(!t)return!0;let n=t.balanceFactor();return n<-1||n>1?!1:e(t.left)&&e(t.right)};return e(this._root)}};var kg=Ie("fileService");var La=class r{constructor(e,t){this.ignorePathCasing=t;this.correlationId=void 0;this.added=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawAdded.map(t=>[t,!0])),e});this.updated=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawUpdated.map(t=>[t,!0])),e});this.deleted=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawDeleted.map(t=>[t,!0])),e});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let n of e){switch(n.type){case 1:this.rawAdded.push(n.resource);break;case 0:this.rawUpdated.push(n.resource);break;case 2:this.rawDeleted.push(n.resource);break}this.correlationId!==r.MIXED_CORRELATION&&(typeof n.cId=="number"?this.correlationId===void 0?this.correlationId=n.cId:this.correlationId!==n.cId&&(this.correlationId=r.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=r.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(e,...t){return this.doContains(e,{includeChildren:!1},...t)}affects(e,...t){return this.doContains(e,{includeChildren:!0},...t)}doContains(e,t,...n){if(!e)return!1;let i=n.length>0;return!!((!i||n.includes(1))&&(this.added.value.get(e)||t.includeChildren&&this.added.value.findSuperstr(e))||(!i||n.includes(0))&&(this.updated.value.get(e)||t.includeChildren&&this.updated.value.findSuperstr(e))||(!i||n.includes(2))&&(this.deleted.value.findSubstr(e)||t.includeChildren&&this.deleted.value.findSuperstr(e)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(e){return this.correlationId===e}hasCorrelation(){return typeof this.correlationId=="number"}};var Vr=class r{static{this.KB=1024}static{this.MB=r.KB*r.KB}static{this.GB=r.MB*r.KB}static{this.TB=r.GB*r.KB}static formatSize(e){return Ae(e)||(e=0),e{this._logger&&Aa(this._logger,a)}))}async _createSpdLogLogger(t,n,i,o){let s=i?6:1,a=30/s*Vr.MB,l=await Mc(t,n,a,s,o);if(l){this._logger=l,Aa(this._logger,this.getLevel());for(let{level:u,message:p}of this.buffer)Da(this._logger,u,p);this.buffer=[]}}log(t,n){this._logger?Da(this._logger,t,n):this.getLevel()<=t&&this.buffer.push({level:t,message:n})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}};var Wr=class extends Nn{doCreateLogger(e,t,n){return new Kr(Nr(),e.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,t)}};var ce,go=globalThis.vscode;if(typeof go<"u"&&typeof go.context<"u"){let r=go.context.configuration();if(r)ce=r.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(ce=globalThis._VSCODE_PRODUCT_JSON,ne.VSCODE_DEV&&Object.assign(ce,{nameShort:`${ce.nameShort} Dev`,nameLong:`${ce.nameLong} Dev`,dataFolderName:`${ce.dataFolderName}-dev`,serverDataFolderName:ce.serverDataFolderName?`${ce.serverDataFolderName}-dev`:void 0}),!ce.version){let r=globalThis._VSCODE_PACKAGE_JSON;Object.assign(ce,{version:r.version})}Object.assign(ce,{extensionsGallery:ne.EXTENSIONS_GALLERY?JSON.parse(ne.EXTENSIONS_GALLERY):ce.extensionsGallery||{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item",extensionUrlTemplate:"https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",resourceUrlTemplate:"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",controlUrl:"",recommendationsUrl:""},telemetryEndpoint:ne.CS_TELEMETRY_URL||ce.telemetryEndpoint||"https://v1.telemetry.coder.com/track"})}else ce={nameShort:"code-server",nameLong:"code-server",applicationName:"code-server",dataFolderName:".code-server",win32MutexName:"codeserver",licenseName:"MIT",licenseUrl:"https://github.com/coder/code-server/blob/main/LICENSE",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"code-server",win32NameVersion:"code-server",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"coder.code-server",win32ShellNameShort:"c&ode-server",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.coder.code.server",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"com.coder.code.server",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/coder/code-server/issues/new",nodejsRepository:"https://nodejs.org",urlProtocol:"code-oss",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.112.0",sha256:"c24322931434940938f8cf76ebc3dac1e95a5539b9625b165b6672d7f7eafea8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE.com"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",completionsRefreshTokenCommand:"github.copilot.signIn",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry"},trustedExtensionAuthAccess:["vscode.git","vscode.github","github.vscode-pull-request-github","github.copilot","github.copilot-chat"],enableTelemetry:!0,quality:"stable",codeServerVersion:"4.114.1",documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",linkProtectionTrustedDomains:["https://open-vsx.org"],aiConfig:{ariaKey:"code-server"},version:"1.114.0",commit:"4af6408e399e2f795e98b043fd30c16ba31ab0c6",date:"2026-04-01T09:27:11Z"},Object.keys(ce).length===0&&Object.assign(ce,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var Oa=ce;var yo=class{constructor(){this.data=new Map}add(e,t){Xn(G(e)),Xn(hi(t)),Xn(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}knows(e){return this.data.has(e)}as(e){return this.data.get(e)||null}dispose(){this.data.forEach(e=>{ut(e.dispose)&&e.dispose()}),this.data.clear()}},Ma=new yo;var Gg=Ie("ptyService");var Uc={Backend:"workbench.contributions.terminal.processBackend"},vo=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(e){let t=this._sanitizeRemoteAuthority(e.remoteAuthority);if(this._backends.has(t))throw new Error(`A terminal backend with remote authority '${t}' was already registered.`);this._backends.set(t,e)}getTerminalBackend(e){return this._backends.get(this._sanitizeRemoteAuthority(e))}_sanitizeRemoteAuthority(e){return e?.toLowerCase()??""}};Ma.add(Uc.Backend,new vo);var Xg=Ie("localPtyService"),Qg=Ie("terminalLogService");var $r=class extends C{constructor(){super();this._onBeat=this._register(new y);this.onBeat=this._onBeat.event;let t=setInterval(()=>{this._onBeat.fire()},5e3);this._register(Y(()=>clearInterval(t)))}};import{execFile as dl,exec as Id}from"child_process";import{userInfo as Hc}from"os";import*as bo from"os";var Ua=/^\d+$/,Fc=/^Microsoft.PowerShell_.*/,Nc=/^Microsoft.PowerShellPreview_.*/;var Bn;switch(process.arch){case"ia32":Bn=1;break;case"arm":case"arm64":Bn=2;break;default:Bn=0;break}var Yt;process.env.PROCESSOR_ARCHITEW6432?Yt=process.env.PROCESSOR_ARCHITEW6432==="ARM64"?2:0:process.env.PROCESSOR_ARCHITECTURE==="ARM64"?Yt=2:process.env.PROCESSOR_ARCHITECTURE==="X86"?Yt=1:Yt=0;var wt=class{constructor(e,t,n){this.exePath=e;this.displayName=t;this.knownToExist=n}async exists(){return this.knownToExist===void 0&&(this.knownToExist=await He.existsFile(this.exePath)),this.knownToExist}};function Bc({useAlternateBitness:r=!1}={}){return r?Bn===0?process.env["ProgramFiles(x86)"]||null:Yt===0&&process.env.ProgramW6432||null:process.env.ProgramFiles||null}async function qr({useAlternateBitness:r=!1,findPreview:e=!1}={}){let t=Bc({useAlternateBitness:r});if(!t)return null;let n=A(t,"PowerShell");if(!await He.existsDirectory(n))return null;let i=-1,o=null;for(let l of await Pn.readdir(n)){let u=-1;if(e){let c=l.indexOf("-");if(c<0)continue;let d=l.substring(0,c);if(!Ua.test(d)||l.substring(c+1)!=="preview")continue;u=parseInt(d,10)}else{if(!Ua.test(l))continue;u=parseInt(l,10)}if(u<=i)continue;let p=A(n,l,"pwsh.exe");await He.existsFile(p)&&(o=p,i=u)}if(!o)return null;let s=t.includes("x86")?" (x86)":"",a=e?" Preview":"";return new wt(o,`PowerShell${a}${s}`,!0)}async function Fa({findPreview:r}={}){if(!process.env.LOCALAPPDATA)return null;let e=A(process.env.LOCALAPPDATA,"Microsoft","WindowsApps");if(!await He.existsDirectory(e))return null;let{pwshMsixDirRegex:t,pwshMsixName:n}=r?{pwshMsixDirRegex:Nc,pwshMsixName:"PowerShell Preview (Store)"}:{pwshMsixDirRegex:Fc,pwshMsixName:"PowerShell (Store)"};for(let i of await Pn.readdir(e))if(t.test(i)){let o=A(e,i,"pwsh.exe");return new wt(o,n)}return null}function Vc(){let r=A(bo.homedir(),".dotnet","tools","pwsh.exe");return new wt(r,".NET Core PowerShell Global Tool")}function Kc(){let r=A(bo.homedir(),"scoop","apps"),e=A(r,"pwsh","current","pwsh.exe");return new wt(e,"PowerShell (Scoop)")}function Wc(){let r=A(process.env.windir,Bn===1&&Yt!==1?"SysNative":"System32","WindowsPowerShell","v1.0","powershell.exe");return new wt(r,"Windows PowerShell",!0)}async function*$c(){let r=await qr();r&&(yield r),r=await qr({useAlternateBitness:!0}),r&&(yield r),r=await Fa(),r&&(yield r),r=Vc(),r&&(yield r),r=await qr({findPreview:!0}),r&&(yield r),r=await Fa({findPreview:!0}),r&&(yield r),r=await qr({useAlternateBitness:!0,findPreview:!0}),r&&(yield r),r=await Kc(),r&&(yield r),r=Wc(),r&&(yield r)}async function*qc(){for await(let r of $c())await r.exists()&&(yield r)}async function Na(){for await(let r of qc())return r;return null}async function Ba(r,e){return r===1?E?Gc():pa(e):jc(r,e)}var _o=null;function jc(r,e){if(Ce&&r===2||ve&&r===3)return"/bin/bash";if(!_o){let t;if(E)t="/bin/bash";else{if(t=e.SHELL,!t)try{t=Hc().shell}catch{}t||(t="sh"),t==="/bin/false"&&(t="/bin/bash")}_o=t}return _o}var xo=null;async function Gc(){return xo||(xo=(await Na()).exePath),xo}var Zt=class extends C{constructor(t,n){super();this._logService=n;this._lastRequestId=0;this._pendingRequests=new Map;this._pendingRequestDisposables=new Map;this._onCreateRequest=this._register(new y);this.onCreateRequest=this._onCreateRequest.event;this._timeout=t===void 0?15e3:t,this._register(Y(()=>{for(let i of this._pendingRequestDisposables.values())Pe(i)}))}createRequest(t){return new Promise((n,i)=>{let o=++this._lastRequestId;this._pendingRequests.set(o,n),this._onCreateRequest.fire({requestId:o,...t});let s=new Ue;me(this._timeout,s.token).then(()=>i(`Request ${o} timed out (${this._timeout}ms)`)),this._pendingRequestDisposables.set(o,[Y(()=>s.cancel())])})}acceptReply(t,n){let i=this._pendingRequests.get(t);i?(this._pendingRequests.delete(t),Pe(this._pendingRequestDisposables.get(t)||[]),this._pendingRequestDisposables.delete(t),i(n)):this._logService.warn(`RequestStore#acceptReply was called without receiving a matching request ${t}`)}};Zt=f([ge(1,Se)],Zt);var zr=class{constructor(e){this._callback=e;this._terminalBufferMap=new Map}dispose(){for(let e of this._terminalBufferMap.values())e.dispose()}startBuffering(e,t,n=5){let i=t(o=>{let s=G(o)?o:o.data,a=this._terminalBufferMap.get(e);if(a){a.data.push(s);return}let l=setTimeout(()=>this.flushBuffer(e),n);a={data:[s],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(e),i.dispose()}},this._terminalBufferMap.set(e,a)});return i}stopBuffering(e){this._terminalBufferMap.get(e)?.dispose()}flushBuffer(e){let t=this._terminalBufferMap.get(e);t&&(this._terminalBufferMap.delete(e),this._callback(e,t.data.join("")))}};function Ka(r,e){let t=r;t.includes("\\")&&(t=t.replace(/\\/g,"\\\\"));let n;switch(e){case"bash":case"sh":case"zsh":case"gitbash":n={bothQuotes:o=>`$'${o.replace(/'/g,"\\'")}'`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break;case"fish":n={bothQuotes:o=>`"${o.replace(/"/g,'\\"')}"`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break;case"pwsh":n={bothQuotes:o=>`"${o.replace(/"/g,'`"')}"`,singleQuotes:o=>`'${o.replace(/'/g,"''")}'`,noSingleQuotes:o=>`'${o}'`};break;default:n={bothQuotes:o=>`$'${o.replace(/'/g,"\\'")}'`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break}let i=/[\`\$\|\&\>\~\#\!\^\*\;\<]/g;return t=t.replace(i,""),t.includes("'")&&t.includes('"')?n.bothQuotes(t):t.includes("'")?n.singleQuotes(t):n.noSingleQuotes(t)}function Wa(r){return r.match(/^['"].*['"]$/)&&(r=r.substring(1,r.length-1)),nr===1&&r&&r[1]===":"?r[0].toUpperCase()+r.substring(1):r}import*as en from"os";function Qc(r){return new Map(r)}function Yc(r){return new Map(r??[])}function $a(r){return new Map(r.map(e=>[e[0],{map:Qc(e[1]),descriptionMap:Yc(e[2])}]))}var Jc=new Map([[2,"APPEND"],[3,"PREPEND"],[1,"REPLACE"]]),ed=/^VSCODE_PYTHON_(PWSH|ZSH|BASH|FISH)_ACTIVATE/,td="ms-python.vscode-python-envs",Hr=class{constructor(e){this.collections=e;this.map=new Map;this.descriptionMap=new Map;e.forEach((t,n)=>{this.populateDescriptionMap(t,n);let i=t.map.entries(),o=i.next();for(;!o.done;){let s=o.value[1],a=o.value[0];if(this.blockPythonActivationVar(a,n)){o=i.next();continue}let l=this.map.get(a);if(l||(l=[],this.map.set(a,l)),l.length>0&&l[0].type===1){o=i.next();continue}let u={extensionIdentifier:n,value:s.value,type:s.type,scope:s.scope,variable:s.variable,options:s.options};u.scope||delete u.scope,l.unshift(u),o=i.next()}})}async applyToProcessEnvironment(e,t,n){let i;E&&(i={},Object.keys(e).forEach(o=>i[o.toLowerCase()]=o));for(let[o,s]of this.getVariableMap(t)){let a=E&&i[o.toLowerCase()]||o;for(let l of s){let u=n?await n(l.value):l.value;if(!this.blockPythonActivationVar(l.variable,l.extensionIdentifier)){if(l.options?.applyAtProcessCreation??!0)switch(l.type){case 2:e[a]=(e[a]||"")+u;break;case 3:e[a]=u+(e[a]||"");break;case 1:e[a]=u;break}if(l.options?.applyAtShellIntegration??!1){let p=`VSCODE_ENV_${Jc.get(l.type)}`;e[p]=(e[p]?e[p]+":":"")+o+"="+this._encodeColons(u)}}}}}_encodeColons(e){return e.replaceAll(":","\\x3a")}blockPythonActivationVar(e,t){return!!(ed.test(e)&&td!==t)}diff(e,t){let n=new Map,i=new Map,o=new Map;if(e.getVariableMap(t).forEach((s,a)=>{let l=this.getVariableMap(t).get(a),u=za(s,l);u&&n.set(a,u)}),this.getVariableMap(t).forEach((s,a)=>{let l=e.getVariableMap(t).get(a),u=za(s,l);u&&o.set(a,u)}),this.getVariableMap(t).forEach((s,a)=>{let l=e.getVariableMap(t).get(a),u=nd(s,l);u&&i.set(a,u)}),!(n.size===0&&i.size===0&&o.size===0))return{added:n,changed:i,removed:o}}getVariableMap(e){let t=new Map;for(let n of this.map.values()){let i=n.filter(o=>qa(o,e));i.length>0&&t.set(i[0].variable,i)}return t}getDescriptionMap(e){let t=new Map;for(let n of this.descriptionMap.values()){let i=n.filter(o=>qa(o,e,!0));for(let o of i)t.set(o.extensionIdentifier,o.description)}return t}populateDescriptionMap(e,t){if(!e.descriptionMap)return;let n=e.descriptionMap.entries(),i=n.next();for(;!i.done;){let o=i.value[1],s=i.value[0],a=this.descriptionMap.get(s);a||(a=[],this.descriptionMap.set(s,a));let l={extensionIdentifier:t,scope:o.scope,description:o.description};l.scope||delete l.scope,a.push(l),i=n.next()}}};function qa(r,e,t=!1){return r.scope?!!(r.scope.workspaceFolder&&e?.workspaceFolder&&r.scope.workspaceFolder.index===e.workspaceFolder.index):t?e===r.scope:!0}function za(r,e){if(!e)return r;let t=new Set;e.forEach(i=>t.add(i.extensionIdentifier));let n=[];return r.forEach(i=>{t.has(i.extensionIdentifier)||n.push(i)}),n.length===0?void 0:n}function nd(r,e){if(!e)return;let t=new Map;e.forEach(i=>t.set(i.extensionIdentifier,i));let n=[];return r.forEach(i=>{let o=t.get(i.extensionIdentifier);o&&(i.type!==o.type||i.value!==o.value||i.scope?.workspaceFolder?.index!==o.scope?.workspaceFolder?.index)&&n.push(o)}),n.length===0?void 0:n}import{chmod as ja,realpathSync as id,mkdirSync as od}from"fs";import{promisify as Ga}from"util";import*as jr from"os";var St;async function rd(){if(St)return;if(!E){St={release:jr.release(),buildNumber:0};return}let r,e;try{let t=await import("@vscode/windows-registry"),n="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",i=t.GetStringRegKey("HKEY_LOCAL_MACHINE",n,"CurrentBuild");i!==void 0&&(r=parseInt(i,10),isNaN(r)&&(r=void 0));let o=t.GetDWORDRegKey("HKEY_LOCAL_MACHINE",n,"CurrentMajorVersionNumber"),s=t.GetDWORDRegKey("HKEY_LOCAL_MACHINE",n,"CurrentMinorVersionNumber");o!==void 0&&s!==void 0&&i!==void 0&&(e=`${o}.${s}.${i}`)}catch{}finally{St={release:e||jr.release(),buildNumber:r||Ha()}}}async function Jt(){return St||await rd(),St.buildNumber}function To(){return St?St.buildNumber:E?Ha():0}function Ha(){let r=/(\d+)\.(\d+)\.(\d+)/g.exec(jr.release());return r&&r.length===4?parseInt(r[3],10):0}async function Za(r,e,t,n,i,o=!1){if(!e.shellIntegration.enabled)return{type:"failure",reason:"injectionSettingDisabled"};if(!r.executable)return{type:"failure",reason:"noExecutable"};if(r.isFeatureTerminal&&!r.forceShellIntegration)return{type:"failure",reason:"featureTerminal"};if(r.ignoreShellIntegration)return{type:"failure",reason:"ignoreShellIntegrationFlag"};let s=E?await Jt():0;if(E&&s<18309)return{type:"failure",reason:"unsupportedWindowsBuild"};let a=r.args,l=rr==="win32"?yt(r.executable).toLowerCase():yt(r.executable),u=ke(qe.asFileUri("").fsPath),p="injection",c,d={VSCODE_INJECTION:"1"};e.shellIntegration.nonce&&(d.VSCODE_NONCE=e.shellIntegration.nonce);let m=["PATH","VIRTUAL_ENV","HOME","SHELL","PWD"];if(r.shellIntegrationEnvironmentReporting&&(E?(e.windowsUseConptyDll||s>=22631&&l!=="bash.exe")&&(d.VSCODE_SHELL_ENV_REPORTING=m.join(",")):d.VSCODE_SHELL_ENV_REPORTING=m.join(",")),E)return l==="pwsh.exe"||l==="powershell.exe"?(d.VSCODE_A11Y_MODE=e.isScreenReaderOptimized?"1":"0",!a||Ya(a)?c=Q.get("windows-pwsh"):Qa(a)&&(c=Q.get("windows-pwsh-login")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u,""),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"}):l==="bash.exe"?(!a||a.length===0?c=Q.get("bash"):Qr(a)&&(d.VSCODE_SHELL_LOGIN="1",Gr(e,d,l),c=Q.get("bash")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"}):(n.warn(`Shell integration cannot be enabled for executable "${r.executable}" and args`,r.args),{type:"failure",reason:"unsupportedShell"});switch(l){case"bash":return!a||a.length===0?c=Q.get("bash"):Qr(a)&&(d.VSCODE_SHELL_LOGIN="1",Gr(e,d,l),c=Q.get("bash")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"fish":return!a||a.length===0?c=Q.get("fish"):Qr(a)?c=Q.get("fish-login"):(a===Q.get("fish")||a===Q.get("fish-login"))&&(c=a),c?(Gr(e,d,l),c=[...c],c[c.length-1]=_t(c[c.length-1],u),{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"pwsh":return!a||Ya(a)?c=Q.get("pwsh"):Qa(a)&&(c=Q.get("pwsh-login")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u,""),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"zsh":{if(!a||a.length===0?c=Q.get("zsh"):Qr(a)?(c=Q.get("zsh-login"),Gr(e,d,l)):(a===Q.get("zsh")||a===Q.get("zsh-login"))&&(c=a),!c)return{type:"failure",reason:"unsupportedArgs"};c=[...c],c[c.length-1]=_t(c[c.length-1],u);let h;try{h=en.userInfo().username}catch{h="unknown"}let b=id(en.tmpdir()),S=A(b,`${h}-${i.applicationName}-zsh`);if(!o)try{await Ga(ja)(S,960)}catch(B){if(B.message.includes("ENOENT")){try{od(S)}catch(Te){return n.error(`Failed to create zdotdir at ${S}: ${Te}`),{type:"failure",reason:"failedToCreateTmpDir"}}try{await Ga(ja)(S,960)}catch{return n.error(`Failed to set sticky bit on ${S}: ${B}`),{type:"failure",reason:"failedToSetStickyBit"}}}return n.error(`Failed to set sticky bit on ${S}: ${B}`),{type:"failure",reason:"failedToSetStickyBit"}}d.ZDOTDIR=S;let H=t?.ZDOTDIR??en.homedir()??"~";d.USER_ZDOTDIR=H;let z=[];return z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh"),dest:A(S,".zshrc")}),z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-profile.zsh"),dest:A(S,".zprofile")}),z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-env.zsh"),dest:A(S,".zshenv")}),z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh"),dest:A(S,".zlogin")}),{type:p,newArgs:c,envMixin:d,filesToCopy:z}}}return n.warn(`Shell integration cannot be enabled for executable "${r.executable}" and args`,r.args),{type:"failure",reason:"unsupportedShell"}}function Gr(r,e,t){if((ve||t==="fish")&&r.environmentVariableCollections){let n=$a(r.environmentVariableCollections),o=new Hr(n).getVariableMap({workspaceFolder:r.workspaceFolder}).get("PATH"),s=[];if(o)for(let a of o)a.type===3&&s.push(a.value);s.length>0&&(e.VSCODE_PATH_PREFIX=s.join(""))}}var Q=new Map;Q.set("windows-pwsh",["-noexit","-command",'try { . "{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1" } catch {}{1}']);Q.set("windows-pwsh-login",["-l","-noexit","-command",'try { . "{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1" } catch {}{1}']);Q.set("pwsh",["-noexit","-command",'. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"{1}']);Q.set("pwsh-login",["-l","-noexit","-command",'. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"']);Q.set("zsh",["-i"]);Q.set("zsh-login",["-il"]);Q.set("bash",["--init-file","{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh"]);Q.set("fish",["--init-command",'source "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish"']);Q.set("fish-login",["-l","--init-command",'source "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish"']);var Xr=["-login","-l"],Xa=["--login","-l"],sd=["-i","--interactive"],Yr=["-nol","-nologo"];function Qa(r){return G(r)?Xr.includes(r.toLowerCase()):r.length===1&&Xr.includes(r[0].toLowerCase())||r.length===2&&(Xr.includes(r[0].toLowerCase())||Xr.includes(r[1].toLowerCase()))&&(Yr.includes(r[0].toLowerCase())||Yr.includes(r[1].toLowerCase()))}function Ya(r){return G(r)?Yr.includes(r.toLowerCase()):r.length===0||r?.length===1&&Yr.includes(r[0].toLowerCase())}function Qr(r){return G(r)||(r=r.filter(e=>!sd.includes(e.toLowerCase()))),G(r)&&Xa.includes(r.toLowerCase())||!G(r)&&r.length===1&&Xa.includes(r[0].toLowerCase())}var ad=/^(?:.*_)?(?:API_?KEY|TOKEN|SECRET|PASSWORD|PASSWD|PWD|CREDENTIAL|AUTH|PRIVATE_?KEY|ACCESS_?KEY|CLIENT_?SECRET|APIKEY)(?:_.*)?$/i,ld=[/^eyJ[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/,/^gh[psuro]_[a-zA-Z0-9]{36}$/,/^github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}$/,/^AIza[A-Za-z0-9_\-]{35}$/,/^xox[pbar]\-[A-Za-z0-9\-]+$/,/^[a-zA-Z0-9]{32,}$/];function Vn(r){if(!r)return r;let e={};for(let t of Object.keys(r)){let n=r[t];if(n===void 0)continue;if(ad.test(t)){e[t]="";continue}let i=!1;for(let o of ld)if(o.test(n)){i=!0;break}e[t]=i?"":n}return e}import*as tn from"fs";import{exec as fd}from"child_process";var Ja=Ie("productService");import{exec as Zr}from"child_process";import{totalmem as ud}from"os";var cd=/[a-zA-Z-]+\.js\b/g;function tl(r){return new Promise((e,t)=>{let n,i=new Map,o=ud();function s(l,u,p,c,d){let m=i.get(u);if(l===r||m){let h={name:a(p),cmd:p,pid:l,ppid:u,load:c,mem:E?d:o*(d/100)};i.set(l,h),l===r&&(n=h),m&&(m.children||(m.children=[]),m.children.push(h),m.children.length>1&&(m.children=m.children.sort((b,S)=>b.pid-S.pid)))}}function a(l){let u=/--utility-sub-type=network/i,p=/--crashes-directory/i,c=/conhost\.exe.+--headless/i,d=/--type=([a-zA-Z-]+)/;if(p.exec(l))return"electron-crash-reporter";if(c.exec(l))return"conpty-agent";let m=d.exec(l);if(m&&m.length===2)return m[1]==="renderer"?"window":m[1]==="utility"?u.exec(l)?"utility-network-service":"utility-process":m[1]==="extensionHost"?"extension-host":m[1];if(l.indexOf("node ")<0&&l.indexOf("node.exe")<0){let h="";do m=cd.exec(l),m&&(h+=m+" ");while(m);if(h)return`electron-nodejs (${h.trim()})`}return l}if(process.platform==="win32"){let l=u=>u.indexOf("\\\\?\\")===0||u.indexOf("\\??\\")===0?u.substring(4):u.indexOf('"\\\\?\\')===0||u.indexOf('"\\??\\')===0?'"'+u.substring(5):u;import("@vscode/windows-process-tree").then(u=>{u.getProcessList(r,p=>{if(!p){t(new Error(`Root process ${r} not found`));return}u.getProcessCpuUsage(p,c=>{let d=new Map;c.forEach(m=>{let h=l(m.commandLine||"");d.set(m.pid,{name:a(h),cmd:h,pid:m.pid,ppid:m.ppid,load:m.cpu||0,mem:m.memory||0})}),n=d.get(r),n?(d.forEach(m=>{let h=d.get(m.ppid);h&&(h.children||(h.children=[]),h.children.push(m))}),d.forEach(m=>{m.children&&(m.children=m.children.sort((h,b)=>h.pid-b.pid))}),e(n)):t(new Error(`Root process ${r} not found`))})},u.ProcessDataFlag.CommandLine|u.ProcessDataFlag.Memory)})}else{let l=function(){let u=[n],p=[];for(;u.length;){let d=u.shift();d&&(p.push(d.pid),d.children&&(u=u.concat(d.children)))}let c=JSON.stringify(qe.asFileUri("vs/base/node/cpuUsage.sh").fsPath);c+=" "+p.join(" "),Zr(c,{},(d,m,h)=>{if(d||h)t(d||new Error(h.toString()));else{let b=m.toString().split(` + | KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,n){let i=g(1903,null,e,tt.getLexeme(t)),o=t.offset,s=tt.getLexeme(t);return this._parsingErrors.push({message:i,offset:o,lexeme:s,additionalInfo:n}),r._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},ae=class{static false(){return ue.INSTANCE}static true(){return fe.INSTANCE}static has(e){return It.create(e)}static equals(e,t){return Rn.create(e,t)}static notEquals(e,t){return Ln.create(e,t)}static regex(e,t){return Mn.create(e,t)}static in(e,t){return Rr.create(e,t)}static notIn(e,t){return Lr.create(e,t)}static not(e){return Tt.create(e)}static and(...e){return Dr.create(e,null,!0)}static or(...e){return Un.create(e,null,!0)}static greater(e,t){return jt.create(e,t)}static greaterEquals(e,t){return Dn.create(e,t)}static smaller(e,t){return An.create(e,t)}static smallerEquals(e,t){return On.create(e,t)}static{this._parser=new uo({regexParsingWithErrorRecovery:!1})}static deserialize(e){return e==null?void 0:this._parser.parse(e)}};function kn(r,e){return r.cmp(e)}var ue=class r{constructor(){this.type=0}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}map(e){return this}negate(){return fe.INSTANCE}},fe=class r{constructor(){this.type=1}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}map(e){return this}negate(){return ue.INSTANCE}},It=class r{constructor(e,t){this.key=e;this.negated=t;this.type=2}static create(e,t=null){let n=re.get(e);return typeof n=="boolean"?n?fe.INSTANCE:ue.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ca(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=re.get(this.key);return typeof e=="boolean"?e?fe.INSTANCE:ue.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(e){return e.mapDefined(this.key)}negate(){return this.negated||(this.negated=Tt.create(this.key,this)),this.negated}},Rn=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=4}static create(e,t,n=null){if(typeof t=="boolean")return t?It.create(e,n):Tt.create(e,n);let i=re.get(e);return typeof i=="boolean"?t===(i?"true":"false")?fe.INSTANCE:ue.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=re.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?fe.INSTANCE:ue.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(e){return e.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Ln.create(this.key,this.value,this)),this.negated}},Rr=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=10;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.valueKey),n=e.getValue(this.key);if(Array.isArray(t)){if(t.includes(n))return!0;if(E&&typeof n=="string"&&n.startsWith("file:///")){let i=n.toLowerCase();return t.some(o=>typeof o=="string"&&o.toLowerCase()===i)}return!1}if(typeof n=="string"&&typeof t=="object"&&t!==null){if(Tc.call(t,n))return!0;if(E&&n.startsWith("file:///")){let i=n.toLowerCase();return Object.keys(t).some(o=>o.toLowerCase()===i)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(e){return e.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Lr.create(this.key,this.valueKey)),this.negated}},Lr=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=11;this._negated=Rr.create(e,t)}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(e){return e.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Ln=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=5}static create(e,t,n=null){if(typeof t=="boolean")return t?Tt.create(e,n):It.create(e,n);let i=re.get(e);return typeof i=="boolean"?t===(i?"true":"false")?ue.INSTANCE:fe.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=re.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?ue.INSTANCE:fe.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(e){return e.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Rn.create(this.key,this.value,this)),this.negated}},Tt=class r{constructor(e,t){this.key=e;this.negated=t;this.type=3}static create(e,t=null){let n=re.get(e);return typeof n=="boolean"?n?ue.INSTANCE:fe.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ca(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=re.get(this.key);return typeof e=="boolean"?e?ue.INSTANCE:fe.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(e){return e.mapNot(this.key)}negate(){return this.negated||(this.negated=It.create(this.key,this)),this.negated}};function Or(r,e){if(typeof r=="string"){let t=parseFloat(r);isNaN(t)||(r=t)}return typeof r=="string"||typeof r=="number"?e(r):ue.INSTANCE}var jt=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=12}static create(e,t,n=null){return Or(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=On.create(this.key,this.value,this)),this.negated}},Dn=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=13}static create(e,t,n=null){return Or(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=An.create(this.key,this.value,this)),this.negated}},An=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=14}static create(e,t,n=null){return Or(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(e){return e.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=jt.create(this.key,this.value,this)),this.negated}},Mn=class r{constructor(e,t){this.key=e;this.regexp=t;this.type=7;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.keye.key)return 1;let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return tn?1:0}equals(e){if(e.type===this.type){let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return this.key===e.key&&t===n}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){let e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}map(e){return e.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=co.create(this)),this.negated}},co=class r{constructor(e){this._actual=e;this.type=8}static create(e){return new r(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(e){return new r(this._actual.map(e))}negate(){return this._actual}};function Pa(r){let e=null;for(let t=0,n=r.length;te.expr.length)return 1;for(let t=0,n=this.expr.length;t1;){let s=i[i.length-1];if(s.type!==9)break;i.pop();let a=i.pop(),l=i.length===0,u=Un.create(s.expr.map(p=>r.create([p,a],null,n)),null,l);u&&(i.push(u),i.sort(kn))}if(i.length===1)return i[0];if(n){for(let s=0;se.serialize()).join(" && ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());this.negated=Un.create(e,this,!0)}return this.negated}},Un=class r{constructor(e,t){this.expr=e;this.negated=t;this.type=9}static create(e,t,n){return r._normalizeArr(e,t,n)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,n=this.expr.length;te.serialize()).join(" || ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){let t=e.shift(),n=e.shift(),i=[];for(let o of Sa(t))for(let s of Sa(n))i.push(Dr.create([o,s],null,!1));e.unshift(r.create(i,null,!1))}this.negated=r.create(e,this,!0)}return this.negated}},Ar=class r extends It{static{this._info=[]}static all(){return r._info.values()}constructor(e,t,n){super(e,null),this._defaultValue=t,typeof n=="object"?r._info.push({...n,key:e}):n!==!0&&r._info.push({key:e,description:n,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return Rn.create(this.key,e)}notEqualsTo(e){return Ln.create(this.key,e)}greater(e){return jt.create(this.key,e)}},Lh=Ie("contextKeyService");function Ca(r,e){return re?1:0}function Et(r,e,t,n){return rt?1:en?1:0}function Sa(r){return r.type===9?r.expr:[r]}var Se=Ie("logService"),jh=Ie("loggerService");function po(r){return Ae(r)}var ka=3;function Dc(r,e){return r!==0&&r<=e}function Gt(r,e=!1){let t="";for(let n=0;n0?" ":"")+i}return t}var Mr=class extends C{constructor(){super(...arguments);this.level=ka;this._onDidChangeLogLevel=this._register(new y)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(t){this.level!==t&&(this.level=t,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(t){return Dc(this.level,t)}canLog(t){return this._store.isDisposed?!1:this.checkLogLevel(t)}},Fn=class extends Mr{constructor(t){super();this.logAlways=t}checkLogLevel(t){return this.logAlways||super.checkLogLevel(t)}trace(t,...n){this.canLog(1)&&this.log(1,Gt([t,...n],!0))}debug(t,...n){this.canLog(2)&&this.log(2,Gt([t,...n]))}info(t,...n){this.canLog(3)&&this.log(3,Gt([t,...n]))}warn(t,...n){this.canLog(4)&&this.log(4,Gt([t,...n]))}error(t,...n){if(this.canLog(5))if(t instanceof Error){let i=Array.prototype.slice.call(arguments);i[0]=t.stack,this.log(5,Gt(i))}else this.log(5,Gt([t,...n]))}flush(){}};var Ur=class extends Mr{constructor(t){super();this.loggers=t;t.length&&this.setLevel(t[0].getLevel())}setLevel(t){for(let n of this.loggers)n.setLevel(t);super.setLevel(t)}trace(t,...n){for(let i of this.loggers)i.trace(t,...n)}debug(t,...n){for(let i of this.loggers)i.debug(t,...n)}info(t,...n){for(let i of this.loggers)i.info(t,...n)}warn(t,...n){for(let i of this.loggers)i.warn(t,...n)}error(t,...n){for(let i of this.loggers)i.error(t,...n)}flush(){for(let t of this.loggers)t.flush()}dispose(){for(let t of this.loggers)t.dispose();super.dispose()}},Nn=class extends C{constructor(t,n,i){super();this.logLevel=t;this.logsHome=n;this._loggers=new lt;this._onDidChangeLoggers=this._register(new y);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new y);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new y);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(i)for(let o of i)this._loggers.set(o.resource,{logger:void 0,info:o})}getLoggerEntry(t){return G(t)?[...this._loggers.values()].find(n=>n.info.id===t):this._loggers.get(t)}getLogger(t){return this.getLoggerEntry(t)?.logger}createLogger(t,n){let i=this.toResource(t),o=G(t)?t:n?.id??Ta(i.toString()).toString(16),s=this._loggers.get(i)?.logger,a=n?.logLevel==="always"?1:n?.logLevel;s||(s=this.doCreateLogger(i,a??this.getLogLevel(i)??this.logLevel,{...n,id:o}));let l={logger:s,info:{resource:i,id:o,logLevel:a,name:n?.name,hidden:n?.hidden,group:n?.group,extensionId:n?.extensionId,when:n?.when}};return this.registerLogger(l.info),this._loggers.set(i,l),s}toResource(t){return G(t)?xe(this.logsHome,`${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):t}setLogLevel(t,n){if(O.isUri(t)){let i=t,o=n,s=this._loggers.get(i);s&&o!==s.info.logLevel&&(s.info.logLevel=o===this.logLevel?void 0:o,s.logger?.setLevel(o),this._loggers.set(s.info.resource,s),this._onDidChangeLogLevel.fire([i,o]))}else{this.logLevel=t;for(let[i,o]of this._loggers.entries())this._loggers.get(i)?.info.logLevel===void 0&&o.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(t,n){let i=this.getLoggerEntry(t);i&&n!==!i.info.hidden&&(i.info.hidden=!n,this._loggers.set(i.info.resource,i),this._onDidChangeVisibility.fire([i.info.resource,n]))}getLogLevel(t){let n;return t&&(n=this._loggers.get(t)?.info.logLevel),n??this.logLevel}registerLogger(t){let n=this._loggers.get(t.resource);n?n.info.hidden!==t.hidden&&this.setVisibility(t.resource,!t.hidden):(this._loggers.set(t.resource,{info:t,logger:void 0}),this._onDidChangeLoggers.fire({added:[t],removed:[]}))}deregisterLogger(t){let n=this.toResource(t),i=this._loggers.get(n);i&&(i.logger&&i.logger.dispose(),this._loggers.delete(n),this._onDidChangeLoggers.fire({added:[],removed:[i.info]}))}*getRegisteredLoggers(){for(let t of this._loggers.values())yield t.info}getRegisteredLogger(t){return this._loggers.get(t)?.info}dispose(){this._loggers.forEach(t=>t.logger?.dispose()),this._loggers.clear(),super.dispose()}};function Ra(r){if(r.verbose)return 1;if(typeof r.logLevel=="string"){let e=Oc(r.logLevel.toLowerCase());if(e!==void 0)return e}return ka}function Ac(r){switch(r){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}function Oc(r){switch(r){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warn":return 4;case"error":return 5;case"critical":return 5;case"off":return 0}}var Gh=new Ar("logLevel",Ac(3));var Fr=class{constructor(e,t){this.loggerService=e;this.getUriTransformer=t}listen(e,t){let n=this.getUriTransformer(e);switch(t){case"onDidChangeLoggers":return w.map(this.loggerService.onDidChangeLoggers,i=>({added:[...i.added].map(o=>this.transformLogger(o,n)),removed:[...i.removed].map(o=>this.transformLogger(o,n))}));case"onDidChangeVisibility":return w.map(this.loggerService.onDidChangeVisibility,i=>[n.transformOutgoingURI(i[0]),i[1]]);case"onDidChangeLogLevel":return w.map(this.loggerService.onDidChangeLogLevel,i=>po(i)?i:[n.transformOutgoingURI(i[0]),i[1]])}throw new Error(`Event not found: ${t}`)}async call(e,t,n){let i=this.getUriTransformer(e);switch(t){case"setLogLevel":return po(n[0])?this.loggerService.setLogLevel(n[0]):this.loggerService.setLogLevel(O.revive(i.transformIncoming(n[0][0])),n[0][1]);case"getRegisteredLoggers":return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(o=>this.transformLogger(o,i)))}throw new Error(`Call not found: ${t}`)}transformLogger(e,t){return{...e,resource:t.transformOutgoingURI(e.resource)}}};var Nr=class extends C{constructor(e,t=[]){super(),this.logger=new Ur([e,...t]),this._register(e.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}flush(){this.logger.flush()}};var Br=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let r=new Uint8Array(16),e=[];for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128;let n=0,i="";return i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i}})();var mo=class{constructor(){this._value="";this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos=0;t--,this._valueLen--){let n=this._value.charCodeAt(t);if(!(n===47||this._splitOnBackslash&&n===92))break}return this.next()}hasNext(){return this._to!1,t=()=>!1){return new r(new ho(e,t))}static forPaths(e=!1){return new r(new Vr(void 0,!e))}static forStrings(){return new r(new mo)}static forConfigKeys(){return new r(new fo)}constructor(e){this._iter=e}clear(){this._root=void 0}fill(e,t){if(t){let n=t.slice(0);mi(n);for(let i of n)this.set(i,e)}else{let n=e.slice(0);mi(n);for(let i of n)this.set(i[0],i[1])}}set(e,t){let n=this._iter.reset(e),i;this._root||(this._root=new Xt,this._root.segment=n.value());let o=[];for(i=this._root;;){let a=n.cmp(i.segment);if(a>0)i.left||(i.left=new Xt,i.left.segment=n.value()),o.push([-1,i]),i=i.left;else if(a<0)i.right||(i.right=new Xt,i.right.segment=n.value()),o.push([1,i]),i=i.right;else if(n.hasNext())n.next(),i.mid||(i.mid=new Xt,i.mid.segment=n.value()),o.push([0,i]),i=i.mid;else break}let s=Ge.unwrap(i.value);i.value=Ge.wrap(t),i.key=e;for(let a=o.length-1;a>=0;a--){let l=o[a][1];l.updateHeight();let u=l.balanceFactor();if(u<-1||u>1){let p=o[a][0],c=o[a+1][0];if(p===1&&c===1)o[a][1]=l.rotateLeft();else if(p===-1&&c===-1)o[a][1]=l.rotateRight();else if(p===1&&c===-1)l.right=o[a+1][1]=o[a+1][1].rotateRight(),o[a][1]=l.rotateLeft();else if(p===-1&&c===1)l.left=o[a+1][1]=o[a+1][1].rotateLeft(),o[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(o[a-1][0]){case-1:o[a-1][1].left=o[a][1];break;case 1:o[a-1][1].right=o[a][1];break;case 0:o[a-1][1].mid=o[a][1];break}else this._root=o[0][1]}}return s}get(e){return Ge.unwrap(this._getNode(e)?.value)}_getNode(e){let t=this._iter.reset(e),n=this._root;for(;n;){let i=t.cmp(n.segment);if(i>0)n=n.left;else if(i<0)n=n.right;else if(t.hasNext())t.next(),n=n.mid;else break}return n}has(e){let t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){let n=this._iter.reset(e),i=[],o=this._root;for(;o;){let s=n.cmp(o.segment);if(s>0)i.push([-1,o]),o=o.left;else if(s<0)i.push([1,o]),o=o.right;else if(n.hasNext())n.next(),i.push([0,o]),o=o.mid;else break}if(o){if(t?(o.left=void 0,o.mid=void 0,o.right=void 0,o.height=1):(o.key=void 0,o.value=void 0),!o.mid&&!o.value)if(o.left&&o.right){let s=[[1,o]],a=this._min(o.right,s);if(a.key){o.key=a.key,o.value=a.value,o.segment=a.segment;let l=a.right;if(s.length>1){let[p,c]=s[s.length-1];switch(p){case-1:c.left=l;break;case 0:Qn(!1);case 1:Qn(!1)}}else o.right=l;let u=this._balanceByStack(s);if(i.length>0){let[p,c]=i[i.length-1];switch(p){case-1:c.left=u;break;case 0:c.mid=u;break;case 1:c.right=u;break}}else this._root=u}}else{let s=o.left??o.right;if(i.length>0){let[a,l]=i[i.length-1];switch(a){case-1:l.left=s;break;case 0:l.mid=s;break;case 1:l.right=s;break}}else this._root=s}this._root=this._balanceByStack(i)??this._root}}_min(e,t){for(;e.left;)t.push([-1,e]),e=e.left;return e}_balanceByStack(e){for(let t=e.length-1;t>=0;t--){let n=e[t][1];n.updateHeight();let i=n.balanceFactor();if(i>1?(n.right.balanceFactor()>=0||(n.right=n.right.rotateRight()),e[t][1]=n.rotateLeft()):i<-1&&(n.left.balanceFactor()<=0||(n.left=n.left.rotateLeft()),e[t][1]=n.rotateRight()),t>0)switch(e[t-1][0]){case-1:e[t-1][1].left=e[t][1];break;case 1:e[t-1][1].right=e[t][1];break;case 0:e[t-1][1].mid=e[t][1];break}else return e[0][1]}}findSubstr(e){let t=this._iter.reset(e),n=this._root,i;for(;n;){let o=t.cmp(n.segment);if(o>0)n=n.left;else if(o<0)n=n.right;else if(t.hasNext())t.next(),i=Ge.unwrap(n.value)||i,n=n.mid;else break}return n&&Ge.unwrap(n.value)||i}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){let n=this._iter.reset(e),i=this._root;for(;i;){let o=n.cmp(i.segment);if(o>0)i=i.left;else if(o<0)i=i.right;else if(n.hasNext())n.next(),i=i.mid;else return i.mid?this._entries(i.mid):t?Ge.unwrap(i.value):void 0}}hasElementOrSubtree(e){return this._findSuperstrOrElement(e,!0)!==void 0}forEach(e){for(let[t,n]of this)e(n,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){let t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value!==void 0&&t.push([e.key,Ge.unwrap(e.value)]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}_isBalanced(){let e=t=>{if(!t)return!0;let n=t.balanceFactor();return n<-1||n>1?!1:e(t.left)&&e(t.right)};return e(this._root)}};var Rg=Ie("fileService");var La=class r{constructor(e,t){this.ignorePathCasing=t;this.correlationId=void 0;this.added=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawAdded.map(t=>[t,!0])),e});this.updated=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawUpdated.map(t=>[t,!0])),e});this.deleted=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawDeleted.map(t=>[t,!0])),e});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let n of e){switch(n.type){case 1:this.rawAdded.push(n.resource);break;case 0:this.rawUpdated.push(n.resource);break;case 2:this.rawDeleted.push(n.resource);break}this.correlationId!==r.MIXED_CORRELATION&&(typeof n.cId=="number"?this.correlationId===void 0?this.correlationId=n.cId:this.correlationId!==n.cId&&(this.correlationId=r.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=r.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(e,...t){return this.doContains(e,{includeChildren:!1},...t)}affects(e,...t){return this.doContains(e,{includeChildren:!0},...t)}doContains(e,t,...n){if(!e)return!1;let i=n.length>0;return!!((!i||n.includes(1))&&(this.added.value.get(e)||t.includeChildren&&this.added.value.findSuperstr(e))||(!i||n.includes(0))&&(this.updated.value.get(e)||t.includeChildren&&this.updated.value.findSuperstr(e))||(!i||n.includes(2))&&(this.deleted.value.findSubstr(e)||t.includeChildren&&this.deleted.value.findSuperstr(e)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(e){return this.correlationId===e}hasCorrelation(){return typeof this.correlationId=="number"}};var Kr=class r{static{this.KB=1024}static{this.MB=r.KB*r.KB}static{this.GB=r.MB*r.KB}static{this.TB=r.GB*r.KB}static formatSize(e){return Ae(e)||(e=0),e{this._logger&&Aa(this._logger,a)}))}async _createSpdLogLogger(t,n,i,o){let s=i?6:1,a=30/s*Kr.MB,l=await Mc(t,n,a,s,o);if(l){this._logger=l,Aa(this._logger,this.getLevel());for(let{level:u,message:p}of this.buffer)Da(this._logger,u,p);this.buffer=[]}}log(t,n){this._logger?Da(this._logger,t,n):this.getLevel()<=t&&this.buffer.push({level:t,message:n})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}};var $r=class extends Nn{doCreateLogger(e,t,n){return new Wr(Br(),e.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,t)}};var ce,yo=globalThis.vscode;if(typeof yo<"u"&&typeof yo.context<"u"){let r=yo.context.configuration();if(r)ce=r.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(ce=globalThis._VSCODE_PRODUCT_JSON,te.VSCODE_DEV&&Object.assign(ce,{nameShort:`${ce.nameShort} Dev`,nameLong:`${ce.nameLong} Dev`,dataFolderName:`${ce.dataFolderName}-dev`,serverDataFolderName:ce.serverDataFolderName?`${ce.serverDataFolderName}-dev`:void 0}),!ce.version){let r=globalThis._VSCODE_PACKAGE_JSON;Object.assign(ce,{version:r.version})}Object.assign(ce,{extensionsGallery:te.EXTENSIONS_GALLERY?JSON.parse(te.EXTENSIONS_GALLERY):ce.extensionsGallery||{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item",extensionUrlTemplate:"https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",resourceUrlTemplate:"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",controlUrl:"",recommendationsUrl:""},telemetryEndpoint:te.CS_TELEMETRY_URL||ce.telemetryEndpoint||"https://v1.telemetry.coder.com/track"})}else ce={nameShort:"code-server",nameLong:"code-server",applicationName:"code-server",dataFolderName:".code-server",win32MutexName:"codeserver",licenseName:"MIT",licenseUrl:"https://github.com/coder/code-server/blob/main/LICENSE",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"code-server",win32NameVersion:"code-server",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"coder.code-server",win32ShellNameShort:"c&ode-server",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.coder.code.server",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"com.coder.code.server",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/coder/code-server/issues/new",nodejsRepository:"https://nodejs.org",urlProtocol:"code-oss",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.117.0",sha256:"854eeb8a785b1f41ba2bd02d7ccd4fdbe10021b61473293973c7e96d036c7fb8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",completionsRefreshTokenCommand:"github.copilot.signIn",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry"},trustedExtensionAuthAccess:["vscode.git","vscode.github","github.vscode-pull-request-github","github.copilot","github.copilot-chat"],onboardingKeymaps:[{id:"vscode",label:"VS Code",description:"Default keyboard mapping"},{id:"sublime",label:"Sublime Text",extensionId:"ms-vscode.sublime-keybindings",description:"Keyboard mapping from Sublime Text"},{id:"intellij",label:"IntelliJ / JetBrains",extensionId:"k--kato.intellij-idea-keybindings",description:"Keyboard mapping from IntelliJ IDEA"},{id:"vim",label:"Vim",extensionId:"vscodevim.vim",description:"Vim modal editing"},{id:"eclipse",label:"Eclipse",extensionId:"alphabotsec.vscode-eclipse-keybindings",description:"Keyboard mapping from Eclipse"},{id:"notepadpp",label:"Notepad++",extensionId:"ms-vscode.notepadplusplus-keybindings",description:"Keyboard mapping from Notepad++"}],onboardingThemes:[{id:"dark-2026",label:"Dark 2026",themeId:"Dark 2026",type:"dark"},{id:"hc-dark",label:"Dark High Contrast",themeId:"Default High Contrast",type:"hcDark"},{id:"solarized-dark",label:"Solarized Dark",themeId:"Solarized Dark",type:"dark"},{id:"light-2026",label:"Light 2026",themeId:"Light 2026",type:"light"},{id:"hc-light",label:"Light High Contrast",themeId:"Default High Contrast Light",type:"hcLight"},{id:"solarized-light",label:"Solarized Light",themeId:"Solarized Light",type:"light"}],builtInExtensionsEnabledWithAutoUpdates:["GitHub.copilot-chat"],enableTelemetry:!0,quality:"stable",codeServerVersion:"4.117.0",documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",linkProtectionTrustedDomains:["https://open-vsx.org"],aiConfig:{ariaKey:"code-server"},version:"1.117.0",commit:"ddeb0a3de0321412c0633dffa85d35770005ae0f",date:"2026-04-21T16:12:14-07:00"},Object.keys(ce).length===0&&Object.assign(ce,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var Oa=ce;var vo=class{constructor(){this.data=new Map}add(e,t){Xn(G(e)),Xn(yi(t)),Xn(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}knows(e){return this.data.has(e)}as(e){return this.data.get(e)||null}dispose(){this.data.forEach(e=>{ut(e.dispose)&&e.dispose()}),this.data.clear()}},Ma=new vo;var Xg=Ie("ptyService");var Uc={Backend:"workbench.contributions.terminal.processBackend"},bo=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(e){let t=this._sanitizeRemoteAuthority(e.remoteAuthority);if(this._backends.has(t))throw new Error(`A terminal backend with remote authority '${t}' was already registered.`);this._backends.set(t,e)}getTerminalBackend(e){return this._backends.get(this._sanitizeRemoteAuthority(e))}_sanitizeRemoteAuthority(e){return e?.toLowerCase()??""}};Ma.add(Uc.Backend,new bo);var Qg=Ie("localPtyService"),Yg=Ie("terminalLogService");var qr=class extends C{constructor(){super();this._onBeat=this._register(new y);this.onBeat=this._onBeat.event;let t=setInterval(()=>{this._onBeat.fire()},5e3);this._register(Y(()=>clearInterval(t)))}};import{execFile as dl,exec as Td}from"child_process";import{userInfo as Hc}from"os";import*as _o from"os";var Ua=/^\d+$/,Fc=/^Microsoft.PowerShell_.*/,Nc=/^Microsoft.PowerShellPreview_.*/;var Bn;switch(process.arch){case"ia32":Bn=1;break;case"arm":case"arm64":Bn=2;break;default:Bn=0;break}var Yt;process.env.PROCESSOR_ARCHITEW6432?Yt=process.env.PROCESSOR_ARCHITEW6432==="ARM64"?2:0:process.env.PROCESSOR_ARCHITECTURE==="ARM64"?Yt=2:process.env.PROCESSOR_ARCHITECTURE==="X86"?Yt=1:Yt=0;var wt=class{constructor(e,t,n){this.exePath=e;this.displayName=t;this.knownToExist=n}async exists(){return this.knownToExist===void 0&&(this.knownToExist=await He.existsFile(this.exePath)),this.knownToExist}};function Bc({useAlternateBitness:r=!1}={}){return r?Bn===0?process.env["ProgramFiles(x86)"]||null:Yt===0&&process.env.ProgramW6432||null:process.env.ProgramFiles||null}async function zr({useAlternateBitness:r=!1,findPreview:e=!1}={}){let t=Bc({useAlternateBitness:r});if(!t)return null;let n=A(t,"PowerShell");if(!await He.existsDirectory(n))return null;let i=-1,o=null;for(let l of await Pn.readdir(n)){let u=-1;if(e){let c=l.indexOf("-");if(c<0)continue;let d=l.substring(0,c);if(!Ua.test(d)||l.substring(c+1)!=="preview")continue;u=parseInt(d,10)}else{if(!Ua.test(l))continue;u=parseInt(l,10)}if(u<=i)continue;let p=A(n,l,"pwsh.exe");await He.existsFile(p)&&(o=p,i=u)}if(!o)return null;let s=t.includes("x86")?" (x86)":"",a=e?" Preview":"";return new wt(o,`PowerShell${a}${s}`,!0)}async function Fa({findPreview:r}={}){if(!process.env.LOCALAPPDATA)return null;let e=A(process.env.LOCALAPPDATA,"Microsoft","WindowsApps");if(!await He.existsDirectory(e))return null;let{pwshMsixDirRegex:t,pwshMsixName:n}=r?{pwshMsixDirRegex:Nc,pwshMsixName:"PowerShell Preview (Store)"}:{pwshMsixDirRegex:Fc,pwshMsixName:"PowerShell (Store)"};for(let i of await Pn.readdir(e))if(t.test(i)){let o=A(e,i,"pwsh.exe");return new wt(o,n)}return null}function Vc(){let r=A(_o.homedir(),".dotnet","tools","pwsh.exe");return new wt(r,".NET Core PowerShell Global Tool")}function Kc(){let r=A(_o.homedir(),"scoop","apps"),e=A(r,"pwsh","current","pwsh.exe");return new wt(e,"PowerShell (Scoop)")}function Wc(){let r=A(process.env.windir,Bn===1&&Yt!==1?"SysNative":"System32","WindowsPowerShell","v1.0","powershell.exe");return new wt(r,"Windows PowerShell",!0)}async function*$c(){let r=await zr();r&&(yield r),r=await zr({useAlternateBitness:!0}),r&&(yield r),r=await Fa(),r&&(yield r),r=Vc(),r&&(yield r),r=await zr({findPreview:!0}),r&&(yield r),r=await Fa({findPreview:!0}),r&&(yield r),r=await zr({useAlternateBitness:!0,findPreview:!0}),r&&(yield r),r=await Kc(),r&&(yield r),r=Wc(),r&&(yield r)}async function*qc(){for await(let r of $c())await r.exists()&&(yield r)}async function Na(){for await(let r of qc())return r;return null}async function Ba(r,e){return r===1?E?Gc():pa(e):jc(r,e)}var xo=null;function jc(r,e){if(Ce&&r===2||ve&&r===3)return"/bin/bash";if(!xo){let t;if(E)t="/bin/bash";else{if(t=e.SHELL,!t)try{t=Hc().shell}catch{}t||(t="sh"),t==="/bin/false"&&(t="/bin/bash")}xo=t}return xo}var Io=null;async function Gc(){return Io||(Io=(await Na()).exePath),Io}var Zt=class extends C{constructor(t,n){super();this._logService=n;this._lastRequestId=0;this._pendingRequests=new Map;this._pendingRequestDisposables=new Map;this._onCreateRequest=this._register(new y);this.onCreateRequest=this._onCreateRequest.event;this._timeout=t===void 0?15e3:t,this._register(Y(()=>{for(let i of this._pendingRequestDisposables.values())Pe(i)}))}createRequest(t){return new Promise((n,i)=>{let o=++this._lastRequestId;this._pendingRequests.set(o,n),this._onCreateRequest.fire({requestId:o,...t});let s=new Ue;me(this._timeout,s.token).then(()=>i(`Request ${o} timed out (${this._timeout}ms)`)),this._pendingRequestDisposables.set(o,[Y(()=>s.cancel())])})}acceptReply(t,n){let i=this._pendingRequests.get(t);i?(this._pendingRequests.delete(t),Pe(this._pendingRequestDisposables.get(t)||[]),this._pendingRequestDisposables.delete(t),i(n)):this._logService.warn(`RequestStore#acceptReply was called without receiving a matching request ${t}`)}};Zt=f([ge(1,Se)],Zt);var Hr=class{constructor(e){this._callback=e;this._terminalBufferMap=new Map}dispose(){for(let e of this._terminalBufferMap.values())e.dispose()}startBuffering(e,t,n=5){let i=t(o=>{let s=G(o)?o:o.data,a=this._terminalBufferMap.get(e);if(a){a.data.push(s);return}let l=setTimeout(()=>this.flushBuffer(e),n);a={data:[s],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(e),i.dispose()}},this._terminalBufferMap.set(e,a)});return i}stopBuffering(e){this._terminalBufferMap.get(e)?.dispose()}flushBuffer(e){let t=this._terminalBufferMap.get(e);t&&(this._terminalBufferMap.delete(e),this._callback(e,t.data.join("")))}};function Ka(r,e){let t=r;t.includes("\\")&&(t=t.replace(/\\/g,"\\\\"));let n;switch(e){case"bash":case"sh":case"zsh":case"gitbash":n={bothQuotes:o=>`$'${o.replace(/'/g,"\\'")}'`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break;case"fish":n={bothQuotes:o=>`"${o.replace(/"/g,'\\"')}"`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break;case"pwsh":n={bothQuotes:o=>`"${o.replace(/"/g,'`"')}"`,singleQuotes:o=>`'${o.replace(/'/g,"''")}'`,noSingleQuotes:o=>`'${o}'`};break;default:n={bothQuotes:o=>`$'${o.replace(/'/g,"\\'")}'`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break}let i=/[\`\$\|\&\>\~\#\!\^\*\;\<]/g;return t=t.replace(i,""),t.includes("'")&&t.includes('"')?n.bothQuotes(t):t.includes("'")?n.singleQuotes(t):n.noSingleQuotes(t)}function Wa(r){return r.match(/^['"].*['"]$/)&&(r=r.substring(1,r.length-1)),nr===1&&r&&r[1]===":"?r[0].toUpperCase()+r.substring(1):r}import*as en from"os";function Qc(r){return new Map(r)}function Yc(r){return new Map(r??[])}function $a(r){return new Map(r.map(e=>[e[0],{map:Qc(e[1]),descriptionMap:Yc(e[2])}]))}var Jc=new Map([[2,"APPEND"],[3,"PREPEND"],[1,"REPLACE"]]),ed=/^VSCODE_PYTHON_(PWSH|ZSH|BASH|FISH)_ACTIVATE/,td="ms-python.vscode-python-envs",jr=class{constructor(e){this.collections=e;this.map=new Map;this.descriptionMap=new Map;e.forEach((t,n)=>{this.populateDescriptionMap(t,n);let i=t.map.entries(),o=i.next();for(;!o.done;){let s=o.value[1],a=o.value[0];if(this.blockPythonActivationVar(a,n)){o=i.next();continue}let l=this.map.get(a);if(l||(l=[],this.map.set(a,l)),l.length>0&&l[0].type===1){o=i.next();continue}let u={extensionIdentifier:n,value:s.value,type:s.type,scope:s.scope,variable:s.variable,options:s.options};u.scope||delete u.scope,l.unshift(u),o=i.next()}})}async applyToProcessEnvironment(e,t,n){let i;E&&(i={},Object.keys(e).forEach(o=>i[o.toLowerCase()]=o));for(let[o,s]of this.getVariableMap(t)){let a=E&&i[o.toLowerCase()]||o;for(let l of s){let u=n?await n(l.value):l.value;if(!this.blockPythonActivationVar(l.variable,l.extensionIdentifier)){if(l.options?.applyAtProcessCreation??!0)switch(l.type){case 2:e[a]=(e[a]||"")+u;break;case 3:e[a]=u+(e[a]||"");break;case 1:e[a]=u;break}if(l.options?.applyAtShellIntegration??!1){let p=`VSCODE_ENV_${Jc.get(l.type)}`;e[p]=(e[p]?e[p]+":":"")+o+"="+this._encodeColons(u)}}}}}_encodeColons(e){return e.replaceAll(":","\\x3a")}blockPythonActivationVar(e,t){return!!(ed.test(e)&&td!==t)}diff(e,t){let n=new Map,i=new Map,o=new Map;if(e.getVariableMap(t).forEach((s,a)=>{let l=this.getVariableMap(t).get(a),u=za(s,l);u&&n.set(a,u)}),this.getVariableMap(t).forEach((s,a)=>{let l=e.getVariableMap(t).get(a),u=za(s,l);u&&o.set(a,u)}),this.getVariableMap(t).forEach((s,a)=>{let l=e.getVariableMap(t).get(a),u=nd(s,l);u&&i.set(a,u)}),!(n.size===0&&i.size===0&&o.size===0))return{added:n,changed:i,removed:o}}getVariableMap(e){let t=new Map;for(let n of this.map.values()){let i=n.filter(o=>qa(o,e));i.length>0&&t.set(i[0].variable,i)}return t}getDescriptionMap(e){let t=new Map;for(let n of this.descriptionMap.values()){let i=n.filter(o=>qa(o,e,!0));for(let o of i)t.set(o.extensionIdentifier,o.description)}return t}populateDescriptionMap(e,t){if(!e.descriptionMap)return;let n=e.descriptionMap.entries(),i=n.next();for(;!i.done;){let o=i.value[1],s=i.value[0],a=this.descriptionMap.get(s);a||(a=[],this.descriptionMap.set(s,a));let l={extensionIdentifier:t,scope:o.scope,description:o.description};l.scope||delete l.scope,a.push(l),i=n.next()}}};function qa(r,e,t=!1){return r.scope?!!(r.scope.workspaceFolder&&e?.workspaceFolder&&r.scope.workspaceFolder.index===e.workspaceFolder.index):t?e===r.scope:!0}function za(r,e){if(!e)return r;let t=new Set;e.forEach(i=>t.add(i.extensionIdentifier));let n=[];return r.forEach(i=>{t.has(i.extensionIdentifier)||n.push(i)}),n.length===0?void 0:n}function nd(r,e){if(!e)return;let t=new Map;e.forEach(i=>t.set(i.extensionIdentifier,i));let n=[];return r.forEach(i=>{let o=t.get(i.extensionIdentifier);o&&(i.type!==o.type||i.value!==o.value||i.scope?.workspaceFolder?.index!==o.scope?.workspaceFolder?.index)&&n.push(o)}),n.length===0?void 0:n}import{chmod as ja,realpathSync as id,mkdirSync as od}from"fs";import{promisify as Ga}from"util";import*as Gr from"os";var St;async function rd(){if(St)return;if(!E){St={release:Gr.release(),buildNumber:0};return}let r,e;try{let t=await import("@vscode/windows-registry"),n="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",i=t.GetStringRegKey("HKEY_LOCAL_MACHINE",n,"CurrentBuild");i!==void 0&&(r=parseInt(i,10),isNaN(r)&&(r=void 0));let o=t.GetDWORDRegKey("HKEY_LOCAL_MACHINE",n,"CurrentMajorVersionNumber"),s=t.GetDWORDRegKey("HKEY_LOCAL_MACHINE",n,"CurrentMinorVersionNumber");o!==void 0&&s!==void 0&&i!==void 0&&(e=`${o}.${s}.${i}`)}catch{}finally{St={release:e||Gr.release(),buildNumber:r||Ha()}}}async function Jt(){return St||await rd(),St.buildNumber}function Eo(){return St?St.buildNumber:E?Ha():0}function Ha(){let r=/(\d+)\.(\d+)\.(\d+)/g.exec(Gr.release());return r&&r.length===4?parseInt(r[3],10):0}async function Za(r,e,t,n,i,o=!1){if(!e.shellIntegration.enabled)return{type:"failure",reason:"injectionSettingDisabled"};if(!r.executable)return{type:"failure",reason:"noExecutable"};if(r.isFeatureTerminal&&!r.forceShellIntegration)return{type:"failure",reason:"featureTerminal"};if(r.ignoreShellIntegration)return{type:"failure",reason:"ignoreShellIntegrationFlag"};let s=E?await Jt():0;if(E&&s<18309)return{type:"failure",reason:"unsupportedWindowsBuild"};let a=r.args,l=rr==="win32"?yt(r.executable).toLowerCase():yt(r.executable),u=ke(qe.asFileUri("").fsPath),p="injection",c,d={VSCODE_INJECTION:"1"};e.shellIntegration.nonce&&(d.VSCODE_NONCE=e.shellIntegration.nonce);let m=["PATH","VIRTUAL_ENV","HOME","SHELL","PWD"];if(r.shellIntegrationEnvironmentReporting&&(E?(e.windowsUseConptyDll||s>=22631&&l!=="bash.exe")&&(d.VSCODE_SHELL_ENV_REPORTING=m.join(",")):d.VSCODE_SHELL_ENV_REPORTING=m.join(",")),E)return l==="pwsh.exe"||l==="powershell.exe"?(d.VSCODE_A11Y_MODE=e.isScreenReaderOptimized?"1":"0",!a||Ya(a)?c=Q.get("windows-pwsh"):Qa(a)&&(c=Q.get("windows-pwsh-login")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u,""),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"}):l==="bash.exe"?(!a||a.length===0?c=Q.get("bash"):Yr(a)&&(d.VSCODE_SHELL_LOGIN="1",Xr(e,d,l),c=Q.get("bash")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"}):(n.warn(`Shell integration cannot be enabled for executable "${r.executable}" and args`,r.args),{type:"failure",reason:"unsupportedShell"});switch(l){case"bash":return!a||a.length===0?c=Q.get("bash"):Yr(a)&&(d.VSCODE_SHELL_LOGIN="1",Xr(e,d,l),c=Q.get("bash")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"fish":return!a||a.length===0?c=Q.get("fish"):Yr(a)?c=Q.get("fish-login"):(a===Q.get("fish")||a===Q.get("fish-login"))&&(c=a),c?(Xr(e,d,l),c=[...c],c[c.length-1]=_t(c[c.length-1],u),{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"pwsh":return!a||Ya(a)?c=Q.get("pwsh"):Qa(a)&&(c=Q.get("pwsh-login")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u,""),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"zsh":{if(!a||a.length===0?c=Q.get("zsh"):Yr(a)?(c=Q.get("zsh-login"),Xr(e,d,l)):(a===Q.get("zsh")||a===Q.get("zsh-login"))&&(c=a),!c)return{type:"failure",reason:"unsupportedArgs"};c=[...c],c[c.length-1]=_t(c[c.length-1],u);let h;try{h=en.userInfo().username}catch{h="unknown"}let b=id(en.tmpdir()),S=A(b,`${h}-${i.applicationName}-zsh`);if(!o)try{await Ga(ja)(S,960)}catch(B){if(B.message.includes("ENOENT")){try{od(S)}catch(Te){return n.error(`Failed to create zdotdir at ${S}: ${Te}`),{type:"failure",reason:"failedToCreateTmpDir"}}try{await Ga(ja)(S,960)}catch{return n.error(`Failed to set sticky bit on ${S}: ${B}`),{type:"failure",reason:"failedToSetStickyBit"}}}return n.error(`Failed to set sticky bit on ${S}: ${B}`),{type:"failure",reason:"failedToSetStickyBit"}}d.ZDOTDIR=S;let H=t?.ZDOTDIR??en.homedir()??"~";d.USER_ZDOTDIR=H;let z=[];return z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh"),dest:A(S,".zshrc")}),z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-profile.zsh"),dest:A(S,".zprofile")}),z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-env.zsh"),dest:A(S,".zshenv")}),z.push({source:A(u,"out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh"),dest:A(S,".zlogin")}),{type:p,newArgs:c,envMixin:d,filesToCopy:z}}}return n.warn(`Shell integration cannot be enabled for executable "${r.executable}" and args`,r.args),{type:"failure",reason:"unsupportedShell"}}function Xr(r,e,t){if((ve||t==="fish")&&r.environmentVariableCollections){let n=$a(r.environmentVariableCollections),o=new jr(n).getVariableMap({workspaceFolder:r.workspaceFolder}).get("PATH"),s=[];if(o)for(let a of o)a.type===3&&s.push(a.value);s.length>0&&(e.VSCODE_PATH_PREFIX=s.join(""))}}var Q=new Map;Q.set("windows-pwsh",["-noexit","-command",'try { . "{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1" } catch {}{1}']);Q.set("windows-pwsh-login",["-l","-noexit","-command",'try { . "{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1" } catch {}{1}']);Q.set("pwsh",["-noexit","-command",'. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"{1}']);Q.set("pwsh-login",["-l","-noexit","-command",'. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"']);Q.set("zsh",["-i"]);Q.set("zsh-login",["-il"]);Q.set("bash",["--init-file","{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh"]);Q.set("fish",["--init-command",'source "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish"']);Q.set("fish-login",["-l","--init-command",'source "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish"']);var Qr=["-login","-l"],Xa=["--login","-l"],sd=["-i","--interactive"],Zr=["-nol","-nologo"];function Qa(r){return G(r)?Qr.includes(r.toLowerCase()):r.length===1&&Qr.includes(r[0].toLowerCase())||r.length===2&&(Qr.includes(r[0].toLowerCase())||Qr.includes(r[1].toLowerCase()))&&(Zr.includes(r[0].toLowerCase())||Zr.includes(r[1].toLowerCase()))}function Ya(r){return G(r)?Zr.includes(r.toLowerCase()):r.length===0||r?.length===1&&Zr.includes(r[0].toLowerCase())}function Yr(r){return G(r)||(r=r.filter(e=>!sd.includes(e.toLowerCase()))),G(r)&&Xa.includes(r.toLowerCase())||!G(r)&&r.length===1&&Xa.includes(r[0].toLowerCase())}var ad=/^(?:.*_)?(?:API_?KEY|TOKEN|SECRET|PASSWORD|PASSWD|PWD|CREDENTIAL|AUTH|PRIVATE_?KEY|ACCESS_?KEY|CLIENT_?SECRET|APIKEY)(?:_.*)?$/i,ld=[/^eyJ[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/,/^gh[psuro]_[a-zA-Z0-9]{36}$/,/^github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}$/,/^AIza[A-Za-z0-9_\-]{35}$/,/^xox[pbar]\-[A-Za-z0-9\-]+$/,/^[a-zA-Z0-9]{32,}$/];function Vn(r){if(!r)return r;let e={};for(let t of Object.keys(r)){let n=r[t];if(n===void 0)continue;if(ad.test(t)){e[t]="";continue}let i=!1;for(let o of ld)if(o.test(n)){i=!0;break}e[t]=i?"":n}return e}import*as tn from"fs";import{exec as hd}from"child_process";var Ja=Ie("productService");import{exec as Jr}from"child_process";import{totalmem as ud}from"os";var cd=/[a-zA-Z-]+\.js\b/g;function tl(r){return new Promise((e,t)=>{let n,i=new Map,o=ud();function s(l,u,p,c,d){let m=i.get(u);if(l===r||m){let h={name:a(p),cmd:p,pid:l,ppid:u,load:c,mem:E?d:o*(d/100)};i.set(l,h),l===r&&(n=h),m&&(m.children||(m.children=[]),m.children.push(h),m.children.length>1&&(m.children=m.children.sort((b,S)=>b.pid-S.pid)))}}function a(l){let u=/--utility-sub-type=network/i,p=/--crashes-directory/i,c=/conhost\.exe.+--headless/i,d=/--type=([a-zA-Z-]+)/;if(p.exec(l))return"electron-crash-reporter";if(c.exec(l))return"conpty-agent";let m=d.exec(l);if(m&&m.length===2)return m[1]==="renderer"?"window":m[1]==="utility"?u.exec(l)?"utility-network-service":"utility-process":m[1]==="extensionHost"?"extension-host":m[1];if(l.indexOf("node ")<0&&l.indexOf("node.exe")<0){let h="";do m=cd.exec(l),m&&(h+=m+" ");while(m);if(h)return`electron-nodejs (${h.trim()})`}return l}if(process.platform==="win32"){let l=u=>u.indexOf("\\\\?\\")===0||u.indexOf("\\??\\")===0?u.substring(4):u.indexOf('"\\\\?\\')===0||u.indexOf('"\\??\\')===0?'"'+u.substring(5):u;import("@vscode/windows-process-tree").then(u=>{u.getProcessList(r,p=>{if(!p){t(new Error(`Root process ${r} not found`));return}u.getProcessCpuUsage(p,c=>{let d=new Map;c.forEach(m=>{let h=l(m.commandLine||"");d.set(m.pid,{name:a(h),cmd:h,pid:m.pid,ppid:m.ppid,load:m.cpu||0,mem:m.memory||0})}),n=d.get(r),n?(d.forEach(m=>{let h=d.get(m.ppid);h&&(h.children||(h.children=[]),h.children.push(m))}),d.forEach(m=>{m.children&&(m.children=m.children.sort((h,b)=>h.pid-b.pid))}),e(n)):t(new Error(`Root process ${r} not found`))})},u.ProcessDataFlag.CommandLine|u.ProcessDataFlag.Memory)})}else{let l=function(){let u=[n],p=[];for(;u.length;){let d=u.shift();d&&(p.push(d.pid),d.children&&(u=u.concat(d.children)))}let c=JSON.stringify(qe.asFileUri("vs/base/node/cpuUsage.sh").fsPath);c+=" "+p.join(" "),Jr(c,{},(d,m,h)=>{if(d||h)t(d||new Error(h.toString()));else{let b=m.toString().split(` diff --git a/lib/vscode/out/vs/workbench/api/node/extensionHostProcess.js b/lib/vscode/out/vs/workbench/api/node/extensionHostProcess.js -index c042d78a3399c4e2e9e79f17606b3b793c01ac1d..ae53dfd7862179d8454a451f06e9906ff7a8e7ef 100644 +index 8c86d76950d31b943e76f815be7c133f9104f144..f85f2382e3b5d5785c5fc9b36698dcd5e366dc6d 100644 --- a/lib/vscode/out/vs/workbench/api/node/extensionHostProcess.js +++ b/lib/vscode/out/vs/workbench/api/node/extensionHostProcess.js -@@ -637,37 +637,20 @@ END_NATIVE_LOG - `),this._isMakingConsoleCall=!1}_wrapStream(e,n){let o=process[e],i=o.write,s="";Object.defineProperty(o,"write",{set:()=>{},get:()=>(a,l,d)=>{if(!this._isMakingConsoleCall){s+=a.toString(l);let c=s.length>pJ?s.length:s.lastIndexOf(` - `);c!==-1&&(console[n](s.slice(0,c)),s=s.slice(c+1))}i.call(o,a,l,d)}})}};Jf=_([C(0,se),C(1,Ye)],Jf);import{constants as rN,promises as $u}from"fs";async function e$(r,t,e,n,o,i){let s;try{await mJ(r,t,e,n,o,i)}catch(a){s=a}finally{s&&o.errorTransformer&&(s=o.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function mJ(r,t,e,n,o,i){oN(i);let s=await r.open(t,{create:!1});try{oN(i);let a=0,l=0,d=o&&typeof o.length=="number"?o.length:void 0,c=H.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),u=o&&typeof o.position=="number"?o.position:0,m=0;do l=await r.read(s,u,c.buffer,m,c.byteLength-m),u+=l,m+=l,a+=l,typeof d=="number"&&(d-=l),m===c.byteLength&&(await e.write(n(c)),c=H.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),m=0);while(l>0&&(typeof d!="number"||d>0)&&oN(i)&&gJ(a,o));if(m>0){let g=m;typeof d=="number"&&(g=Math.min(m,d)),e.write(n(c.slice(0,g)))}}catch(a){throw s2(a)}finally{await r.close(s)}}function oN(r){if(r.isCancellationRequested)throw Ys();return!0}function gJ(r,t){if(typeof t?.limits?.size=="number"&&r>t.limits.size)throw Si(p(2128,null),"EntryTooLarge");return!0}var eP=class extends O{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new E);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new vi(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new vi(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let o=this.toWatchRequest(e,n),i=RP(this.universalWatchRequests,o);return this.refreshUniversalWatchers(),K(()=>{i(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(MB(o)){let i=this.options?.watcher?.recursive?.usePolling;i===!0?o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(i)&&i.includes(o.path)&&(o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return o}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>ze(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(zL(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},i=RP(this.nonRecursiveWatchRequests,o);return this.refreshNonRecursiveWatchers(),K(()=>{i(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>ze(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(zL(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return yo(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return HU(n)}};import{fork as vJ}from"child_process";function t$(r){let t=r;return t&&typeof t.type=="string"&&typeof t.severity=="string"}function fJ(r){let t=[],e;try{let n=JSON.parse(r.arguments),o=n[n.length-1];o&&o.__$stack&&(n.pop(),e=o.__$stack),t.push(...n)}catch{t.push("Unable to log remote console arguments",r.arguments)}return{args:t,stack:e}}function hJ(r){if(!r)return r;let t=r.indexOf(` - `);return t===-1?r:r.substring(0,t)}function n$(r,t){let{args:e,stack:n}=fJ(r),o=typeof e[0]=="string"&&e.length===1,i=hJ(n);i&&(i=`(${i.trim()})`);let s=[];if(typeof e[0]=="string"?i&&o?s=[`%c[${t}] %c${e[0]} %c${i}`,Yf("blue"),Yf(""),Yf("grey")]:s=[`%c[${t}] %c${e[0]}`,Yf("blue"),Yf(""),...e.slice(1)]:s=[`%c[${t}]%`,Yf("blue"),...e],i&&!o&&s.push(i),typeof console[r.severity]!="function")throw new Error("Unknown console method");console[r.severity].apply(console,s)}function Yf(r){return`color: ${r}`}var tP=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new E;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new yh(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,o,i){return e.requestPromise(t,n,o,i)},listen(n,o){return e.requestEvent(t,n,o)}}}requestPromise(t,e,n,o=ve.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(o.isCancellationRequested)return Promise.reject(Ys());this.disposeDelayer.cancel();let i=this.getCachedChannel(t),s=vr(d=>i.call(e,n,d)),a=o.onCancellationRequested(()=>s.cancel()),l=K(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(t,e,n){if(!this.disposeDelayer)return he.None;this.disposeDelayer.cancel();let o,i=new E({onWillAddFirstListener:()=>{o=this.getCachedChannel(t).listen(e,n)(i.fire,i),this.activeRequests.add(o)},onDidRemoveLastListener:()=>{this.activeRequests.delete(o),o.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return i.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...at(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(u=>!/^--inspect(-brk)?=/.test(u)).filter(u=>!u.startsWith("--vscode-"))),$V(e.env),this.child=vJ(this.modulePath,t,e);let n=new E,i=he.fromNodeEventEmitter(this.child,"message",u=>u)(u=>{if(t$(u)){n$(u,`IPC Library: ${this.options.serverName}`);return}n.fire(H.wrap(Buffer.from(u,"base64")))}),s=this.options.useQueue?qV(this.child):this.child,a=u=>this.child?.connected&&s.send(u.buffer.toString("base64")),l=n.event,d={send:a,onMessage:l};this._client=new _h(d);let c=()=>this.disposeClient();process.once("exit",c),this.child.on("error",u=>console.warn('IPC "'+this.options.serverName+'" errored with '+u)),this.child.on("exit",(u,m)=>{process.removeListener("exit",c),i.dispose(),this.activeRequests.forEach(g=>Tn(g)),this.activeRequests.clear(),u!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+u+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:u,signal:m})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}};var nP=class extends pw{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new tP(ul.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:o})=>this.onError(`terminated by itself with code ${n}, signal: ${o} (ETERM)`))),V_.toService(kF(e.getChannel("watcher")))}};import{watchFile as bJ,unwatchFile as yJ}from"fs";var oP=class extends O{constructor(){super();this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new E);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new E);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Fn);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new vi(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Jt;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return mw(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:Gn(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Jt;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[o,i]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(o)||n.push(i);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(o=>ze(o))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new $;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let o=this.recursiveWatcher?.subscribe(e.path,(i,s)=>{n.isDisposed||(i?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return o?(n.add(o),!0):!1}doMonitorWithNodeJS(e,n){let o=!1,i=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),d=this.isPathNotFound(a),c=o;o=l,!l&&(d||c)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{bJ(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},i)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(K(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{yJ(e.path,i)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:b.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let o=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(o,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${NB(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}};import{watch as IJ,promises as xJ}from"fs";var rP=class r extends O{constructor(e,n,o,i,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=o;this.onDidWatchFail=i;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new up({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new TI(e=>this.handleFileChanges(e),r.FILE_CHANGES_HANDLER_DELAY));this.cts=new Ce;this.realPath=new mt(async()=>{let e=this.request.path;try{e=await st.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Qe;this.excludes=KL(this.request.path,this.request.excludes,l),this.includes=this.request.includes?KL(this.request.path,this.request.includes,l):void 0,this.filter=mw(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await xJ.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new $;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let o=b.file(this.request.path),i=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await ZN(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:o,type:a.type,cId:this.request.correlationId},!0))});return i?(n.add(i),!0):!1}async doWatchWithNodeJS(e,n){let o=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(pt&&_r(o,"/Volumes/",!0)){this.error(`Refusing to watch ${o} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let i=new Ce(this.cts.token);n.add(K(()=>i.dispose(!0)));let s=new $;n.add(s);try{let a=b.file(this.request.path),l=nt(o),d=IJ(o);s.add(K(()=>{d.removeAllListeners(),d.close()})),this.trace(`Started watching: '${o}'`);let c=new Set;if(e)try{for(let m of await st.readdir(o))c.add(m)}catch(m){this.error(m)}if(i.token.isCancellationRequested)return;let u=new Map;s.add(K(()=>{for(let[,m]of u)m.dispose();u.clear()})),d.on("error",(m,g)=>{i.token.isCancellationRequested||(this.error(`Failed to watch ${o} for changes using fs.watch() (${m}, ${g})`),this.notifyWatchFailed())}),d.on("change",(m,g)=>{if(i.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${m}"] ${g}`);let h="";if(g&&(h=g.toString(),pt&&(h=oc(h))),!(!h||m!=="change"&&m!=="rename"))if(e)if(m==="rename"){u.get(h)?.dispose();let f=setTimeout(async()=>{if(u.delete(h),ap(h,l,!Qe)&&!await st.exists(o)){this.onWatchedPathDeleted(a);return}if(i.token.isCancellationRequested)return;let I=await this.existsChildStrictCase(Ne(o,h));if(i.token.isCancellationRequested)return;let S;I?c.has(h)?S=0:(S=1,c.add(h)):(c.delete(h),S=2),this.onFileChange({resource:Et(a,h),type:S,cId:this.request.correlationId})},r.FILE_DELETE_HANDLER_DELAY);u.set(h,K(()=>clearTimeout(f)))}else{let f;c.has(h)?f=0:(f=1,c.add(h)),this.onFileChange({resource:Et(a,h),type:f,cId:this.request.correlationId})}else if(m==="rename"||!ap(h,l,!Qe)){let f=setTimeout(async()=>{let I=await st.exists(o);i.token.isCancellationRequested||(I?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},r.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(K(()=>clearTimeout(f)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(i.token.isCancellationRequested)return;this.error(`Failed to watch ${o} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=LB(e),o=[];for(let s of n){if(OB(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}o.push(s)}if(o.length===0)return;if(this.verboseLogging)for(let s of o)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(o)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${o[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${o.length}, most recent change: ${o[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Qe)return st.exists(e);try{let n=nt(e);return(await st.readdir(cn(e))).some(i=>i===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}};var iP=class extends oP{constructor(e){super();this.recursiveWatcher=e;this.onDidError=he.None;this._watchers=new Map;this.worker=this._register(new sn)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],o=new Set(Array.from(this.watchers));for(let i of e){let s=this._watchers.get(this.requestToWatcherKey(i));s&&OA(s.request.excludes,i.excludes)&&OA(s.request.includes,i.includes)?o.delete(s):n.push(i)}n.length&&this.trace(`Request to start watching: ${n.map(i=>this.requestToString(i)).join(",")}`),o.size&&this.trace(`Request to stop watching: ${Array.from(o).map(i=>this.requestToString(i.request)).join(",")}`),this.worker.clear();for(let i of o)this.stopWatching(i);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new up({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Qe?e:e.toLowerCase()}startWatching(e){let n=new rP(e,this.recursiveWatcher,i=>this._onDidChangeFile.fire(i),()=>this._onDidWatchFail.fire(e),i=>this._onDidLogMessage.fire(i),this.verboseLogging),o={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),o)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let o of e){let i=n.get(o.correlationId);i||(i=new Map,n.set(o.correlationId,i));let s=this.pathToWatcherKey(o.path);i.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(o)}`),i.set(s,o)}return Array.from(n.values()).flatMap(o=>Array.from(o.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}};var sP=class extends uw{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new iP(void 0))}};var aP=class r extends eP{constructor(){super(...arguments);this.onDidChangeCapabilities=he.None;this.resourceLocks=new Ke(e=>tc.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Qe&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:o}=await Lo.stat(this.toFilePath(e)),i;return(n.mode&128)===0&&(i=2),(n.mode&rN.S_IXUSR||n.mode&rN.S_IXGRP||n.mode&rN.S_IXOTH)&&(i=(i??0)|4),{type:this.toType(n,o),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:i}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return st.realpath(n)}async readdir(e){try{let n=await st.readdir(this.toFilePath(e),{withFileTypes:!0}),o=[];return await Promise.all(n.map(async i=>{try{let s;i.isSymbolicLink()?s=(await this.stat(Et(e,i.name))).type:s=this.toType(i),o.push([i.name,s])}catch(s){this.logService.trace(s)}})),o}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let o;return n?.dangling?o=0:e.isFile()?o=1:e.isDirectory()?o=2:o=0,n&&(o|=64),o}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let o;for(;o=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await o.wait();let i=new In;return this.resourceLocks.set(e,i),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),K(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),i.open()})}async readFile(e,n){let o;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),o=await this.createResourceLock(e));let i=this.toFilePath(e);return await $u.readFile(i)}catch(i){throw this.toFileSystemProviderError(i)}finally{o?.dispose()}}traceLock(e){r.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,o){let i=nc(s=>H.concat(s.map(a=>H.wrap(a))).buffer);return e$(this,e,i,s=>s.buffer,{...n,bufferSize:256*1024},o),i}async writeFile(e,n,o){return o?.atomic!==!1&&o?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,Et(Qo(e),`${Tt(e)}${o.atomic.postfix}`),n,o):this.doWriteFile(e,n,o)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:o}=await Lo.stat(n);if(o)return!1}catch{}return!0}async doWriteFileAtomic(e,n,o,i){let s=new $;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,o,{...i,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,o,i){let s;try{let a=this.toFilePath(e);if(!o.create||!o.overwrite){if(await st.exists(a)){if(!o.overwrite)throw Si(p(2131,null),"EntryExists")}else if(!o.create)throw Si(p(2134,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:o.append,unlock:o.unlock},i),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){r.canFlush=e}async open(e,n,o){let i=this.toFilePath(e),s;mc(n)&&!o&&(s=await this.createResourceLock(e));let a;try{if(mc(n)&&n.unlock)try{let{stat:l}=await Lo.stat(i);l.mode&128||await $u.chmod(i,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(Ie&&mc(n)&&!n.append)try{a=await st.open(i,"r+"),await st.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await st.close(a)}catch(d){this.logService.trace(d)}a=void 0}}typeof a!="number"&&(a=await st.open(i,mc(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),mc(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),mc(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${i})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${i})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&r.canFlush)try{await st.fdatasync(e)}catch(o){r.configureFlushOnWrite(!1),this.logService.error(o)}return await st.close(e)}catch(o){throw this.toFileSystemProviderError(o)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,o,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await st.read(e,o,i,s,a)).bytesRead}catch(d){throw this.toFileSystemProviderError(d)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,o){let i=this.mapHandleToPos.get(e);typeof i=="number"&&(typeof n=="number"||(typeof o=="number"?this.mapHandleToPos.set(e,i+o):this.mapHandleToPos.delete(e)))}async write(e,n,o,i,s){return eF(()=>this.doWrite(e,n,o,i,s),100,3)}async doWrite(e,n,o,i,s){let a=this.normalizePos(e,n),l=null;try{l=(await st.write(e,o,i,s,a)).bytesWritten}catch(d){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),d)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await $u.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let o=this.toFilePath(e);if(n.recursive){let i;n?.atomic!==!1&&n.atomic.postfix&&(i=Ne(cn(o),`${nt(o)}${n.atomic.postfix}`)),await st.rm(o,1,i)}else try{await $u.unlink(o)}catch(i){if(i.code==="EPERM"||i.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await Lo.stat(o);s=a.isDirectory()&&!l}catch{}if(s)await $u.rmdir(o);else throw i}else throw i}}catch(o){throw this.toFileSystemProviderError(o)}}async rename(e,n,o){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"move",o.overwrite),await st.rename(i,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(2135,null,nt(i),nt(cn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,o){let i=this.toFilePath(e),s=this.toFilePath(n);if(i!==s)try{await this.validateMoveCopy(e,n,"copy",o.overwrite),await st.copy(i,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(2129,null,nt(i),nt(cn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,o,i){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=ap(s,a,!0)),l){if(o==="copy")throw Si(p(2130,null),"EntryExists");if(o==="move")return}let c=await this.statIgnoreError(e);if(!c)throw Si(p(2133,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!i)throw Si(p(2132,null),"EntryExists");(c.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,o){let i=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(ap(i,s,!a))return;let l=new $;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),o&&await $u.mkdir(cn(s),{recursive:!0}),await $u.copyFile(i,s)}catch(d){if(d.code==="ENOENT"&&!o)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(d)}finally{l.dispose()}}createUniversalWatcher(e,n,o){return new nP(i=>e(i),i=>n(i),o)}createNonRecursiveWatcher(e,n,o){return new sP(i=>e(i),i=>n(i),o)}toFileSystemProviderError(e){if(e instanceof Sl)return e;let n=e,o;switch(e.code){case"ENOENT":o="EntryNotFound";break;case"EISDIR":o="EntryIsADirectory";break;case"ENOTDIR":o="EntryNotADirectory";break;case"EEXIST":o="EntryExists";break;case"EPERM":case"EACCES":o="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,o="Unknown";break;default:o="Unknown"}return Si(n,o)}async toFileSystemProviderWriteError(e,n){let o=this.toFileSystemProviderError(n);if(e&&o.code==="NoPermissions")try{let{stat:i}=await Lo.stat(this.toFilePath(e));i.mode&128||(o=Si(n,"EntryWriteLocked"))}catch(i){this.logService.trace(i)}return o}};var Xf=class{constructor(t,e){t.addFileSystemProvider(V.file,new iN(e),{isCaseSensitive:Qe})}};Xf=_([C(0,Hs),C(1,oe)],Xf);var iN=class{constructor(t){this.impl=new aP(t)}async stat(t){let e=await this.impl.stat(t);return{type:e.type,ctime:e.ctime,mtime:e.mtime,size:e.size,permissions:e.permissions===1?1:void 0}}readDirectory(t){return this.impl.readdir(t)}createDirectory(t){return this.impl.mkdir(t)}readFile(t){return this.impl.readFile(t)}writeFile(t,e,n){return this.impl.writeFile(t,e,{...n,unlock:!1,atomic:!1})}delete(t,e){return this.impl.delete(t,{...e,useTrash:!1,atomic:!1})}rename(t,e,n){return this.impl.rename(t,e,n)}copy(t,e,n){return this.impl.copy(t,e,n)}get onDidChangeFile(){throw new Error("Method not implemented.")}watch(t,e){throw new Error("Method not implemented.")}};import r$ from"node:module";var i$=r$.createRequire(import.meta.url),sN=class extends Wu{_installInterceptor(){let t=this,e=i$("module"),n=e._load;e._load=function(l,d,c){return l=s(l),t._factories.has(l)?t._factories.get(l).load(l,b.file(N_(d.filename)),u=>n.apply(this,[u,d,c])):n.apply(this,arguments)};let o=e._resolveLookupPaths;e._resolveLookupPaths=(a,l)=>o.call(this,s(a),l);let i=e._resolveFilename;e._resolveFilename=function(l,d,c,u){return l==="vsda"&&Array.isArray(u?.paths)&&u.paths.length===0&&(u.paths=e._nodeModulePaths(import.meta.dirname)),i.call(this,l,d,c,u)};let s=a=>{for(let l of t._alternatives){let d=l(a);if(d){a=d;break}}return a}}},aN=class r extends Wu{constructor(){super(...arguments);this._store=new $}static _createDataUri(e){return`data:text/javascript;base64,${Buffer.from(e).toString("base64")}`}static{this._loaderScript=` +@@ -647,33 +647,16 @@ END_NATIVE_LOG + `),this._isMakingConsoleCall=!1}_wrapStream(e,n){let o=process[e],r=o.write,s="";Object.defineProperty(o,"write",{set:()=>{},get:()=>(a,l,d)=>{if(!this._isMakingConsoleCall){s+=a.toString(l);let c=s.length>WJ?s.length:s.lastIndexOf(` + `);c!==-1&&(console[n](s.slice(0,c)),s=s.slice(c+1))}r.call(o,a,l,d)}})}};ih=_([C(0,ie),C(1,Ye)],ih);import{constants as bN,promises as Gu}from"fs";async function I$(i,t,e,n,o,r){let s;try{await VJ(i,t,e,n,o,r)}catch(a){s=a}finally{s&&o.errorTransformer&&(s=o.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function VJ(i,t,e,n,o,r){vN(r);let s=await i.open(t,{create:!1});try{vN(r);let a=0,l=0,d=o&&typeof o.length=="number"?o.length:void 0,c=W.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),u=o&&typeof o.position=="number"?o.position:0,m=0;do l=await i.read(s,u,c.buffer,m,c.byteLength-m),u+=l,m+=l,a+=l,typeof d=="number"&&(d-=l),m===c.byteLength&&(await e.write(n(c)),c=W.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),m=0);while(l>0&&(typeof d!="number"||d>0)&&vN(r)&&BJ(a,o));if(m>0){let g=m;typeof d=="number"&&(g=Math.min(m,d)),e.write(n(c.slice(0,g)))}}catch(a){throw x2(a)}finally{await i.close(s)}}function vN(i){if(i.isCancellationRequested)throw Ys();return!0}function BJ(i,t){if(typeof t?.limits?.size=="number"&&i>t.limits.size)throw Ci(p(2152,null),"EntryTooLarge");return!0}var uP=class extends O{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new E);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new bi(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new bi(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let o=this.toWatchRequest(e,n),r=BP(this.universalWatchRequests,o);return this.refreshUniversalWatchers(),j(()=>{r(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(GB(o)){let r=this.options?.watcher?.recursive?.usePolling;r===!0?o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(r)&&r.includes(o.path)&&(o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return o}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>$e(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(nO(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},r=BP(this.nonRecursiveWatchRequests,o);return this.refreshNonRecursiveWatchers(),j(()=>{r(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>$e(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(nO(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return yo(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return eF(n)}};import{fork as qJ}from"child_process";function x$(i){let t=i;return t&&typeof t.type=="string"&&typeof t.severity=="string"}function $J(i){let t=[],e;try{let n=JSON.parse(i.arguments),o=n[n.length-1];o&&o.__$stack&&(n.pop(),e=o.__$stack),t.push(...n)}catch{t.push("Unable to log remote console arguments",i.arguments)}return{args:t,stack:e}}function zJ(i){if(!i)return i;let t=i.indexOf(` + `);return t===-1?i:i.substring(0,t)}function S$(i,t){let{args:e,stack:n}=$J(i),o=typeof e[0]=="string"&&e.length===1,r=zJ(n);r&&(r=`(${r.trim()})`);let s=[];if(typeof e[0]=="string"?r&&o?s=[`%c[${t}] %c${e[0]} %c${r}`,sh("blue"),sh(""),sh("grey")]:s=[`%c[${t}] %c${e[0]}`,sh("blue"),sh(""),...e.slice(1)]:s=[`%c[${t}]%`,sh("blue"),...e],r&&!o&&s.push(r),typeof console[i.severity]!="function")throw new Error("Unknown console method");console[i.severity].apply(console,s)}function sh(i){return`color: ${i}`}var pP=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new E;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new Ph(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,o,r){return e.requestPromise(t,n,o,r)},listen(n,o){return e.requestEvent(t,n,o)}}}requestPromise(t,e,n,o=ue.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(o.isCancellationRequested)return Promise.reject(Ys());this.disposeDelayer.cancel();let r=this.getCachedChannel(t),s=hr(d=>r.call(e,n,d)),a=o.onCancellationRequested(()=>s.cancel()),l=j(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(t,e,n){if(!this.disposeDelayer)return ve.None;this.disposeDelayer.cancel();let o,r=new E({onWillAddFirstListener:()=>{o=this.getCachedChannel(t).listen(e,n)(r.fire,r),this.activeRequests.add(o)},onDidRemoveLastListener:()=>{this.activeRequests.delete(o),o.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return r.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...at(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(u=>!/^--inspect(-brk)?=/.test(u)).filter(u=>!u.startsWith("--vscode-"))),oB(e.env),this.child=qJ(this.modulePath,t,e);let n=new E,r=ve.fromNodeEventEmitter(this.child,"message",u=>u)(u=>{if(x$(u)){S$(u,`IPC Library: ${this.options.serverName}`);return}n.fire(W.wrap(Buffer.from(u,"base64")))}),s=this.options.useQueue?iB(this.child):this.child,a=u=>this.child?.connected&&s.send(u.buffer.toString("base64")),l=n.event,d={send:a,onMessage:l};this._client=new Fh(d);let c=()=>this.disposeClient();process.once("exit",c),this.child.on("error",u=>console.warn('IPC "'+this.options.serverName+'" errored with '+u)),this.child.on("exit",(u,m)=>{process.removeListener("exit",c),r.dispose(),this.activeRequests.forEach(g=>En(g)),this.activeRequests.clear(),u!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+u+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:u,signal:m})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}};var mP=class extends Tw{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new pP(vl.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:n,signal:o})=>this.onError(`terminated by itself with code ${n}, signal: ${o} (ETERM)`))),Y_.toService(BF(e.getChannel("watcher")))}};import{watchFile as KJ,unwatchFile as jJ}from"fs";var gP=class extends O{constructor(){super();this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new E);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new E);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new Tn);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new bi(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new qt;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return Ew(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:Gn(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new qt;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[o,r]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(o)||n.push(r);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(o=>$e(o))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new z;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let o=this.recursiveWatcher?.subscribe(e.path,(r,s)=>{n.isDisposed||(r?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return o?(n.add(o),!0):!1}doMonitorWithNodeJS(e,n){let o=!1,r=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),d=this.isPathNotFound(a),c=o;o=l,!l&&(d||c)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{KJ(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},r)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(j(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{jJ(e.path,r)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:y.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let o=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(o,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:""}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):""}, filter: ${YB(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:""})`}async setVerboseLogging(e){this.verboseLogging=e}};import{watch as GJ,promises as QJ}from"fs";var fP=class i extends O{constructor(e,n,o,r,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=o;this.onDidWatchFail=r;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new hp({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new UI(e=>this.handleFileChanges(e),i.FILE_CHANGES_HANDLER_DELAY));this.cts=new Te;this.realPath=new ft(async()=>{let e=this.request.path;try{e=await st.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Qe;this.excludes=rO(this.request.path,this.request.excludes,l),this.includes=this.request.includes?rO(this.request.path,this.request.includes,l):void 0,this.filter=Ew(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await QJ.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let n=new z;return this.doWatchWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,n)),n}doWatchWithExistingWatcher(e,n){if(e)return!1;let o=y.file(this.request.path),r=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{n.isDisposed||(s?await gU(this.doWatch(e),n):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:o,type:a.type,cId:this.request.correlationId},!0))});return r?(n.add(r),!0):!1}async doWatchWithNodeJS(e,n){let o=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(gt&&Dr(o,"/Volumes/",!0)){this.error(`Refusing to watch ${o} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let r=new Te(this.cts.token);n.add(j(()=>r.dispose(!0)));let s=new z;n.add(s);try{let a=y.file(this.request.path),l=ot(o),d=GJ(o);s.add(j(()=>{d.removeAllListeners(),d.close()})),this.trace(`Started watching: '${o}'`);let c=new Set;if(e)try{for(let m of await st.readdir(o))c.add(m)}catch(m){this.error(m)}if(r.token.isCancellationRequested)return;let u=new Map;s.add(j(()=>{for(let[,m]of u)m.dispose();u.clear()})),d.on("error",(m,g)=>{r.token.isCancellationRequested||(this.error(`Failed to watch ${o} for changes using fs.watch() (${m}, ${g})`),this.notifyWatchFailed())}),d.on("change",(m,g)=>{if(r.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${m}"] ${g}`);let h="";if(g&&(h=g.toString(),gt&&(h=dc(h))),!(!h||m!=="change"&&m!=="rename"))if(e)if(m==="rename"){u.get(h)?.dispose();let f=setTimeout(async()=>{if(u.delete(h),pp(h,l,!Qe)&&!await st.exists(o)){this.onWatchedPathDeleted(a);return}if(r.token.isCancellationRequested)return;let I=await this.existsChildStrictCase(Ne(o,h));if(r.token.isCancellationRequested)return;let S;I?c.has(h)?S=0:(S=1,c.add(h)):(c.delete(h),S=2),this.onFileChange({resource:Pt(a,h),type:S,cId:this.request.correlationId})},i.FILE_DELETE_HANDLER_DELAY);u.set(h,j(()=>clearTimeout(f)))}else{let f;c.has(h)?f=0:(f=1,c.add(h)),this.onFileChange({resource:Pt(a,h),type:f,cId:this.request.correlationId})}else if(m==="rename"||!pp(h,l,!Qe)){let f=setTimeout(async()=>{let I=await st.exists(o);r.token.isCancellationRequested||(I?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},i.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(j(()=>clearTimeout(f)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(r.token.isCancellationRequested)return;this.error(`Failed to watch ${o} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=QB(e),o=[];for(let s of n){if(JB(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}o.push(s)}if(o.length===0)return;if(this.verboseLogging)for(let s of o)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(o)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${o[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${o.length}, most recent change: ${o[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Qe)return st.exists(e);try{let n=ot(e);return(await st.readdir(cn(e))).some(r=>r===n)}catch(n){return this.trace(n),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}};var hP=class extends gP{constructor(e){super();this.recursiveWatcher=e;this.onDidError=ve.None;this._watchers=new Map;this.worker=this._register(new Jt)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],o=new Set(Array.from(this.watchers));for(let r of e){let s=this._watchers.get(this.requestToWatcherKey(r));s&&qA(s.request.excludes,r.excludes)&&qA(s.request.includes,r.includes)?o.delete(s):n.push(r)}n.length&&this.trace(`Request to start watching: ${n.map(r=>this.requestToString(r)).join(",")}`),o.size&&this.trace(`Request to stop watching: ${Array.from(o).map(r=>this.requestToString(r.request)).join(",")}`),this.worker.clear();for(let r of o)this.stopWatching(r);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new hp({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Qe?e:e.toLowerCase()}startWatching(e){let n=new fP(e,this.recursiveWatcher,r=>this._onDidChangeFile.fire(r),()=>this._onDidWatchFail.fire(e),r=>this._onDidLogMessage.fire(r),this.verboseLogging),o={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),o)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let o of e){let r=n.get(o.correlationId);r||(r=new Map,n.set(o.correlationId,r));let s=this.pathToWatcherKey(o.path);r.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(o)}`),r.set(s,o)}return Array.from(n.values()).flatMap(o=>Array.from(o.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}};var vP=class extends Cw{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new hP(void 0))}};var bP=class i extends uP{constructor(){super(...arguments);this.onDidChangeCapabilities=ve.None;this.resourceLocks=new qe(e=>ac.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Qe&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:o}=await Mo.stat(this.toFilePath(e)),r;return(n.mode&128)===0&&(r=2),(n.mode&bN.S_IXUSR||n.mode&bN.S_IXGRP||n.mode&bN.S_IXOTH)&&(r=(r??0)|4),{type:this.toType(n,o),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:r}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return st.realpath(n)}async readdir(e){try{let n=await st.readdir(this.toFilePath(e),{withFileTypes:!0}),o=[];return await Promise.all(n.map(async r=>{try{let s;r.isSymbolicLink()?s=(await this.stat(Pt(e,r.name))).type:s=this.toType(r),o.push([r.name,s])}catch(s){this.logService.trace(s)}})),o}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let o;return n?.dangling?o=0:e.isFile()?o=1:e.isDirectory()?o=2:o=0,n&&(o|=64),o}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let o;for(;o=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await o.wait();let r=new In;return this.resourceLocks.set(e,r),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),j(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===r&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),r.open()})}async readFile(e,n){let o;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),o=await this.createResourceLock(e));let r=this.toFilePath(e);return await Gu.readFile(r)}catch(r){throw this.toFileSystemProviderError(r)}finally{o?.dispose()}}traceLock(e){i.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,o){let r=lc(s=>W.concat(s.map(a=>W.wrap(a))).buffer);return I$(this,e,r,s=>s.buffer,{...n,bufferSize:256*1024},o),r}async writeFile(e,n,o){return o?.atomic!==!1&&o?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,Pt(jo(e),`${it(e)}${o.atomic.postfix}`),n,o):this.doWriteFile(e,n,o)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:o}=await Mo.stat(n);if(o)return!1}catch{}return!0}async doWriteFileAtomic(e,n,o,r){let s=new z;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,o,{...r,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,o,r){let s;try{let a=this.toFilePath(e);if(!o.create||!o.overwrite){if(await st.exists(a)){if(!o.overwrite)throw Ci(p(2155,null),"EntryExists")}else if(!o.create)throw Ci(p(2158,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:o.append,unlock:o.unlock},r),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){i.canFlush=e}async open(e,n,o){let r=this.toFilePath(e),s;yc(n)&&!o&&(s=await this.createResourceLock(e));let a;try{if(yc(n)&&n.unlock)try{let{stat:l}=await Mo.stat(r);l.mode&128||await Gu.chmod(r,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(Ie&&yc(n)&&!n.append)try{a=await st.open(r,"r+"),await st.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await st.close(a)}catch(d){this.logService.trace(d)}a=void 0}}typeof a!="number"&&(a=await st.open(r,yc(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),yc(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),yc(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${r})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${r})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&i.canFlush)try{await st.fdatasync(e)}catch(o){i.configureFlushOnWrite(!1),this.logService.error(o)}return await st.close(e)}catch(o){throw this.toFileSystemProviderError(o)}finally{n&&(this.mapHandleToLock.get(e)===n&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),n.dispose())}}async read(e,n,o,r,s){let a=this.normalizePos(e,n),l=null;try{l=(await st.read(e,o,r,s,a)).bytesRead}catch(d){throw this.toFileSystemProviderError(d)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,o){let r=this.mapHandleToPos.get(e);typeof r=="number"&&(typeof n=="number"||(typeof o=="number"?this.mapHandleToPos.set(e,r+o):this.mapHandleToPos.delete(e)))}async write(e,n,o,r,s){return fF(()=>this.doWrite(e,n,o,r,s),100,3)}async doWrite(e,n,o,r,s){let a=this.normalizePos(e,n),l=null;try{l=(await st.write(e,o,r,s,a)).bytesWritten}catch(d){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),d)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Gu.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let o=this.toFilePath(e);if(n.recursive){let r;n?.atomic!==!1&&n.atomic.postfix&&(r=Ne(cn(o),`${ot(o)}${n.atomic.postfix}`)),await st.rm(o,1,r)}else try{await Gu.unlink(o)}catch(r){if(r.code==="EPERM"||r.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await Mo.stat(o);s=a.isDirectory()&&!l}catch{}if(s)await Gu.rmdir(o);else throw r}else throw r}}catch(o){throw this.toFileSystemProviderError(o)}}async rename(e,n,o){let r=this.toFilePath(e),s=this.toFilePath(n);if(r!==s)try{await this.validateMoveCopy(e,n,"move",o.overwrite),await st.rename(r,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(2159,null,ot(r),ot(cn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,o){let r=this.toFilePath(e),s=this.toFilePath(n);if(r!==s)try{await this.validateMoveCopy(e,n,"copy",o.overwrite),await st.copy(r,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(2153,null,ot(r),ot(cn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,o,r){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=pp(s,a,!0)),l){if(o==="copy")throw Ci(p(2154,null),"EntryExists");if(o==="move")return}let c=await this.statIgnoreError(e);if(!c)throw Ci(p(2157,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!r)throw Ci(p(2156,null),"EntryExists");(c.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,o){let r=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(pp(r,s,!a))return;let l=new z;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),o&&await Gu.mkdir(cn(s),{recursive:!0}),await Gu.copyFile(r,s)}catch(d){if(d.code==="ENOENT"&&!o)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(d)}finally{l.dispose()}}createUniversalWatcher(e,n,o){return new mP(r=>e(r),r=>n(r),o)}createNonRecursiveWatcher(e,n,o){return new vP(r=>e(r),r=>n(r),o)}toFileSystemProviderError(e){if(e instanceof Pl)return e;let n=e,o;switch(e.code){case"ENOENT":o="EntryNotFound";break;case"EISDIR":o="EntryIsADirectory";break;case"ENOTDIR":o="EntryNotADirectory";break;case"EEXIST":o="EntryExists";break;case"EPERM":case"EACCES":o="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,o="Unknown";break;default:o="Unknown"}return Ci(n,o)}async toFileSystemProviderWriteError(e,n){let o=this.toFileSystemProviderError(n);if(e&&o.code==="NoPermissions")try{let{stat:r}=await Mo.stat(this.toFilePath(e));r.mode&128||(o=Ci(n,"EntryWriteLocked"))}catch(r){this.logService.trace(r)}return o}};var ah=class{constructor(t,e){t.addFileSystemProvider(B.file,new yN(e),{isCaseSensitive:Qe})}};ah=_([C(0,Hs),C(1,ne)],ah);var yN=class{constructor(t){this.impl=new bP(t)}async stat(t){let e=await this.impl.stat(t);return{type:e.type,ctime:e.ctime,mtime:e.mtime,size:e.size,permissions:e.permissions===1?1:void 0}}readDirectory(t){return this.impl.readdir(t)}createDirectory(t){return this.impl.mkdir(t)}readFile(t){return this.impl.readFile(t)}writeFile(t,e,n){return this.impl.writeFile(t,e,{...n,unlock:!1,atomic:!1})}delete(t,e){return this.impl.delete(t,{...e,useTrash:!1,atomic:!1})}rename(t,e,n){return this.impl.rename(t,e,n)}copy(t,e,n){return this.impl.copy(t,e,n)}get onDidChangeFile(){throw new Error("Method not implemented.")}watch(t,e){throw new Error("Method not implemented.")}};import T$ from"node:module";var E$=T$.createRequire(import.meta.url),IN=class extends qu{_installInterceptor(){let t=this,e=E$("module"),n=e._load;e._load=function(l,d,c){return l=s(l),t._factories.has(l)?t._factories.get(l).load(l,y.file(K_(d.filename)),u=>n.apply(this,[u,d,c])):n.apply(this,arguments)};let o=e._resolveLookupPaths;e._resolveLookupPaths=(a,l)=>o.call(this,s(a),l);let r=e._resolveFilename;e._resolveFilename=function(l,d,c,u){return l==="vsda"&&Array.isArray(u?.paths)&&u.paths.length===0&&(u.paths=e._nodeModulePaths(import.meta.dirname)),r.call(this,l,d,c,u)};let s=a=>{for(let l of t._alternatives){let d=l(a);if(d){a=d;break}}return a}}},xN=class i extends qu{constructor(){super(...arguments);this._store=new z}static _createDataUri(e){return`data:text/javascript;base64,${Buffer.from(e).toString("base64")}`}static{this._loaderScript=` - let lookup; - export const initialize = async (context) => { - let requestIds = 0; @@ -63,7 +63,7 @@ index c042d78a3399c4e2e9e79f17606b3b793c01ac1d..ae53dfd7862179d8454a451f06e9906f - }); - }; - }; -+ const EXPORTS = ["version","ai","authentication","commands","comments","chat","debug","env","extensions","interactive","l10n","languages","lm","notebooks","scm","speech","tasks","tests","window","workspace","Breakpoint","TerminalOutputAnchor","ChatResultFeedbackKind","ChatVariableLevel","ChatCompletionItem","ChatReferenceDiagnostic","CallHierarchyIncomingCall","CallHierarchyItem","CallHierarchyOutgoingCall","CancellationError","CancellationTokenSource","CandidatePortSource","CodeAction","CodeActionKind","CodeActionTriggerKind","CodeLens","Color","ColorInformation","ColorPresentation","ColorThemeKind","CommentMode","CommentState","CommentThreadCollapsibleState","CommentThreadState","CommentThreadApplicability","CommentThreadFocus","CompletionItem","CompletionItemKind","CompletionItemTag","CompletionList","CompletionTriggerKind","ConfigurationTarget","CustomExecution","DebugAdapterExecutable","DebugAdapterInlineImplementation","DebugAdapterNamedPipeServer","DebugAdapterServer","DebugConfigurationProviderTriggerKind","DebugConsoleMode","DebugVisualization","DecorationRangeBehavior","Diagnostic","DiagnosticRelatedInformation","DiagnosticSeverity","DiagnosticTag","Disposable","DocumentHighlight","DocumentHighlightKind","MultiDocumentHighlight","DocumentLink","DocumentSymbol","EndOfLine","EnvironmentVariableMutatorType","EvaluatableExpression","InlineValueText","InlineValueVariableLookup","InlineValueEvaluatableExpression","InlineCompletionTriggerKind","InlineCompletionsDisposeReasonKind","EventEmitter","ExtensionKind","ExtensionMode","ExternalUriOpenerPriority","FileChangeType","FileDecoration","FileDecoration2","FileSystemError","FileType","FilePermission","FoldingRange","FoldingRangeKind","FunctionBreakpoint","InlineCompletionItem","InlineCompletionList","Hover","VerboseHover","HoverVerbosityAction","IndentAction","Location","MarkdownString","OverviewRulerLane","ParameterInformation","PortAutoForwardAction","Position","ProcessExecution","ProgressLocation","QuickInputButtonLocation","QuickInputButtons","Range","RelativePattern","Selection","SelectionRange","SemanticTokens","SemanticTokensBuilder","SemanticTokensEdit","SemanticTokensEdits","SemanticTokensLegend","ShellExecution","ShellQuoting","SignatureHelp","SignatureHelpTriggerKind","SignatureInformation","SnippetString","SourceBreakpoint","StandardTokenType","StatusBarAlignment","SymbolInformation","SymbolKind","SymbolTag","Task","TaskEventKind","TaskGroup","TaskPanelKind","TaskRevealKind","TaskRunOn","TaskScope","TerminalLink","TerminalQuickFixTerminalCommand","TerminalQuickFixOpener","TerminalLocation","TerminalProfile","TerminalExitReason","TerminalShellExecutionCommandLineConfidence","TerminalCompletionItem","TerminalCompletionItemKind","TerminalCompletionList","TerminalShellType","TextDocumentSaveReason","TextEdit","SnippetTextEdit","TextEditorCursorStyle","TextEditorChangeKind","TextEditorLineNumbersStyle","TextEditorRevealType","TextEditorSelectionChangeKind","SyntaxTokenType","TextDocumentChangeReason","ThemeColor","ThemeIcon","TreeItem","TreeItemCheckboxState","TreeItemCollapsibleState","TypeHierarchyItem","UIKind","Uri","ViewColumn","WorkspaceEdit","DocumentPasteTriggerKind","DocumentDropEdit","DocumentDropOrPasteEditKind","DocumentPasteEdit","InlayHint","InlayHintLabelPart","InlayHintKind","RemoteAuthorityResolverError","ResolvedAuthority","ManagedResolvedAuthority","SourceControlInputBoxValidationType","ExtensionRuntime","TimelineItem","NotebookRange","NotebookCellKind","NotebookCellExecutionState","NotebookCellData","NotebookData","NotebookRendererScript","NotebookCellStatusBarAlignment","NotebookEditorRevealType","NotebookCellOutput","NotebookCellOutputItem","CellErrorStackFrame","NotebookCellStatusBarItem","NotebookControllerAffinity","NotebookControllerAffinity2","NotebookEdit","NotebookKernelSourceAction","NotebookVariablesRequestKind","PortAttributes","LinkedEditingRanges","TestResultState","TestRunRequest","TestMessage","TestMessageStackFrame","TestTag","TestRunProfileKind","TextSearchCompleteMessageType","DataTransfer","DataTransferItem","TestCoverageCount","FileCoverage","StatementCoverage","BranchCoverage","DeclarationCoverage","WorkspaceTrustState","LanguageStatusSeverity","QuickPickItemKind","InputBoxValidationSeverity","TabInputText","TabInputTextDiff","TabInputTextMerge","TabInputCustom","TabInputNotebook","TabInputNotebookDiff","TabInputWebview","TabInputTerminal","TabInputInteractiveWindow","TabInputChat","TabInputTextMultiDiff","TelemetryTrustedValue","LogLevel","EditSessionIdentityMatch","InteractiveSessionVoteDirection","ChatCopyKind","ChatSessionChangedFile","ChatSessionChangedFile2","ChatEditingSessionActionOutcome","InteractiveEditorResponseFeedbackKind","DebugStackFrame","DebugThread","RelatedInformationType","SpeechToTextStatus","TextToSpeechStatus","PartialAcceptTriggerKind","InlineCompletionEndOfLifeReasonKind","InlineCompletionDisplayLocationKind","KeywordRecognitionStatus","ChatImageMimeType","ChatResponseMarkdownPart","ChatResponseFileTreePart","ChatResponseAnchorPart","ChatResponseProgressPart","ChatResponseProgressPart2","ChatResponseThinkingProgressPart","ChatResponseHookPart","ChatResponseReferencePart","ChatResponseReferencePart2","ChatResponseCodeCitationPart","ChatResponseCodeblockUriPart","ChatResponseWarningPart","ChatResponseTextEditPart","ChatResponseNotebookEditPart","ChatResponseWorkspaceEditPart","ChatResponseMarkdownWithVulnerabilitiesPart","ChatResponseCommandButtonPart","ChatResponseConfirmationPart","ChatQuestion","ChatQuestionType","ChatResponseQuestionCarouselPart","ChatResponseMovePart","ChatResponseExtensionsPart","ChatResponseExternalEditPart","ChatResponsePullRequestPart","ChatResponseMultiDiffPart","ChatResponseReferencePartStatusKind","ChatResponseClearToPreviousToolInvocationReason","ChatRequestTurn","ChatRequestTurn2","ChatResponseTurn","ChatResponseTurn2","ChatSubagentToolInvocationData","ChatToolInvocationPart","ChatLocation","ChatSessionStatus","ChatSessionCustomizationType","ChatDebugLogLevel","ChatDebugToolCallResult","ChatDebugHookResult","ChatDebugToolCallEvent","ChatDebugModelTurnEvent","ChatDebugGenericEvent","ChatDebugSubagentInvocationEvent","ChatDebugUserMessageEvent","ChatDebugAgentResponseEvent","ChatDebugMessageSection","ChatDebugEventTextContent","ChatDebugMessageContentType","ChatDebugEventMessageContent","ChatDebugEventToolCallContent","ChatDebugEventModelTurnContent","ChatDebugEventHookContent","ChatRequestEditorData","ChatRequestNotebookData","ChatReferenceBinaryData","ChatRequestEditedFileEventKind","LanguageModelChatMessageRole","LanguageModelChatMessage","LanguageModelChatMessage2","LanguageModelToolResultPart","LanguageModelToolResultPart2","LanguageModelTextPart","LanguageModelTextPart2","LanguageModelPartAudience","ToolResultAudience","LanguageModelToolCallPart","LanguageModelThinkingPart","LanguageModelError","LanguageModelToolResult","LanguageModelToolResult2","LanguageModelDataPart","LanguageModelDataPart2","LanguageModelToolExtensionSource","LanguageModelToolMCPSource","ExtendedLanguageModelToolResult","LanguageModelChatToolMode","LanguageModelPromptTsxPart","NewSymbolName","NewSymbolNameTag","NewSymbolNameTriggerKind","ExcludeSettingOptions","TextSearchContext2","TextSearchMatch2","AISearchKeyword","TextSearchCompleteMessageTypeNew","ChatErrorLevel","McpHttpServerDefinition","McpHttpServerDefinition2","McpStdioServerDefinition","McpStdioServerDefinition2","McpToolAvailability","McpToolInvocationContentData","SettingsSearchResultKind","ChatTodoStatus","ChatDebugSubagentStatus"]; ++ const EXPORTS = ["version","ai","authentication","commands","comments","chat","debug","env","extensions","interactive","l10n","languages","lm","notebooks","scm","speech","tasks","tests","window","workspace","Breakpoint","TerminalOutputAnchor","ChatResultFeedbackKind","ChatVariableLevel","ChatCompletionItem","ChatReferenceDiagnostic","CallHierarchyIncomingCall","CallHierarchyItem","CallHierarchyOutgoingCall","CancellationError","CancellationTokenSource","CandidatePortSource","CodeAction","CodeActionKind","CodeActionTriggerKind","CodeLens","Color","ColorInformation","ColorPresentation","ColorThemeKind","CommentMode","CommentState","CommentThreadCollapsibleState","CommentThreadState","CommentThreadApplicability","CommentThreadFocus","CompletionItem","CompletionItemKind","CompletionItemTag","CompletionList","CompletionTriggerKind","ConfigurationTarget","CustomExecution","DebugAdapterExecutable","DebugAdapterInlineImplementation","DebugAdapterNamedPipeServer","DebugAdapterServer","DebugConfigurationProviderTriggerKind","DebugConsoleMode","DebugVisualization","DecorationRangeBehavior","Diagnostic","DiagnosticRelatedInformation","DiagnosticSeverity","DiagnosticTag","Disposable","DocumentHighlight","DocumentHighlightKind","MultiDocumentHighlight","DocumentLink","DocumentSymbol","EndOfLine","EnvironmentVariableMutatorType","EvaluatableExpression","InlineValueText","InlineValueVariableLookup","InlineValueEvaluatableExpression","InlineCompletionTriggerKind","InlineCompletionsDisposeReasonKind","EventEmitter","ExtensionKind","ExtensionMode","ExternalUriOpenerPriority","FileChangeType","FileDecoration","FileDecoration2","FileSystemError","FileType","FilePermission","FoldingRange","FoldingRangeKind","FunctionBreakpoint","InlineCompletionItem","InlineCompletionList","Hover","VerboseHover","HoverVerbosityAction","IndentAction","Location","MarkdownString","OverviewRulerLane","ParameterInformation","PortAutoForwardAction","Position","ProcessExecution","ProgressLocation","QuickInputButtonLocation","QuickInputButtons","Range","RelativePattern","Selection","SelectionRange","SemanticTokens","SemanticTokensBuilder","SemanticTokensEdit","SemanticTokensEdits","SemanticTokensLegend","ShellExecution","ShellQuoting","SignatureHelp","SignatureHelpTriggerKind","SignatureInformation","SnippetString","SourceBreakpoint","StandardTokenType","StatusBarAlignment","SymbolInformation","SymbolKind","SymbolTag","Task","TaskEventKind","TaskGroup","TaskPanelKind","TaskRevealKind","TaskRunOn","TaskScope","TerminalLink","TerminalQuickFixTerminalCommand","TerminalQuickFixOpener","TerminalLocation","TerminalProfile","TerminalExitReason","TerminalShellExecutionCommandLineConfidence","TerminalCompletionItem","TerminalCompletionItemKind","TerminalCompletionList","TerminalShellType","TextDocumentSaveReason","TextEdit","SnippetTextEdit","TextEditorCursorStyle","TextEditorChangeKind","TextEditorLineNumbersStyle","TextEditorRevealType","TextEditorSelectionChangeKind","SyntaxTokenType","TextDocumentChangeReason","ThemeColor","ThemeIcon","TreeItem","TreeItemCheckboxState","TreeItemCollapsibleState","TypeHierarchyItem","UIKind","Uri","ViewColumn","WorkspaceEdit","DocumentPasteTriggerKind","DocumentDropEdit","DocumentDropOrPasteEditKind","DocumentPasteEdit","InlayHint","InlayHintLabelPart","InlayHintKind","RemoteAuthorityResolverError","ResolvedAuthority","ManagedResolvedAuthority","SourceControlInputBoxValidationType","ExtensionRuntime","TimelineItem","NotebookRange","NotebookCellKind","NotebookCellExecutionState","NotebookCellData","NotebookData","NotebookRendererScript","NotebookCellStatusBarAlignment","NotebookEditorRevealType","NotebookCellOutput","NotebookCellOutputItem","CellErrorStackFrame","NotebookCellStatusBarItem","NotebookControllerAffinity","NotebookControllerAffinity2","NotebookEdit","NotebookKernelSourceAction","NotebookVariablesRequestKind","PortAttributes","LinkedEditingRanges","TestResultState","TestRunRequest","TestMessage","TestMessageStackFrame","TestTag","TestRunProfileKind","TextSearchCompleteMessageType","DataTransfer","DataTransferItem","TestCoverageCount","FileCoverage","StatementCoverage","BranchCoverage","DeclarationCoverage","WorkspaceTrustState","LanguageStatusSeverity","QuickPickItemKind","InputBoxValidationSeverity","TabInputText","TabInputTextDiff","TabInputTextMerge","TabInputCustom","TabInputNotebook","TabInputNotebookDiff","TabInputWebview","TabInputTerminal","TabInputInteractiveWindow","TabInputChat","TabInputTextMultiDiff","TelemetryTrustedValue","LogLevel","EditSessionIdentityMatch","InteractiveSessionVoteDirection","ChatCopyKind","ChatSessionChangedFile","ChatEditingSessionActionOutcome","InteractiveEditorResponseFeedbackKind","DebugStackFrame","DebugThread","RelatedInformationType","SpeechToTextStatus","TextToSpeechStatus","PartialAcceptTriggerKind","InlineCompletionEndOfLifeReasonKind","InlineCompletionDisplayLocationKind","KeywordRecognitionStatus","ChatImageMimeType","ChatResponseMarkdownPart","ChatResponseFileTreePart","ChatResponseAnchorPart","ChatResponseProgressPart","ChatResponseProgressPart2","ChatResponseThinkingProgressPart","ChatResponseHookPart","ChatResponseReferencePart","ChatResponseReferencePart2","ChatResponseCodeCitationPart","ChatResponseCodeblockUriPart","ChatResponseWarningPart","ChatResponseTextEditPart","ChatResponseNotebookEditPart","ChatResponseWorkspaceEditPart","ChatResponseMarkdownWithVulnerabilitiesPart","ChatResponseCommandButtonPart","ChatResponseConfirmationPart","ChatQuestion","ChatQuestionType","ChatResponseQuestionCarouselPart","ChatResponseMovePart","ChatResponseExtensionsPart","ChatResponseExternalEditPart","ChatResponsePullRequestPart","ChatResponseMultiDiffPart","ChatResponseReferencePartStatusKind","ChatResponseClearToPreviousToolInvocationReason","ChatRequestTurn","ChatRequestTurn2","ChatResponseTurn","ChatResponseTurn2","ChatSubagentToolInvocationData","ChatToolInvocationPart","ChatLocation","ChatSessionStatus","ChatSessionCustomizationType","ChatDebugLogLevel","ChatDebugToolCallResult","ChatDebugHookResult","ChatDebugToolCallEvent","ChatDebugModelTurnEvent","ChatDebugGenericEvent","ChatDebugSubagentInvocationEvent","ChatDebugUserMessageEvent","ChatDebugAgentResponseEvent","ChatDebugMessageSection","ChatDebugEventTextContent","ChatDebugMessageContentType","ChatDebugEventMessageContent","ChatDebugEventToolCallContent","ChatDebugEventModelTurnContent","ChatDebugEventHookContent","ChatRequestEditorData","ChatRequestNotebookData","ChatReferenceBinaryData","ChatRequestEditedFileEventKind","LanguageModelChatMessageRole","LanguageModelChatMessage","LanguageModelChatMessage2","LanguageModelToolResultPart","LanguageModelToolResultPart2","LanguageModelTextPart","LanguageModelTextPart2","LanguageModelPartAudience","ToolResultAudience","LanguageModelToolCallPart","LanguageModelThinkingPart","LanguageModelError","LanguageModelToolResult","LanguageModelToolResult2","LanguageModelDataPart","LanguageModelDataPart2","LanguageModelToolExtensionSource","LanguageModelToolMCPSource","ExtendedLanguageModelToolResult","LanguageModelChatToolMode","LanguageModelPromptTsxPart","NewSymbolName","NewSymbolNameTag","NewSymbolNameTriggerKind","ExcludeSettingOptions","TextSearchContext2","TextSearchMatch2","AISearchKeyword","TextSearchCompleteMessageTypeNew","ChatErrorLevel","McpHttpServerDefinition","McpHttpServerDefinition2","McpStdioServerDefinition","McpStdioServerDefinition2","McpToolAvailability","McpToolInvocationContentData","SettingsSearchResultKind","ChatTodoStatus","ChatDebugSubagentStatus"]; + export const initialize = async () => {}; export const resolve = async (specifier, context, nextResolve) => { if (specifier !== 'vscode' || !context.parentURL) { @@ -78,11 +78,6 @@ index c042d78a3399c4e2e9e79f17606b3b793c01ac1d..ae53dfd7862179d8454a451f06e9906f + const code = "const _api = globalThis._VSCODE_IMPORT_VSCODE_API(decodeURIComponent('" + callerUrl + "'));\\n" + + EXPORTS.map(k => "export const " + k + " = _api['" + k + "'];").join("\\n"); + return { url: "data:text/javascript," + encodeURIComponent(code), shortCircuit: true }; - };`}static{this._vscodeImportFnName="_VSCODE_IMPORT_VSCODE_API"}dispose(){this._store.dispose()}_installInterceptor(){let e=new Vy,n=new Map;Object.defineProperty(globalThis,r._vscodeImportFnName,{enumerable:!1,configurable:!1,writable:!1,value:l=>e.getKey(l)});let{port1:o,port2:i}=new MessageChannel,s,a=o;a.onmessage=l=>{s||(s=this._factories.get("vscode"),ep(s));let{id:d,url:c}=l.data,u=b.parse(c),m=s.load("_not_used",u,()=>{throw new Error("CANNOT LOAD MODULE from here.")}),g=e.get(m);g||(g=Ae(),e.set(m,g));let h=n.get(g);if(!h){let f=`const _vscodeInstance = globalThis.${r._vscodeImportFnName}('${g}'); + };`}static{this._vscodeImportFnName="_VSCODE_IMPORT_VSCODE_API"}dispose(){this._store.dispose()}_installInterceptor(){let e=new eI,n=new Map;Object.defineProperty(globalThis,i._vscodeImportFnName,{enumerable:!1,configurable:!1,writable:!1,value:l=>e.getKey(l)});let{port1:o,port2:r}=new MessageChannel,s,a=o;a.onmessage=l=>{s||(s=this._factories.get("vscode"),rp(s));let{id:d,url:c}=l.data,u=y.parse(c),m=s.load("_not_used",u,()=>{throw new Error("CANNOT LOAD MODULE from here.")}),g=e.get(m);g||(g=Ee(),e.set(m,g));let h=n.get(g);if(!h){let f=`const _vscodeInstance = globalThis.${i._vscodeImportFnName}('${g}'); ${Object.keys(m).map((I=>`export const ${I} = _vscodeInstance['${I}'];`)).join(` --`)}`;h=r._createDataUri(f),n.set(g,h)}o.postMessage({id:d,url:h})},r$.register(r._createDataUri(r._loaderScript),{parentURL:import.meta.url,data:{port:i},transferList:[i]}),this._store.add(K(()=>{o.close(),i.close()}))}},lP=class extends Td{constructor(){super(...arguments);this.extensionRuntime=1}async _beforeAlmostReadyToRunExtensions(){this._instaService.createInstance(Jf);let e=this._instaService.invokeFunction(M5);if(this._instaService.createInstance(jf),this._initData.remote.isRemote&&this._initData.remote.authority){let o=this._instaService.createInstance(Gf);process.env.VSCODE_IPC_HOOK_CLI=o.ipcHandlePath}this._instaService.createInstance(Xf),await this._instaService.createInstance(sN,e,{mine:this._myRegistry,all:this._globalRegistry}).install(),await this._store.add(this._instaService.createInstance(aN,e,{mine:this._myRegistry,all:this._globalRegistry})).install(),Ft("code/extHost/didInitAPI"),(async()=>{let o=process.env.VSCODE_IPC_HOOK_CLI,i=process.env.CODE_SERVER_SESSION_SOCKET;if(!o||!i)return;let a={workspace:this._instaService.invokeFunction(d=>d.get(Sn).workspace),socketPath:o},l=JSON.stringify({entry:a});await new Promise((d,c)=>{let m=o$.request({path:"/add-session",socketPath:i,method:"POST",headers:{"content-type":"application/json"}},g=>{g.on("error",c),g.on("end",()=>{try{g.statusCode===200?d():c(new Error("Unexpected status code: "+g.statusCode))}catch(h){c(h)}})});m.on("error",c),m.write(l),m.end()})})().catch(o=>{this._logService.error(o)});let n=await this._extHostConfiguration.getConfigProvider();await Z5(this._extHostWorkspace,n,this,this._logService,this._mainThreadTelemetryProxy,this._initData,this._store),Ft("code/extHost/didInitProxyResolver")}_getEntryPoint(e){return e.main}async _doLoadModule(e,n,o,i){if(n.scheme!==V.file)throw new Error(`Cannot load URI: '${n}', must be of file-scheme`);let s=null;o.codeLoadingStart(),this._logService.trace(`ExtensionService#loadModule [${i}] -> ${n.toString(!0)}`),this._logService.flush();let a=e?.identifier.value;e&&await this._extHostLocalizationService.initializeLocalizedMessages(e);try{a&&Ft(`code/extHost/willLoadExtensionCode/${a}`),i==="esm"?s=await import(n.toString(!0)):s=i$(n.fsPath)}finally{a&&Ft(`code/extHost/didLoadExtensionCode/${a}`),o.codeLoadingStop()}return s}async _loadCommonJSModule(e,n,o){return this._doLoadModule(e,n,o,"cjs")}async _loadESMModule(e,n,o){return this._doLoadModule(e,n,o,"esm")}async $setRemoteEnvironment(e){if(this._initData.remote.isRemote)for(let n in e){let o=e[n];o===null?delete process.env[n]:process.env[n]=o}}};import*as Zf from"fs";import{exec as y$}from"child_process";var SJ=(r,t,e)=>{let n=new Uint8Array(16);for(let s=0;s<16;s++)n[s]=Math.round(Math.random()*256);let o=Mo(H.wrap(n));return[`GET ws://localhost${r}?${t}&skipWebSocketFrames=true HTTP/1.1`,"Connection: Upgrade","Upgrade: websocket",`Sec-WebSocket-Key: ${o}`].join(`\r -+`)}`;h=r._createDataUri(f),n.set(g,h)}o.postMessage({id:d,url:h})},r$.register(r._createDataUri(r._loaderScript),{parentURL:import.meta.url}),this._store.add(K(()=>{o.close(),i.close()}))}},lP=class extends Td{constructor(){super(...arguments);this.extensionRuntime=1}async _beforeAlmostReadyToRunExtensions(){this._instaService.createInstance(Jf);let e=this._instaService.invokeFunction(M5);if(this._instaService.createInstance(jf),this._initData.remote.isRemote&&this._initData.remote.authority){let o=this._instaService.createInstance(Gf);process.env.VSCODE_IPC_HOOK_CLI=o.ipcHandlePath}this._instaService.createInstance(Xf),await this._instaService.createInstance(sN,e,{mine:this._myRegistry,all:this._globalRegistry}).install(),await this._store.add(this._instaService.createInstance(aN,e,{mine:this._myRegistry,all:this._globalRegistry})).install(),Ft("code/extHost/didInitAPI"),(async()=>{let o=process.env.VSCODE_IPC_HOOK_CLI,i=process.env.CODE_SERVER_SESSION_SOCKET;if(!o||!i)return;let a={workspace:this._instaService.invokeFunction(d=>d.get(Sn).workspace),socketPath:o},l=JSON.stringify({entry:a});await new Promise((d,c)=>{let m=o$.request({path:"/add-session",socketPath:i,method:"POST",headers:{"content-type":"application/json"}},g=>{g.on("error",c),g.on("end",()=>{try{g.statusCode===200?d():c(new Error("Unexpected status code: "+g.statusCode))}catch(h){c(h)}})});m.on("error",c),m.write(l),m.end()})})().catch(o=>{this._logService.error(o)});let n=await this._extHostConfiguration.getConfigProvider();await Z5(this._extHostWorkspace,n,this,this._logService,this._mainThreadTelemetryProxy,this._initData,this._store),Ft("code/extHost/didInitProxyResolver")}_getEntryPoint(e){return e.main}async _doLoadModule(e,n,o,i){if(n.scheme!==V.file)throw new Error(`Cannot load URI: '${n}', must be of file-scheme`);let s=null;o.codeLoadingStart(),this._logService.trace(`ExtensionService#loadModule [${i}] -> ${n.toString(!0)}`),this._logService.flush();let a=e?.identifier.value;e&&await this._extHostLocalizationService.initializeLocalizedMessages(e);try{a&&Ft(`code/extHost/willLoadExtensionCode/${a}`),i==="esm"?s=await import(n.toString(!0)):s=i$(n.fsPath)}finally{a&&Ft(`code/extHost/didLoadExtensionCode/${a}`),o.codeLoadingStop()}return s}async _loadCommonJSModule(e,n,o){return this._doLoadModule(e,n,o,"cjs")}async _loadESMModule(e,n,o){return this._doLoadModule(e,n,o,"esm")}async $setRemoteEnvironment(e){if(this._initData.remote.isRemote)for(let n in e){let o=e[n];o===null?delete process.env[n]:process.env[n]=o}}};import*as Zf from"fs";import{exec as y$}from"child_process";var SJ=(r,t,e)=>{let n=new Uint8Array(16);for(let s=0;s<16;s++)n[s]=Math.round(Math.random()*256);let o=Mo(H.wrap(n));return[`GET ws://localhost${r}?${t}&skipWebSocketFrames=true HTTP/1.1`,"Connection: Upgrade","Upgrade: websocket",`Sec-WebSocket-Key: ${o}`].join(`\r - `)+`\r - \r - `},s$=H.fromString(`\r diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 80f6a7f..77cc85f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ settings: patchedDependencies: code-server: - hash: f27e6f7bc69f43c9eddb7727952e605173ad828b852080c65527053e72c260e9 + hash: e5d32873b15de188da472d692c4d06a96f6cdbe347b07614eb73e46556207f19 path: patches/code-server.patch importers: @@ -120,7 +120,7 @@ importers: version: 6.1.0-beta.197 code-server: specifier: ^4.117.0 - version: 4.117.0(patch_hash=f27e6f7bc69f43c9eddb7727952e605173ad828b852080c65527053e72c260e9)(typescript@6.0.3) + version: 4.117.0(patch_hash=e5d32873b15de188da472d692c4d06a96f6cdbe347b07614eb73e46556207f19)(typescript@6.0.3) cookie: specifier: ^0.7.0 version: 0.7.2 @@ -2589,7 +2589,7 @@ snapshots: dependencies: readdirp: 5.0.0 - code-server@4.117.0(patch_hash=f27e6f7bc69f43c9eddb7727952e605173ad828b852080c65527053e72c260e9)(typescript@6.0.3): + code-server@4.117.0(patch_hash=e5d32873b15de188da472d692c4d06a96f6cdbe347b07614eb73e46556207f19)(typescript@6.0.3): dependencies: '@coder/logger': 3.0.1 argon2: 0.44.0