@qwen-code/qwen-code 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/bundled/qc-helper/docs/configuration/model-providers.md +2 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +38 -28
  3. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  4. package/bundled/qc-helper/docs/features/channels/github.md +107 -0
  5. package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
  6. package/bundled/qc-helper/docs/features/code-review.md +1 -1
  7. package/bundled/qc-helper/docs/features/hooks.md +52 -15
  8. package/bundled/qc-helper/docs/features/mcp.md +9 -1
  9. package/bundled/qc-helper/docs/features/scheduled-tasks.md +3 -1
  10. package/bundled/qc-helper/docs/features/sub-agents.md +20 -0
  11. package/bundled/qc-helper/docs/qwen-serve.md +4 -2
  12. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +2 -2
  13. package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
  14. package/bundled/review/DESIGN.md +19 -0
  15. package/bundled/review/SKILL.md +120 -61
  16. package/chunks/MaxSizedBox-VI3ROJJA.js +84 -0
  17. package/chunks/{StandaloneSessionPicker-BIRMPLRD.js → StandaloneSessionPicker-LYXKD2EV.js} +67 -68
  18. package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-DFVPFQ6C.js} +2 -2
  19. package/chunks/{acpAgent-6J2U72PQ.js → acpAgent-WN5SRDQO.js} +1373 -553
  20. package/chunks/agent-K6ECSM64.js +80 -0
  21. package/chunks/agent-headless-NO4Y2HOE.js +74 -0
  22. package/chunks/{anthropicContentGenerator-75BKLTSP.js → anthropicContentGenerator-V2QOGVYD.js} +79 -27
  23. package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-6K6U7XYJ.js} +4 -4
  24. package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-GD2IJJ7I.js} +4 -4
  25. package/chunks/bridge-3KJEWDNE.js +90 -0
  26. package/chunks/{build-RV63TIRH.js → build-S6DO7LMM.js} +1 -1
  27. package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
  28. package/chunks/channel-management-service-XR7GZSWF.js +403 -0
  29. package/chunks/channel-settings-store-HW4FXXUA.js +87 -0
  30. package/chunks/{channel-worker-group-2ZD7TVAT.js → channel-worker-group-XDPTDWTX.js} +11 -6
  31. package/chunks/{channel-worker-manager-4OA4BCGB.js → channel-worker-manager-YYEHVRRE.js} +11 -6
  32. package/chunks/{channel-worker-supervisor-V7KCFJTS.js → channel-worker-supervisor-74HTWA2G.js} +7 -5
  33. package/chunks/{chunk-M5JM7OSF.js → chunk-2DN4J57Y.js} +2 -3
  34. package/chunks/{chunk-ETSW4KLJ.js → chunk-2FAK6PNM.js} +2 -2
  35. package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
  36. package/chunks/{chunk-EPDRMGT4.js → chunk-2LKVPASC.js} +4 -28
  37. package/chunks/{chunk-PWTZEM3C.js → chunk-2LQTH543.js} +3 -37
  38. package/chunks/{chunk-LH2BYDQ5.js → chunk-2N7CODY5.js} +18 -12
  39. package/chunks/{chunk-4WIZGAH3.js → chunk-2XSLTRFZ.js} +6 -58
  40. package/chunks/{chunk-FSITMZJH.js → chunk-3EFXSQCM.js} +18 -9
  41. package/chunks/{chunk-HIJQF5B5.js → chunk-3L2SPEBH.js} +1 -1
  42. package/chunks/{chunk-BIQWWWJN.js → chunk-4G2BISNC.js} +1 -1
  43. package/chunks/{chunk-PWVFN2LF.js → chunk-52ZSWYEG.js} +1 -1
  44. package/chunks/{chunk-ZJHVAS7M.js → chunk-5KTQXHPY.js} +4 -5
  45. package/chunks/{chunk-PC6JANNU.js → chunk-5MKRTI4T.js} +4 -4
  46. package/chunks/{chunk-DHHOYAPR.js → chunk-5TBMQLGG.js} +7 -7
  47. package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
  48. package/chunks/chunk-5YKDXHUY.js +463 -0
  49. package/chunks/chunk-5ZF5XXTS.js +363 -0
  50. package/chunks/{chunk-K4XWPEWB.js → chunk-64LQLPL7.js} +4 -33
  51. package/chunks/{chunk-YPE6A4GC.js → chunk-657BH7VM.js} +2 -2
  52. package/chunks/{chunk-R5AFZNQW.js → chunk-65PQENQP.js} +14 -7
  53. package/chunks/{chunk-RIBKPMRP.js → chunk-6PE7N3A4.js} +18 -7
  54. package/chunks/{chunk-JZA3JUDJ.js → chunk-6QIGFD5W.js} +1 -1
  55. package/chunks/{chunk-JVPM2ULZ.js → chunk-6RPMI2AB.js} +6 -6
  56. package/chunks/{chunk-OHNBB4XR.js → chunk-75GFAX4R.js} +1 -1
  57. package/chunks/{chunk-NIBLUX3Y.js → chunk-75MIQ3LV.js} +148 -21
  58. package/chunks/{chunk-U7M2DMGW.js → chunk-7AEJDLRA.js} +130 -5
  59. package/chunks/{chunk-TPRQ7RZH.js → chunk-7BAU433D.js} +2293 -945
  60. package/chunks/{chunk-M4FMGVY4.js → chunk-7DXQIJID.js} +3 -3
  61. package/chunks/{chunk-RWTEFFPU.js → chunk-7I5GTCT4.js} +620 -383
  62. package/chunks/{chunk-A5L3JMUA.js → chunk-7XATOOE7.js} +18 -4
  63. package/chunks/{chunk-Y34KJKDC.js → chunk-A2D5BAVP.js} +1 -1
  64. package/chunks/{chunk-5I2IWRSH.js → chunk-A3NDJ5SB.js} +2 -2
  65. package/chunks/{chunk-OFDOK3VM.js → chunk-A4COXFB3.js} +8 -13
  66. package/chunks/{chunk-JLU636DO.js → chunk-ALMR3E6Q.js} +1 -0
  67. package/chunks/{chunk-Q4M4MDQ4.js → chunk-AQIDMUGU.js} +1 -1
  68. package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
  69. package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
  70. package/chunks/{chunk-BJX6ZSUK.js → chunk-BCZFQXWK.js} +2 -2
  71. package/chunks/{chunk-MB4MZHMJ.js → chunk-BGTQCTQW.js} +211 -522
  72. package/chunks/{chunk-MZAXJAUM.js → chunk-BMFALVGQ.js} +1 -1
  73. package/chunks/{chunk-PSOO6YXD.js → chunk-BNWB5CYE.js} +9 -7
  74. package/chunks/{chunk-BKHWX6I2.js → chunk-BPZKP57P.js} +11 -3
  75. package/chunks/{chunk-H4SBPHSA.js → chunk-CAPPWD3X.js} +3 -3
  76. package/chunks/{chunk-LQIW3YFY.js → chunk-CQL64ESB.js} +7 -7
  77. package/chunks/{chunk-TOFQCPDC.js → chunk-CVHIL5IG.js} +4 -5
  78. package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
  79. package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
  80. package/chunks/chunk-DZLYR4U3.js +1252 -0
  81. package/chunks/{chunk-TEHGS6UP.js → chunk-EIF3FXTB.js} +117 -24
  82. package/chunks/{chunk-2SCDWPXI.js → chunk-EJGJIBRS.js} +5 -5
  83. package/chunks/{chunk-7MVVZO4N.js → chunk-EVKE2FZL.js} +4 -4
  84. package/chunks/{chunk-OKY7HXPG.js → chunk-FNMZK765.js} +2 -2
  85. package/chunks/{chunk-VIA5XA4U.js → chunk-FTD6DP4T.js} +3 -1
  86. package/chunks/chunk-FYJ7W2PI.js +194 -0
  87. package/chunks/{chunk-L5UHQJTJ.js → chunk-GATT5TKW.js} +1 -1
  88. package/chunks/{chunk-X5XDDSSH.js → chunk-GEBV2JGB.js} +28 -5
  89. package/chunks/{chunk-VAK25FTU.js → chunk-GKX7E4CO.js} +1 -1
  90. package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
  91. package/chunks/{chunk-5NBDS5S6.js → chunk-GNR2RNMP.js} +162 -7
  92. package/chunks/{chunk-YH6G52F2.js → chunk-GXIJHV66.js} +4 -4
  93. package/chunks/chunk-GZ3RCT54.js +76 -0
  94. package/chunks/{chunk-2X55UKQE.js → chunk-HMRM2A3U.js} +3 -3
  95. package/chunks/chunk-HV26XH34.js +319 -0
  96. package/chunks/{chunk-LB6DUZ26.js → chunk-J7OACQDE.js} +229 -172
  97. package/chunks/{chunk-K36B6G2O.js → chunk-JFMA7Y5M.js} +5 -5
  98. package/chunks/{chunk-55DJUCI2.js → chunk-JHNRZMHI.js} +53 -43
  99. package/chunks/{chunk-63P4EL5V.js → chunk-JMONIXMJ.js} +1 -1
  100. package/chunks/{chunk-L26JL52R.js → chunk-JSD33JG6.js} +47 -64
  101. package/chunks/{chunk-YBL3QUDD.js → chunk-JTV5K7NH.js} +1 -1
  102. package/chunks/{chunk-RZIX2G32.js → chunk-JX27F6QS.js} +1 -1
  103. package/chunks/chunk-JYBU6YUE.js +378 -0
  104. package/chunks/{chunk-7JURR4JT.js → chunk-KAMYKP7E.js} +167 -81
  105. package/chunks/{chunk-KMQ33DO4.js → chunk-KCO4FLFJ.js} +4 -4
  106. package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
  107. package/chunks/{chunk-RHLZR4E5.js → chunk-LGAOC3ZS.js} +1 -1
  108. package/chunks/{chunk-EBJQ6AXW.js → chunk-LO4ROVP4.js} +262 -16
  109. package/chunks/{chunk-NH6KE4JX.js → chunk-LW3RFMG7.js} +3 -3
  110. package/chunks/{chunk-J56UI34H.js → chunk-M7OONWYU.js} +2 -2
  111. package/chunks/{chunk-2NH6DYI4.js → chunk-MHAIJPTD.js} +12 -12
  112. package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
  113. package/chunks/{chunk-VRYUBFMC.js → chunk-MR5EAQ5M.js} +1 -1
  114. package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
  115. package/chunks/{chunk-H5FFA6TH.js → chunk-NOKIVHOL.js} +16 -3
  116. package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
  117. package/chunks/{chunk-SQCQ4KO2.js → chunk-OCESJA77.js} +393 -330
  118. package/chunks/chunk-OCPBI7J5.js +18 -0
  119. package/chunks/{chunk-E5TUC6CA.js → chunk-OKF7JF3R.js} +3 -3
  120. package/chunks/{chunk-TGILQ3YH.js → chunk-P4WOAOJW.js} +141 -64
  121. package/chunks/{chunk-ZFDTEDCF.js → chunk-PB3MBFKG.js} +6 -6
  122. package/chunks/{chunk-3RN6GBKS.js → chunk-PLDQBIO6.js} +1 -1
  123. package/chunks/{chunk-FNQ6T3CV.js → chunk-PONHVBRT.js} +10 -7
  124. package/chunks/{chunk-CIKQ7KKO.js → chunk-PT722TDT.js} +271 -376
  125. package/chunks/chunk-Q43KPN7X.js +2196 -0
  126. package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
  127. package/chunks/{chunk-MVSUYZDT.js → chunk-QIZKCVM3.js} +4 -4
  128. package/chunks/{chunk-QAF7NMK7.js → chunk-RCUQIPTN.js} +1 -1
  129. package/chunks/{chunk-6FGBXPWM.js → chunk-RPLGZJV2.js} +38 -44
  130. package/chunks/{chunk-GSN55ZRI.js → chunk-S4WJVPZW.js} +19 -7
  131. package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
  132. package/chunks/{chunk-BULDBTYC.js → chunk-S7W2GKIO.js} +1 -28
  133. package/chunks/{chunk-MUP3T3AD.js → chunk-SGFT55XI.js} +1 -35
  134. package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
  135. package/chunks/chunk-T26EAKDL.js +13 -0
  136. package/chunks/{chunk-UDX5OBWR.js → chunk-T2QMKU3R.js} +80 -2
  137. package/chunks/{chunk-IKYJHJNF.js → chunk-T3O2B4XO.js} +3 -3
  138. package/chunks/{chunk-RF3EXIHJ.js → chunk-T4TXDL7G.js} +32 -21
  139. package/chunks/{chunk-J24WCGIN.js → chunk-TBBV36Y4.js} +4 -4
  140. package/chunks/{chunk-LKEJ26GS.js → chunk-TCIFAA7K.js} +16 -11
  141. package/chunks/{chunk-JXJFVC6E.js → chunk-TDL6LB4K.js} +46 -11
  142. package/chunks/{chunk-7ZCNENPP.js → chunk-TFRMVU6R.js} +1 -1
  143. package/chunks/{chunk-VULLI6WQ.js → chunk-TV64SXKD.js} +6 -6
  144. package/chunks/{chunk-FQK6JAFG.js → chunk-U3E3UQAA.js} +4 -4
  145. package/chunks/{chunk-LK7CHLVP.js → chunk-U4VTUMMK.js} +0 -60
  146. package/chunks/{chunk-ACY3A37B.js → chunk-UBEPNVDI.js} +23 -18
  147. package/chunks/{chunk-NL7LTRLR.js → chunk-UHUSJ6X7.js} +29 -68
  148. package/chunks/{chunk-ZOIFNCKL.js → chunk-UPUG4GXM.js} +3 -23
  149. package/chunks/{chunk-6GMVPFB2.js → chunk-UWMLWVCA.js} +19 -6
  150. package/chunks/{chunk-IKCX4CCL.js → chunk-VCPIZRYH.js} +118 -95
  151. package/chunks/{chunk-ZNAUOR2I.js → chunk-VWOOBLTY.js} +2 -2
  152. package/chunks/{chunk-YX324OPW.js → chunk-VYOXCEPJ.js} +1 -1
  153. package/chunks/{chunk-USTWD7QV.js → chunk-W4MIWP6M.js} +26 -16
  154. package/chunks/{chunk-HTR4WV6U.js → chunk-W4RQUHY3.js} +31 -1
  155. package/chunks/{chunk-DLWL3Z7A.js → chunk-WBSMNTSV.js} +3 -3
  156. package/chunks/{chunk-IO3IX5Q4.js → chunk-WUZ7H6DP.js} +1 -1
  157. package/chunks/{chunk-2JZBVYTU.js → chunk-WZRWHXFE.js} +1 -8
  158. package/chunks/{chunk-PHOF65IG.js → chunk-X5WNMMIA.js} +23553 -34321
  159. package/chunks/chunk-XBYYDKAZ.js +80 -0
  160. package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
  161. package/chunks/{chunk-WCXCRJYB.js → chunk-XFZYFU3I.js} +1 -1
  162. package/chunks/{chunk-3QMGYBFN.js → chunk-XWWKIXVD.js} +1 -80
  163. package/chunks/{chunk-3SJ43L4W.js → chunk-XZC5VLBZ.js} +2 -0
  164. package/chunks/{chunk-UUUTRMI2.js → chunk-Y4IHBGBP.js} +1 -1
  165. package/chunks/{chunk-PR75REBZ.js → chunk-Y6AXW2OG.js} +12 -82
  166. package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
  167. package/chunks/{chunk-IJTOWOD7.js → chunk-YGF33UXG.js} +82 -8
  168. package/chunks/chunk-Z4X5MTRT.js +133 -0
  169. package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
  170. package/chunks/{chunk-ZD6UTE4A.js → chunk-ZHBO7WVX.js} +1 -1
  171. package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
  172. package/chunks/{chunk-KIM5GUMA.js → chunk-ZURDMIDR.js} +368 -156
  173. package/chunks/{computer-use-SOQ4E3VX.js → computer-use-ZTIDHMMA.js} +49 -50
  174. package/chunks/{config-utils-7V7GGIW6.js → config-utils-NYSXDMEQ.js} +4 -3
  175. package/chunks/contextCommand-2PIEU37Z.js +79 -0
  176. package/chunks/core-runtime-3XEYLQFK.js +133 -0
  177. package/chunks/{create-sub-session-QRJLW5BV.js → create-sub-session-R76FVXCI.js} +46 -47
  178. package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-SBYUMSSS.js} +3 -3
  179. package/chunks/{cron-create-YIID5XAW.js → cron-create-2QK6TCEC.js} +6 -6
  180. package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-FDCDFYMG.js} +5 -5
  181. package/chunks/{cron-list-XEGS463Q.js → cron-list-XN3WVBTP.js} +6 -6
  182. package/chunks/{daemon-YO6433NF.js → daemon-Q2AB5Z23.js} +356 -15
  183. package/chunks/daemon-status-provider-3XJI6CAL.js +89 -0
  184. package/chunks/daemon-trust-policy-ILUDTLHD.js +84 -0
  185. package/chunks/daemon-trust-policy-monitor-HS3PKKRO.js +171 -0
  186. package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
  187. package/chunks/deferred-core-runtime-X4QV662U.js +88 -0
  188. package/chunks/dist-BSTVRPMT.js +4227 -0
  189. package/chunks/{dist-46NQKLTW.js → dist-DOLYHMXE.js} +2 -2
  190. package/chunks/{dist-AIKFMUKK.js → dist-HVRQ2CFL.js} +271 -11
  191. package/chunks/{dist-WEAHOXDM.js → dist-IXQEQWRG.js} +2 -1
  192. package/chunks/{dist-BBLXMS3N.js → dist-SSU66DM4.js} +3 -3
  193. package/chunks/{dist-F6IBUDR4.js → dist-SV7Q3AWJ.js} +1 -1
  194. package/chunks/{dist-YFNEUWSE.js → dist-YGBBMK3Z.js} +1 -1
  195. package/chunks/earlyInputCapture-XKLZT7ZD.js +81 -0
  196. package/chunks/{edit-OBDSQURM.js → edit-HHGIOTQ2.js} +47 -48
  197. package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
  198. package/chunks/{enter-worktree-U6MRPQ2P.js → enter-worktree-ZN7PUQ46.js} +47 -48
  199. package/chunks/{enterPlanMode-BC5QUZZ2.js → enterPlanMode-EIFIDSIV.js} +47 -48
  200. package/chunks/{environment-W5UFC2CH.js → environment-XXQ75D2Q.js} +48 -49
  201. package/chunks/errors-4GMVU7CK.js +87 -0
  202. package/chunks/esm-K5FARBNI.js +5548 -0
  203. package/chunks/{exit-worktree-DGNYMECB.js → exit-worktree-GXMI4ATY.js} +47 -48
  204. package/chunks/exitPlanMode-34UVY7M6.js +72 -0
  205. package/chunks/{fast-path-JJZFJANL.js → fast-path-VPIVA7L6.js} +16 -6
  206. package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
  207. package/chunks/{gemini-QS36EBZV.js → gemini-4BWIK4WD.js} +102 -99
  208. package/chunks/{geminiContentGenerator-AG4KB6CV.js → geminiContentGenerator-3XVV5MSS.js} +40 -11
  209. package/chunks/{getMachineId-bsd-V7W3GODC.js → getMachineId-bsd-FG7IUY6U.js} +1 -1
  210. package/chunks/{getMachineId-darwin-TDO75DQP.js → getMachineId-darwin-GLCJI2RA.js} +1 -1
  211. package/chunks/{getMachineId-linux-TF43WQT2.js → getMachineId-linux-O6OPPAKO.js} +1 -1
  212. package/chunks/{getMachineId-unsupported-ZGUO3TXT.js → getMachineId-unsupported-S6CKYVGC.js} +1 -1
  213. package/chunks/{getMachineId-win-ECFYZZFQ.js → getMachineId-win-X5SRNEH7.js} +1 -1
  214. package/chunks/{glob-V7R3PSK3.js → glob-TZ2ABCJG.js} +47 -48
  215. package/chunks/{grep-QYPSK7OP.js → grep-BEF463NA.js} +49 -49
  216. package/chunks/handleAutoUpdate-L6ERF36Y.js +80 -0
  217. package/chunks/i18n-FMM5FDXR.js +96 -0
  218. package/chunks/{image-gen-Z3VPGKRC.js → image-gen-HHVLF7HS.js} +12 -12
  219. package/chunks/initializer-625TIAIO.js +85 -0
  220. package/chunks/installationInfo-6AM4I2Y3.js +79 -0
  221. package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
  222. package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-72IYCAZV.js} +3 -3
  223. package/chunks/lib-RUF3WZA6.js +9 -0
  224. package/chunks/list-L2GA674Y.js +88 -0
  225. package/chunks/{list-agents-5KJJHR6I.js → list-agents-R6KDXQR3.js} +3 -3
  226. package/chunks/loadedSettingsAdapter-SPUTNKAV.js +82 -0
  227. package/chunks/{loggingContentGenerator-HS3S5H3Q.js → loggingContentGenerator-LKOF7XI7.js} +78 -113
  228. package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-3IQKCYAH.js} +7 -7
  229. package/chunks/{ls-NTK6VOQJ.js → ls-DKZ37A7N.js} +5 -5
  230. package/chunks/{lsp-2JI24STP.js → lsp-QNWN7KN3.js} +3 -3
  231. package/chunks/{managed-npm-update-JYEMMXA3.js → managed-npm-update-ACQGGIN5.js} +47 -48
  232. package/chunks/mcp-SZLHKFJW.js +82 -0
  233. package/chunks/{monitor-R3ODH5U6.js → monitor-DF52UVHI.js} +47 -48
  234. package/chunks/nonInteractiveCli-5T7KYKLK.js +144 -0
  235. package/chunks/{notebook-edit-BNOK452R.js → notebook-edit-FCWS4XVN.js} +47 -48
  236. package/chunks/{openaiContentGenerator-WMCU3O2H.js → openaiContentGenerator-7LDK3DCJ.js} +26 -27
  237. package/chunks/pidfile-6ERW3DF4.js +85 -0
  238. package/chunks/process-registry-2CHQBXH5.js +157 -0
  239. package/chunks/{processUtils-RT7UNCC2.js → processUtils-COKZAMUP.js} +2 -2
  240. package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
  241. package/chunks/{qwenContentGenerator-HHCRK4SX.js → qwenContentGenerator-TKWUMR7N.js} +52 -53
  242. package/chunks/{qwenOAuth2-OWLB5AKH.js → qwenOAuth2-7HMU47SF.js} +10 -10
  243. package/chunks/read-file-X6DRC574.js +29 -0
  244. package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-GFTWYXMK.js} +4 -4
  245. package/chunks/{record-artifact-RQKFYO5B.js → record-artifact-XAMSFSW4.js} +3 -3
  246. package/chunks/resumeHistoryUtils-PFPM2GWM.js +90 -0
  247. package/chunks/ripGrep-OWV2IVJC.js +72 -0
  248. package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
  249. package/chunks/{run-qwen-serve-FU6HEM4J.js → run-qwen-serve-TSTCO4XE.js} +953 -249
  250. package/chunks/{runtime-XXRRTNP6.js → runtime-DAUPSUKI.js} +56 -56
  251. package/chunks/{scheduler-G2ZS2Z7E.js → scheduler-KMADMT26.js} +46 -47
  252. package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
  253. package/chunks/{sdk-exporters-http-FYBSUCPD.js → sdk-exporters-http-WO556XNU.js} +7 -7
  254. package/chunks/{sdk-impl-GMVPB7NB.js → sdk-impl-LPAVACSF.js} +14 -14
  255. package/chunks/{send-message-Q6OOR6BR.js → send-message-SAWK4DZX.js} +6 -6
  256. package/chunks/serve-NNRWS6F4.js +88 -0
  257. package/chunks/{server-4UMH7OIZ.js → server-WEH7DVCH.js} +3691 -823
  258. package/chunks/{session-K3O3Q2SV.js → session-WXC56V2I.js} +98 -95
  259. package/chunks/{settings-CR2EWTBA.js → settings-DJDXFDZ3.js} +55 -56
  260. package/chunks/shell-JN5VRQXD.js +82 -0
  261. package/chunks/{skill-I3SDA4MB.js → skill-SGXPKJCS.js} +20 -21
  262. package/chunks/skill-settings-VJ5PDMZI.js +90 -0
  263. package/chunks/spawnChannel-ETMJW7YX.js +81 -0
  264. package/chunks/standalone-update-MK3Z7KBI.js +91 -0
  265. package/chunks/{startInteractiveUI-SLZGHRPH.js → startInteractiveUI-ZCGIXPGT.js} +724 -383
  266. package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-355CB6CJ.js} +4 -4
  267. package/chunks/{task-create-N7WQSGYA.js → task-create-INGWNUG4.js} +10 -10
  268. package/chunks/{task-list-FOPULZEP.js → task-list-5XNNGTF4.js} +7 -7
  269. package/chunks/{task-stop-H6RHXFVQ.js → task-stop-4ROAOBXH.js} +3 -3
  270. package/chunks/{task-update-M57TFZJT.js → task-update-CRK5VWWZ.js} +10 -10
  271. package/chunks/{team-create-YJALH5D2.js → team-create-QQGAJG7P.js} +49 -50
  272. package/chunks/{team-delete-QE2UXJL7.js → team-delete-S2RCXA4P.js} +7 -7
  273. package/chunks/{team-plan-approval-34QFYKGN.js → team-plan-approval-RT7Q5R6O.js} +47 -48
  274. package/chunks/theme-manager-EEWIQJ7J.js +76 -0
  275. package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-7WM3VDMY.js} +7 -7
  276. package/chunks/{tool-search-NF7GB6LE.js → tool-search-Z3Z4AYKP.js} +19 -21
  277. package/chunks/total-session-admission-44JKRWQD.js +84 -0
  278. package/chunks/trustedFolders-X2JEIO57.js +94 -0
  279. package/chunks/{update-relaunch-WBUZJC5O.js → update-relaunch-VWNPYDIP.js} +5 -5
  280. package/chunks/updateCheck-KAQH67DV.js +91 -0
  281. package/chunks/useAutoAcceptIndicator-JH6BCF7S.js +92 -0
  282. package/chunks/{validateNonInterActiveAuth-3R223G3R.js → validateNonInterActiveAuth-GIUJ2UFS.js} +93 -90
  283. package/chunks/{version-HS7YSFHV.js → version-BGLYIJUY.js} +1 -1
  284. package/chunks/{web-fetch-NKCSG7ZE.js → web-fetch-OTDU4VQF.js} +19 -21
  285. package/chunks/{web-search-S62WAP4S.js → web-search-FP6SIHPR.js} +13 -13
  286. package/chunks/{workflow-QAGU5RU4.js → workflow-YCIVBYSB.js} +48 -49
  287. package/chunks/workspace-providers-status-S35YAIUS.js +85 -0
  288. package/chunks/{workspace-registration-store-24JMHDGF.js → workspace-registration-store-OTMS3H4C.js} +1 -1
  289. package/chunks/workspace-registry-O63R6IZ4.js +92 -0
  290. package/chunks/workspace-service-M6LLHKJ5.js +99 -0
  291. package/chunks/workspace-skills-status-C2V7BAIS.js +85 -0
  292. package/chunks/workspace-trust-reconciler-IBUPOUJN.js +345 -0
  293. package/chunks/write-file-3BZC3EAE.js +72 -0
  294. package/chunks/xterm-headless-NTYVIBT3.js +3475 -0
  295. package/chunks/{zh-LUIGBD55.js → zh-H3YDK5QW.js} +9 -1
  296. package/chunks/{zh-TW-F5KG2IYD.js → zh-TW-JYCP7XUA.js} +9 -1
  297. package/chunks/zoom-image-TZ6S2O57.js +351 -0
  298. package/cli.js +13 -13
  299. package/locales/ca.js +7 -2
  300. package/locales/de.js +7 -2
  301. package/locales/en.js +10 -2
  302. package/locales/fr.js +7 -2
  303. package/locales/ja.js +7 -2
  304. package/locales/pt.js +7 -2
  305. package/locales/ru.js +7 -2
  306. package/locales/zh-TW.js +10 -2
  307. package/locales/zh.js +10 -2
  308. package/package.json +5 -4
  309. package/web-shell/assets/{arc-DcbWnB9T.js → arc-75-Wdeo3.js} +1 -1
  310. package/web-shell/assets/{architectureDiagram-3BPJPVTR-kMMF5sud.js → architectureDiagram-3BPJPVTR-FKeXQbyP.js} +1 -1
  311. package/web-shell/assets/{blockDiagram-GPEHLZMM-Htl9vTJS.js → blockDiagram-GPEHLZMM-CY0vc-A3.js} +1 -1
  312. package/web-shell/assets/{c4Diagram-AAUBKEIU-BnZnm0mQ.js → c4Diagram-AAUBKEIU-CNP-A-8u.js} +1 -1
  313. package/web-shell/assets/channel-DPYMT76A.js +1 -0
  314. package/web-shell/assets/{chunk-2J33WTMH-DziB7kDG.js → chunk-2J33WTMH-GybS4Gii.js} +1 -1
  315. package/web-shell/assets/{chunk-4BX2VUAB-CmkD8daw.js → chunk-4BX2VUAB-02H91V8v.js} +1 -1
  316. package/web-shell/assets/{chunk-55IACEB6-CHAd9A_U.js → chunk-55IACEB6-D3M-2VT6.js} +1 -1
  317. package/web-shell/assets/{chunk-727SXJPM-Dqaam3fE.js → chunk-727SXJPM-CCu29u4H.js} +1 -1
  318. package/web-shell/assets/{chunk-AQP2D5EJ-D_-saBYM.js → chunk-AQP2D5EJ-CaFKWgrn.js} +1 -1
  319. package/web-shell/assets/{chunk-FMBD7UC4-B9r_veWD.js → chunk-FMBD7UC4-ZZpPqIwQ.js} +1 -1
  320. package/web-shell/assets/{chunk-ND2GUHAM-B3EaCSpL.js → chunk-ND2GUHAM-D22DqGs8.js} +1 -1
  321. package/web-shell/assets/{chunk-QZHKN3VN-CYq8x9mn.js → chunk-QZHKN3VN-Bu85S0fw.js} +1 -1
  322. package/web-shell/assets/classDiagram-4FO5ZUOK--JstsIgL.js +1 -0
  323. package/web-shell/assets/classDiagram-v2-Q7XG4LA2--JstsIgL.js +1 -0
  324. package/web-shell/assets/{cose-bilkent-S5V4N54A-D0ng4uiB.js → cose-bilkent-S5V4N54A-f1CK1Gwe.js} +1 -1
  325. package/web-shell/assets/{dagre-BM42HDAG-DCZollQv.js → dagre-BM42HDAG-D0Ow8F_n.js} +1 -1
  326. package/web-shell/assets/{diagram-2AECGRRQ-Dfk2pWS0.js → diagram-2AECGRRQ-BPrmTWp8.js} +1 -1
  327. package/web-shell/assets/{diagram-5GNKFQAL-kX38ltWR.js → diagram-5GNKFQAL-HccuFAzy.js} +1 -1
  328. package/web-shell/assets/{diagram-KO2AKTUF-CJz2vsXh.js → diagram-KO2AKTUF-BrS76mbA.js} +1 -1
  329. package/web-shell/assets/{diagram-LMA3HP47-BvMLZm_7.js → diagram-LMA3HP47-V7T9lU-5.js} +1 -1
  330. package/web-shell/assets/{diagram-OG6HWLK6-l7kfStkO.js → diagram-OG6HWLK6-DKidyJMR.js} +1 -1
  331. package/web-shell/assets/{erDiagram-TEJ5UH35-BSVa8GGT.js → erDiagram-TEJ5UH35-DBadZIkp.js} +1 -1
  332. package/web-shell/assets/{flowDiagram-I6XJVG4X-CoawKIXH.js → flowDiagram-I6XJVG4X-BymfqdNJ.js} +1 -1
  333. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DFUDH0zF.js → ganttDiagram-6RSMTGT7-DOw340jf.js} +1 -1
  334. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Y2pvpT4e.js → gitGraphDiagram-PVQCEYII-_8EiD8sl.js} +1 -1
  335. package/web-shell/assets/{index-D0GX0zZf.js → index-CKIadvET.js} +1 -1
  336. package/web-shell/assets/index-D1eXNRHe.js +1389 -0
  337. package/web-shell/assets/index-DVLD4CQq.css +5 -0
  338. package/web-shell/assets/{infoDiagram-5YYISTIA-CU8_zLiX.js → infoDiagram-5YYISTIA-D61KYQBu.js} +1 -1
  339. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-AVQiV0DU.js → ishikawaDiagram-YF4QCWOH-CsiXSpNx.js} +1 -1
  340. package/web-shell/assets/{journeyDiagram-JHISSGLW-DQ0VSKa3.js → journeyDiagram-JHISSGLW-Sdfionyh.js} +1 -1
  341. package/web-shell/assets/{kanban-definition-UN3LZRKU-BqnWqsE_.js → kanban-definition-UN3LZRKU-C3WI3Cnl.js} +1 -1
  342. package/web-shell/assets/{linear-BkoihsaA.js → linear-Dpigcc62.js} +1 -1
  343. package/web-shell/assets/{mermaid.core-5RJs-31j.js → mermaid.core-Ct97pqgW.js} +5 -5
  344. package/web-shell/assets/{mindmap-definition-RKZ34NQL-D33Bxnpd.js → mindmap-definition-RKZ34NQL-BzeaN0rB.js} +1 -1
  345. package/web-shell/assets/{pieDiagram-4H26LBE5-BuEAw3BH.js → pieDiagram-4H26LBE5-CvjgcbVD.js} +1 -1
  346. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Kox_usEq.js → quadrantDiagram-W4KKPZXB-BUzgTNdH.js} +1 -1
  347. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CNjeUif0.js → requirementDiagram-4Y6WPE33-B7zKlgUQ.js} +1 -1
  348. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BCd2OL_U.js → sankeyDiagram-5OEKKPKP-Bb9CQgrT.js} +1 -1
  349. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CF2ZTsz0.js → sequenceDiagram-3UESZ5HK-DJ6V7itG.js} +1 -1
  350. package/web-shell/assets/{stateDiagram-AJRCARHV-qenSzHtm.js → stateDiagram-AJRCARHV-IImflERY.js} +1 -1
  351. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CYI_YoNR.js +1 -0
  352. package/web-shell/assets/{timeline-definition-PNZ67QCA-B5DyWdgs.js → timeline-definition-PNZ67QCA-6Q_uWHKh.js} +1 -1
  353. package/web-shell/assets/{vennDiagram-CIIHVFJN-DqP4I_o_.js → vennDiagram-CIIHVFJN-TmyKyjwv.js} +1 -1
  354. package/web-shell/assets/{wardley-L42UT6IY-CJe2e4mg.js → wardley-L42UT6IY-CRh9uiPv.js} +1 -1
  355. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BMDSw-Rr.js → wardleyDiagram-YWT4CUSO-59TKAW8w.js} +1 -1
  356. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BTVZYkxD.js → xychartDiagram-2RQKCTM6-GCSUIK2L.js} +1 -1
  357. package/web-shell/index.html +2 -2
  358. package/chunks/MaxSizedBox-5DPPWPGT.js +0 -85
  359. package/chunks/agent-6ODUANDO.js +0 -81
  360. package/chunks/agent-headless-7BYQTMHW.js +0 -75
  361. package/chunks/bridge-ZUB64FAE.js +0 -90
  362. package/chunks/chunk-LEH5C7FV.js +0 -232
  363. package/chunks/chunk-SZRN75WQ.js +0 -29
  364. package/chunks/chunk-UGYMA4EI.js +0 -219
  365. package/chunks/chunk-Z2BC6UJ5.js +0 -8575
  366. package/chunks/contextCommand-JLHYA34Z.js +0 -80
  367. package/chunks/daemon-status-provider-2233Q37D.js +0 -89
  368. package/chunks/earlyInputCapture-A7NDU3PF.js +0 -82
  369. package/chunks/errors-M7CLORXH.js +0 -88
  370. package/chunks/exitPlanMode-GXTBWQAR.js +0 -403
  371. package/chunks/handleAutoUpdate-6DBEZYPV.js +0 -81
  372. package/chunks/i18n-VUJJZIMU.js +0 -97
  373. package/chunks/initializer-UWAK5U5O.js +0 -86
  374. package/chunks/installationInfo-6O2YAA52.js +0 -80
  375. package/chunks/list-GB4ESM3T.js +0 -89
  376. package/chunks/loadedSettingsAdapter-OT6JVQ7U.js +0 -83
  377. package/chunks/mcp-6DBDJPFU.js +0 -83
  378. package/chunks/nonInteractiveCli-MOYCYBBU.js +0 -141
  379. package/chunks/pidfile-TFRZZZIO.js +0 -86
  380. package/chunks/read-file-APMO3PSX.js +0 -31
  381. package/chunks/resumeHistoryUtils-6KRYEAWZ.js +0 -91
  382. package/chunks/ripGrep-BEJDEDXW.js +0 -73
  383. package/chunks/serve-7BSTXJ4T.js +0 -89
  384. package/chunks/shell-HH3PF3A2.js +0 -83
  385. package/chunks/spawnChannel-RWNDBXGA.js +0 -82
  386. package/chunks/src-GE4TTTML.js +0 -3147
  387. package/chunks/standalone-update-Q6WFRZZQ.js +0 -92
  388. package/chunks/theme-manager-SWRILQHI.js +0 -77
  389. package/chunks/total-session-admission-DLHHHLD3.js +0 -84
  390. package/chunks/trustedFolders-KHXHY6PY.js +0 -93
  391. package/chunks/updateCheck-RKL6M5XN.js +0 -92
  392. package/chunks/useAutoAcceptIndicator-CFQ5BUJL.js +0 -93
  393. package/chunks/workspace-providers-status-QSVZUETE.js +0 -86
  394. package/chunks/workspace-registry-UT4RBNBM.js +0 -88
  395. package/chunks/workspace-service-JFWRUS4V.js +0 -98
  396. package/chunks/workspace-skills-status-ZBBKJOI2.js +0 -85
  397. package/chunks/write-file-VHIXW5M7.js +0 -73
  398. package/web-shell/assets/channel-Cq7YKtfC.js +0 -1
  399. package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +0 -1
  400. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +0 -1
  401. package/web-shell/assets/index-D9haPt0X.css +0 -5
  402. package/web-shell/assets/index-ckX9Pq5k.js +0 -1230
  403. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +0 -1
  404. package/chunks/{chunk-TARRHLLG.js → chunk-QUGAUQGJ.js} +25 -25
  405. package/chunks/{chunk-U7ZFW55U.js → chunk-VOQXFAY5.js} +977 -977
  406. /package/chunks/{chunk-LXXMOYPL.js → chunk-VXZBKKQR.js} +0 -0
@@ -0,0 +1,2196 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ require_strip_json_comments
5
+ } from "./chunk-ALGGS7UH.js";
6
+ import {
7
+ arePathsEquivalent,
8
+ getPathComparisonVariants,
9
+ isWithinRoot
10
+ } from "./chunk-MR3PXB6E.js";
11
+ import {
12
+ writeStderrLine
13
+ } from "./chunk-OWAK7LMW.js";
14
+ import {
15
+ ideContextStore
16
+ } from "./chunk-X5WNMMIA.js";
17
+ import {
18
+ require_proper_lockfile
19
+ } from "./chunk-KRXPRVGL.js";
20
+ import {
21
+ atomicWriteFileSync
22
+ } from "./chunk-7XATOOE7.js";
23
+ import {
24
+ FatalConfigError,
25
+ Storage,
26
+ getErrorMessage
27
+ } from "./chunk-UHUSJ6X7.js";
28
+ import {
29
+ init_esbuild_shims
30
+ } from "./chunk-5O2XNYP6.js";
31
+ import {
32
+ __name,
33
+ __toESM
34
+ } from "./chunk-J2S4EL5Y.js";
35
+
36
+ // packages/cli/src/config/trustedFolders.ts
37
+ init_esbuild_shims();
38
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
39
+ import * as fs3 from "node:fs";
40
+ import * as path from "node:path";
41
+ var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
42
+
43
+ // packages/cli/src/utils/jsonc-editor.ts
44
+ init_esbuild_shims();
45
+ import * as fs2 from "node:fs";
46
+ import { isDeepStrictEqual } from "node:util";
47
+
48
+ // node_modules/jsonc-parser/lib/esm/main.js
49
+ init_esbuild_shims();
50
+
51
+ // node_modules/jsonc-parser/lib/esm/impl/format.js
52
+ init_esbuild_shims();
53
+
54
+ // node_modules/jsonc-parser/lib/esm/impl/scanner.js
55
+ init_esbuild_shims();
56
+ function createScanner(text, ignoreTrivia = false) {
57
+ const len = text.length;
58
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
59
+ function scanHexDigits(count, exact) {
60
+ let digits = 0;
61
+ let value2 = 0;
62
+ while (digits < count || !exact) {
63
+ let ch = text.charCodeAt(pos);
64
+ if (ch >= 48 && ch <= 57) {
65
+ value2 = value2 * 16 + ch - 48;
66
+ } else if (ch >= 65 && ch <= 70) {
67
+ value2 = value2 * 16 + ch - 65 + 10;
68
+ } else if (ch >= 97 && ch <= 102) {
69
+ value2 = value2 * 16 + ch - 97 + 10;
70
+ } else {
71
+ break;
72
+ }
73
+ pos++;
74
+ digits++;
75
+ }
76
+ if (digits < count) {
77
+ value2 = -1;
78
+ }
79
+ return value2;
80
+ }
81
+ __name(scanHexDigits, "scanHexDigits");
82
+ function setPosition(newPosition) {
83
+ pos = newPosition;
84
+ value = "";
85
+ tokenOffset = 0;
86
+ token = 16;
87
+ scanError = 0;
88
+ }
89
+ __name(setPosition, "setPosition");
90
+ function scanNumber() {
91
+ let start = pos;
92
+ if (text.charCodeAt(pos) === 48) {
93
+ pos++;
94
+ } else {
95
+ pos++;
96
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
97
+ pos++;
98
+ }
99
+ }
100
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
101
+ pos++;
102
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
103
+ pos++;
104
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
105
+ pos++;
106
+ }
107
+ } else {
108
+ scanError = 3;
109
+ return text.substring(start, pos);
110
+ }
111
+ }
112
+ let end = pos;
113
+ if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
114
+ pos++;
115
+ if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
116
+ pos++;
117
+ }
118
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
119
+ pos++;
120
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
121
+ pos++;
122
+ }
123
+ end = pos;
124
+ } else {
125
+ scanError = 3;
126
+ }
127
+ }
128
+ return text.substring(start, end);
129
+ }
130
+ __name(scanNumber, "scanNumber");
131
+ function scanString() {
132
+ let result = "", start = pos;
133
+ while (true) {
134
+ if (pos >= len) {
135
+ result += text.substring(start, pos);
136
+ scanError = 2;
137
+ break;
138
+ }
139
+ const ch = text.charCodeAt(pos);
140
+ if (ch === 34) {
141
+ result += text.substring(start, pos);
142
+ pos++;
143
+ break;
144
+ }
145
+ if (ch === 92) {
146
+ result += text.substring(start, pos);
147
+ pos++;
148
+ if (pos >= len) {
149
+ scanError = 2;
150
+ break;
151
+ }
152
+ const ch2 = text.charCodeAt(pos++);
153
+ switch (ch2) {
154
+ case 34:
155
+ result += '"';
156
+ break;
157
+ case 92:
158
+ result += "\\";
159
+ break;
160
+ case 47:
161
+ result += "/";
162
+ break;
163
+ case 98:
164
+ result += "\b";
165
+ break;
166
+ case 102:
167
+ result += "\f";
168
+ break;
169
+ case 110:
170
+ result += "\n";
171
+ break;
172
+ case 114:
173
+ result += "\r";
174
+ break;
175
+ case 116:
176
+ result += " ";
177
+ break;
178
+ case 117:
179
+ const ch3 = scanHexDigits(4, true);
180
+ if (ch3 >= 0) {
181
+ result += String.fromCharCode(ch3);
182
+ } else {
183
+ scanError = 4;
184
+ }
185
+ break;
186
+ default:
187
+ scanError = 5;
188
+ }
189
+ start = pos;
190
+ continue;
191
+ }
192
+ if (ch >= 0 && ch <= 31) {
193
+ if (isLineBreak(ch)) {
194
+ result += text.substring(start, pos);
195
+ scanError = 2;
196
+ break;
197
+ } else {
198
+ scanError = 6;
199
+ }
200
+ }
201
+ pos++;
202
+ }
203
+ return result;
204
+ }
205
+ __name(scanString, "scanString");
206
+ function scanNext() {
207
+ value = "";
208
+ scanError = 0;
209
+ tokenOffset = pos;
210
+ lineStartOffset = lineNumber;
211
+ prevTokenLineStartOffset = tokenLineStartOffset;
212
+ if (pos >= len) {
213
+ tokenOffset = len;
214
+ return token = 17;
215
+ }
216
+ let code = text.charCodeAt(pos);
217
+ if (isWhiteSpace(code)) {
218
+ do {
219
+ pos++;
220
+ value += String.fromCharCode(code);
221
+ code = text.charCodeAt(pos);
222
+ } while (isWhiteSpace(code));
223
+ return token = 15;
224
+ }
225
+ if (isLineBreak(code)) {
226
+ pos++;
227
+ value += String.fromCharCode(code);
228
+ if (code === 13 && text.charCodeAt(pos) === 10) {
229
+ pos++;
230
+ value += "\n";
231
+ }
232
+ lineNumber++;
233
+ tokenLineStartOffset = pos;
234
+ return token = 14;
235
+ }
236
+ switch (code) {
237
+ // tokens: []{}:,
238
+ case 123:
239
+ pos++;
240
+ return token = 1;
241
+ case 125:
242
+ pos++;
243
+ return token = 2;
244
+ case 91:
245
+ pos++;
246
+ return token = 3;
247
+ case 93:
248
+ pos++;
249
+ return token = 4;
250
+ case 58:
251
+ pos++;
252
+ return token = 6;
253
+ case 44:
254
+ pos++;
255
+ return token = 5;
256
+ // strings
257
+ case 34:
258
+ pos++;
259
+ value = scanString();
260
+ return token = 10;
261
+ // comments
262
+ case 47:
263
+ const start = pos - 1;
264
+ if (text.charCodeAt(pos + 1) === 47) {
265
+ pos += 2;
266
+ while (pos < len) {
267
+ if (isLineBreak(text.charCodeAt(pos))) {
268
+ break;
269
+ }
270
+ pos++;
271
+ }
272
+ value = text.substring(start, pos);
273
+ return token = 12;
274
+ }
275
+ if (text.charCodeAt(pos + 1) === 42) {
276
+ pos += 2;
277
+ const safeLength = len - 1;
278
+ let commentClosed = false;
279
+ while (pos < safeLength) {
280
+ const ch = text.charCodeAt(pos);
281
+ if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
282
+ pos += 2;
283
+ commentClosed = true;
284
+ break;
285
+ }
286
+ pos++;
287
+ if (isLineBreak(ch)) {
288
+ if (ch === 13 && text.charCodeAt(pos) === 10) {
289
+ pos++;
290
+ }
291
+ lineNumber++;
292
+ tokenLineStartOffset = pos;
293
+ }
294
+ }
295
+ if (!commentClosed) {
296
+ pos++;
297
+ scanError = 1;
298
+ }
299
+ value = text.substring(start, pos);
300
+ return token = 13;
301
+ }
302
+ value += String.fromCharCode(code);
303
+ pos++;
304
+ return token = 16;
305
+ // numbers
306
+ case 45:
307
+ value += String.fromCharCode(code);
308
+ pos++;
309
+ if (pos === len || !isDigit(text.charCodeAt(pos))) {
310
+ return token = 16;
311
+ }
312
+ // found a minus, followed by a number so
313
+ // we fall through to proceed with scanning
314
+ // numbers
315
+ case 48:
316
+ case 49:
317
+ case 50:
318
+ case 51:
319
+ case 52:
320
+ case 53:
321
+ case 54:
322
+ case 55:
323
+ case 56:
324
+ case 57:
325
+ value += scanNumber();
326
+ return token = 11;
327
+ // literals and unknown symbols
328
+ default:
329
+ while (pos < len && isUnknownContentCharacter(code)) {
330
+ pos++;
331
+ code = text.charCodeAt(pos);
332
+ }
333
+ if (tokenOffset !== pos) {
334
+ value = text.substring(tokenOffset, pos);
335
+ switch (value) {
336
+ case "true":
337
+ return token = 8;
338
+ case "false":
339
+ return token = 9;
340
+ case "null":
341
+ return token = 7;
342
+ }
343
+ return token = 16;
344
+ }
345
+ value += String.fromCharCode(code);
346
+ pos++;
347
+ return token = 16;
348
+ }
349
+ }
350
+ __name(scanNext, "scanNext");
351
+ function isUnknownContentCharacter(code) {
352
+ if (isWhiteSpace(code) || isLineBreak(code)) {
353
+ return false;
354
+ }
355
+ switch (code) {
356
+ case 125:
357
+ case 93:
358
+ case 123:
359
+ case 91:
360
+ case 34:
361
+ case 58:
362
+ case 44:
363
+ case 47:
364
+ return false;
365
+ }
366
+ return true;
367
+ }
368
+ __name(isUnknownContentCharacter, "isUnknownContentCharacter");
369
+ function scanNextNonTrivia() {
370
+ let result;
371
+ do {
372
+ result = scanNext();
373
+ } while (result >= 12 && result <= 15);
374
+ return result;
375
+ }
376
+ __name(scanNextNonTrivia, "scanNextNonTrivia");
377
+ return {
378
+ setPosition,
379
+ getPosition: /* @__PURE__ */ __name(() => pos, "getPosition"),
380
+ scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
381
+ getToken: /* @__PURE__ */ __name(() => token, "getToken"),
382
+ getTokenValue: /* @__PURE__ */ __name(() => value, "getTokenValue"),
383
+ getTokenOffset: /* @__PURE__ */ __name(() => tokenOffset, "getTokenOffset"),
384
+ getTokenLength: /* @__PURE__ */ __name(() => pos - tokenOffset, "getTokenLength"),
385
+ getTokenStartLine: /* @__PURE__ */ __name(() => lineStartOffset, "getTokenStartLine"),
386
+ getTokenStartCharacter: /* @__PURE__ */ __name(() => tokenOffset - prevTokenLineStartOffset, "getTokenStartCharacter"),
387
+ getTokenError: /* @__PURE__ */ __name(() => scanError, "getTokenError")
388
+ };
389
+ }
390
+ __name(createScanner, "createScanner");
391
+ function isWhiteSpace(ch) {
392
+ return ch === 32 || ch === 9;
393
+ }
394
+ __name(isWhiteSpace, "isWhiteSpace");
395
+ function isLineBreak(ch) {
396
+ return ch === 10 || ch === 13;
397
+ }
398
+ __name(isLineBreak, "isLineBreak");
399
+ function isDigit(ch) {
400
+ return ch >= 48 && ch <= 57;
401
+ }
402
+ __name(isDigit, "isDigit");
403
+ var CharacterCodes;
404
+ (function(CharacterCodes2) {
405
+ CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
406
+ CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
407
+ CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
408
+ CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
409
+ CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
410
+ CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
411
+ CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
412
+ CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
413
+ CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
414
+ CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
415
+ CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
416
+ CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
417
+ CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
418
+ CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
419
+ CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
420
+ CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
421
+ CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
422
+ CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
423
+ CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
424
+ CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
425
+ CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
426
+ CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
427
+ CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
428
+ CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
429
+ CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
430
+ CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
431
+ CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
432
+ CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
433
+ CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
434
+ CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
435
+ CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
436
+ CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
437
+ CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
438
+ CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
439
+ CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
440
+ CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
441
+ CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
442
+ CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
443
+ CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
444
+ CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
445
+ CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
446
+ CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
447
+ CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
448
+ CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
449
+ CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
450
+ CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
451
+ CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
452
+ CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
453
+ CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
454
+ CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
455
+ CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
456
+ CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
457
+ CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
458
+ CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
459
+ CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
460
+ CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
461
+ CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
462
+ CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
463
+ CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
464
+ CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
465
+ CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
466
+ CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
467
+ CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
468
+ CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
469
+ CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
470
+ CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
471
+ CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
472
+ CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
473
+ CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
474
+ CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
475
+ CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
476
+ CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
477
+ CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
478
+ CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
479
+ CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
480
+ CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
481
+ CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
482
+ CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
483
+ CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
484
+ CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
485
+ })(CharacterCodes || (CharacterCodes = {}));
486
+
487
+ // node_modules/jsonc-parser/lib/esm/impl/string-intern.js
488
+ init_esbuild_shims();
489
+ var cachedSpaces = new Array(20).fill(0).map((_, index) => {
490
+ return " ".repeat(index);
491
+ });
492
+ var maxCachedValues = 200;
493
+ var cachedBreakLinesWithSpaces = {
494
+ " ": {
495
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
496
+ return "\n" + " ".repeat(index);
497
+ }),
498
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
499
+ return "\r" + " ".repeat(index);
500
+ }),
501
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
502
+ return "\r\n" + " ".repeat(index);
503
+ })
504
+ },
505
+ " ": {
506
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
507
+ return "\n" + " ".repeat(index);
508
+ }),
509
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
510
+ return "\r" + " ".repeat(index);
511
+ }),
512
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
513
+ return "\r\n" + " ".repeat(index);
514
+ })
515
+ }
516
+ };
517
+ var supportedEols = ["\n", "\r", "\r\n"];
518
+
519
+ // node_modules/jsonc-parser/lib/esm/impl/format.js
520
+ function format(documentText, range, options) {
521
+ let initialIndentLevel;
522
+ let formatText;
523
+ let formatTextStart;
524
+ let rangeStart;
525
+ let rangeEnd;
526
+ if (range) {
527
+ rangeStart = range.offset;
528
+ rangeEnd = rangeStart + range.length;
529
+ formatTextStart = rangeStart;
530
+ while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
531
+ formatTextStart--;
532
+ }
533
+ let endOffset = rangeEnd;
534
+ while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
535
+ endOffset++;
536
+ }
537
+ formatText = documentText.substring(formatTextStart, endOffset);
538
+ initialIndentLevel = computeIndentLevel(formatText, options);
539
+ } else {
540
+ formatText = documentText;
541
+ initialIndentLevel = 0;
542
+ formatTextStart = 0;
543
+ rangeStart = 0;
544
+ rangeEnd = documentText.length;
545
+ }
546
+ const eol = getEOL(options, documentText);
547
+ const eolFastPathSupported = supportedEols.includes(eol);
548
+ let numberLineBreaks = 0;
549
+ let indentLevel = 0;
550
+ let indentValue;
551
+ if (options.insertSpaces) {
552
+ indentValue = cachedSpaces[options.tabSize || 4] ?? repeat(cachedSpaces[1], options.tabSize || 4);
553
+ } else {
554
+ indentValue = " ";
555
+ }
556
+ const indentType = indentValue === " " ? " " : " ";
557
+ let scanner = createScanner(formatText, false);
558
+ let hasError = false;
559
+ function newLinesAndIndent() {
560
+ if (numberLineBreaks > 1) {
561
+ return repeat(eol, numberLineBreaks) + repeat(indentValue, initialIndentLevel + indentLevel);
562
+ }
563
+ const amountOfSpaces = indentValue.length * (initialIndentLevel + indentLevel);
564
+ if (!eolFastPathSupported || amountOfSpaces > cachedBreakLinesWithSpaces[indentType][eol].length) {
565
+ return eol + repeat(indentValue, initialIndentLevel + indentLevel);
566
+ }
567
+ if (amountOfSpaces <= 0) {
568
+ return eol;
569
+ }
570
+ return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces];
571
+ }
572
+ __name(newLinesAndIndent, "newLinesAndIndent");
573
+ function scanNext() {
574
+ let token = scanner.scan();
575
+ numberLineBreaks = 0;
576
+ while (token === 15 || token === 14) {
577
+ if (token === 14 && options.keepLines) {
578
+ numberLineBreaks += 1;
579
+ } else if (token === 14) {
580
+ numberLineBreaks = 1;
581
+ }
582
+ token = scanner.scan();
583
+ }
584
+ hasError = token === 16 || scanner.getTokenError() !== 0;
585
+ return token;
586
+ }
587
+ __name(scanNext, "scanNext");
588
+ const editOperations = [];
589
+ function addEdit(text, startOffset, endOffset) {
590
+ if (!hasError && (!range || startOffset < rangeEnd && endOffset > rangeStart) && documentText.substring(startOffset, endOffset) !== text) {
591
+ editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
592
+ }
593
+ }
594
+ __name(addEdit, "addEdit");
595
+ let firstToken = scanNext();
596
+ if (options.keepLines && numberLineBreaks > 0) {
597
+ addEdit(repeat(eol, numberLineBreaks), 0, 0);
598
+ }
599
+ if (firstToken !== 17) {
600
+ let firstTokenStart = scanner.getTokenOffset() + formatTextStart;
601
+ let initialIndent = indentValue.length * initialIndentLevel < 20 && options.insertSpaces ? cachedSpaces[indentValue.length * initialIndentLevel] : repeat(indentValue, initialIndentLevel);
602
+ addEdit(initialIndent, formatTextStart, firstTokenStart);
603
+ }
604
+ while (firstToken !== 17) {
605
+ let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
606
+ let secondToken = scanNext();
607
+ let replaceContent = "";
608
+ let needsLineBreak = false;
609
+ while (numberLineBreaks === 0 && (secondToken === 12 || secondToken === 13)) {
610
+ let commentTokenStart = scanner.getTokenOffset() + formatTextStart;
611
+ addEdit(cachedSpaces[1], firstTokenEnd, commentTokenStart);
612
+ firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
613
+ needsLineBreak = secondToken === 12;
614
+ replaceContent = needsLineBreak ? newLinesAndIndent() : "";
615
+ secondToken = scanNext();
616
+ }
617
+ if (secondToken === 2) {
618
+ if (firstToken !== 1) {
619
+ indentLevel--;
620
+ }
621
+ ;
622
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 1) {
623
+ replaceContent = newLinesAndIndent();
624
+ } else if (options.keepLines) {
625
+ replaceContent = cachedSpaces[1];
626
+ }
627
+ } else if (secondToken === 4) {
628
+ if (firstToken !== 3) {
629
+ indentLevel--;
630
+ }
631
+ ;
632
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 3) {
633
+ replaceContent = newLinesAndIndent();
634
+ } else if (options.keepLines) {
635
+ replaceContent = cachedSpaces[1];
636
+ }
637
+ } else {
638
+ switch (firstToken) {
639
+ case 3:
640
+ case 1:
641
+ indentLevel++;
642
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
643
+ replaceContent = newLinesAndIndent();
644
+ } else {
645
+ replaceContent = cachedSpaces[1];
646
+ }
647
+ break;
648
+ case 5:
649
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
650
+ replaceContent = newLinesAndIndent();
651
+ } else {
652
+ replaceContent = cachedSpaces[1];
653
+ }
654
+ break;
655
+ case 12:
656
+ replaceContent = newLinesAndIndent();
657
+ break;
658
+ case 13:
659
+ if (numberLineBreaks > 0) {
660
+ replaceContent = newLinesAndIndent();
661
+ } else if (!needsLineBreak) {
662
+ replaceContent = cachedSpaces[1];
663
+ }
664
+ break;
665
+ case 6:
666
+ if (options.keepLines && numberLineBreaks > 0) {
667
+ replaceContent = newLinesAndIndent();
668
+ } else if (!needsLineBreak) {
669
+ replaceContent = cachedSpaces[1];
670
+ }
671
+ break;
672
+ case 10:
673
+ if (options.keepLines && numberLineBreaks > 0) {
674
+ replaceContent = newLinesAndIndent();
675
+ } else if (secondToken === 6 && !needsLineBreak) {
676
+ replaceContent = "";
677
+ }
678
+ break;
679
+ case 7:
680
+ case 8:
681
+ case 9:
682
+ case 11:
683
+ case 2:
684
+ case 4:
685
+ if (options.keepLines && numberLineBreaks > 0) {
686
+ replaceContent = newLinesAndIndent();
687
+ } else {
688
+ if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) {
689
+ replaceContent = cachedSpaces[1];
690
+ } else if (secondToken !== 5 && secondToken !== 17) {
691
+ hasError = true;
692
+ }
693
+ }
694
+ break;
695
+ case 16:
696
+ hasError = true;
697
+ break;
698
+ }
699
+ if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) {
700
+ replaceContent = newLinesAndIndent();
701
+ }
702
+ }
703
+ if (secondToken === 17) {
704
+ if (options.keepLines && numberLineBreaks > 0) {
705
+ replaceContent = newLinesAndIndent();
706
+ } else {
707
+ replaceContent = options.insertFinalNewline ? eol : "";
708
+ }
709
+ }
710
+ const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
711
+ addEdit(replaceContent, firstTokenEnd, secondTokenStart);
712
+ firstToken = secondToken;
713
+ }
714
+ return editOperations;
715
+ }
716
+ __name(format, "format");
717
+ function repeat(s, count) {
718
+ let result = "";
719
+ for (let i = 0; i < count; i++) {
720
+ result += s;
721
+ }
722
+ return result;
723
+ }
724
+ __name(repeat, "repeat");
725
+ function computeIndentLevel(content, options) {
726
+ let i = 0;
727
+ let nChars = 0;
728
+ const tabSize = options.tabSize || 4;
729
+ while (i < content.length) {
730
+ let ch = content.charAt(i);
731
+ if (ch === cachedSpaces[1]) {
732
+ nChars++;
733
+ } else if (ch === " ") {
734
+ nChars += tabSize;
735
+ } else {
736
+ break;
737
+ }
738
+ i++;
739
+ }
740
+ return Math.floor(nChars / tabSize);
741
+ }
742
+ __name(computeIndentLevel, "computeIndentLevel");
743
+ function getEOL(options, text) {
744
+ for (let i = 0; i < text.length; i++) {
745
+ const ch = text.charAt(i);
746
+ if (ch === "\r") {
747
+ if (i + 1 < text.length && text.charAt(i + 1) === "\n") {
748
+ return "\r\n";
749
+ }
750
+ return "\r";
751
+ } else if (ch === "\n") {
752
+ return "\n";
753
+ }
754
+ }
755
+ return options && options.eol || "\n";
756
+ }
757
+ __name(getEOL, "getEOL");
758
+ function isEOL(text, offset) {
759
+ return "\r\n".indexOf(text.charAt(offset)) !== -1;
760
+ }
761
+ __name(isEOL, "isEOL");
762
+
763
+ // node_modules/jsonc-parser/lib/esm/impl/edit.js
764
+ init_esbuild_shims();
765
+
766
+ // node_modules/jsonc-parser/lib/esm/impl/parser.js
767
+ init_esbuild_shims();
768
+ var ParseOptions;
769
+ (function(ParseOptions2) {
770
+ ParseOptions2.DEFAULT = {
771
+ allowTrailingComma: false
772
+ };
773
+ })(ParseOptions || (ParseOptions = {}));
774
+ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
775
+ let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
776
+ function ensurePropertyComplete(endOffset) {
777
+ if (currentParent.type === "property") {
778
+ currentParent.length = endOffset - currentParent.offset;
779
+ currentParent = currentParent.parent;
780
+ }
781
+ }
782
+ __name(ensurePropertyComplete, "ensurePropertyComplete");
783
+ function onValue(valueNode) {
784
+ currentParent.children.push(valueNode);
785
+ return valueNode;
786
+ }
787
+ __name(onValue, "onValue");
788
+ const visitor = {
789
+ onObjectBegin: /* @__PURE__ */ __name((offset) => {
790
+ currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
791
+ }, "onObjectBegin"),
792
+ onObjectProperty: /* @__PURE__ */ __name((name, offset, length) => {
793
+ currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
794
+ currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
795
+ }, "onObjectProperty"),
796
+ onObjectEnd: /* @__PURE__ */ __name((offset, length) => {
797
+ ensurePropertyComplete(offset + length);
798
+ currentParent.length = offset + length - currentParent.offset;
799
+ currentParent = currentParent.parent;
800
+ ensurePropertyComplete(offset + length);
801
+ }, "onObjectEnd"),
802
+ onArrayBegin: /* @__PURE__ */ __name((offset, length) => {
803
+ currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
804
+ }, "onArrayBegin"),
805
+ onArrayEnd: /* @__PURE__ */ __name((offset, length) => {
806
+ currentParent.length = offset + length - currentParent.offset;
807
+ currentParent = currentParent.parent;
808
+ ensurePropertyComplete(offset + length);
809
+ }, "onArrayEnd"),
810
+ onLiteralValue: /* @__PURE__ */ __name((value, offset, length) => {
811
+ onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
812
+ ensurePropertyComplete(offset + length);
813
+ }, "onLiteralValue"),
814
+ onSeparator: /* @__PURE__ */ __name((sep, offset, length) => {
815
+ if (currentParent.type === "property") {
816
+ if (sep === ":") {
817
+ currentParent.colonOffset = offset;
818
+ } else if (sep === ",") {
819
+ ensurePropertyComplete(offset);
820
+ }
821
+ }
822
+ }, "onSeparator"),
823
+ onError: /* @__PURE__ */ __name((error, offset, length) => {
824
+ errors.push({ error, offset, length });
825
+ }, "onError")
826
+ };
827
+ visit(text, visitor, options);
828
+ const result = currentParent.children[0];
829
+ if (result) {
830
+ delete result.parent;
831
+ }
832
+ return result;
833
+ }
834
+ __name(parseTree, "parseTree");
835
+ function findNodeAtLocation(root, path2) {
836
+ if (!root) {
837
+ return void 0;
838
+ }
839
+ let node = root;
840
+ for (let segment of path2) {
841
+ if (typeof segment === "string") {
842
+ if (node.type !== "object" || !Array.isArray(node.children)) {
843
+ return void 0;
844
+ }
845
+ let found = false;
846
+ for (const propertyNode of node.children) {
847
+ if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
848
+ node = propertyNode.children[1];
849
+ found = true;
850
+ break;
851
+ }
852
+ }
853
+ if (!found) {
854
+ return void 0;
855
+ }
856
+ } else {
857
+ const index = segment;
858
+ if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
859
+ return void 0;
860
+ }
861
+ node = node.children[index];
862
+ }
863
+ }
864
+ return node;
865
+ }
866
+ __name(findNodeAtLocation, "findNodeAtLocation");
867
+ function getNodeValue(node) {
868
+ switch (node.type) {
869
+ case "array":
870
+ return node.children.map(getNodeValue);
871
+ case "object":
872
+ const obj = /* @__PURE__ */ Object.create(null);
873
+ for (let prop of node.children) {
874
+ const valueNode = prop.children[1];
875
+ if (valueNode) {
876
+ obj[prop.children[0].value] = getNodeValue(valueNode);
877
+ }
878
+ }
879
+ return obj;
880
+ case "null":
881
+ case "string":
882
+ case "number":
883
+ case "boolean":
884
+ return node.value;
885
+ default:
886
+ return void 0;
887
+ }
888
+ }
889
+ __name(getNodeValue, "getNodeValue");
890
+ function visit(text, visitor, options = ParseOptions.DEFAULT) {
891
+ const _scanner = createScanner(text, false);
892
+ const _jsonPath = [];
893
+ let suppressedCallbacks = 0;
894
+ function toNoArgVisit(visitFunction) {
895
+ return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
896
+ }
897
+ __name(toNoArgVisit, "toNoArgVisit");
898
+ function toOneArgVisit(visitFunction) {
899
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
900
+ }
901
+ __name(toOneArgVisit, "toOneArgVisit");
902
+ function toOneArgVisitWithPath(visitFunction) {
903
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
904
+ }
905
+ __name(toOneArgVisitWithPath, "toOneArgVisitWithPath");
906
+ function toBeginVisit(visitFunction) {
907
+ return visitFunction ? () => {
908
+ if (suppressedCallbacks > 0) {
909
+ suppressedCallbacks++;
910
+ } else {
911
+ let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
912
+ if (cbReturn === false) {
913
+ suppressedCallbacks = 1;
914
+ }
915
+ }
916
+ } : () => true;
917
+ }
918
+ __name(toBeginVisit, "toBeginVisit");
919
+ function toEndVisit(visitFunction) {
920
+ return visitFunction ? () => {
921
+ if (suppressedCallbacks > 0) {
922
+ suppressedCallbacks--;
923
+ }
924
+ if (suppressedCallbacks === 0) {
925
+ visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
926
+ }
927
+ } : () => true;
928
+ }
929
+ __name(toEndVisit, "toEndVisit");
930
+ const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
931
+ const disallowComments = options && options.disallowComments;
932
+ const allowTrailingComma = options && options.allowTrailingComma;
933
+ function scanNext() {
934
+ while (true) {
935
+ const token = _scanner.scan();
936
+ switch (_scanner.getTokenError()) {
937
+ case 4:
938
+ handleError(
939
+ 14
940
+ /* ParseErrorCode.InvalidUnicode */
941
+ );
942
+ break;
943
+ case 5:
944
+ handleError(
945
+ 15
946
+ /* ParseErrorCode.InvalidEscapeCharacter */
947
+ );
948
+ break;
949
+ case 3:
950
+ handleError(
951
+ 13
952
+ /* ParseErrorCode.UnexpectedEndOfNumber */
953
+ );
954
+ break;
955
+ case 1:
956
+ if (!disallowComments) {
957
+ handleError(
958
+ 11
959
+ /* ParseErrorCode.UnexpectedEndOfComment */
960
+ );
961
+ }
962
+ break;
963
+ case 2:
964
+ handleError(
965
+ 12
966
+ /* ParseErrorCode.UnexpectedEndOfString */
967
+ );
968
+ break;
969
+ case 6:
970
+ handleError(
971
+ 16
972
+ /* ParseErrorCode.InvalidCharacter */
973
+ );
974
+ break;
975
+ }
976
+ switch (token) {
977
+ case 12:
978
+ case 13:
979
+ if (disallowComments) {
980
+ handleError(
981
+ 10
982
+ /* ParseErrorCode.InvalidCommentToken */
983
+ );
984
+ } else {
985
+ onComment();
986
+ }
987
+ break;
988
+ case 16:
989
+ handleError(
990
+ 1
991
+ /* ParseErrorCode.InvalidSymbol */
992
+ );
993
+ break;
994
+ case 15:
995
+ case 14:
996
+ break;
997
+ default:
998
+ return token;
999
+ }
1000
+ }
1001
+ }
1002
+ __name(scanNext, "scanNext");
1003
+ function handleError(error, skipUntilAfter = [], skipUntil = []) {
1004
+ onError(error);
1005
+ if (skipUntilAfter.length + skipUntil.length > 0) {
1006
+ let token = _scanner.getToken();
1007
+ while (token !== 17) {
1008
+ if (skipUntilAfter.indexOf(token) !== -1) {
1009
+ scanNext();
1010
+ break;
1011
+ } else if (skipUntil.indexOf(token) !== -1) {
1012
+ break;
1013
+ }
1014
+ token = scanNext();
1015
+ }
1016
+ }
1017
+ }
1018
+ __name(handleError, "handleError");
1019
+ function parseString(isValue) {
1020
+ const value = _scanner.getTokenValue();
1021
+ if (isValue) {
1022
+ onLiteralValue(value);
1023
+ } else {
1024
+ onObjectProperty(value);
1025
+ _jsonPath.push(value);
1026
+ }
1027
+ scanNext();
1028
+ return true;
1029
+ }
1030
+ __name(parseString, "parseString");
1031
+ function parseLiteral() {
1032
+ switch (_scanner.getToken()) {
1033
+ case 11:
1034
+ const tokenValue = _scanner.getTokenValue();
1035
+ let value = Number(tokenValue);
1036
+ if (isNaN(value)) {
1037
+ handleError(
1038
+ 2
1039
+ /* ParseErrorCode.InvalidNumberFormat */
1040
+ );
1041
+ value = 0;
1042
+ }
1043
+ onLiteralValue(value);
1044
+ break;
1045
+ case 7:
1046
+ onLiteralValue(null);
1047
+ break;
1048
+ case 8:
1049
+ onLiteralValue(true);
1050
+ break;
1051
+ case 9:
1052
+ onLiteralValue(false);
1053
+ break;
1054
+ default:
1055
+ return false;
1056
+ }
1057
+ scanNext();
1058
+ return true;
1059
+ }
1060
+ __name(parseLiteral, "parseLiteral");
1061
+ function parseProperty() {
1062
+ if (_scanner.getToken() !== 10) {
1063
+ handleError(3, [], [
1064
+ 2,
1065
+ 5
1066
+ /* SyntaxKind.CommaToken */
1067
+ ]);
1068
+ return false;
1069
+ }
1070
+ parseString(false);
1071
+ if (_scanner.getToken() === 6) {
1072
+ onSeparator(":");
1073
+ scanNext();
1074
+ if (!parseValue()) {
1075
+ handleError(4, [], [
1076
+ 2,
1077
+ 5
1078
+ /* SyntaxKind.CommaToken */
1079
+ ]);
1080
+ }
1081
+ } else {
1082
+ handleError(5, [], [
1083
+ 2,
1084
+ 5
1085
+ /* SyntaxKind.CommaToken */
1086
+ ]);
1087
+ }
1088
+ _jsonPath.pop();
1089
+ return true;
1090
+ }
1091
+ __name(parseProperty, "parseProperty");
1092
+ function parseObject() {
1093
+ onObjectBegin();
1094
+ scanNext();
1095
+ let needsComma = false;
1096
+ while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
1097
+ if (_scanner.getToken() === 5) {
1098
+ if (!needsComma) {
1099
+ handleError(4, [], []);
1100
+ }
1101
+ onSeparator(",");
1102
+ scanNext();
1103
+ if (_scanner.getToken() === 2 && allowTrailingComma) {
1104
+ break;
1105
+ }
1106
+ } else if (needsComma) {
1107
+ handleError(6, [], []);
1108
+ }
1109
+ if (!parseProperty()) {
1110
+ handleError(4, [], [
1111
+ 2,
1112
+ 5
1113
+ /* SyntaxKind.CommaToken */
1114
+ ]);
1115
+ }
1116
+ needsComma = true;
1117
+ }
1118
+ onObjectEnd();
1119
+ if (_scanner.getToken() !== 2) {
1120
+ handleError(7, [
1121
+ 2
1122
+ /* SyntaxKind.CloseBraceToken */
1123
+ ], []);
1124
+ } else {
1125
+ scanNext();
1126
+ }
1127
+ return true;
1128
+ }
1129
+ __name(parseObject, "parseObject");
1130
+ function parseArray() {
1131
+ onArrayBegin();
1132
+ scanNext();
1133
+ let isFirstElement = true;
1134
+ let needsComma = false;
1135
+ while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
1136
+ if (_scanner.getToken() === 5) {
1137
+ if (!needsComma) {
1138
+ handleError(4, [], []);
1139
+ }
1140
+ onSeparator(",");
1141
+ scanNext();
1142
+ if (_scanner.getToken() === 4 && allowTrailingComma) {
1143
+ break;
1144
+ }
1145
+ } else if (needsComma) {
1146
+ handleError(6, [], []);
1147
+ }
1148
+ if (isFirstElement) {
1149
+ _jsonPath.push(0);
1150
+ isFirstElement = false;
1151
+ } else {
1152
+ _jsonPath[_jsonPath.length - 1]++;
1153
+ }
1154
+ if (!parseValue()) {
1155
+ handleError(4, [], [
1156
+ 4,
1157
+ 5
1158
+ /* SyntaxKind.CommaToken */
1159
+ ]);
1160
+ }
1161
+ needsComma = true;
1162
+ }
1163
+ onArrayEnd();
1164
+ if (!isFirstElement) {
1165
+ _jsonPath.pop();
1166
+ }
1167
+ if (_scanner.getToken() !== 4) {
1168
+ handleError(8, [
1169
+ 4
1170
+ /* SyntaxKind.CloseBracketToken */
1171
+ ], []);
1172
+ } else {
1173
+ scanNext();
1174
+ }
1175
+ return true;
1176
+ }
1177
+ __name(parseArray, "parseArray");
1178
+ function parseValue() {
1179
+ switch (_scanner.getToken()) {
1180
+ case 3:
1181
+ return parseArray();
1182
+ case 1:
1183
+ return parseObject();
1184
+ case 10:
1185
+ return parseString(true);
1186
+ default:
1187
+ return parseLiteral();
1188
+ }
1189
+ }
1190
+ __name(parseValue, "parseValue");
1191
+ scanNext();
1192
+ if (_scanner.getToken() === 17) {
1193
+ if (options.allowEmptyContent) {
1194
+ return true;
1195
+ }
1196
+ handleError(4, [], []);
1197
+ return false;
1198
+ }
1199
+ if (!parseValue()) {
1200
+ handleError(4, [], []);
1201
+ return false;
1202
+ }
1203
+ if (_scanner.getToken() !== 17) {
1204
+ handleError(9, [], []);
1205
+ }
1206
+ return true;
1207
+ }
1208
+ __name(visit, "visit");
1209
+ function getNodeType(value) {
1210
+ switch (typeof value) {
1211
+ case "boolean":
1212
+ return "boolean";
1213
+ case "number":
1214
+ return "number";
1215
+ case "string":
1216
+ return "string";
1217
+ case "object": {
1218
+ if (!value) {
1219
+ return "null";
1220
+ } else if (Array.isArray(value)) {
1221
+ return "array";
1222
+ }
1223
+ return "object";
1224
+ }
1225
+ default:
1226
+ return "null";
1227
+ }
1228
+ }
1229
+ __name(getNodeType, "getNodeType");
1230
+
1231
+ // node_modules/jsonc-parser/lib/esm/impl/edit.js
1232
+ function setProperty(text, originalPath, value, options) {
1233
+ const path2 = originalPath.slice();
1234
+ const errors = [];
1235
+ const root = parseTree(text, errors);
1236
+ let parent = void 0;
1237
+ let lastSegment = void 0;
1238
+ while (path2.length > 0) {
1239
+ lastSegment = path2.pop();
1240
+ parent = findNodeAtLocation(root, path2);
1241
+ if (parent === void 0 && value !== void 0) {
1242
+ if (typeof lastSegment === "string") {
1243
+ value = { [lastSegment]: value };
1244
+ } else {
1245
+ value = [value];
1246
+ }
1247
+ } else {
1248
+ break;
1249
+ }
1250
+ }
1251
+ if (!parent) {
1252
+ if (value === void 0) {
1253
+ throw new Error("Can not delete in empty document");
1254
+ }
1255
+ return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
1256
+ } else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
1257
+ const existing = findNodeAtLocation(parent, [lastSegment]);
1258
+ if (existing !== void 0) {
1259
+ if (value === void 0) {
1260
+ if (!existing.parent) {
1261
+ throw new Error("Malformed AST");
1262
+ }
1263
+ const propertyIndex = parent.children.indexOf(existing.parent);
1264
+ let removeBegin;
1265
+ let removeEnd = existing.parent.offset + existing.parent.length;
1266
+ if (propertyIndex > 0) {
1267
+ let previous = parent.children[propertyIndex - 1];
1268
+ removeBegin = previous.offset + previous.length;
1269
+ } else {
1270
+ removeBegin = parent.offset + 1;
1271
+ if (parent.children.length > 1) {
1272
+ let next = parent.children[1];
1273
+ removeEnd = next.offset;
1274
+ }
1275
+ }
1276
+ return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: "" }, options);
1277
+ } else {
1278
+ return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
1279
+ }
1280
+ } else {
1281
+ if (value === void 0) {
1282
+ return [];
1283
+ }
1284
+ const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
1285
+ const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
1286
+ let edit;
1287
+ if (index > 0) {
1288
+ let previous = parent.children[index - 1];
1289
+ edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
1290
+ } else if (parent.children.length === 0) {
1291
+ edit = { offset: parent.offset + 1, length: 0, content: newProperty };
1292
+ } else {
1293
+ edit = { offset: parent.offset + 1, length: 0, content: newProperty + "," };
1294
+ }
1295
+ return withFormatting(text, edit, options);
1296
+ }
1297
+ } else if (parent.type === "array" && typeof lastSegment === "number" && Array.isArray(parent.children)) {
1298
+ const insertIndex = lastSegment;
1299
+ if (insertIndex === -1) {
1300
+ const newProperty = `${JSON.stringify(value)}`;
1301
+ let edit;
1302
+ if (parent.children.length === 0) {
1303
+ edit = { offset: parent.offset + 1, length: 0, content: newProperty };
1304
+ } else {
1305
+ const previous = parent.children[parent.children.length - 1];
1306
+ edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
1307
+ }
1308
+ return withFormatting(text, edit, options);
1309
+ } else if (value === void 0 && parent.children.length >= 0) {
1310
+ const removalIndex = lastSegment;
1311
+ const toRemove = parent.children[removalIndex];
1312
+ let edit;
1313
+ if (parent.children.length === 1) {
1314
+ edit = { offset: parent.offset + 1, length: parent.length - 2, content: "" };
1315
+ } else if (parent.children.length - 1 === removalIndex) {
1316
+ let previous = parent.children[removalIndex - 1];
1317
+ let offset = previous.offset + previous.length;
1318
+ let parentEndOffset = parent.offset + parent.length;
1319
+ edit = { offset, length: parentEndOffset - 2 - offset, content: "" };
1320
+ } else {
1321
+ edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: "" };
1322
+ }
1323
+ return withFormatting(text, edit, options);
1324
+ } else if (value !== void 0) {
1325
+ let edit;
1326
+ const newProperty = `${JSON.stringify(value)}`;
1327
+ if (!options.isArrayInsertion && parent.children.length > lastSegment) {
1328
+ const toModify = parent.children[lastSegment];
1329
+ edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
1330
+ } else if (parent.children.length === 0 || lastSegment === 0) {
1331
+ edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + "," };
1332
+ } else {
1333
+ const index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
1334
+ const previous = parent.children[index - 1];
1335
+ edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
1336
+ }
1337
+ return withFormatting(text, edit, options);
1338
+ } else {
1339
+ throw new Error(`Can not ${value === void 0 ? "remove" : options.isArrayInsertion ? "insert" : "modify"} Array index ${insertIndex} as length is not sufficient`);
1340
+ }
1341
+ } else {
1342
+ throw new Error(`Can not add ${typeof lastSegment !== "number" ? "index" : "property"} to parent of type ${parent.type}`);
1343
+ }
1344
+ }
1345
+ __name(setProperty, "setProperty");
1346
+ function withFormatting(text, edit, options) {
1347
+ if (!options.formattingOptions) {
1348
+ return [edit];
1349
+ }
1350
+ let newText = applyEdit(text, edit);
1351
+ let begin = edit.offset;
1352
+ let end = edit.offset + edit.content.length;
1353
+ if (edit.length === 0 || edit.content.length === 0) {
1354
+ while (begin > 0 && !isEOL(newText, begin - 1)) {
1355
+ begin--;
1356
+ }
1357
+ while (end < newText.length && !isEOL(newText, end)) {
1358
+ end++;
1359
+ }
1360
+ }
1361
+ const edits = format(newText, { offset: begin, length: end - begin }, { ...options.formattingOptions, keepLines: false });
1362
+ for (let i = edits.length - 1; i >= 0; i--) {
1363
+ const edit2 = edits[i];
1364
+ newText = applyEdit(newText, edit2);
1365
+ begin = Math.min(begin, edit2.offset);
1366
+ end = Math.max(end, edit2.offset + edit2.length);
1367
+ end += edit2.content.length - edit2.length;
1368
+ }
1369
+ const editLength = text.length - (newText.length - end) - begin;
1370
+ return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
1371
+ }
1372
+ __name(withFormatting, "withFormatting");
1373
+ function applyEdit(text, edit) {
1374
+ return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
1375
+ }
1376
+ __name(applyEdit, "applyEdit");
1377
+
1378
+ // node_modules/jsonc-parser/lib/esm/main.js
1379
+ var ScanError;
1380
+ (function(ScanError2) {
1381
+ ScanError2[ScanError2["None"] = 0] = "None";
1382
+ ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
1383
+ ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
1384
+ ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
1385
+ ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
1386
+ ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
1387
+ ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
1388
+ })(ScanError || (ScanError = {}));
1389
+ var SyntaxKind;
1390
+ (function(SyntaxKind2) {
1391
+ SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
1392
+ SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
1393
+ SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
1394
+ SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
1395
+ SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
1396
+ SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
1397
+ SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
1398
+ SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
1399
+ SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
1400
+ SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
1401
+ SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
1402
+ SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
1403
+ SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
1404
+ SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
1405
+ SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
1406
+ SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
1407
+ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
1408
+ })(SyntaxKind || (SyntaxKind = {}));
1409
+ var parseTree2 = parseTree;
1410
+ var findNodeAtLocation2 = findNodeAtLocation;
1411
+ var getNodeValue2 = getNodeValue;
1412
+ var ParseErrorCode;
1413
+ (function(ParseErrorCode2) {
1414
+ ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
1415
+ ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
1416
+ ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
1417
+ ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
1418
+ ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
1419
+ ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
1420
+ ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
1421
+ ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
1422
+ ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
1423
+ ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
1424
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
1425
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
1426
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
1427
+ ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
1428
+ ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
1429
+ ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
1430
+ })(ParseErrorCode || (ParseErrorCode = {}));
1431
+ function printParseErrorCode(code) {
1432
+ switch (code) {
1433
+ case 1:
1434
+ return "InvalidSymbol";
1435
+ case 2:
1436
+ return "InvalidNumberFormat";
1437
+ case 3:
1438
+ return "PropertyNameExpected";
1439
+ case 4:
1440
+ return "ValueExpected";
1441
+ case 5:
1442
+ return "ColonExpected";
1443
+ case 6:
1444
+ return "CommaExpected";
1445
+ case 7:
1446
+ return "CloseBraceExpected";
1447
+ case 8:
1448
+ return "CloseBracketExpected";
1449
+ case 9:
1450
+ return "EndOfFileExpected";
1451
+ case 10:
1452
+ return "InvalidCommentToken";
1453
+ case 11:
1454
+ return "UnexpectedEndOfComment";
1455
+ case 12:
1456
+ return "UnexpectedEndOfString";
1457
+ case 13:
1458
+ return "UnexpectedEndOfNumber";
1459
+ case 14:
1460
+ return "InvalidUnicode";
1461
+ case 15:
1462
+ return "InvalidEscapeCharacter";
1463
+ case 16:
1464
+ return "InvalidCharacter";
1465
+ }
1466
+ return "<unknown ParseErrorCode>";
1467
+ }
1468
+ __name(printParseErrorCode, "printParseErrorCode");
1469
+ function modify(text, path2, value, options) {
1470
+ return setProperty(text, path2, value, options);
1471
+ }
1472
+ __name(modify, "modify");
1473
+ function applyEdits(text, edits) {
1474
+ let sortedEdits = edits.slice(0).sort((a, b) => {
1475
+ const diff = a.offset - b.offset;
1476
+ if (diff === 0) {
1477
+ return a.length - b.length;
1478
+ }
1479
+ return diff;
1480
+ });
1481
+ let lastModifiedOffset = text.length;
1482
+ for (let i = sortedEdits.length - 1; i >= 0; i--) {
1483
+ let e = sortedEdits[i];
1484
+ if (e.offset + e.length <= lastModifiedOffset) {
1485
+ text = applyEdit(text, e);
1486
+ } else {
1487
+ throw new Error("Overlapping edit");
1488
+ }
1489
+ lastModifiedOffset = e.offset;
1490
+ }
1491
+ return text;
1492
+ }
1493
+ __name(applyEdits, "applyEdits");
1494
+
1495
+ // packages/cli/src/utils/writeWithBackup.ts
1496
+ init_esbuild_shims();
1497
+ import * as fs from "node:fs";
1498
+ function writeWithBackupSync(targetPath, content, options = {}) {
1499
+ const { backupSuffix = ".orig", encoding = "utf-8" } = options;
1500
+ const tempPath = `${targetPath}.tmp`;
1501
+ const backupPath = `${targetPath}${backupSuffix}`;
1502
+ let backupCreated = false;
1503
+ try {
1504
+ if (fs.existsSync(tempPath)) {
1505
+ fs.unlinkSync(tempPath);
1506
+ }
1507
+ } catch (_e) {
1508
+ }
1509
+ try {
1510
+ fs.writeFileSync(tempPath, content, { encoding, flush: true });
1511
+ if (fs.existsSync(targetPath)) {
1512
+ const targetStat = fs.statSync(targetPath);
1513
+ if (targetStat.isDirectory()) {
1514
+ try {
1515
+ fs.unlinkSync(tempPath);
1516
+ } catch (_e) {
1517
+ }
1518
+ throw new Error(
1519
+ `Cannot write to '${targetPath}' because it is a directory`
1520
+ );
1521
+ }
1522
+ try {
1523
+ fs.renameSync(targetPath, backupPath);
1524
+ backupCreated = true;
1525
+ } catch (backupError) {
1526
+ try {
1527
+ fs.unlinkSync(tempPath);
1528
+ } catch (_e) {
1529
+ }
1530
+ throw new Error(
1531
+ `Failed to backup existing file: ${backupError instanceof Error ? backupError.message : String(backupError)}`
1532
+ );
1533
+ }
1534
+ }
1535
+ try {
1536
+ fs.renameSync(tempPath, targetPath);
1537
+ if (backupCreated) {
1538
+ try {
1539
+ fs.unlinkSync(backupPath);
1540
+ } catch (_e) {
1541
+ }
1542
+ }
1543
+ } catch (renameError) {
1544
+ let restoreFailedMessage;
1545
+ let backupExisted = false;
1546
+ if (fs.existsSync(backupPath)) {
1547
+ backupExisted = true;
1548
+ try {
1549
+ fs.renameSync(backupPath, targetPath);
1550
+ } catch (restoreError) {
1551
+ restoreFailedMessage = restoreError instanceof Error ? restoreError.message : String(restoreError);
1552
+ }
1553
+ }
1554
+ const writeFailureMessage = renameError instanceof Error ? renameError.message : String(renameError);
1555
+ if (restoreFailedMessage) {
1556
+ throw new Error(
1557
+ `Failed to write file: ${writeFailureMessage}. Automatic restore failed: ${restoreFailedMessage}. Manual recovery may be required using backup file '${backupPath}'.`
1558
+ );
1559
+ }
1560
+ if (backupExisted) {
1561
+ throw new Error(
1562
+ `Failed to write file: ${writeFailureMessage}. Target was automatically restored from backup '${backupPath}'.`
1563
+ );
1564
+ }
1565
+ throw new Error(
1566
+ `Failed to write file: ${writeFailureMessage}. No backup file was available for restoration.`
1567
+ );
1568
+ }
1569
+ } catch (error) {
1570
+ try {
1571
+ if (fs.existsSync(tempPath)) {
1572
+ fs.unlinkSync(tempPath);
1573
+ }
1574
+ } catch (_e) {
1575
+ }
1576
+ throw error;
1577
+ }
1578
+ }
1579
+ __name(writeWithBackupSync, "writeWithBackupSync");
1580
+
1581
+ // packages/cli/src/utils/jsonc-editor.ts
1582
+ var PARSE_OPTIONS = { allowTrailingComma: true };
1583
+ function updateSettingsFilePreservingFormat(filePath, updates, sync = false, replacePath = []) {
1584
+ if (!fs2.existsSync(filePath)) {
1585
+ const content = JSON.stringify(updates, null, 2);
1586
+ writeWithBackupSync(filePath, content);
1587
+ return true;
1588
+ }
1589
+ const originalContent = fs2.readFileSync(filePath, "utf-8");
1590
+ try {
1591
+ parseJsoncObject(originalContent);
1592
+ } catch (_error) {
1593
+ writeStderrLine("Error parsing settings file.");
1594
+ writeStderrLine(
1595
+ `Settings file may be corrupted: ${_error instanceof Error ? _error.message : String(_error)}`
1596
+ );
1597
+ return false;
1598
+ }
1599
+ let updatedContent;
1600
+ try {
1601
+ updatedContent = updateJsoncContent(
1602
+ originalContent,
1603
+ updates,
1604
+ sync,
1605
+ replacePath
1606
+ );
1607
+ } catch (validationError) {
1608
+ writeStderrLine(
1609
+ "Error: Refusing to write settings file \u2014 the result would not be valid JSON."
1610
+ );
1611
+ writeStderrLine(
1612
+ validationError instanceof Error ? validationError.message : String(validationError)
1613
+ );
1614
+ return false;
1615
+ }
1616
+ writeWithBackupSync(filePath, updatedContent);
1617
+ return true;
1618
+ }
1619
+ __name(updateSettingsFilePreservingFormat, "updateSettingsFilePreservingFormat");
1620
+ function parseJsoncObject(content) {
1621
+ const errors = [];
1622
+ const root = parseTree2(stripBom(content), errors, PARSE_OPTIONS);
1623
+ if (errors.length > 0) {
1624
+ const error = errors[0];
1625
+ throw new Error(
1626
+ `${printParseErrorCode(error.error)} at offset ${error.offset}`
1627
+ );
1628
+ }
1629
+ if (root?.type !== "object") {
1630
+ throw new Error("JSONC document root is not a JSON object.");
1631
+ }
1632
+ return JSON.parse(JSON.stringify(getNodeValue2(root)));
1633
+ }
1634
+ __name(parseJsoncObject, "parseJsoncObject");
1635
+ function updateJsoncContent(content, updates, sync = false, replacePath = []) {
1636
+ const bom = content.startsWith("\uFEFF") ? "\uFEFF" : "";
1637
+ const editableContent = stripBom(content);
1638
+ const parsed = parseJsoncObject(editableContent);
1639
+ const targetWithUndefined = applyUpdates(
1640
+ structuredClone(parsed),
1641
+ updates,
1642
+ sync,
1643
+ replacePath
1644
+ );
1645
+ const target = JSON.parse(JSON.stringify(targetWithUndefined));
1646
+ const options = {
1647
+ formattingOptions: detectFormattingOptions(editableContent)
1648
+ };
1649
+ let updated = normalizeDuplicateProperties(editableContent, options);
1650
+ const current = parseJsoncObject(updated);
1651
+ for (const operation of collectOperations(current, target)) {
1652
+ if (operation.value === void 0) {
1653
+ updated = removeTrailingInlineComment(updated, operation.path);
1654
+ }
1655
+ updated = applyEdits(
1656
+ updated,
1657
+ modify(updated, operation.path, operation.value, options)
1658
+ );
1659
+ }
1660
+ const reparsed = parseJsoncObject(updated);
1661
+ if (!isDeepStrictEqual(reparsed, target)) {
1662
+ throw new Error("Edited JSONC does not match the intended settings.");
1663
+ }
1664
+ return bom + updated;
1665
+ }
1666
+ __name(updateJsoncContent, "updateJsoncContent");
1667
+ function applyUpdates(current, updates, sync = false, replacePath = [], currentPath = []) {
1668
+ const result = current;
1669
+ if (sync) {
1670
+ const keysToRemove = Object.keys(result).filter(
1671
+ (key) => !Object.hasOwn(updates, key)
1672
+ );
1673
+ for (const key of keysToRemove) {
1674
+ delete result[key];
1675
+ }
1676
+ }
1677
+ for (const key of Object.getOwnPropertyNames(updates)) {
1678
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
1679
+ continue;
1680
+ }
1681
+ const value = updates[key];
1682
+ const nextPath = [...currentPath, key];
1683
+ const valueIsObject = typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
1684
+ if (pathsEqual(nextPath, replacePath)) {
1685
+ result[key] = valueIsObject ? applyUpdates({}, value) : value;
1686
+ continue;
1687
+ }
1688
+ if (valueIsObject && (typeof result[key] !== "object" || result[key] === null || Array.isArray(result[key]))) {
1689
+ result[key] = applyUpdates(
1690
+ {},
1691
+ value,
1692
+ sync,
1693
+ replacePath,
1694
+ nextPath
1695
+ );
1696
+ } else if (valueIsObject && typeof result[key] === "object" && result[key] !== null && !Array.isArray(result[key])) {
1697
+ result[key] = applyUpdates(
1698
+ result[key],
1699
+ value,
1700
+ sync,
1701
+ replacePath,
1702
+ nextPath
1703
+ );
1704
+ } else {
1705
+ result[key] = value;
1706
+ }
1707
+ }
1708
+ return result;
1709
+ }
1710
+ __name(applyUpdates, "applyUpdates");
1711
+ function stripBom(content) {
1712
+ return content.startsWith("\uFEFF") ? content.slice(1) : content;
1713
+ }
1714
+ __name(stripBom, "stripBom");
1715
+ function isRecord(value) {
1716
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1717
+ }
1718
+ __name(isRecord, "isRecord");
1719
+ function detectFormattingOptions(content) {
1720
+ const root = parseTree2(content, [], PARSE_OPTIONS);
1721
+ const firstKey = root?.children?.[0]?.children?.[0];
1722
+ const lineStart = firstKey === void 0 ? -1 : content.lastIndexOf("\n", firstKey.offset - 1);
1723
+ const candidate = firstKey === void 0 ? void 0 : content.slice(lineStart + 1, firstKey.offset);
1724
+ const indentation = candidate !== void 0 && /^[ \t]*$/.test(candidate) ? candidate : " ";
1725
+ return {
1726
+ eol: content.includes("\r\n") ? "\r\n" : "\n",
1727
+ insertSpaces: !indentation.startsWith(" "),
1728
+ tabSize: indentation.startsWith(" ") ? 1 : indentation.length,
1729
+ insertFinalNewline: content.endsWith("\n")
1730
+ };
1731
+ }
1732
+ __name(detectFormattingOptions, "detectFormattingOptions");
1733
+ function collectOperations(current, target, path2 = [], operations = []) {
1734
+ for (const key of Object.keys(current)) {
1735
+ if (!Object.hasOwn(target, key)) {
1736
+ operations.push({ path: [...path2, key], value: void 0 });
1737
+ }
1738
+ }
1739
+ for (const key of Object.keys(target)) {
1740
+ const nextPath = [...path2, key];
1741
+ if (!Object.hasOwn(current, key)) {
1742
+ operations.push({ path: nextPath, value: target[key] });
1743
+ } else if (isRecord(current[key]) && isRecord(target[key])) {
1744
+ collectOperations(current[key], target[key], nextPath, operations);
1745
+ } else if (!isDeepStrictEqual(current[key], target[key])) {
1746
+ operations.push({ path: nextPath, value: target[key] });
1747
+ }
1748
+ }
1749
+ return operations;
1750
+ }
1751
+ __name(collectOperations, "collectOperations");
1752
+ function findDuplicateProperty(node, path2 = []) {
1753
+ if (node.type !== "object" || node.children === void 0) {
1754
+ return void 0;
1755
+ }
1756
+ const properties = /* @__PURE__ */ new Map();
1757
+ for (const property of node.children) {
1758
+ const keyNode = property.children?.[0];
1759
+ const key = keyNode?.value;
1760
+ if (typeof key !== "string" || keyNode === void 0) {
1761
+ continue;
1762
+ }
1763
+ const previous = properties.get(key);
1764
+ if (previous !== void 0) {
1765
+ return {
1766
+ objectPath: [...path2],
1767
+ keyNode: previous,
1768
+ propertyNames: new Set(properties.keys())
1769
+ };
1770
+ }
1771
+ properties.set(key, keyNode);
1772
+ }
1773
+ for (const property of node.children) {
1774
+ const key = property.children?.[0]?.value;
1775
+ const valueNode = property.children?.[1];
1776
+ if (typeof key !== "string" || valueNode === void 0) {
1777
+ continue;
1778
+ }
1779
+ const duplicate = findDuplicateProperty(valueNode, [...path2, key]);
1780
+ if (duplicate !== void 0) {
1781
+ return duplicate;
1782
+ }
1783
+ }
1784
+ return void 0;
1785
+ }
1786
+ __name(findDuplicateProperty, "findDuplicateProperty");
1787
+ function normalizeDuplicateProperties(content, options) {
1788
+ let normalized = content;
1789
+ let duplicateIndex = 0;
1790
+ while (true) {
1791
+ const root = parseTree2(normalized, [], PARSE_OPTIONS);
1792
+ if (root === void 0) {
1793
+ return normalized;
1794
+ }
1795
+ const duplicate = findDuplicateProperty(root);
1796
+ if (duplicate === void 0) {
1797
+ return normalized;
1798
+ }
1799
+ let temporaryKey;
1800
+ do {
1801
+ temporaryKey = `__qwen_duplicate_${duplicateIndex}`;
1802
+ duplicateIndex += 1;
1803
+ } while (duplicate.propertyNames.has(temporaryKey));
1804
+ let renamed = normalized.slice(0, duplicate.keyNode.offset) + JSON.stringify(temporaryKey) + normalized.slice(duplicate.keyNode.offset + duplicate.keyNode.length);
1805
+ renamed = removeTrailingInlineComment(renamed, [
1806
+ ...duplicate.objectPath,
1807
+ temporaryKey
1808
+ ]);
1809
+ normalized = applyEdits(
1810
+ renamed,
1811
+ modify(
1812
+ renamed,
1813
+ [...duplicate.objectPath, temporaryKey],
1814
+ void 0,
1815
+ options
1816
+ )
1817
+ );
1818
+ }
1819
+ }
1820
+ __name(normalizeDuplicateProperties, "normalizeDuplicateProperties");
1821
+ function removeTrailingInlineComment(content, path2) {
1822
+ const root = parseTree2(content, [], PARSE_OPTIONS);
1823
+ if (root === void 0) {
1824
+ return content;
1825
+ }
1826
+ const node = findNodeAtLocation2(root, [...path2]);
1827
+ if (node === void 0) {
1828
+ return content;
1829
+ }
1830
+ const tail = content.slice(node.offset + node.length);
1831
+ const match = tail.match(
1832
+ /^[ \t]*(?:,[ \t]*)?(\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/
1833
+ );
1834
+ const comment = match?.[1];
1835
+ if (comment === void 0 || match === null) {
1836
+ return content;
1837
+ }
1838
+ const commentOffset = node.offset + node.length + match[0].indexOf(comment);
1839
+ return content.slice(0, commentOffset) + content.slice(commentOffset + comment.length);
1840
+ }
1841
+ __name(removeTrailingInlineComment, "removeTrailingInlineComment");
1842
+ function pathsEqual(left, right) {
1843
+ return left.length === right.length && left.every((segment, index) => segment === right[index]);
1844
+ }
1845
+ __name(pathsEqual, "pathsEqual");
1846
+
1847
+ // packages/cli/src/config/trustedFolders.ts
1848
+ var TRUSTED_FOLDERS_FILENAME = "trustedFolders.json";
1849
+ function getTrustedFoldersPath() {
1850
+ if (process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"]) {
1851
+ return process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"];
1852
+ }
1853
+ return path.join(Storage.getGlobalQwenDir(), TRUSTED_FOLDERS_FILENAME);
1854
+ }
1855
+ __name(getTrustedFoldersPath, "getTrustedFoldersPath");
1856
+ var TrustLevel = /* @__PURE__ */ ((TrustLevel2) => {
1857
+ TrustLevel2["TRUST_FOLDER"] = "TRUST_FOLDER";
1858
+ TrustLevel2["TRUST_PARENT"] = "TRUST_PARENT";
1859
+ TrustLevel2["DO_NOT_TRUST"] = "DO_NOT_TRUST";
1860
+ return TrustLevel2;
1861
+ })(TrustLevel || {});
1862
+ var trustedFoldersChangeListeners = /* @__PURE__ */ new Set();
1863
+ function onTrustedFoldersChanged(listener) {
1864
+ trustedFoldersChangeListeners.add(listener);
1865
+ return () => trustedFoldersChangeListeners.delete(listener);
1866
+ }
1867
+ __name(onTrustedFoldersChanged, "onTrustedFoldersChanged");
1868
+ function notifyTrustedFoldersChanged() {
1869
+ for (const listener of trustedFoldersChangeListeners) listener();
1870
+ }
1871
+ __name(notifyTrustedFoldersChanged, "notifyTrustedFoldersChanged");
1872
+ var LoadedTrustedFolders = class {
1873
+ constructor(user, errors) {
1874
+ this.user = user;
1875
+ this.errors = errors;
1876
+ }
1877
+ static {
1878
+ __name(this, "LoadedTrustedFolders");
1879
+ }
1880
+ get rules() {
1881
+ return Object.entries(this.user.config).map(([path2, trustLevel]) => ({
1882
+ path: path2,
1883
+ trustLevel
1884
+ }));
1885
+ }
1886
+ /**
1887
+ * Returns true or false if the path should be "trusted". This function
1888
+ * should only be invoked when the folder trust setting is active.
1889
+ *
1890
+ * @param location path
1891
+ * @returns
1892
+ */
1893
+ isPathTrusted(location) {
1894
+ const trustedPaths = [];
1895
+ const untrustedPaths = [];
1896
+ for (const rule of this.rules) {
1897
+ switch (rule.trustLevel) {
1898
+ case "TRUST_FOLDER" /* TRUST_FOLDER */:
1899
+ trustedPaths.push(rule.path);
1900
+ break;
1901
+ case "TRUST_PARENT" /* TRUST_PARENT */:
1902
+ trustedPaths.push(path.dirname(rule.path));
1903
+ break;
1904
+ case "DO_NOT_TRUST" /* DO_NOT_TRUST */:
1905
+ untrustedPaths.push(rule.path);
1906
+ break;
1907
+ default:
1908
+ break;
1909
+ }
1910
+ }
1911
+ const locationVariants = getPathComparisonVariants(location);
1912
+ for (const trustedPath of trustedPaths) {
1913
+ for (const locationVariant of locationVariants) {
1914
+ for (const trustedVariant of getPathComparisonVariants(trustedPath)) {
1915
+ if (isWithinRoot(locationVariant, trustedVariant)) {
1916
+ return true;
1917
+ }
1918
+ }
1919
+ }
1920
+ }
1921
+ for (const untrustedPath of untrustedPaths) {
1922
+ for (const locationVariant of locationVariants) {
1923
+ for (const untrustedVariant of getPathComparisonVariants(
1924
+ untrustedPath
1925
+ )) {
1926
+ if (locationVariant === untrustedVariant) {
1927
+ return false;
1928
+ }
1929
+ }
1930
+ }
1931
+ }
1932
+ return void 0;
1933
+ }
1934
+ setValue(path2, trustLevel) {
1935
+ const committedConfig = writeTrustedFolders(
1936
+ this.user.path,
1937
+ (diskConfig) => ({ ...diskConfig, [path2]: trustLevel })
1938
+ );
1939
+ this.user.config = committedConfig;
1940
+ notifyTrustedFoldersChanged();
1941
+ }
1942
+ };
1943
+ var loadedTrustedFolders;
1944
+ function resetTrustedFoldersForTesting() {
1945
+ loadedTrustedFolders = void 0;
1946
+ }
1947
+ __name(resetTrustedFoldersForTesting, "resetTrustedFoldersForTesting");
1948
+ function loadTrustedFolders() {
1949
+ if (loadedTrustedFolders) {
1950
+ return loadedTrustedFolders;
1951
+ }
1952
+ const errors = [];
1953
+ let userConfig = {};
1954
+ const userPath = getTrustedFoldersPath();
1955
+ try {
1956
+ if (fs3.existsSync(userPath)) {
1957
+ const content = fs3.readFileSync(userPath, "utf-8");
1958
+ const parsed = JSON.parse((0, import_strip_json_comments.default)(content));
1959
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
1960
+ errors.push({
1961
+ message: "Trusted folders file is not a valid JSON object.",
1962
+ path: userPath
1963
+ });
1964
+ } else {
1965
+ userConfig = parsed;
1966
+ }
1967
+ }
1968
+ } catch (error) {
1969
+ errors.push({
1970
+ message: getErrorMessage(error),
1971
+ path: userPath
1972
+ });
1973
+ }
1974
+ loadedTrustedFolders = new LoadedTrustedFolders(
1975
+ { path: userPath, config: userConfig },
1976
+ errors
1977
+ );
1978
+ return loadedTrustedFolders;
1979
+ }
1980
+ __name(loadTrustedFolders, "loadTrustedFolders");
1981
+ function saveTrustedFolders(trustedFoldersFile) {
1982
+ writeTrustedFolders(trustedFoldersFile.path, () => ({
1983
+ ...trustedFoldersFile.config
1984
+ }));
1985
+ }
1986
+ __name(saveTrustedFolders, "saveTrustedFolders");
1987
+ function assertTrustedFoldersConfig(config) {
1988
+ for (const [rulePath, trustLevel] of Object.entries(config)) {
1989
+ if (!Object.values(TrustLevel).includes(trustLevel)) {
1990
+ throw new FatalConfigError(
1991
+ `Invalid trusted folder rule for ${JSON.stringify(rulePath)}.`
1992
+ );
1993
+ }
1994
+ }
1995
+ }
1996
+ __name(assertTrustedFoldersConfig, "assertTrustedFoldersConfig");
1997
+ function writeTrustedFolders(filePath, update) {
1998
+ const dirPath = path.dirname(filePath);
1999
+ if (!fs3.existsSync(dirPath)) {
2000
+ fs3.mkdirSync(dirPath, { recursive: true });
2001
+ }
2002
+ const release = import_proper_lockfile.default.lockSync(filePath, {
2003
+ realpath: false,
2004
+ stale: 1e4
2005
+ });
2006
+ try {
2007
+ let originalContent = "{}";
2008
+ if (fs3.existsSync(filePath)) {
2009
+ const stat = fs3.lstatSync(filePath);
2010
+ if (stat.isSymbolicLink() || !stat.isFile()) {
2011
+ throw new FatalConfigError(
2012
+ "Trusted folders path must be a regular file."
2013
+ );
2014
+ }
2015
+ originalContent = fs3.readFileSync(filePath, "utf-8");
2016
+ }
2017
+ let parsed;
2018
+ try {
2019
+ parsed = parseJsoncObject(originalContent);
2020
+ } catch (error) {
2021
+ if (error instanceof Error && error.message === "JSONC document root is not a JSON object.") {
2022
+ throw new FatalConfigError(
2023
+ "Trusted folders file is not a valid JSON object."
2024
+ );
2025
+ }
2026
+ throw error;
2027
+ }
2028
+ const diskConfig = Object.fromEntries(Object.entries(parsed));
2029
+ assertTrustedFoldersConfig(diskConfig);
2030
+ const nextConfig = update({ ...diskConfig });
2031
+ assertTrustedFoldersConfig(nextConfig);
2032
+ const content = updateJsoncContent(originalContent, nextConfig, true);
2033
+ atomicWriteFileSync(
2034
+ filePath,
2035
+ content,
2036
+ // noFollow: refuse to follow any pre-placed symlink at the
2037
+ // config path — a redirected write could either leak the
2038
+ // trusted-folder list to an attacker target or leave the user's
2039
+ // real config silently stale. Matches the credential write
2040
+ // sites' security posture (sharedTokenManager, oauth-token-storage,
2041
+ // file-token-storage all use noFollow:true).
2042
+ { encoding: "utf-8", mode: 384, forceMode: true, noFollow: true }
2043
+ );
2044
+ return nextConfig;
2045
+ } finally {
2046
+ try {
2047
+ release();
2048
+ } catch {
2049
+ }
2050
+ }
2051
+ }
2052
+ __name(writeTrustedFolders, "writeTrustedFolders");
2053
+ function isFolderTrustEnabled(settings) {
2054
+ const folderTrustSetting = settings.security?.folderTrust?.enabled ?? false;
2055
+ return folderTrustSetting;
2056
+ }
2057
+ __name(isFolderTrustEnabled, "isFolderTrustEnabled");
2058
+ function isWithinRootAcrossVariants(childPath, parentPath) {
2059
+ for (const childVariant of getPathComparisonVariants(childPath)) {
2060
+ for (const parentVariant of getPathComparisonVariants(parentPath)) {
2061
+ if (isWithinRoot(childVariant, parentVariant)) {
2062
+ return true;
2063
+ }
2064
+ }
2065
+ }
2066
+ return false;
2067
+ }
2068
+ __name(isWithinRootAcrossVariants, "isWithinRootAcrossVariants");
2069
+ function getExplicitTrustLevel(trustConfig, workspaceCwd) {
2070
+ for (const [rulePath, trustLevel] of Object.entries(trustConfig)) {
2071
+ if (trustLevel === "TRUST_FOLDER" /* TRUST_FOLDER */ && isWithinRootAcrossVariants(workspaceCwd, rulePath)) {
2072
+ return trustLevel;
2073
+ }
2074
+ if (trustLevel === "TRUST_PARENT" /* TRUST_PARENT */ && isWithinRootAcrossVariants(workspaceCwd, path.dirname(rulePath))) {
2075
+ return trustLevel;
2076
+ }
2077
+ }
2078
+ for (const [rulePath, trustLevel] of Object.entries(trustConfig)) {
2079
+ if (trustLevel === "DO_NOT_TRUST" /* DO_NOT_TRUST */ && arePathsEquivalent(workspaceCwd, rulePath)) {
2080
+ return trustLevel;
2081
+ }
2082
+ }
2083
+ return null;
2084
+ }
2085
+ __name(getExplicitTrustLevel, "getExplicitTrustLevel");
2086
+ function loadTrustedFoldersWithOverrides(trustConfig) {
2087
+ const folders = loadTrustedFolders();
2088
+ if (folders.errors.length > 0) {
2089
+ const errorMessages = folders.errors.map(
2090
+ (error) => `Error in ${error.path}: ${error.message}`
2091
+ );
2092
+ throw new FatalConfigError(
2093
+ `${errorMessages.join("\n")}
2094
+ Please fix the configuration file and try again.`
2095
+ );
2096
+ }
2097
+ if (trustConfig) {
2098
+ return new LoadedTrustedFolders(
2099
+ { ...folders.user, config: trustConfig },
2100
+ folders.errors
2101
+ );
2102
+ }
2103
+ return folders;
2104
+ }
2105
+ __name(loadTrustedFoldersWithOverrides, "loadTrustedFoldersWithOverrides");
2106
+ function trustStatusToResult(status) {
2107
+ if (status.effective.source === "disabled") {
2108
+ return { isTrusted: true, source: void 0 };
2109
+ }
2110
+ return {
2111
+ isTrusted: status.effective.state === "trusted" ? true : status.effective.state === "untrusted" ? false : void 0,
2112
+ source: status.effective.source === "file" || status.effective.source === "ide" ? status.effective.source : void 0
2113
+ };
2114
+ }
2115
+ __name(trustStatusToResult, "trustStatusToResult");
2116
+ function getWorkspaceTrustStatus(settings, workspaceCwd, trustConfig) {
2117
+ if (!isFolderTrustEnabled(settings)) {
2118
+ return {
2119
+ v: 1,
2120
+ workspaceCwd,
2121
+ folderTrustEnabled: false,
2122
+ effective: { state: "trusted", source: "disabled" },
2123
+ explicitTrustLevel: null,
2124
+ requiresDaemonRestartForChanges: true
2125
+ };
2126
+ }
2127
+ const ideTrust = ideContextStore.get()?.workspaceState?.isTrusted;
2128
+ if (ideTrust !== void 0 && arePathsEquivalent(workspaceCwd, process.cwd())) {
2129
+ return {
2130
+ v: 1,
2131
+ workspaceCwd,
2132
+ folderTrustEnabled: true,
2133
+ effective: {
2134
+ state: ideTrust ? "trusted" : "untrusted",
2135
+ source: "ide"
2136
+ },
2137
+ explicitTrustLevel: null,
2138
+ requiresDaemonRestartForChanges: true
2139
+ };
2140
+ }
2141
+ const folders = loadTrustedFoldersWithOverrides(trustConfig);
2142
+ const isTrusted = folders.isPathTrusted(workspaceCwd);
2143
+ const state = isTrusted === true ? "trusted" : isTrusted === false ? "untrusted" : "unknown";
2144
+ return {
2145
+ v: 1,
2146
+ workspaceCwd,
2147
+ folderTrustEnabled: true,
2148
+ effective: {
2149
+ state,
2150
+ source: isTrusted === void 0 ? "none" : "file"
2151
+ },
2152
+ explicitTrustLevel: getExplicitTrustLevel(
2153
+ folders.user.config,
2154
+ workspaceCwd
2155
+ ),
2156
+ requiresDaemonRestartForChanges: true
2157
+ };
2158
+ }
2159
+ __name(getWorkspaceTrustStatus, "getWorkspaceTrustStatus");
2160
+ function isWorkspaceTrusted(settings, trustConfig, workspacePath) {
2161
+ if (!isFolderTrustEnabled(settings)) {
2162
+ return { isTrusted: true, source: void 0 };
2163
+ }
2164
+ const ideTrust = ideContextStore.get()?.workspaceState?.isTrusted;
2165
+ if (ideTrust !== void 0 && (workspacePath === void 0 || arePathsEquivalent(workspacePath, process.cwd()))) {
2166
+ return { isTrusted: ideTrust, source: "ide" };
2167
+ }
2168
+ return trustStatusToResult(
2169
+ getWorkspaceTrustStatus(
2170
+ settings,
2171
+ workspacePath ?? process.cwd(),
2172
+ trustConfig
2173
+ )
2174
+ );
2175
+ }
2176
+ __name(isWorkspaceTrusted, "isWorkspaceTrusted");
2177
+
2178
+ export {
2179
+ updateSettingsFilePreservingFormat,
2180
+ TRUSTED_FOLDERS_FILENAME,
2181
+ getTrustedFoldersPath,
2182
+ TrustLevel,
2183
+ onTrustedFoldersChanged,
2184
+ LoadedTrustedFolders,
2185
+ resetTrustedFoldersForTesting,
2186
+ loadTrustedFolders,
2187
+ saveTrustedFolders,
2188
+ isFolderTrustEnabled,
2189
+ getWorkspaceTrustStatus,
2190
+ isWorkspaceTrusted
2191
+ };
2192
+ /**
2193
+ * @license
2194
+ * Copyright 2025 Google LLC
2195
+ * SPDX-License-Identifier: Apache-2.0
2196
+ */