@rpamis/comet 0.4.3 → 0.4.5

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 (464) hide show
  1. package/README.md +372 -332
  2. package/assets/manifest.json +1 -1
  3. package/assets/skills/comet/scripts/comet-archive.mjs +113 -97
  4. package/assets/skills/comet/scripts/comet-check.mjs +117 -104
  5. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +59 -59
  6. package/assets/skills/comet/scripts/comet-guard.mjs +170 -157
  7. package/assets/skills/comet/scripts/comet-handoff.mjs +110 -97
  8. package/assets/skills/comet/scripts/comet-hook-guard.mjs +110 -97
  9. package/assets/skills/comet/scripts/comet-hook-router.mjs +272 -153
  10. package/assets/skills/comet/scripts/comet-intent.mjs +31 -31
  11. package/assets/skills/comet/scripts/comet-resume-probe.mjs +104 -91
  12. package/assets/skills/comet/scripts/comet-runtime.mjs +311 -296
  13. package/assets/skills/comet/scripts/comet-state.mjs +221 -207
  14. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +25 -25
  15. package/assets/skills/comet-archive/SKILL.md +13 -9
  16. package/assets/skills/comet-build/SKILL.md +4 -6
  17. package/assets/skills/comet-classic/SKILL.md +1 -1
  18. package/assets/skills/comet-classic/reference/scripts.md +9 -1
  19. package/assets/skills/comet-design/SKILL.md +0 -2
  20. package/assets/skills/comet-hotfix/SKILL.md +1 -3
  21. package/assets/skills/comet-native/SKILL.md +8 -7
  22. package/assets/skills/comet-native/reference/artifacts.md +51 -7
  23. package/assets/skills/comet-native/reference/clarification.md +5 -5
  24. package/assets/skills/comet-native/reference/commands.md +15 -13
  25. package/assets/skills/comet-native/reference/recovery.md +3 -3
  26. package/assets/skills/comet-native/reference/workspace.md +10 -4
  27. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +257 -169
  28. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +238 -153
  29. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +241 -124
  30. package/assets/skills/comet-native/scripts/comet-native-init.mjs +189 -108
  31. package/assets/skills/comet-native/scripts/comet-native-new.mjs +220 -139
  32. package/assets/skills/comet-native/scripts/comet-native-next.mjs +245 -160
  33. package/assets/skills/comet-native/scripts/comet-native-root.mjs +210 -129
  34. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +284 -196
  35. package/assets/skills/comet-native/scripts/comet-native-select.mjs +212 -128
  36. package/assets/skills/comet-native/scripts/comet-native-show.mjs +207 -126
  37. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +203 -118
  38. package/assets/skills/comet-native/scripts/comet-native-status.mjs +208 -124
  39. package/assets/skills/comet-open/SKILL.md +0 -2
  40. package/assets/skills/comet-tweak/SKILL.md +1 -1
  41. package/assets/skills/comet-verify/SKILL.md +0 -2
  42. package/assets/skills-zh/comet-archive/SKILL.md +13 -9
  43. package/assets/skills-zh/comet-build/SKILL.md +4 -6
  44. package/assets/skills-zh/comet-classic/SKILL.md +1 -1
  45. package/assets/skills-zh/comet-classic/reference/scripts.md +9 -1
  46. package/assets/skills-zh/comet-design/SKILL.md +0 -2
  47. package/assets/skills-zh/comet-hotfix/SKILL.md +1 -3
  48. package/assets/skills-zh/comet-native/SKILL.md +8 -7
  49. package/assets/skills-zh/comet-native/reference/artifacts.md +51 -7
  50. package/assets/skills-zh/comet-native/reference/clarification.md +5 -5
  51. package/assets/skills-zh/comet-native/reference/commands.md +16 -10
  52. package/assets/skills-zh/comet-native/reference/recovery.md +3 -3
  53. package/assets/skills-zh/comet-native/reference/workspace.md +10 -4
  54. package/assets/skills-zh/comet-open/SKILL.md +0 -2
  55. package/assets/skills-zh/comet-tweak/SKILL.md +1 -1
  56. package/assets/skills-zh/comet-verify/SKILL.md +0 -2
  57. package/bin/comet-daemon-router.js +23 -7
  58. package/bin/fast-runtime-router.js +1 -1
  59. package/dist/app/cli/index.js +1 -0
  60. package/dist/app/cli/index.js.map +1 -1
  61. package/dist/app/commands/daemon-server.d.ts.map +1 -1
  62. package/dist/app/commands/daemon-server.js +13 -2
  63. package/dist/app/commands/daemon-server.js.map +1 -1
  64. package/dist/app/commands/doctor.d.ts.map +1 -1
  65. package/dist/app/commands/doctor.js +17 -10
  66. package/dist/app/commands/doctor.js.map +1 -1
  67. package/dist/app/commands/i18n.d.ts +1 -1
  68. package/dist/app/commands/i18n.d.ts.map +1 -1
  69. package/dist/app/commands/i18n.js +4 -0
  70. package/dist/app/commands/i18n.js.map +1 -1
  71. package/dist/app/commands/project-knowledge.d.ts +2 -0
  72. package/dist/app/commands/project-knowledge.d.ts.map +1 -1
  73. package/dist/app/commands/project-knowledge.js +64 -7
  74. package/dist/app/commands/project-knowledge.js.map +1 -1
  75. package/dist/app/commands/uninstall.d.ts +1 -0
  76. package/dist/app/commands/uninstall.d.ts.map +1 -1
  77. package/dist/app/commands/uninstall.js +65 -10
  78. package/dist/app/commands/uninstall.js.map +1 -1
  79. package/dist/domains/agent-learning/coordinator.d.ts +8 -1
  80. package/dist/domains/agent-learning/coordinator.d.ts.map +1 -1
  81. package/dist/domains/agent-learning/coordinator.js +58 -0
  82. package/dist/domains/agent-learning/coordinator.js.map +1 -1
  83. package/dist/domains/agent-learning/experience-journal.d.ts +21 -1
  84. package/dist/domains/agent-learning/experience-journal.d.ts.map +1 -1
  85. package/dist/domains/agent-learning/experience-journal.js +190 -11
  86. package/dist/domains/agent-learning/experience-journal.js.map +1 -1
  87. package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
  88. package/dist/domains/bundle/bundle-platform.js +6 -1
  89. package/dist/domains/bundle/bundle-platform.js.map +1 -1
  90. package/dist/domains/comet-classic/classic-archive-entry.d.ts +1 -1
  91. package/dist/domains/comet-classic/classic-archive-entry.d.ts.map +1 -1
  92. package/dist/domains/comet-classic/classic-archive-entry.js +5 -2
  93. package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
  94. package/dist/domains/comet-classic/classic-archive.d.ts.map +1 -1
  95. package/dist/domains/comet-classic/classic-archive.js +5 -1
  96. package/dist/domains/comet-classic/classic-archive.js.map +1 -1
  97. package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
  98. package/dist/domains/comet-classic/classic-branch-binding.js +5 -4
  99. package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
  100. package/dist/domains/comet-classic/classic-check-entry.d.ts +1 -1
  101. package/dist/domains/comet-classic/classic-check-entry.d.ts.map +1 -1
  102. package/dist/domains/comet-classic/classic-check-entry.js +5 -2
  103. package/dist/domains/comet-classic/classic-check-entry.js.map +1 -1
  104. package/dist/domains/comet-classic/classic-check-snapshot.d.ts.map +1 -1
  105. package/dist/domains/comet-classic/classic-check-snapshot.js +68 -26
  106. package/dist/domains/comet-classic/classic-check-snapshot.js.map +1 -1
  107. package/dist/domains/comet-classic/classic-design-readiness.d.ts +1 -1
  108. package/dist/domains/comet-classic/classic-guard-entry.d.ts +1 -1
  109. package/dist/domains/comet-classic/classic-guard-entry.d.ts.map +1 -1
  110. package/dist/domains/comet-classic/classic-guard-entry.js +5 -2
  111. package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
  112. package/dist/domains/comet-classic/classic-handoff-entry.d.ts +1 -1
  113. package/dist/domains/comet-classic/classic-handoff-entry.d.ts.map +1 -1
  114. package/dist/domains/comet-classic/classic-handoff-entry.js +5 -2
  115. package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
  116. package/dist/domains/comet-classic/classic-progress.d.ts +60 -2
  117. package/dist/domains/comet-classic/classic-progress.d.ts.map +1 -1
  118. package/dist/domains/comet-classic/classic-progress.js +199 -22
  119. package/dist/domains/comet-classic/classic-progress.js.map +1 -1
  120. package/dist/domains/comet-classic/classic-recovery.d.ts +20 -1
  121. package/dist/domains/comet-classic/classic-recovery.d.ts.map +1 -1
  122. package/dist/domains/comet-classic/classic-resume-probe.d.ts.map +1 -1
  123. package/dist/domains/comet-classic/classic-resume-probe.js +3 -2
  124. package/dist/domains/comet-classic/classic-resume-probe.js.map +1 -1
  125. package/dist/domains/comet-classic/classic-script-entry.d.ts +3 -1
  126. package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
  127. package/dist/domains/comet-classic/classic-script-entry.js +34 -3
  128. package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
  129. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  130. package/dist/domains/comet-classic/classic-state-command.js +3 -2
  131. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  132. package/dist/domains/comet-classic/classic-state-entry.d.ts +1 -1
  133. package/dist/domains/comet-classic/classic-state-entry.d.ts.map +1 -1
  134. package/dist/domains/comet-classic/classic-state-entry.js +5 -2
  135. package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
  136. package/dist/domains/comet-classic/classic-store.d.ts.map +1 -1
  137. package/dist/domains/comet-classic/classic-store.js +67 -1
  138. package/dist/domains/comet-classic/classic-store.js.map +1 -1
  139. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  140. package/dist/domains/comet-entry/resume-probe.js +3 -2
  141. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  142. package/dist/domains/comet-native/native-acceptance.d.ts +5 -1
  143. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  144. package/dist/domains/comet-native/native-acceptance.js +13 -2
  145. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  146. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  147. package/dist/domains/comet-native/native-archive-command.js +167 -37
  148. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  149. package/dist/domains/comet-native/native-artifact-language.d.ts +10 -1
  150. package/dist/domains/comet-native/native-artifact-language.d.ts.map +1 -1
  151. package/dist/domains/comet-native/native-artifact-language.js +65 -12
  152. package/dist/domains/comet-native/native-artifact-language.js.map +1 -1
  153. package/dist/domains/comet-native/native-artifacts.d.ts +10 -1
  154. package/dist/domains/comet-native/native-artifacts.d.ts.map +1 -1
  155. package/dist/domains/comet-native/native-artifacts.js +130 -21
  156. package/dist/domains/comet-native/native-artifacts.js.map +1 -1
  157. package/dist/domains/comet-native/native-builder-acceptance-review.d.ts +16 -0
  158. package/dist/domains/comet-native/native-builder-acceptance-review.d.ts.map +1 -0
  159. package/dist/domains/comet-native/native-builder-acceptance-review.js +65 -0
  160. package/dist/domains/comet-native/native-builder-acceptance-review.js.map +1 -0
  161. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
  162. package/dist/domains/comet-native/native-cli-help.js +8 -4
  163. package/dist/domains/comet-native/native-cli-help.js.map +1 -1
  164. package/dist/domains/comet-native/native-cli-shared.d.ts +4 -2
  165. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  166. package/dist/domains/comet-native/native-cli-shared.js +37 -9
  167. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  168. package/dist/domains/comet-native/native-cli.d.ts +4 -1
  169. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  170. package/dist/domains/comet-native/native-cli.js +9 -5
  171. package/dist/domains/comet-native/native-cli.js.map +1 -1
  172. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  173. package/dist/domains/comet-native/native-doctor-command.js +144 -3
  174. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  175. package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-git-provenance.js +3 -2
  177. package/dist/domains/comet-native/native-git-provenance.js.map +1 -1
  178. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  179. package/dist/domains/comet-native/native-hook-guard.js +57 -26
  180. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  181. package/dist/domains/comet-native/native-local-execution.d.ts +1 -0
  182. package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -1
  183. package/dist/domains/comet-native/native-local-execution.js +7 -0
  184. package/dist/domains/comet-native/native-local-execution.js.map +1 -1
  185. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  186. package/dist/domains/comet-native/native-lock.js +12 -0
  187. package/dist/domains/comet-native/native-lock.js.map +1 -1
  188. package/dist/domains/comet-native/native-loop-runtime.d.ts +2 -0
  189. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -1
  190. package/dist/domains/comet-native/native-loop-runtime.js +6 -0
  191. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -1
  192. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  193. package/dist/domains/comet-native/native-next-command.js +57 -28
  194. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  195. package/dist/domains/comet-native/native-output-language.d.ts.map +1 -1
  196. package/dist/domains/comet-native/native-output-language.js +7 -0
  197. package/dist/domains/comet-native/native-output-language.js.map +1 -1
  198. package/dist/domains/comet-native/native-portable-acceptance.d.ts +2 -0
  199. package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -1
  200. package/dist/domains/comet-native/native-portable-acceptance.js +11 -1
  201. package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -1
  202. package/dist/domains/comet-native/native-portable-archive.d.ts +1 -0
  203. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -1
  204. package/dist/domains/comet-native/native-portable-archive.js +3 -0
  205. package/dist/domains/comet-native/native-portable-archive.js.map +1 -1
  206. package/dist/domains/comet-native/native-portable-checks.d.ts +14 -4
  207. package/dist/domains/comet-native/native-portable-checks.d.ts.map +1 -1
  208. package/dist/domains/comet-native/native-portable-checks.js +159 -60
  209. package/dist/domains/comet-native/native-portable-checks.js.map +1 -1
  210. package/dist/domains/comet-native/native-portable-continuation.d.ts +2 -1
  211. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
  212. package/dist/domains/comet-native/native-portable-continuation.js +121 -39
  213. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
  214. package/dist/domains/comet-native/native-portable-requirements.d.ts +1 -0
  215. package/dist/domains/comet-native/native-portable-requirements.d.ts.map +1 -1
  216. package/dist/domains/comet-native/native-portable-requirements.js +68 -18
  217. package/dist/domains/comet-native/native-portable-requirements.js.map +1 -1
  218. package/dist/domains/comet-native/native-portable-shape-coordination.d.ts.map +1 -1
  219. package/dist/domains/comet-native/native-portable-shape-coordination.js +18 -5
  220. package/dist/domains/comet-native/native-portable-shape-coordination.js.map +1 -1
  221. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
  222. package/dist/domains/comet-native/native-portable-state.js +12 -3
  223. package/dist/domains/comet-native/native-portable-state.js.map +1 -1
  224. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -1
  225. package/dist/domains/comet-native/native-portable-status.js +10 -4
  226. package/dist/domains/comet-native/native-portable-status.js.map +1 -1
  227. package/dist/domains/comet-native/native-portable-types.d.ts +2 -1
  228. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
  229. package/dist/domains/comet-native/native-portable-types.js.map +1 -1
  230. package/dist/domains/comet-native/native-portable-verification.d.ts +3 -0
  231. package/dist/domains/comet-native/native-portable-verification.d.ts.map +1 -1
  232. package/dist/domains/comet-native/native-portable-verification.js +28 -35
  233. package/dist/domains/comet-native/native-portable-verification.js.map +1 -1
  234. package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts +2 -0
  235. package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts.map +1 -1
  236. package/dist/domains/comet-native/native-portable-verifier-coordination.js +9 -0
  237. package/dist/domains/comet-native/native-portable-verifier-coordination.js.map +1 -1
  238. package/dist/domains/comet-native/native-runner-input-artifacts.d.ts +9 -0
  239. package/dist/domains/comet-native/native-runner-input-artifacts.d.ts.map +1 -0
  240. package/dist/domains/comet-native/native-runner-input-artifacts.js +102 -0
  241. package/dist/domains/comet-native/native-runner-input-artifacts.js.map +1 -0
  242. package/dist/domains/comet-native/native-runner-input.d.ts +90 -64
  243. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -1
  244. package/dist/domains/comet-native/native-runner-input.js +107 -22
  245. package/dist/domains/comet-native/native-runner-input.js.map +1 -1
  246. package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -1
  247. package/dist/domains/comet-native/native-script-entry.js +9 -3
  248. package/dist/domains/comet-native/native-script-entry.js.map +1 -1
  249. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  250. package/dist/domains/comet-native/native-snapshot.js +7 -2
  251. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  252. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  253. package/dist/domains/comet-native/native-verification-receipt-runtime.js +5 -4
  254. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  255. package/dist/domains/comet-native/native-workspace-finish.d.ts +26 -0
  256. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -1
  257. package/dist/domains/comet-native/native-workspace-finish.js +520 -15
  258. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -1
  259. package/dist/domains/comet-plugin/integration.d.ts +1 -0
  260. package/dist/domains/comet-plugin/integration.d.ts.map +1 -1
  261. package/dist/domains/comet-plugin/integration.js +20 -10
  262. package/dist/domains/comet-plugin/integration.js.map +1 -1
  263. package/dist/domains/comet-plugin/plugin-runtime.d.ts +8 -2
  264. package/dist/domains/comet-plugin/plugin-runtime.d.ts.map +1 -1
  265. package/dist/domains/comet-plugin/plugin-runtime.js +18 -4
  266. package/dist/domains/comet-plugin/plugin-runtime.js.map +1 -1
  267. package/dist/domains/dashboard/project-directory.d.ts +4 -0
  268. package/dist/domains/dashboard/project-directory.d.ts.map +1 -1
  269. package/dist/domains/dashboard/project-directory.js +30 -2
  270. package/dist/domains/dashboard/project-directory.js.map +1 -1
  271. package/dist/domains/dashboard/server.d.ts.map +1 -1
  272. package/dist/domains/dashboard/server.js +28 -3
  273. package/dist/domains/dashboard/server.js.map +1 -1
  274. package/dist/domains/dashboard/web/assets/{abnfDiagram-VCTEODGH-qlcciI25.js → abnfDiagram-VCTEODGH-m9_t3fwH.js} +1 -1
  275. package/dist/domains/dashboard/web/assets/{arc-KVm4k9kp.js → arc-CDiwRrMg.js} +1 -1
  276. package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-ypJOsR2Y.js +1 -0
  277. package/dist/domains/dashboard/web/assets/{architectureDiagram-5GKGNRK7-C366RdBK.js → architectureDiagram-5GKGNRK7-Xwj-hlQB.js} +1 -1
  278. package/dist/domains/dashboard/web/assets/{blockDiagram-I7D4REHJ-DAuTc2OO.js → blockDiagram-I7D4REHJ-Cme6qNK_.js} +1 -1
  279. package/dist/domains/dashboard/web/assets/{c4Diagram-7LVT6UL2-CFB0RZmL.js → c4Diagram-7LVT6UL2-Cxs1dU7y.js} +1 -1
  280. package/dist/domains/dashboard/web/assets/channel-BFTjR7Ng.js +1 -0
  281. package/dist/domains/dashboard/web/assets/{chunk-4HAMMTFA-DTV6lyGQ.js → chunk-4HAMMTFA-DBQykIWE.js} +1 -1
  282. package/dist/domains/dashboard/web/assets/{chunk-75Z2AOVW-DgJm4cEX.js → chunk-75Z2AOVW-Dh-E6TAx.js} +1 -1
  283. package/dist/domains/dashboard/web/assets/{chunk-DU6HZSFF-NAtcgGZr.js → chunk-DU6HZSFF-W3lPaoVP.js} +2 -2
  284. package/dist/domains/dashboard/web/assets/{chunk-F27PBJKO-BcFXHZMJ.js → chunk-F27PBJKO-dzf1fpYi.js} +1 -1
  285. package/dist/domains/dashboard/web/assets/{chunk-GMAD6QVW-wNemar9b.js → chunk-GMAD6QVW-CeuSGVHV.js} +1 -1
  286. package/dist/domains/dashboard/web/assets/{chunk-GVQU2GXP-BiVCDO9d.js → chunk-GVQU2GXP-BrGrIBgk.js} +1 -1
  287. package/dist/domains/dashboard/web/assets/{chunk-IMKFNOWR-D9GDj4b6.js → chunk-IMKFNOWR-DXiTC1Xo.js} +1 -1
  288. package/dist/domains/dashboard/web/assets/{chunk-L3NEJ4N5-DkPl5vac.js → chunk-L3NEJ4N5-DnyD3Ocj.js} +1 -1
  289. package/dist/domains/dashboard/web/assets/{chunk-OSK3NFVY-RbbxGqtJ.js → chunk-OSK3NFVY-6vxhPm51.js} +1 -1
  290. package/dist/domains/dashboard/web/assets/{chunk-P2QGCYS3-B9_X57eT.js → chunk-P2QGCYS3-DChNsVqO.js} +1 -1
  291. package/dist/domains/dashboard/web/assets/{chunk-POPQ4Y6H-DE4bOH0D.js → chunk-POPQ4Y6H-RBgha6dE.js} +1 -1
  292. package/dist/domains/dashboard/web/assets/{chunk-PWAF6VOD-Bo-W1iA1.js → chunk-PWAF6VOD-CayoKmnh.js} +1 -1
  293. package/dist/domains/dashboard/web/assets/{chunk-SHT3W25Y-BhLxs4rZ.js → chunk-SHT3W25Y-sOkLJZoB.js} +1 -1
  294. package/dist/domains/dashboard/web/assets/{chunk-SVP7TREG-BCXfn8uF.js → chunk-SVP7TREG-j0QRwmsq.js} +1 -1
  295. package/dist/domains/dashboard/web/assets/{chunk-TICWLB2K-DqSBgE5L.js → chunk-TICWLB2K-D7Re_d_T.js} +1 -1
  296. package/dist/domains/dashboard/web/assets/{chunk-XXDRQBXY-Dbkt1xEZ.js → chunk-XXDRQBXY-BFV70fKF.js} +1 -1
  297. package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-gDSLbV2K.js +1 -0
  298. package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-gDSLbV2K.js +1 -0
  299. package/dist/domains/dashboard/web/assets/{cose-bilkent-JH36ORCC-DrwNpMyX.js → cose-bilkent-JH36ORCC-k7gqx2Br.js} +1 -1
  300. package/dist/domains/dashboard/web/assets/{cynefin-OW5HDTMX-BbDlivxs.js → cynefin-OW5HDTMX-CWI6FZT8.js} +1 -1
  301. package/dist/domains/dashboard/web/assets/{cynefinDiagram-5FMLGOSQ-DmLmRN42.js → cynefinDiagram-5FMLGOSQ-D-O3RrOu.js} +1 -1
  302. package/dist/domains/dashboard/web/assets/{dagre-GXQ25YYZ-Cgm5DNgI.js → dagre-GXQ25YYZ-BR1jxWfn.js} +1 -1
  303. package/dist/domains/dashboard/web/assets/{diagram-S7CK7UJ4-Bnht1X2m.js → diagram-S7CK7UJ4-B6gXFYBj.js} +1 -1
  304. package/dist/domains/dashboard/web/assets/{diagram-UQ7AKVKN-LELTI4PR.js → diagram-UQ7AKVKN-BBW6aRk8.js} +1 -1
  305. package/dist/domains/dashboard/web/assets/{diagram-VSXAHHWV-Do0fZuNG.js → diagram-VSXAHHWV-BC0CZeyH.js} +1 -1
  306. package/dist/domains/dashboard/web/assets/{diagram-VX7I27RA-B0rZTUwt.js → diagram-VX7I27RA-BmwBIkwS.js} +1 -1
  307. package/dist/domains/dashboard/web/assets/{diagram-Z3DM3KII-wn8xCc_j.js → diagram-Z3DM3KII-DTZgX9SF.js} +1 -1
  308. package/dist/domains/dashboard/web/assets/{dist-CYwDKy2m.js → dist-brXLwleg.js} +1 -1
  309. package/dist/domains/dashboard/web/assets/{ebnfDiagram-PWID7BFC-CMDOpP2T.js → ebnfDiagram-PWID7BFC-CsMXo0C6.js} +1 -1
  310. package/dist/domains/dashboard/web/assets/{erDiagram-RLTQ6QDP-C2d43bdq.js → erDiagram-RLTQ6QDP-DQ9ewX94.js} +1 -1
  311. package/dist/domains/dashboard/web/assets/{es-BzaOcXwu.js → es-CgcAhzLf.js} +1 -1
  312. package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-Ll12Q19y.js +1 -0
  313. package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-Bf2-9XUn.js +1 -0
  314. package/dist/domains/dashboard/web/assets/{ganttDiagram-EL5Y4UJY-hTH7TzhY.js → ganttDiagram-EL5Y4UJY-DIFkXe6G.js} +1 -1
  315. package/dist/domains/dashboard/web/assets/{gitGraph-4MIJSDKK-C3CCywb-.js → gitGraph-4MIJSDKK-BHY8ZnpE.js} +1 -1
  316. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-WWUBYQGX-DW6jDckj.js → gitGraphDiagram-WWUBYQGX-cBn9dMzs.js} +1 -1
  317. package/dist/domains/dashboard/web/assets/{index-CTZPz_mx.js → index-C_6nf1Fw.js} +3 -3
  318. package/dist/domains/dashboard/web/assets/{index-CWNqBYyI.css → index-Gaxnq6Jd.css} +1 -1
  319. package/dist/domains/dashboard/web/assets/{info-A6RAGUB7-Bg3eKis8.js → info-A6RAGUB7-DtUaS9jN.js} +1 -1
  320. package/dist/domains/dashboard/web/assets/{infoDiagram-27XIBGKW-7zk6ytVJ.js → infoDiagram-27XIBGKW-CIl0e_EN.js} +1 -1
  321. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-5VMMS53U-CGDCTmCQ.js → ishikawaDiagram-5VMMS53U-DAdtPZ_c.js} +1 -1
  322. package/dist/domains/dashboard/web/assets/{journeyDiagram-3NMN7TZE-C8_L_e8a.js → journeyDiagram-3NMN7TZE-CBokRgde.js} +1 -1
  323. package/dist/domains/dashboard/web/assets/{kanban-definition-UXKFOSKX-D5x6qTgM.js → kanban-definition-UXKFOSKX-DrqCYJ-7.js} +1 -1
  324. package/dist/domains/dashboard/web/assets/katex-D29apahB.js +257 -0
  325. package/dist/domains/dashboard/web/assets/{line-DC93oja4.js → line-BDlVqlh4.js} +1 -1
  326. package/dist/domains/dashboard/web/assets/{linear-81TNubkB.js → linear-DTAzui9x.js} +1 -1
  327. package/dist/domains/dashboard/web/assets/{mermaid-parser.core-D60d8uy9.js → mermaid-parser.core-CFw-xbYY.js} +3 -3
  328. package/dist/domains/dashboard/web/assets/{mermaid.core-l4Wgjz2Q.js → mermaid.core-Ck7fB8UD.js} +4 -4
  329. package/dist/domains/dashboard/web/assets/{mindmap-definition-YA3MSWOX-Dfqu1201.js → mindmap-definition-YA3MSWOX-C7kb9KL9.js} +1 -1
  330. package/dist/domains/dashboard/web/assets/{packet-AYTQ26CC-CsFZBhTs.js → packet-AYTQ26CC-P8Mtt0tp.js} +1 -1
  331. package/dist/domains/dashboard/web/assets/{pegDiagram-XKGWAZYB-myFMaA7n.js → pegDiagram-XKGWAZYB-DUDD9qv5.js} +1 -1
  332. package/dist/domains/dashboard/web/assets/{pie-WAS4IAKB-FMuCTNSk.js → pie-WAS4IAKB-dEmLxiDR.js} +1 -1
  333. package/dist/domains/dashboard/web/assets/{pieDiagram-E7YTZNPT-CSR4B4Z1.js → pieDiagram-E7YTZNPT-BUssAcqk.js} +1 -1
  334. package/dist/domains/dashboard/web/assets/purify.es-Bvo9QlJ8.js +3 -0
  335. package/dist/domains/dashboard/web/assets/{quadrantDiagram-AXDQQJYC-BiE4kEeP.js → quadrantDiagram-AXDQQJYC-BzaAWdQL.js} +1 -1
  336. package/dist/domains/dashboard/web/assets/{radar-RG4KPBEZ-BZ-n7JtG.js → radar-RG4KPBEZ-mqtvaz9w.js} +1 -1
  337. package/dist/domains/dashboard/web/assets/{railroad-74A4TZTK-CWVtRfHu.js → railroad-74A4TZTK-7tTnGpoz.js} +1 -1
  338. package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CpJvyBJM.js +1 -0
  339. package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-BJ5g77l6.js +1 -0
  340. package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-BslCK-Gr.js +1 -0
  341. package/dist/domains/dashboard/web/assets/{railroadDiagram-O6MQD6OU-CBj7v1de.js → railroadDiagram-O6MQD6OU-DM1AKXm0.js} +1 -1
  342. package/dist/domains/dashboard/web/assets/{requirementDiagram-BXWQKSXE-DSDgb54n.js → requirementDiagram-BXWQKSXE--H5KiPSc.js} +1 -1
  343. package/dist/domains/dashboard/web/assets/{sankeyDiagram-P5KCCOFB-1-oXLUAP.js → sankeyDiagram-P5KCCOFB-JweUq_u2.js} +1 -1
  344. package/dist/domains/dashboard/web/assets/{sequenceDiagram-WJ2MYXX4-DAF4nGs_.js → sequenceDiagram-WJ2MYXX4-pxb1iTGb.js} +1 -1
  345. package/dist/domains/dashboard/web/assets/{src-CTWLVUqE.js → src-joFOxopw.js} +1 -1
  346. package/dist/domains/dashboard/web/assets/{stateDiagram-D77RDMKH-DzENBaJT.js → stateDiagram-D77RDMKH-CDu5crd8.js} +1 -1
  347. package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-wV5AqWaM.js +1 -0
  348. package/dist/domains/dashboard/web/assets/{swimlanes-42K2YHIH-CnxFUZJc.js → swimlanes-42K2YHIH-ioSqowJ4.js} +1 -1
  349. package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-DOPLn-V5.js +8 -0
  350. package/dist/domains/dashboard/web/assets/{timeline-definition-24CTP7MA-KtvPzpZM.js → timeline-definition-24CTP7MA-2YXSYkS3.js} +1 -1
  351. package/dist/domains/dashboard/web/assets/{treeView-Q6P3EWNA-Bdu3P9iY.js → treeView-Q6P3EWNA-DEGims38.js} +1 -1
  352. package/dist/domains/dashboard/web/assets/{treemap-WGGIJYW6-DFnn23JR.js → treemap-WGGIJYW6-CJvBhTlR.js} +1 -1
  353. package/dist/domains/dashboard/web/assets/{vennDiagram-4TSXK5OY-BjpviP26.js → vennDiagram-4TSXK5OY-CHdNWhBK.js} +1 -1
  354. package/dist/domains/dashboard/web/assets/{wardley-WFR3VGLG-CEo4a-j4.js → wardley-WFR3VGLG-CVO9PCjo.js} +1 -1
  355. package/dist/domains/dashboard/web/assets/{wardleyDiagram-VM6X3IG4-Bf54n6im.js → wardleyDiagram-VM6X3IG4-RToPmij6.js} +1 -1
  356. package/dist/domains/dashboard/web/assets/{xychartDiagram-S5SC5T6Z-CU-hI0Cm.js → xychartDiagram-S5SC5T6Z-DaWHnpHE.js} +1 -1
  357. package/dist/domains/dashboard/web/index.html +2 -2
  358. package/dist/domains/project-knowledge/host-review.d.ts +15 -2
  359. package/dist/domains/project-knowledge/host-review.d.ts.map +1 -1
  360. package/dist/domains/project-knowledge/host-review.js +65 -25
  361. package/dist/domains/project-knowledge/host-review.js.map +1 -1
  362. package/dist/domains/project-knowledge/index.d.ts +1 -0
  363. package/dist/domains/project-knowledge/index.d.ts.map +1 -1
  364. package/dist/domains/project-knowledge/index.js +1 -0
  365. package/dist/domains/project-knowledge/index.js.map +1 -1
  366. package/dist/domains/project-knowledge/learning.d.ts +2 -1
  367. package/dist/domains/project-knowledge/learning.d.ts.map +1 -1
  368. package/dist/domains/project-knowledge/learning.js +6 -0
  369. package/dist/domains/project-knowledge/learning.js.map +1 -1
  370. package/dist/domains/project-knowledge/plugin.d.ts.map +1 -1
  371. package/dist/domains/project-knowledge/plugin.js +3 -1
  372. package/dist/domains/project-knowledge/plugin.js.map +1 -1
  373. package/dist/domains/skill/dsh-adapter.d.ts +5 -1
  374. package/dist/domains/skill/dsh-adapter.d.ts.map +1 -1
  375. package/dist/domains/skill/dsh-adapter.js +222 -87
  376. package/dist/domains/skill/dsh-adapter.js.map +1 -1
  377. package/dist/domains/skill/platform-inspect.d.ts +1 -0
  378. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  379. package/dist/domains/skill/platform-inspect.js +8 -4
  380. package/dist/domains/skill/platform-inspect.js.map +1 -1
  381. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  382. package/dist/domains/skill/platform-install.js +7 -7
  383. package/dist/domains/skill/platform-install.js.map +1 -1
  384. package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -1
  385. package/dist/domains/workflow-contract/hook-target-scope.js +2 -1
  386. package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -1
  387. package/dist/platform/fs/file-system.d.ts +2 -0
  388. package/dist/platform/fs/file-system.d.ts.map +1 -1
  389. package/dist/platform/fs/file-system.js +11 -0
  390. package/dist/platform/fs/file-system.js.map +1 -1
  391. package/dist/platform/install/dsh-profiles.d.ts +3 -0
  392. package/dist/platform/install/dsh-profiles.d.ts.map +1 -0
  393. package/dist/platform/install/dsh-profiles.js +40 -0
  394. package/dist/platform/install/dsh-profiles.js.map +1 -0
  395. package/dist/platform/install/platforms.d.ts.map +1 -1
  396. package/dist/platform/install/platforms.js +1 -0
  397. package/dist/platform/install/platforms.js.map +1 -1
  398. package/dist/platform/install/project-registry.d.ts +7 -1
  399. package/dist/platform/install/project-registry.d.ts.map +1 -1
  400. package/dist/platform/install/project-registry.js +49 -5
  401. package/dist/platform/install/project-registry.js.map +1 -1
  402. package/dist/platform/paths/git-worktree-cache.d.ts +3 -0
  403. package/dist/platform/paths/git-worktree-cache.d.ts.map +1 -0
  404. package/dist/platform/paths/git-worktree-cache.js +109 -0
  405. package/dist/platform/paths/git-worktree-cache.js.map +1 -0
  406. package/dist/platform/paths/git-worktree.d.ts +6 -0
  407. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  408. package/dist/platform/paths/git-worktree.js +191 -30
  409. package/dist/platform/paths/git-worktree.js.map +1 -1
  410. package/dist/platform/paths/project-worktree-root.d.ts +3 -0
  411. package/dist/platform/paths/project-worktree-root.d.ts.map +1 -0
  412. package/dist/platform/paths/project-worktree-root.js +14 -0
  413. package/dist/platform/paths/project-worktree-root.js.map +1 -0
  414. package/dist/platform/process/comet-daemon.d.ts +3 -0
  415. package/dist/platform/process/comet-daemon.d.ts.map +1 -1
  416. package/dist/platform/process/comet-daemon.js +8 -6
  417. package/dist/platform/process/comet-daemon.js.map +1 -1
  418. package/dist/platform/process/external-command.d.ts +3 -0
  419. package/dist/platform/process/external-command.d.ts.map +1 -1
  420. package/dist/platform/process/external-command.js +69 -2
  421. package/dist/platform/process/external-command.js.map +1 -1
  422. package/dist/platform/process/git.d.ts.map +1 -1
  423. package/dist/platform/process/git.js +3 -4
  424. package/dist/platform/process/git.js.map +1 -1
  425. package/dist/platform/process/hook-adapter.d.ts +2 -0
  426. package/dist/platform/process/hook-adapter.d.ts.map +1 -1
  427. package/dist/platform/process/hook-adapter.js +45 -3
  428. package/dist/platform/process/hook-adapter.js.map +1 -1
  429. package/dist/platform/process/hook-read-cache.d.ts +2 -0
  430. package/dist/platform/process/hook-read-cache.d.ts.map +1 -1
  431. package/dist/platform/process/hook-read-cache.js +25 -13
  432. package/dist/platform/process/hook-read-cache.js.map +1 -1
  433. package/dist/platform/process/process-identity.d.ts.map +1 -1
  434. package/dist/platform/process/process-identity.js +18 -51
  435. package/dist/platform/process/process-identity.js.map +1 -1
  436. package/dist/platform/process/runtime-metrics.d.ts +10 -1
  437. package/dist/platform/process/runtime-metrics.d.ts.map +1 -1
  438. package/dist/platform/process/runtime-metrics.js +37 -2
  439. package/dist/platform/process/runtime-metrics.js.map +1 -1
  440. package/dist/platform/process/windows-process-broker.d.ts +1 -0
  441. package/dist/platform/process/windows-process-broker.d.ts.map +1 -1
  442. package/dist/platform/process/windows-process-broker.js +70 -11
  443. package/dist/platform/process/windows-process-broker.js.map +1 -1
  444. package/dist/platform/process/windows-process-identity.d.ts +6 -0
  445. package/dist/platform/process/windows-process-identity.d.ts.map +1 -0
  446. package/dist/platform/process/windows-process-identity.js +190 -0
  447. package/dist/platform/process/windows-process-identity.js.map +1 -0
  448. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +11 -3
  449. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +11 -3
  450. package/eval/local/tests/scaffold/test_task_resolution.py +6 -2
  451. package/package.json +14 -8
  452. package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-QeljAKq2.js +0 -1
  453. package/dist/domains/dashboard/web/assets/channel-_AqwP0KA.js +0 -1
  454. package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-CRo4aB_7.js +0 -1
  455. package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-CRo4aB_7.js +0 -1
  456. package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-KYANo3DQ.js +0 -1
  457. package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-CSROlLuj.js +0 -1
  458. package/dist/domains/dashboard/web/assets/katex-CXMH3UgJ.js +0 -257
  459. package/dist/domains/dashboard/web/assets/purify.es-ChwZkWde.js +0 -3
  460. package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CkHwwI2i.js +0 -1
  461. package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-8xzEHL6v.js +0 -1
  462. package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-nSHBw0tH.js +0 -1
  463. package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-CNw52Fkn.js +0 -1
  464. package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-6TRvbqqI.js +0 -8
@@ -1,148 +1,148 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Rp=Object.create;var Nc=Object.defineProperty;var _p=Object.getOwnPropertyDescriptor;var Ap=Object.getOwnPropertyNames;var Ip=Object.getPrototypeOf,Tp=Object.prototype.hasOwnProperty;var Pi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var k=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}};var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var jp=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ap(t))!Tp.call(e,n)&&n!==r&&Nc(e,n,{get:()=>t[n],enumerable:!(i=_p(t,n))||i.enumerable});return e};var Ve=(e,t,r)=>(r=e!=null?Rp(Ip(e)):{},jp(t||!e||!e.__esModule?Nc(r,"default",{value:e,enumerable:!0}):r,e));var R=g(z=>{"use strict";var Ca=Symbol.for("yaml.alias"),bc=Symbol.for("yaml.document"),Ri=Symbol.for("yaml.map"),kc=Symbol.for("yaml.pair"),Pa=Symbol.for("yaml.scalar"),_i=Symbol.for("yaml.seq"),Te=Symbol.for("yaml.node.type"),$p=e=>!!e&&typeof e=="object"&&e[Te]===Ca,Op=e=>!!e&&typeof e=="object"&&e[Te]===bc,Hp=e=>!!e&&typeof e=="object"&&e[Te]===Ri,Dp=e=>!!e&&typeof e=="object"&&e[Te]===kc,Sc=e=>!!e&&typeof e=="object"&&e[Te]===Pa,Lp=e=>!!e&&typeof e=="object"&&e[Te]===_i;function Ec(e){if(e&&typeof e=="object")switch(e[Te]){case Ri:case _i:return!0}return!1}function Mp(e){if(e&&typeof e=="object")switch(e[Te]){case Ca:case Ri:case Pa:case _i:return!0}return!1}var Fp=e=>(Sc(e)||Ec(e))&&!!e.anchor;z.ALIAS=Ca;z.DOC=bc;z.MAP=Ri;z.NODE_TYPE=Te;z.PAIR=kc;z.SCALAR=Pa;z.SEQ=_i;z.hasAnchor=Fp;z.isAlias=$p;z.isCollection=Ec;z.isDocument=Op;z.isMap=Hp;z.isNode=Mp;z.isPair=Dp;z.isScalar=Sc;z.isSeq=Lp});var cr=g(Ra=>{"use strict";var V=R(),Q=Symbol("break visit"),xc=Symbol("skip children"),Se=Symbol("remove node");function Ai(e,t){let r=Cc(t);V.isDocument(e)?_t(null,e.contents,r,Object.freeze([e]))===Se&&(e.contents=null):_t(null,e,r,Object.freeze([]))}Ai.BREAK=Q;Ai.SKIP=xc;Ai.REMOVE=Se;function _t(e,t,r,i){let n=Pc(e,t,r,i);if(V.isNode(n)||V.isPair(n))return Rc(e,i,n),_t(e,n,r,i);if(typeof n!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let a=0;a<t.items.length;++a){let o=_t(a,t.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===Q)return Q;o===Se&&(t.items.splice(a,1),a-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let a=_t("key",t.key,r,i);if(a===Q)return Q;a===Se&&(t.key=null);let o=_t("value",t.value,r,i);if(o===Q)return Q;o===Se&&(t.value=null)}}return n}async function Ii(e,t){let r=Cc(t);V.isDocument(e)?await At(null,e.contents,r,Object.freeze([e]))===Se&&(e.contents=null):await At(null,e,r,Object.freeze([]))}Ii.BREAK=Q;Ii.SKIP=xc;Ii.REMOVE=Se;async function At(e,t,r,i){let n=await Pc(e,t,r,i);if(V.isNode(n)||V.isPair(n))return Rc(e,i,n),At(e,n,r,i);if(typeof n!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let a=0;a<t.items.length;++a){let o=await At(a,t.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===Q)return Q;o===Se&&(t.items.splice(a,1),a-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let a=await At("key",t.key,r,i);if(a===Q)return Q;a===Se&&(t.key=null);let o=await At("value",t.value,r,i);if(o===Q)return Q;o===Se&&(t.value=null)}}return n}function Cc(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Pc(e,t,r,i){if(typeof r=="function")return r(e,t,i);if(V.isMap(t))return r.Map?.(e,t,i);if(V.isSeq(t))return r.Seq?.(e,t,i);if(V.isPair(t))return r.Pair?.(e,t,i);if(V.isScalar(t))return r.Scalar?.(e,t,i);if(V.isAlias(t))return r.Alias?.(e,t,i)}function Rc(e,t,r){let i=t[t.length-1];if(V.isCollection(i))i.items[e]=r;else if(V.isPair(i))e==="key"?i.key=r:i.value=r;else if(V.isDocument(i))i.contents=r;else{let n=V.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Ra.visit=Ai;Ra.visitAsync=Ii});var _a=g(Ac=>{"use strict";var _c=R(),Bp=cr(),Vp={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},qp=e=>e.replace(/[!,[\]{}]/g,t=>Vp[t]),lr=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[a,o]=i;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[a]=i;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,o),!1}}default:return r(0,`Unknown directive ${n}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,i,n]=t.match(/^(.*!)([^!]*)$/s);n||r(`The ${t} tag has no suffix`);let a=this.tags[i];if(a)try{return a+decodeURIComponent(n)}catch(o){return r(String(o)),null}return i==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,i]of Object.entries(this.tags))if(t.startsWith(i))return r+qp(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(t&&i.length>0&&_c.isNode(t.contents)){let a={};Bp.visit(t.contents,(o,s)=>{_c.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of i)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(s=>s.startsWith(o)))&&r.push(`%TAG ${a} ${o}`);return r.join(`
5
- `)}};lr.defaultYaml={explicit:!1,version:"1.2"};lr.defaultTags={"!!":"tag:yaml.org,2002:"};Ac.Directives=lr});var Ti=g(ur=>{"use strict";var Ic=R(),Wp=cr();function zp(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function Tc(e){let t=new Set;return Wp.visit(e,{Value(r,i){i.anchor&&t.add(i.anchor)}}),t}function jc(e,t){for(let r=1;;++r){let i=`${e}${r}`;if(!t.has(i))return i}}function Jp(e,t){let r=[],i=new Map,n=null;return{onAnchor:a=>{r.push(a),n??(n=Tc(e));let o=jc(t,n);return n.add(o),o},setAnchors:()=>{for(let a of r){let o=i.get(a);if(typeof o=="object"&&o.anchor&&(Ic.isScalar(o.node)||Ic.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:i}}ur.anchorIsValid=zp;ur.anchorNames=Tc;ur.createNodeAnchors=Jp;ur.findNewAnchor=jc});var Aa=g($c=>{"use strict";function dr(e,t,r,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,a=i.length;n<a;++n){let o=i[n],s=dr(e,i,String(n),o);s===void 0?delete i[n]:s!==o&&(i[n]=s)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let a=i.get(n),o=dr(e,i,n,a);o===void 0?i.delete(n):o!==a&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let a=dr(e,i,n,n);a===void 0?i.delete(n):a!==n&&(i.delete(n),i.add(a))}else for(let[n,a]of Object.entries(i)){let o=dr(e,i,n,a);o===void 0?delete i[n]:o!==a&&(i[n]=o)}return e.call(t,r,i)}$c.applyReviver=dr});var qe=g(Hc=>{"use strict";var Gp=R();function Oc(e,t,r){if(Array.isArray(e))return e.map((i,n)=>Oc(i,String(n),r));if(e&&typeof e.toJSON=="function"){if(!r||!Gp.hasAnchor(e))return e.toJSON(t,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=a=>{i.res=a,delete r.onCreate};let n=e.toJSON(t,r);return r.onCreate&&r.onCreate(n),n}return typeof e=="bigint"&&!r?.keep?Number(e):e}Hc.toJS=Oc});var ji=g(Lc=>{"use strict";var Up=Aa(),Dc=R(),Kp=qe(),Ia=class{constructor(t){Object.defineProperty(this,Dc.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:i,onAnchor:n,reviver:a}={}){if(!Dc.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},s=Kp.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?Up.applyReviver(a,{"":s},"",s):s}};Lc.NodeBase=Ia});var fr=g(Mc=>{"use strict";var Yp=Ti(),Xp=cr(),It=R(),Qp=ji(),Zp=qe(),Ta=class extends Qp.NodeBase{constructor(t){super(It.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;r?.aliasResolveCache?i=r.aliasResolveCache:(i=[],Xp.visit(t,{Node:(a,o)=>{(It.isAlias(o)||It.hasAnchor(o))&&i.push(o)}}),r&&(r.aliasResolveCache=i));let n;for(let a of i){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(t,r){if(!r)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:a}=r,o=this.resolve(n,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=i.get(o);if(s||(Zp.toJS(o,null,r),s=i.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=$i(n,o,i)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,r,i){let n=`*${this.source}`;if(t){if(Yp.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${n} `}return n}};function $i(e,t,r){if(It.isAlias(t)){let i=t.resolve(e),n=r&&i&&r.get(i);return n?n.count*n.aliasCount:0}else if(It.isCollection(t)){let i=0;for(let n of t.items){let a=$i(e,n,r);a>i&&(i=a)}return i}else if(It.isPair(t)){let i=$i(e,t.key,r),n=$i(e,t.value,r);return Math.max(i,n)}return 1}Mc.Alias=Ta});var M=g(ja=>{"use strict";var eh=R(),th=ji(),rh=qe(),ih=e=>!e||typeof e!="function"&&typeof e!="object",We=class extends th.NodeBase{constructor(t){super(eh.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:rh.toJS(this.value,t,r)}toString(){return String(this.value)}};We.BLOCK_FOLDED="BLOCK_FOLDED";We.BLOCK_LITERAL="BLOCK_LITERAL";We.PLAIN="PLAIN";We.QUOTE_DOUBLE="QUOTE_DOUBLE";We.QUOTE_SINGLE="QUOTE_SINGLE";ja.Scalar=We;ja.isScalarValue=ih});var pr=g(Bc=>{"use strict";var nh=fr(),ft=R(),Fc=M(),ah="tag:yaml.org,2002:";function oh(e,t,r){if(t){let i=r.filter(a=>a.tag===t),n=i.find(a=>!a.format)??i[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return r.find(i=>i.identify?.(e)&&!i.format)}function sh(e,t,r){if(ft.isDocument(e)&&(e=e.contents),ft.isNode(e))return e;if(ft.isPair(e)){let d=r.schema[ft.MAP].createNode?.(r.schema,null,r);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=r,c;if(i&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=n(e)),new nh.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=ah+t.slice(2));let l=oh(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new Fc.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?o[ft.MAP]:Symbol.iterator in Object(e)?o[ft.SEQ]:o[ft.MAP]}a&&(a(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,e,r):new Fc.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}Bc.createNode=sh});var Hi=g(Oi=>{"use strict";var ch=pr(),Ee=R(),lh=ji();function $a(e,t,r){let i=r;for(let n=t.length-1;n>=0;--n){let a=t[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=i,i=o}else i=new Map([[a,i]])}return ch.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Vc=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Oa=class extends lh.NodeBase{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(i=>Ee.isNode(i)||Ee.isPair(i)?i.clone(t):i),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(Vc(t))this.add(r);else{let[i,...n]=t,a=this.get(i,!0);if(Ee.isCollection(a))a.addIn(n,r);else if(a===void 0&&this.schema)this.set(i,$a(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(t){let[r,...i]=t;if(i.length===0)return this.delete(r);let n=this.get(r,!0);if(Ee.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}getIn(t,r){let[i,...n]=t,a=this.get(i,!0);return n.length===0?!r&&Ee.isScalar(a)?a.value:a:Ee.isCollection(a)?a.getIn(n,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!Ee.isPair(r))return!1;let i=r.value;return i==null||t&&Ee.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[r,...i]=t;if(i.length===0)return this.has(r);let n=this.get(r,!0);return Ee.isCollection(n)?n.hasIn(i):!1}setIn(t,r){let[i,...n]=t;if(n.length===0)this.set(i,r);else{let a=this.get(i,!0);if(Ee.isCollection(a))a.setIn(n,r);else if(a===void 0&&this.schema)this.set(i,$a(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};Oi.Collection=Oa;Oi.collectionFromPath=$a;Oi.isEmptyPath=Vc});var hr=g(Di=>{"use strict";var uh=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Ha(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var dh=(e,t,r)=>e.endsWith(`
6
- `)?Ha(r,t):r.includes(`
4
+ var Kh=Object.create;var gl=Object.defineProperty;var Yh=Object.getOwnPropertyDescriptor;var Xh=Object.getOwnPropertyNames;var Qh=Object.getPrototypeOf,Zh=Object.prototype.hasOwnProperty;var rn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var k=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(i){throw r=[i],i}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var em=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Xh(e))!Zh.call(t,n)&&n!==r&&gl(t,n,{get:()=>e[n],enumerable:!(i=Yh(e,n))||i.enumerable});return t};var Qe=(t,e,r)=>(r=t!=null?Kh(Qh(t)):{},em(e||!t||!t.__esModule?gl(r,"default",{value:t,enumerable:!0}):r,t));var _=w(J=>{"use strict";var mo=Symbol.for("yaml.alias"),wl=Symbol.for("yaml.document"),nn=Symbol.for("yaml.map"),yl=Symbol.for("yaml.pair"),vo=Symbol.for("yaml.scalar"),an=Symbol.for("yaml.seq"),Ve=Symbol.for("yaml.node.type"),tm=t=>!!t&&typeof t=="object"&&t[Ve]===mo,rm=t=>!!t&&typeof t=="object"&&t[Ve]===wl,im=t=>!!t&&typeof t=="object"&&t[Ve]===nn,nm=t=>!!t&&typeof t=="object"&&t[Ve]===yl,Nl=t=>!!t&&typeof t=="object"&&t[Ve]===vo,am=t=>!!t&&typeof t=="object"&&t[Ve]===an;function bl(t){if(t&&typeof t=="object")switch(t[Ve]){case nn:case an:return!0}return!1}function om(t){if(t&&typeof t=="object")switch(t[Ve]){case mo:case nn:case vo:case an:return!0}return!1}var sm=t=>(Nl(t)||bl(t))&&!!t.anchor;J.ALIAS=mo;J.DOC=wl;J.MAP=nn;J.NODE_TYPE=Ve;J.PAIR=yl;J.SCALAR=vo;J.SEQ=an;J.hasAnchor=sm;J.isAlias=tm;J.isCollection=bl;J.isDocument=rm;J.isMap=im;J.isNode=om;J.isPair=nm;J.isScalar=Nl;J.isSeq=am});var Rr=w(go=>{"use strict";var W=_(),te=Symbol("break visit"),kl=Symbol("skip children"),Ae=Symbol("remove node");function on(t,e){let r=Sl(e);W.isDocument(t)?zt(null,t.contents,r,Object.freeze([t]))===Ae&&(t.contents=null):zt(null,t,r,Object.freeze([]))}on.BREAK=te;on.SKIP=kl;on.REMOVE=Ae;function zt(t,e,r,i){let n=El(t,e,r,i);if(W.isNode(n)||W.isPair(n))return xl(t,i,n),zt(t,n,r,i);if(typeof n!="symbol"){if(W.isCollection(e)){i=Object.freeze(i.concat(e));for(let a=0;a<e.items.length;++a){let o=zt(a,e.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===te)return te;o===Ae&&(e.items.splice(a,1),a-=1)}}}else if(W.isPair(e)){i=Object.freeze(i.concat(e));let a=zt("key",e.key,r,i);if(a===te)return te;a===Ae&&(e.key=null);let o=zt("value",e.value,r,i);if(o===te)return te;o===Ae&&(e.value=null)}}return n}async function sn(t,e){let r=Sl(e);W.isDocument(t)?await Gt(null,t.contents,r,Object.freeze([t]))===Ae&&(t.contents=null):await Gt(null,t,r,Object.freeze([]))}sn.BREAK=te;sn.SKIP=kl;sn.REMOVE=Ae;async function Gt(t,e,r,i){let n=await El(t,e,r,i);if(W.isNode(n)||W.isPair(n))return xl(t,i,n),Gt(t,n,r,i);if(typeof n!="symbol"){if(W.isCollection(e)){i=Object.freeze(i.concat(e));for(let a=0;a<e.items.length;++a){let o=await Gt(a,e.items[a],r,i);if(typeof o=="number")a=o-1;else{if(o===te)return te;o===Ae&&(e.items.splice(a,1),a-=1)}}}else if(W.isPair(e)){i=Object.freeze(i.concat(e));let a=await Gt("key",e.key,r,i);if(a===te)return te;a===Ae&&(e.key=null);let o=await Gt("value",e.value,r,i);if(o===te)return te;o===Ae&&(e.value=null)}}return n}function Sl(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function El(t,e,r,i){if(typeof r=="function")return r(t,e,i);if(W.isMap(e))return r.Map?.(t,e,i);if(W.isSeq(e))return r.Seq?.(t,e,i);if(W.isPair(e))return r.Pair?.(t,e,i);if(W.isScalar(e))return r.Scalar?.(t,e,i);if(W.isAlias(e))return r.Alias?.(t,e,i)}function xl(t,e,r){let i=e[e.length-1];if(W.isCollection(i))i.items[t]=r;else if(W.isPair(i))t==="key"?i.key=r:i.value=r;else if(W.isDocument(i))i.contents=r;else{let n=W.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}go.visit=on;go.visitAsync=sn});var wo=w(Pl=>{"use strict";var Cl=_(),cm=Rr(),lm={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},um=t=>t.replace(/[!,[\]{}]/g,e=>lm[e]),_r=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[a,o]=i;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[a]=i;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,o),!1}}default:return r(0,`Unknown directive ${n}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,i,n]=e.match(/^(.*!)([^!]*)$/s);n||r(`The ${e} tag has no suffix`);let a=this.tags[i];if(a)try{return a+decodeURIComponent(n)}catch(o){return r(String(o)),null}return i==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,i]of Object.entries(this.tags))if(e.startsWith(i))return r+um(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&Cl.isNode(e.contents)){let a={};cm.visit(e.contents,(o,s)=>{Cl.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of i)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(s=>s.startsWith(o)))&&r.push(`%TAG ${a} ${o}`);return r.join(`
5
+ `)}};_r.defaultYaml={explicit:!1,version:"1.2"};_r.defaultTags={"!!":"tag:yaml.org,2002:"};Pl.Directives=_r});var cn=w(Ar=>{"use strict";var Rl=_(),dm=Rr();function fm(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function _l(t){let e=new Set;return dm.visit(t,{Value(r,i){i.anchor&&e.add(i.anchor)}}),e}function Al(t,e){for(let r=1;;++r){let i=`${t}${r}`;if(!e.has(i))return i}}function pm(t,e){let r=[],i=new Map,n=null;return{onAnchor:a=>{r.push(a),n??(n=_l(t));let o=Al(e,n);return n.add(o),o},setAnchors:()=>{for(let a of r){let o=i.get(a);if(typeof o=="object"&&o.anchor&&(Rl.isScalar(o.node)||Rl.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:i}}Ar.anchorIsValid=fm;Ar.anchorNames=_l;Ar.createNodeAnchors=pm;Ar.findNewAnchor=Al});var yo=w(Il=>{"use strict";function Ir(t,e,r,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,a=i.length;n<a;++n){let o=i[n],s=Ir(t,i,String(n),o);s===void 0?delete i[n]:s!==o&&(i[n]=s)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let a=i.get(n),o=Ir(t,i,n,a);o===void 0?i.delete(n):o!==a&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let a=Ir(t,i,n,n);a===void 0?i.delete(n):a!==n&&(i.delete(n),i.add(a))}else for(let[n,a]of Object.entries(i)){let o=Ir(t,i,n,a);o===void 0?delete i[n]:o!==a&&(i[n]=o)}return t.call(e,r,i)}Il.applyReviver=Ir});var Ze=w($l=>{"use strict";var hm=_();function Tl(t,e,r){if(Array.isArray(t))return t.map((i,n)=>Tl(i,String(n),r));if(t&&typeof t.toJSON=="function"){if(!r||!hm.hasAnchor(t))return t.toJSON(e,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(t,i),r.onCreate=a=>{i.res=a,delete r.onCreate};let n=t.toJSON(e,r);return r.onCreate&&r.onCreate(n),n}return typeof t=="bigint"&&!r?.keep?Number(t):t}$l.toJS=Tl});var ln=w(Ol=>{"use strict";var mm=yo(),jl=_(),vm=Ze(),No=class{constructor(e){Object.defineProperty(this,jl.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:i,onAnchor:n,reviver:a}={}){if(!jl.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},s=vm.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?mm.applyReviver(a,{"":s},"",s):s}};Ol.NodeBase=No});var Tr=w(Hl=>{"use strict";var gm=cn(),wm=Rr(),Jt=_(),ym=ln(),Nm=Ze(),bo=class extends ym.NodeBase{constructor(e){super(Jt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;r?.aliasResolveCache?i=r.aliasResolveCache:(i=[],wm.visit(e,{Node:(a,o)=>{(Jt.isAlias(o)||Jt.hasAnchor(o))&&i.push(o)}}),r&&(r.aliasResolveCache=i));let n;for(let a of i){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(e,r){if(!r)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:a}=r,o=this.resolve(n,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=i.get(o);if(s||(Nm.toJS(o,null,r),s=i.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=un(n,o,i)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,r,i){let n=`*${this.source}`;if(e){if(gm.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${n} `}return n}};function un(t,e,r){if(Jt.isAlias(e)){let i=e.resolve(t),n=r&&i&&r.get(i);return n?n.count*n.aliasCount:0}else if(Jt.isCollection(e)){let i=0;for(let n of e.items){let a=un(t,n,r);a>i&&(i=a)}return i}else if(Jt.isPair(e)){let i=un(t,e.key,r),n=un(t,e.value,r);return Math.max(i,n)}return 1}Hl.Alias=bo});var F=w(ko=>{"use strict";var bm=_(),km=ln(),Sm=Ze(),Em=t=>!t||typeof t!="function"&&typeof t!="object",et=class extends km.NodeBase{constructor(e){super(bm.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Sm.toJS(this.value,e,r)}toString(){return String(this.value)}};et.BLOCK_FOLDED="BLOCK_FOLDED";et.BLOCK_LITERAL="BLOCK_LITERAL";et.PLAIN="PLAIN";et.QUOTE_DOUBLE="QUOTE_DOUBLE";et.QUOTE_SINGLE="QUOTE_SINGLE";ko.Scalar=et;ko.isScalarValue=Em});var $r=w(Ll=>{"use strict";var xm=Tr(),St=_(),Dl=F(),Cm="tag:yaml.org,2002:";function Pm(t,e,r){if(e){let i=r.filter(a=>a.tag===e),n=i.find(a=>!a.format)??i[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return r.find(i=>i.identify?.(t)&&!i.format)}function Rm(t,e,r){if(St.isDocument(t)&&(t=t.contents),St.isNode(t))return t;if(St.isPair(t)){let d=r.schema[St.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=r,c;if(i&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=n(t)),new xm.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=Cm+e.slice(2));let l=Pm(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Dl.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?o[St.MAP]:Symbol.iterator in Object(t)?o[St.SEQ]:o[St.MAP]}a&&(a(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Dl.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Ll.createNode=Rm});var fn=w(dn=>{"use strict";var _m=$r(),Ie=_(),Am=ln();function So(t,e,r){let i=r;for(let n=e.length-1;n>=0;--n){let a=e[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=i,i=o}else i=new Map([[a,i]])}return _m.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Bl=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Eo=class extends Am.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(i=>Ie.isNode(i)||Ie.isPair(i)?i.clone(e):i),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Bl(e))this.add(r);else{let[i,...n]=e,a=this.get(i,!0);if(Ie.isCollection(a))a.addIn(n,r);else if(a===void 0&&this.schema)this.set(i,So(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[r,...i]=e;if(i.length===0)return this.delete(r);let n=this.get(r,!0);if(Ie.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}getIn(e,r){let[i,...n]=e,a=this.get(i,!0);return n.length===0?!r&&Ie.isScalar(a)?a.value:a:Ie.isCollection(a)?a.getIn(n,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ie.isPair(r))return!1;let i=r.value;return i==null||e&&Ie.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[r,...i]=e;if(i.length===0)return this.has(r);let n=this.get(r,!0);return Ie.isCollection(n)?n.hasIn(i):!1}setIn(e,r){let[i,...n]=e;if(n.length===0)this.set(i,r);else{let a=this.get(i,!0);if(Ie.isCollection(a))a.setIn(n,r);else if(a===void 0&&this.schema)this.set(i,So(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};dn.Collection=Eo;dn.collectionFromPath=So;dn.isEmptyPath=Bl});var jr=w(pn=>{"use strict";var Im=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function xo(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Tm=(t,e,r)=>t.endsWith(`
6
+ `)?xo(r,e):r.includes(`
7
7
  `)?`
8
- `+Ha(r,t):(e.endsWith(" ")?"":" ")+r;Di.indentComment=Ha;Di.lineComment=dh;Di.stringifyComment=uh});var Wc=g(mr=>{"use strict";var fh="flow",Da="block",Li="quoted";function ph(e,t,r="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return e;n<a&&(a=0);let c=Math.max(1+a,1+n-t.length);if(e.length<=c)return e;let l=[],u={},d=n-t.length;typeof i=="number"&&(i>n-Math.max(2,a)?l.push(0):d=n-i);let f,h,v=!1,p=-1,m=-1,w=-1;r===Da&&(p=qc(e,p,t.length),p!==-1&&(d=p+c));for(let b;b=e[p+=1];){if(r===Li&&b==="\\"){switch(m=p,e[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(b===`
9
- `)r===Da&&(p=qc(e,p,t.length)),d=p+t.length+c,f=void 0;else{if(b===" "&&h&&h!==" "&&h!==`
10
- `&&h!==" "){let S=e[p+1];S&&S!==" "&&S!==`
11
- `&&S!==" "&&(f=p)}if(p>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Li){for(;h===" "||h===" ";)h=b,b=e[p+=1],v=!0;let S=p>w+1?p-2:m-1;if(u[S])return e;l.push(S),u[S]=!0,d=S+c,f=void 0}else v=!0}h=b}if(v&&s&&s(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let S=l[b],E=l[b+1]||e.length;S===0?y=`
12
- ${t}${e.slice(0,E)}`:(r===Li&&u[S]&&(y+=`${e[S]}\\`),y+=`
13
- ${t}${e.slice(S+1,E)}`)}return y}function qc(e,t,r){let i=t,n=t+1,a=e[n];for(;a===" "||a===" ";)if(t<n+r)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
- `);i=t,n=t+1,a=e[n]}return i}mr.FOLD_BLOCK=Da;mr.FOLD_FLOW=fh;mr.FOLD_QUOTED=Li;mr.foldFlowLines=ph});var gr=g(zc=>{"use strict";var fe=M(),ze=Wc(),Fi=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Bi=e=>/^(%|---|\.\.\.)/m.test(e);function hh(e,t,r){if(!t||t<0)return!1;let i=t-r,n=e.length;if(n<=i)return!1;for(let a=0,o=0;a<n;++a)if(e[a]===`
15
- `){if(a-o>i)return!0;if(o=a+1,n-o<=i)return!1}return!0}function vr(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,n=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Bi(e)?" ":""),o="",s=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(s,c);let u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(c,6)}c+=5,s=c+1}break;case"n":if(i||r[c+2]==='"'||r.length<n)c+=1;else{for(o+=r.slice(s,c)+`
8
+ `+xo(r,e):(t.endsWith(" ")?"":" ")+r;pn.indentComment=xo;pn.lineComment=Tm;pn.stringifyComment=Im});var Fl=w(Or=>{"use strict";var $m="flow",Co="block",hn="quoted";function jm(t,e,r="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return t;n<a&&(a=0);let c=Math.max(1+a,1+n-e.length);if(t.length<=c)return t;let l=[],u={},d=n-e.length;typeof i=="number"&&(i>n-Math.max(2,a)?l.push(0):d=n-i);let f,h,v=!1,p=-1,m=-1,g=-1;r===Co&&(p=Ml(t,p,e.length),p!==-1&&(d=p+c));for(let N;N=t[p+=1];){if(r===hn&&N==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}g=p}if(N===`
9
+ `)r===Co&&(p=Ml(t,p,e.length)),d=p+e.length+c,f=void 0;else{if(N===" "&&h&&h!==" "&&h!==`
10
+ `&&h!==" "){let S=t[p+1];S&&S!==" "&&S!==`
11
+ `&&S!==" "&&(f=p)}if(p>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===hn){for(;h===" "||h===" ";)h=N,N=t[p+=1],v=!0;let S=p>g+1?p-2:m-1;if(u[S])return t;l.push(S),u[S]=!0,d=S+c,f=void 0}else v=!0}h=N}if(v&&s&&s(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let N=0;N<l.length;++N){let S=l[N],x=l[N+1]||t.length;S===0?y=`
12
+ ${e}${t.slice(0,x)}`:(r===hn&&u[S]&&(y+=`${t[S]}\\`),y+=`
13
+ ${e}${t.slice(S+1,x)}`)}return y}function Ml(t,e,r){let i=e,n=e+1,a=t[n];for(;a===" "||a===" ";)if(e<n+r)a=t[++e];else{do a=t[++e];while(a&&a!==`
14
+ `);i=e,n=e+1,a=t[n]}return i}Or.FOLD_BLOCK=Co;Or.FOLD_FLOW=$m;Or.FOLD_QUOTED=hn;Or.foldFlowLines=jm});var Dr=w(ql=>{"use strict";var we=F(),tt=Fl(),vn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),gn=t=>/^(%|---|\.\.\.)/m.test(t);function Om(t,e,r){if(!e||e<0)return!1;let i=e-r,n=t.length;if(n<=i)return!1;for(let a=0,o=0;a<n;++a)if(t[a]===`
15
+ `){if(a-o>i)return!0;if(o=a+1,n-o<=i)return!1}return!0}function Hr(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=e,n=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(gn(t)?" ":""),o="",s=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(s,c);let u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(c,6)}c+=5,s=c+1}break;case"n":if(i||r[c+2]==='"'||r.length<n)c+=1;else{for(o+=r.slice(s,c)+`
16
16
 
17
17
  `;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)o+=`
18
- `,c+=2;o+=a,r[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+r.slice(s):r,i?o:ze.foldFlowLines(o,a,ze.FOLD_QUOTED,Fi(t,!1))}function La(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(e))return vr(e,t);let r=t.indent||(Bi(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${r}`)+"'";return t.implicitKey?i:ze.foldFlowLines(i,r,ze.FOLD_FLOW,Fi(t,!1))}function Tt(e,t){let{singleQuote:r}=t.options,i;if(r===!1)i=vr;else{let n=e.includes('"'),a=e.includes("'");n&&!a?i=La:a&&!n?i=vr:i=r?La:vr}return i(e,t)}var Ma;try{Ma=new RegExp(`(^|(?<!
18
+ `,c+=2;o+=a,r[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+r.slice(s):r,i?o:tt.foldFlowLines(o,a,tt.FOLD_QUOTED,vn(e,!1))}function Po(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return Hr(t,e);let r=e.indent||(gn(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${r}`)+"'";return e.implicitKey?i:tt.foldFlowLines(i,r,tt.FOLD_FLOW,vn(e,!1))}function Ut(t,e){let{singleQuote:r}=e.options,i;if(r===!1)i=Hr;else{let n=t.includes('"'),a=t.includes("'");n&&!a?i=Po:a&&!n?i=Hr:i=r?Po:Hr}return i(t,e)}var Ro;try{Ro=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Ma=/\n+(?!\n|$)/g}function Mi({comment:e,type:t,value:r},i,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(r))return Tt(r,i);let l=i.indent||(i.forceBlockIndent||Bi(r)?" ":""),u=o==="literal"?!0:o==="folded"||t===fe.Scalar.BLOCK_FOLDED?!1:t===fe.Scalar.BLOCK_LITERAL?!0:!hh(r,c,l.length);if(!r)return u?`|
23
+ |$)`,"g")}catch{Ro=/\n+(?!\n|$)/g}function mn({comment:t,type:e,value:r},i,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(r))return Ut(r,i);let l=i.indent||(i.forceBlockIndent||gn(r)?" ":""),u=o==="literal"?!0:o==="folded"||e===we.Scalar.BLOCK_FOLDED?!1:e===we.Scalar.BLOCK_LITERAL?!0:!Om(r,c,l.length);if(!r)return u?`|
24
24
  `:`>
25
- `;let d,f;for(f=r.length;f>0;--f){let E=r[f-1];if(E!==`
26
- `&&E!==" "&&E!==" ")break}let h=r.substring(f),v=h.indexOf(`
25
+ `;let d,f;for(f=r.length;f>0;--f){let x=r[f-1];if(x!==`
26
+ `&&x!==" "&&x!==" ")break}let h=r.substring(f),v=h.indexOf(`
27
27
  `);v===-1?d="-":r===h||v!==h.length-1?(d="+",a&&a()):d="",h&&(r=r.slice(0,-h.length),h[h.length-1]===`
28
- `&&(h=h.slice(0,-1)),h=h.replace(Ma,`$&${l}`));let p=!1,m,w=-1;for(m=0;m<r.length;++m){let E=r[m];if(E===" ")p=!0;else if(E===`
29
- `)w=m;else break}let y=r.substring(0,w<m?w+1:m);y&&(r=r.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let S=(p?l?"2":"1":"")+d;if(e&&(S+=" "+s(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let E=r.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),x=!1,T=Fi(i,!0);o!=="folded"&&t!==fe.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{x=!0});let N=ze.foldFlowLines(`${y}${E}${h}`,l,ze.FOLD_BLOCK,T);if(!x)return`>${S}
31
- ${l}${N}`}return r=r.replace(/\n+/g,`$&${l}`),`|${S}
32
- ${l}${y}${r}${h}`}function mh(e,t,r,i){let{type:n,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
33
- `)||u&&/[[\]{},]/.test(a))return Tt(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
- `)?Tt(a,t):Mi(e,t,r,i);if(!s&&!u&&n!==fe.Scalar.PLAIN&&a.includes(`
35
- `))return Mi(e,t,r,i);if(Bi(a)){if(c==="")return t.forceBlockIndent=!0,Mi(e,t,r,i);if(s&&c===l)return Tt(a,t)}let d=a.replace(/\n+/g,`$&
36
- ${c}`);if(o){let f=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(d),{compat:h,tags:v}=t.doc.schema;if(v.some(f)||h?.some(f))return Tt(a,t)}return s?d:ze.foldFlowLines(d,c,ze.FOLD_FLOW,Fi(t,!1))}function vh(e,t,r,i){let{implicitKey:n,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==fe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=fe.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case fe.Scalar.BLOCK_FOLDED:case fe.Scalar.BLOCK_LITERAL:return n||a?Tt(o.value,t):Mi(o,t,r,i);case fe.Scalar.QUOTE_DOUBLE:return vr(o.value,t);case fe.Scalar.QUOTE_SINGLE:return La(o.value,t);case fe.Scalar.PLAIN:return mh(o,t,r,i);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,f=n&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}zc.stringifyString=vh});var wr=g(Fa=>{"use strict";var gh=Ti(),Je=R(),wh=hr(),yh=gr();function Nh(e,t){let r=Object.assign({blockQuote:!0,commentString:wh.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(r.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:i,options:r}}function bh(e,t){if(t.tag){let n=e.filter(a=>a.tag===t.tag);if(n.length>0)return n.find(a=>a.format===t.format)??n[0]}let r,i;if(Je.isScalar(t)){i=t.value;let n=e.filter(a=>a.identify?.(i));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}r=n.find(a=>a.format===t.format)??n.find(a=>!a.format)}else i=t,r=e.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!r){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return r}function kh(e,t,{anchors:r,doc:i}){if(!i.directives)return"";let n=[],a=(Je.isScalar(e)||Je.isCollection(e))&&e.anchor;a&&gh.anchorIsValid(a)&&(r.add(a),n.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(i.directives.tagString(o)),n.join(" ")}function Sh(e,t,r,i){if(Je.isPair(e))return e.toString(t,r,i);if(Je.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,a=Je.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=bh(t.doc.schema.tags,a));let o=kh(a,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,t,r,i):Je.isScalar(a)?yh.stringifyString(a,t,r,i):a.toString(t,r,i);return o?Je.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${t.indent}${s}`:s}Fa.createStringifyContext=Nh;Fa.stringify=Sh});var Kc=g(Uc=>{"use strict";var je=R(),Jc=M(),Gc=wr(),yr=hr();function Eh({key:e,value:t},r,i,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=je.isNode(e)&&e.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(je.isCollection(e)||!je.isNode(e)&&typeof e=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let h=!d&&(!e||f&&t==null&&!r.inFlow||je.isCollection(e)||(je.isScalar(e)?e.type===Jc.Scalar.BLOCK_FOLDED||e.type===Jc.Scalar.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!h&&(d||!a),indent:s+c});let v=!1,p=!1,m=Gc.stringify(e,r,()=>v=!0,()=>p=!0);if(!h&&!r.inFlow&&m.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(r.inFlow){if(a||t==null)return v&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(a&&!d||t==null&&h)return m=`? ${m}`,f&&!v?m+=yr.lineComment(m,r.indent,l(f)):p&&n&&n(),m;v&&(f=null),h?(f&&(m+=yr.lineComment(m,r.indent,l(f))),m=`? ${m}
38
- ${s}:`):(m=`${m}:`,f&&(m+=yr.lineComment(m,r.indent,l(f))));let w,y,b;je.isNode(t)?(w=!!t.spaceBefore,y=t.commentBefore,b=t.comment):(w=!1,y=null,b=null,t&&typeof t=="object"&&(t=o.createNode(t))),r.implicitKey=!1,!h&&!f&&je.isScalar(t)&&(r.indentAtStart=m.length+1),p=!1,!u&&c.length>=2&&!r.inFlow&&!h&&je.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let S=!1,E=Gc.stringify(t,r,()=>S=!0,()=>p=!0),x=" ";if(f||w||y){if(x=w?`
39
- `:"",y){let T=l(y);x+=`
40
- ${yr.indentComment(T,r.indent)}`}E===""&&!r.inFlow?x===`
41
- `&&b&&(x=`
28
+ `&&(h=h.slice(0,-1)),h=h.replace(Ro,`$&${l}`));let p=!1,m,g=-1;for(m=0;m<r.length;++m){let x=r[m];if(x===" ")p=!0;else if(x===`
29
+ `)g=m;else break}let y=r.substring(0,g<m?g+1:m);y&&(r=r.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let S=(p?l?"2":"1":"")+d;if(t&&(S+=" "+s(t.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let x=r.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,j=vn(i,!0);o!=="folded"&&e!==we.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{E=!0});let b=tt.foldFlowLines(`${y}${x}${h}`,l,tt.FOLD_BLOCK,j);if(!E)return`>${S}
31
+ ${l}${b}`}return r=r.replace(/\n+/g,`$&${l}`),`|${S}
32
+ ${l}${y}${r}${h}`}function Hm(t,e,r,i){let{type:n,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=e;if(s&&a.includes(`
33
+ `)||u&&/[[\]{},]/.test(a))return Ut(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
+ `)?Ut(a,e):mn(t,e,r,i);if(!s&&!u&&n!==we.Scalar.PLAIN&&a.includes(`
35
+ `))return mn(t,e,r,i);if(gn(a)){if(c==="")return e.forceBlockIndent=!0,mn(t,e,r,i);if(s&&c===l)return Ut(a,e)}let d=a.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let f=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(d),{compat:h,tags:v}=e.doc.schema;if(v.some(f)||h?.some(f))return Ut(a,e)}return s?d:tt.foldFlowLines(d,c,tt.FOLD_FLOW,vn(e,!1))}function Dm(t,e,r,i){let{implicitKey:n,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==we.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=we.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case we.Scalar.BLOCK_FOLDED:case we.Scalar.BLOCK_LITERAL:return n||a?Ut(o.value,e):mn(o,e,r,i);case we.Scalar.QUOTE_DOUBLE:return Hr(o.value,e);case we.Scalar.QUOTE_SINGLE:return Po(o.value,e);case we.Scalar.PLAIN:return Hm(o,e,r,i);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=n&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}ql.stringifyString=Dm});var Lr=w(_o=>{"use strict";var Lm=cn(),rt=_(),Bm=jr(),Mm=Dr();function Fm(t,e){let r=Object.assign({blockQuote:!0,commentString:Bm.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),i;switch(r.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:i,options:r}}function qm(t,e){if(e.tag){let n=t.filter(a=>a.tag===e.tag);if(n.length>0)return n.find(a=>a.format===e.format)??n[0]}let r,i;if(rt.isScalar(e)){i=e.value;let n=t.filter(a=>a.identify?.(i));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}r=n.find(a=>a.format===e.format)??n.find(a=>!a.format)}else i=e,r=t.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!r){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return r}function Vm(t,e,{anchors:r,doc:i}){if(!i.directives)return"";let n=[],a=(rt.isScalar(t)||rt.isCollection(t))&&t.anchor;a&&Lm.anchorIsValid(a)&&(r.add(a),n.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&n.push(i.directives.tagString(o)),n.join(" ")}function Wm(t,e,r,i){if(rt.isPair(t))return t.toString(e,r,i);if(rt.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let n,a=rt.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>n=c});n??(n=qm(e.doc.schema.tags,a));let o=Vm(a,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,e,r,i):rt.isScalar(a)?Mm.stringifyString(a,e,r,i):a.toString(e,r,i);return o?rt.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
+ ${e.indent}${s}`:s}_o.createStringifyContext=Fm;_o.stringify=Wm});var Gl=w(zl=>{"use strict";var We=_(),Vl=F(),Wl=Lr(),Br=jr();function zm({key:t,value:e},r,i,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=We.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(We.isCollection(t)||!We.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let h=!d&&(!t||f&&e==null&&!r.inFlow||We.isCollection(t)||(We.isScalar(t)?t.type===Vl.Scalar.BLOCK_FOLDED||t.type===Vl.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!h&&(d||!a),indent:s+c});let v=!1,p=!1,m=Wl.stringify(t,r,()=>v=!0,()=>p=!0);if(!h&&!r.inFlow&&m.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(r.inFlow){if(a||e==null)return v&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(a&&!d||e==null&&h)return m=`? ${m}`,f&&!v?m+=Br.lineComment(m,r.indent,l(f)):p&&n&&n(),m;v&&(f=null),h?(f&&(m+=Br.lineComment(m,r.indent,l(f))),m=`? ${m}
38
+ ${s}:`):(m=`${m}:`,f&&(m+=Br.lineComment(m,r.indent,l(f))));let g,y,N;We.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,N=e.comment):(g=!1,y=null,N=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!h&&!f&&We.isScalar(e)&&(r.indentAtStart=m.length+1),p=!1,!u&&c.length>=2&&!r.inFlow&&!h&&We.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let S=!1,x=Wl.stringify(e,r,()=>S=!0,()=>p=!0),E=" ";if(f||g||y){if(E=g?`
39
+ `:"",y){let j=l(y);E+=`
40
+ ${Br.indentComment(j,r.indent)}`}x===""&&!r.inFlow?E===`
41
+ `&&N&&(E=`
42
42
 
43
- `):x+=`
44
- ${r.indent}`}else if(!h&&je.isCollection(t)){let T=E[0],N=E.indexOf(`
45
- `),F=N!==-1,Be=r.inFlow??t.flow??t.items.length===0;if(F||!Be){let Rt=!1;if(F&&(T==="&"||T==="!")){let B=E.indexOf(" ");T==="&"&&B!==-1&&B<N&&E[B+1]==="!"&&(B=E.indexOf(" ",B+1)),(B===-1||N<B)&&(Rt=!0)}Rt||(x=`
46
- ${r.indent}`)}}else(E===""||E[0]===`
47
- `)&&(x="");return m+=x+E,r.inFlow?S&&i&&i():b&&!S?m+=yr.lineComment(m,r.indent,l(b)):p&&n&&n(),m}Uc.stringifyPair=Eh});var Va=g(Ba=>{"use strict";var Yc=Pi("process");function xh(e,...t){e==="debug"&&console.log(...t)}function Ch(e,t){(e==="debug"||e==="warn")&&(typeof Yc.emitWarning=="function"?Yc.emitWarning(t):console.warn(t))}Ba.debug=xh;Ba.warn=Ch});var Ji=g(zi=>{"use strict";var Wi=R(),Xc=M(),Vi="<<",qi={identify:e=>e===Vi||typeof e=="symbol"&&e.description===Vi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Xc.Scalar(Symbol(Vi)),{addToJSMap:Qc}),stringify:()=>Vi},Ph=(e,t)=>(qi.identify(t)||Wi.isScalar(t)&&(!t.type||t.type===Xc.Scalar.PLAIN)&&qi.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===qi.tag&&r.default);function Qc(e,t,r){let i=Zc(e,r);if(Wi.isSeq(i))for(let n of i.items)qa(e,t,n);else if(Array.isArray(i))for(let n of i)qa(e,t,n);else qa(e,t,i)}function qa(e,t,r){let i=Zc(e,r);if(!Wi.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,e,Map);for(let[a,o]of n)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Zc(e,t){return e&&Wi.isAlias(t)?t.resolve(e.doc,e):t}zi.addMergeToJSMap=Qc;zi.isMergeKey=Ph;zi.merge=qi});var za=g(rl=>{"use strict";var Rh=Va(),el=Ji(),_h=wr(),tl=R(),Wa=qe();function Ah(e,t,{key:r,value:i}){if(tl.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,i);else if(el.isMergeKey(e,r))el.addMergeToJSMap(e,t,i);else{let n=Wa.toJS(r,"",e);if(t instanceof Map)t.set(n,Wa.toJS(i,n,e));else if(t instanceof Set)t.add(n);else{let a=Ih(r,n,e),o=Wa.toJS(i,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Ih(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(tl.isNode(e)&&r?.doc){let i=_h.createStringifyContext(r.doc,{});i.anchors=new Set;for(let a of r.anchors.keys())i.anchors.add(a.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=e.toString(i);if(!r.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Rh.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return n}return JSON.stringify(t)}rl.addPairToJSMap=Ah});var Ge=g(Ja=>{"use strict";var il=pr(),Th=Kc(),jh=za(),Gi=R();function $h(e,t,r){let i=il.createNode(e,void 0,r),n=il.createNode(t,void 0,r);return new Ui(i,n)}var Ui=class e{constructor(t,r=null){Object.defineProperty(this,Gi.NODE_TYPE,{value:Gi.PAIR}),this.key=t,this.value=r}clone(t){let{key:r,value:i}=this;return Gi.isNode(r)&&(r=r.clone(t)),Gi.isNode(i)&&(i=i.clone(t)),new e(r,i)}toJSON(t,r){let i=r?.mapAsMap?new Map:{};return jh.addPairToJSMap(r,i,this)}toString(t,r,i){return t?.doc?Th.stringifyPair(this,t,r,i):JSON.stringify(this)}};Ja.Pair=Ui;Ja.createPair=$h});var Ga=g(al=>{"use strict";var pt=R(),nl=wr(),Ki=hr();function Oh(e,t,r){return(t.inFlow??e.flow?Dh:Hh)(e,t,r)}function Hh({comment:e,items:t},r,{blockItemPrefix:i,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:a,type:null}),d=!1,f=[];for(let v=0;v<t.length;++v){let p=t[v],m=null;if(pt.isNode(p))!d&&p.spaceBefore&&f.push(""),Yi(r,f,p.commentBefore,d),p.comment&&(m=p.comment);else if(pt.isPair(p)){let y=pt.isNode(p.key)?p.key:null;y&&(!d&&y.spaceBefore&&f.push(""),Yi(r,f,y.commentBefore,d))}d=!1;let w=nl.stringify(p,u,()=>m=null,()=>d=!0);m&&(w+=Ki.lineComment(w,a,l(m))),d&&m&&(d=!1),f.push(i+w)}let h;if(f.length===0)h=n.start+n.end;else{h=f[0];for(let v=1;v<f.length;++v){let p=f[v];h+=p?`
43
+ `):E+=`
44
+ ${r.indent}`}else if(!h&&We.isCollection(e)){let j=x[0],b=x.indexOf(`
45
+ `),q=b!==-1,Xe=r.inFlow??e.flow??e.items.length===0;if(q||!Xe){let Wt=!1;if(q&&(j==="&"||j==="!")){let V=x.indexOf(" ");j==="&"&&V!==-1&&V<b&&x[V+1]==="!"&&(V=x.indexOf(" ",V+1)),(V===-1||b<V)&&(Wt=!0)}Wt||(E=`
46
+ ${r.indent}`)}}else(x===""||x[0]===`
47
+ `)&&(E="");return m+=E+x,r.inFlow?S&&i&&i():N&&!S?m+=Br.lineComment(m,r.indent,l(N)):p&&n&&n(),m}zl.stringifyPair=zm});var Io=w(Ao=>{"use strict";var Jl=rn("process");function Gm(t,...e){t==="debug"&&console.log(...e)}function Jm(t,e){(t==="debug"||t==="warn")&&(typeof Jl.emitWarning=="function"?Jl.emitWarning(e):console.warn(e))}Ao.debug=Gm;Ao.warn=Jm});var kn=w(bn=>{"use strict";var Nn=_(),Ul=F(),wn="<<",yn={identify:t=>t===wn||typeof t=="symbol"&&t.description===wn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ul.Scalar(Symbol(wn)),{addToJSMap:Kl}),stringify:()=>wn},Um=(t,e)=>(yn.identify(e)||Nn.isScalar(e)&&(!e.type||e.type===Ul.Scalar.PLAIN)&&yn.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===yn.tag&&r.default);function Kl(t,e,r){let i=Yl(t,r);if(Nn.isSeq(i))for(let n of i.items)To(t,e,n);else if(Array.isArray(i))for(let n of i)To(t,e,n);else To(t,e,i)}function To(t,e,r){let i=Yl(t,r);if(!Nn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,t,Map);for(let[a,o]of n)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Yl(t,e){return t&&Nn.isAlias(e)?e.resolve(t.doc,t):e}bn.addMergeToJSMap=Kl;bn.isMergeKey=Um;bn.merge=yn});var jo=w(Zl=>{"use strict";var Km=Io(),Xl=kn(),Ym=Lr(),Ql=_(),$o=Ze();function Xm(t,e,{key:r,value:i}){if(Ql.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,i);else if(Xl.isMergeKey(t,r))Xl.addMergeToJSMap(t,e,i);else{let n=$o.toJS(r,"",t);if(e instanceof Map)e.set(n,$o.toJS(i,n,t));else if(e instanceof Set)e.add(n);else{let a=Qm(r,n,t),o=$o.toJS(i,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function Qm(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Ql.isNode(t)&&r?.doc){let i=Ym.createStringifyContext(r.doc,{});i.anchors=new Set;for(let a of r.anchors.keys())i.anchors.add(a.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=t.toString(i);if(!r.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Km.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return n}return JSON.stringify(e)}Zl.addPairToJSMap=Xm});var it=w(Oo=>{"use strict";var eu=$r(),Zm=Gl(),ev=jo(),Sn=_();function tv(t,e,r){let i=eu.createNode(t,void 0,r),n=eu.createNode(e,void 0,r);return new En(i,n)}var En=class t{constructor(e,r=null){Object.defineProperty(this,Sn.NODE_TYPE,{value:Sn.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:i}=this;return Sn.isNode(r)&&(r=r.clone(e)),Sn.isNode(i)&&(i=i.clone(e)),new t(r,i)}toJSON(e,r){let i=r?.mapAsMap?new Map:{};return ev.addPairToJSMap(r,i,this)}toString(e,r,i){return e?.doc?Zm.stringifyPair(this,e,r,i):JSON.stringify(this)}};Oo.Pair=En;Oo.createPair=tv});var Ho=w(ru=>{"use strict";var Et=_(),tu=Lr(),xn=jr();function rv(t,e,r){return(e.inFlow??t.flow?nv:iv)(t,e,r)}function iv({comment:t,items:e},r,{blockItemPrefix:i,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:a,type:null}),d=!1,f=[];for(let v=0;v<e.length;++v){let p=e[v],m=null;if(Et.isNode(p))!d&&p.spaceBefore&&f.push(""),Cn(r,f,p.commentBefore,d),p.comment&&(m=p.comment);else if(Et.isPair(p)){let y=Et.isNode(p.key)?p.key:null;y&&(!d&&y.spaceBefore&&f.push(""),Cn(r,f,y.commentBefore,d))}d=!1;let g=tu.stringify(p,u,()=>m=null,()=>d=!0);m&&(g+=xn.lineComment(g,a,l(m))),d&&m&&(d=!1),f.push(i+g)}let h;if(f.length===0)h=n.start+n.end;else{h=f[0];for(let v=1;v<f.length;++v){let p=f[v];h+=p?`
48
48
  ${c}${p}`:`
49
- `}}return e?(h+=`
50
- `+Ki.indentComment(l(e),c),s&&s()):d&&o&&o(),h}function Dh({items:e},t,{flowChars:r,itemIndent:i}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;i+=a;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let v=0;v<e.length;++v){let p=e[v],m=null;if(pt.isNode(p))p.spaceBefore&&d.push(""),Yi(t,d,p.commentBefore,!1),p.comment&&(m=p.comment);else if(pt.isPair(p)){let y=pt.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&d.push(""),Yi(t,d,y.commentBefore,!1),y.comment&&(l=!0));let b=pt.isNode(p.value)?p.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=nl.stringify(p,c,()=>m=null);l||(l=d.length>u||w.includes(`
51
- `)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),m&&(w+=Ki.lineComment(w,i,s(m))),d.push(w),u=d.length}let{start:f,end:h}=r;if(d.length===0)return f+h;if(!l){let v=d.reduce((p,m)=>p+m.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=f;for(let p of d)v+=p?`
49
+ `}}return t?(h+=`
50
+ `+xn.indentComment(l(t),c),s&&s()):d&&o&&o(),h}function nv({items:t},e,{flowChars:r,itemIndent:i}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;i+=a;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let v=0;v<t.length;++v){let p=t[v],m=null;if(Et.isNode(p))p.spaceBefore&&d.push(""),Cn(e,d,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Et.isPair(p)){let y=Et.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&d.push(""),Cn(e,d,y.commentBefore,!1),y.comment&&(l=!0));let N=Et.isNode(p.value)?p.value:null;N?(N.comment&&(m=N.comment),N.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let g=tu.stringify(p,c,()=>m=null);l||(l=d.length>u||g.includes(`
51
+ `)),v<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=d.reduce((y,N)=>y+N.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),m&&(g+=xn.lineComment(g,i,s(m))),d.push(g),u=d.length}let{start:f,end:h}=r;if(d.length===0)return f+h;if(!l){let v=d.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&v>e.options.lineWidth}if(l){let v=f;for(let p of d)v+=p?`
52
52
  ${a}${n}${p}`:`
53
53
  `;return`${v}
54
- ${n}${h}`}else return`${f}${o}${d.join(" ")}${o}${h}`}function Yi({indent:e,options:{commentString:t}},r,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let a=Ki.indentComment(t(i),e);r.push(a.trimStart())}}al.stringifyCollection=Oh});var Ke=g(Ka=>{"use strict";var Lh=Ga(),Mh=za(),Fh=Hi(),Ue=R(),Xi=Ge(),Bh=M();function Nr(e,t){let r=Ue.isScalar(t)?t.value:t;for(let i of e)if(Ue.isPair(i)&&(i.key===t||i.key===r||Ue.isScalar(i.key)&&i.key.value===r))return i}var Ua=class extends Fh.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ue.MAP,t),this.items=[]}static from(t,r,i){let{keepUndefined:n,replacer:a}=i,o=new this(t),s=(c,l)=>{if(typeof a=="function")l=a.call(r,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(Xi.createPair(c,l,i))};if(r instanceof Map)for(let[c,l]of r)s(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))s(c,r[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,r){let i;Ue.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new Xi.Pair(t,t?.value):i=new Xi.Pair(t.key,t.value);let n=Nr(this.items,i.key),a=this.schema?.sortMapEntries;if(n){if(!r)throw new Error(`Key ${i.key} already set`);Ue.isScalar(n.value)&&Bh.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(a){let o=this.items.findIndex(s=>a(i,s)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(t){let r=Nr(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let n=Nr(this.items,t)?.value;return(!r&&Ue.isScalar(n)?n.value:n)??void 0}has(t){return!!Nr(this.items,t)}set(t,r){this.add(new Xi.Pair(t,r),!0)}toJSON(t,r,i){let n=i?new i:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(n);for(let a of this.items)Mh.addPairToJSMap(r,n,a);return n}toString(t,r,i){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Ue.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Lh.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:r})}};Ka.YAMLMap=Ua;Ka.findPair=Nr});var jt=g(sl=>{"use strict";var Vh=R(),ol=Ke(),qh={collection:"map",default:!0,nodeClass:ol.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Vh.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>ol.YAMLMap.from(e,t,r)};sl.map=qh});var Ye=g(cl=>{"use strict";var Wh=pr(),zh=Ga(),Jh=Hi(),Zi=R(),Gh=M(),Uh=qe(),Ya=class extends Jh.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Zi.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=Qi(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let i=Qi(t);if(typeof i!="number")return;let n=this.items[i];return!r&&Zi.isScalar(n)?n.value:n}has(t){let r=Qi(t);return typeof r=="number"&&r<this.items.length}set(t,r){let i=Qi(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];Zi.isScalar(n)&&Gh.isScalarValue(r)?n.value=r:this.items[i]=r}toJSON(t,r){let i=[];r?.onCreate&&r.onCreate(i);let n=0;for(let a of this.items)i.push(Uh.toJS(a,String(n++),r));return i}toString(t,r,i){return t?zh.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:r}):JSON.stringify(this)}static from(t,r,i){let{replacer:n}=i,a=new this(t);if(r&&Symbol.iterator in Object(r)){let o=0;for(let s of r){if(typeof n=="function"){let c=r instanceof Set?s:String(o++);s=n.call(r,c,s)}a.items.push(Wh.createNode(s,void 0,i))}}return a}};function Qi(e){let t=Zi.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}cl.YAMLSeq=Ya});var $t=g(ul=>{"use strict";var Kh=R(),ll=Ye(),Yh={collection:"seq",default:!0,nodeClass:ll.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Kh.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>ll.YAMLSeq.from(e,t,r)};ul.seq=Yh});var br=g(dl=>{"use strict";var Xh=gr(),Qh={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,i){return t=Object.assign({actualString:!0},t),Xh.stringifyString(e,t,r,i)}};dl.string=Qh});var en=g(hl=>{"use strict";var fl=M(),pl={identify:e=>e==null,createNode:()=>new fl.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new fl.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&pl.test.test(e)?e:t.options.nullStr};hl.nullTag=pl});var Xa=g(vl=>{"use strict";var Zh=M(),ml={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Zh.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&ml.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?r.options.trueStr:r.options.falseStr}};vl.boolTag=ml});var Ot=g(gl=>{"use strict";function em({format:e,minFractionDigits:t,tag:r,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}gl.stringifyNumber=em});var Za=g(tn=>{"use strict";var tm=M(),Qa=Ot(),rm={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Qa.stringifyNumber},im={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Qa.stringifyNumber(e)}},nm={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new tm.Scalar(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:Qa.stringifyNumber};tn.float=nm;tn.floatExp=im;tn.floatNaN=rm});var to=g(nn=>{"use strict";var wl=Ot(),rn=e=>typeof e=="bigint"||Number.isInteger(e),eo=(e,t,r,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),r);function yl(e,t,r){let{value:i}=e;return rn(i)&&i>=0?r+i.toString(t):wl.stringifyNumber(e)}var am={identify:e=>rn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>eo(e,2,8,r),stringify:e=>yl(e,8,"0o")},om={identify:rn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>eo(e,0,10,r),stringify:wl.stringifyNumber},sm={identify:e=>rn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>eo(e,2,16,r),stringify:e=>yl(e,16,"0x")};nn.int=om;nn.intHex=sm;nn.intOct=am});var bl=g(Nl=>{"use strict";var cm=jt(),lm=en(),um=$t(),dm=br(),fm=Xa(),ro=Za(),io=to(),pm=[cm.map,um.seq,dm.string,lm.nullTag,fm.boolTag,io.intOct,io.int,io.intHex,ro.floatNaN,ro.floatExp,ro.float];Nl.schema=pm});var El=g(Sl=>{"use strict";var hm=M(),mm=jt(),vm=$t();function kl(e){return typeof e=="bigint"||Number.isInteger(e)}var an=({value:e})=>JSON.stringify(e),gm=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:an},{identify:e=>e==null,createNode:()=>new hm.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:an},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:an},{identify:kl,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>kl(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:an}],wm={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},ym=[mm.map,vm.seq].concat(gm,wm);Sl.schema=ym});var ao=g(xl=>{"use strict";var kr=Pi("buffer"),no=M(),Nm=gr(),bm={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof kr.Buffer=="function")return kr.Buffer.from(e,"base64");if(typeof atob=="function"){let r=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(r.length);for(let n=0;n<r.length;++n)i[n]=r.charCodeAt(n);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},i,n,a){if(!r)return"";let o=r,s;if(typeof kr.Buffer=="function")s=o instanceof kr.Buffer?o.toString("base64"):kr.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=no.Scalar.BLOCK_LITERAL),t!==no.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=s.substr(f,c);s=u.join(t===no.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return Nm.stringifyString({comment:e,type:t,value:s},i,n,a)}};xl.binary=bm});var cn=g(sn=>{"use strict";var on=R(),oo=Ge(),km=M(),Sm=Ye();function Cl(e,t){if(on.isSeq(e))for(let r=0;r<e.items.length;++r){let i=e.items[r];if(!on.isPair(i)){if(on.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new oo.Pair(new km.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
54
+ ${n}${h}`}else return`${f}${o}${d.join(" ")}${o}${h}`}function Cn({indent:t,options:{commentString:e}},r,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let a=xn.indentComment(e(i),t);r.push(a.trimStart())}}ru.stringifyCollection=rv});var at=w(Lo=>{"use strict";var av=Ho(),ov=jo(),sv=fn(),nt=_(),Pn=it(),cv=F();function Mr(t,e){let r=nt.isScalar(e)?e.value:e;for(let i of t)if(nt.isPair(i)&&(i.key===e||i.key===r||nt.isScalar(i.key)&&i.key.value===r))return i}var Do=class extends sv.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(nt.MAP,e),this.items=[]}static from(e,r,i){let{keepUndefined:n,replacer:a}=i,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(r,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(Pn.createPair(c,l,i))};if(r instanceof Map)for(let[c,l]of r)s(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))s(c,r[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,r){let i;nt.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new Pn.Pair(e,e?.value):i=new Pn.Pair(e.key,e.value);let n=Mr(this.items,i.key),a=this.schema?.sortMapEntries;if(n){if(!r)throw new Error(`Key ${i.key} already set`);nt.isScalar(n.value)&&cv.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(a){let o=this.items.findIndex(s=>a(i,s)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let r=Mr(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let n=Mr(this.items,e)?.value;return(!r&&nt.isScalar(n)?n.value:n)??void 0}has(e){return!!Mr(this.items,e)}set(e,r){this.add(new Pn.Pair(e,r),!0)}toJSON(e,r,i){let n=i?new i:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(n);for(let a of this.items)ov.addPairToJSMap(r,n,a);return n}toString(e,r,i){if(!e)return JSON.stringify(this);for(let n of this.items)if(!nt.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),av.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:r})}};Lo.YAMLMap=Do;Lo.findPair=Mr});var Kt=w(nu=>{"use strict";var lv=_(),iu=at(),uv={collection:"map",default:!0,nodeClass:iu.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return lv.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>iu.YAMLMap.from(t,e,r)};nu.map=uv});var ot=w(au=>{"use strict";var dv=$r(),fv=Ho(),pv=fn(),_n=_(),hv=F(),mv=Ze(),Bo=class extends pv.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(_n.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Rn(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let i=Rn(e);if(typeof i!="number")return;let n=this.items[i];return!r&&_n.isScalar(n)?n.value:n}has(e){let r=Rn(e);return typeof r=="number"&&r<this.items.length}set(e,r){let i=Rn(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[i];_n.isScalar(n)&&hv.isScalarValue(r)?n.value=r:this.items[i]=r}toJSON(e,r){let i=[];r?.onCreate&&r.onCreate(i);let n=0;for(let a of this.items)i.push(mv.toJS(a,String(n++),r));return i}toString(e,r,i){return e?fv.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:r}):JSON.stringify(this)}static from(e,r,i){let{replacer:n}=i,a=new this(e);if(r&&Symbol.iterator in Object(r)){let o=0;for(let s of r){if(typeof n=="function"){let c=r instanceof Set?s:String(o++);s=n.call(r,c,s)}a.items.push(dv.createNode(s,void 0,i))}}return a}};function Rn(t){let e=_n.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}au.YAMLSeq=Bo});var Yt=w(su=>{"use strict";var vv=_(),ou=ot(),gv={collection:"seq",default:!0,nodeClass:ou.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return vv.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>ou.YAMLSeq.from(t,e,r)};su.seq=gv});var Fr=w(cu=>{"use strict";var wv=Dr(),yv={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,i){return e=Object.assign({actualString:!0},e),wv.stringifyString(t,e,r,i)}};cu.string=yv});var An=w(du=>{"use strict";var lu=F(),uu={identify:t=>t==null,createNode:()=>new lu.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new lu.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&uu.test.test(t)?t:e.options.nullStr};du.nullTag=uu});var Mo=w(pu=>{"use strict";var Nv=F(),fu={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Nv.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&fu.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?r.options.trueStr:r.options.falseStr}};pu.boolTag=fu});var Xt=w(hu=>{"use strict";function bv({format:t,minFractionDigits:e,tag:r,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}hu.stringifyNumber=bv});var qo=w(In=>{"use strict";var kv=F(),Fo=Xt(),Sv={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Fo.stringifyNumber},Ev={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Fo.stringifyNumber(t)}},xv={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new kv.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:Fo.stringifyNumber};In.float=xv;In.floatExp=Ev;In.floatNaN=Sv});var Wo=w($n=>{"use strict";var mu=Xt(),Tn=t=>typeof t=="bigint"||Number.isInteger(t),Vo=(t,e,r,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),r);function vu(t,e,r){let{value:i}=t;return Tn(i)&&i>=0?r+i.toString(e):mu.stringifyNumber(t)}var Cv={identify:t=>Tn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>Vo(t,2,8,r),stringify:t=>vu(t,8,"0o")},Pv={identify:Tn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>Vo(t,0,10,r),stringify:mu.stringifyNumber},Rv={identify:t=>Tn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>Vo(t,2,16,r),stringify:t=>vu(t,16,"0x")};$n.int=Pv;$n.intHex=Rv;$n.intOct=Cv});var wu=w(gu=>{"use strict";var _v=Kt(),Av=An(),Iv=Yt(),Tv=Fr(),$v=Mo(),zo=qo(),Go=Wo(),jv=[_v.map,Iv.seq,Tv.string,Av.nullTag,$v.boolTag,Go.intOct,Go.int,Go.intHex,zo.floatNaN,zo.floatExp,zo.float];gu.schema=jv});var bu=w(Nu=>{"use strict";var Ov=F(),Hv=Kt(),Dv=Yt();function yu(t){return typeof t=="bigint"||Number.isInteger(t)}var jn=({value:t})=>JSON.stringify(t),Lv=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:jn},{identify:t=>t==null,createNode:()=>new Ov.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:jn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:jn},{identify:yu,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>yu(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:jn}],Bv={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Mv=[Hv.map,Dv.seq].concat(Lv,Bv);Nu.schema=Mv});var Uo=w(ku=>{"use strict";var qr=rn("buffer"),Jo=F(),Fv=Dr(),qv={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof qr.Buffer=="function")return qr.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(r.length);for(let n=0;n<r.length;++n)i[n]=r.charCodeAt(n);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},i,n,a){if(!r)return"";let o=r,s;if(typeof qr.Buffer=="function")s=o instanceof qr.Buffer?o.toString("base64"):qr.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Jo.Scalar.BLOCK_LITERAL),e!==Jo.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=s.substr(f,c);s=u.join(e===Jo.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Fv.stringifyString({comment:t,type:e,value:s},i,n,a)}};ku.binary=qv});var Dn=w(Hn=>{"use strict";var On=_(),Ko=it(),Vv=F(),Wv=ot();function Su(t,e){if(On.isSeq(t))for(let r=0;r<t.items.length;++r){let i=t.items[r];if(!On.isPair(i)){if(On.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let n=i.items[0]||new Ko.Pair(new Vv.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
56
56
  ${n.key.commentBefore}`:i.commentBefore),i.comment){let a=n.value??n.key;a.comment=a.comment?`${i.comment}
57
- ${a.comment}`:i.comment}i=n}e.items[r]=on.isPair(i)?i:new oo.Pair(i)}}else t("Expected a sequence for this tag");return e}function Pl(e,t,r){let{replacer:i}=r,n=new Sm.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof i=="function"&&(o=i.call(t,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(oo.createPair(s,c,r))}return n}var Em={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Cl,createNode:Pl};sn.createPairs=Pl;sn.pairs=Em;sn.resolvePairs=Cl});var lo=g(co=>{"use strict";var Rl=R(),so=qe(),Sr=Ke(),xm=Ye(),_l=cn(),ht=class e extends xm.YAMLSeq{constructor(){super(),this.add=Sr.YAMLMap.prototype.add.bind(this),this.delete=Sr.YAMLMap.prototype.delete.bind(this),this.get=Sr.YAMLMap.prototype.get.bind(this),this.has=Sr.YAMLMap.prototype.has.bind(this),this.set=Sr.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,r){if(!r)return super.toJSON(t);let i=new Map;r?.onCreate&&r.onCreate(i);for(let n of this.items){let a,o;if(Rl.isPair(n)?(a=so.toJS(n.key,"",r),o=so.toJS(n.value,a,r)):a=so.toJS(n,"",r),i.has(a))throw new Error("Ordered maps must not include duplicate keys");i.set(a,o)}return i}static from(t,r,i){let n=_l.createPairs(t,r,i),a=new this;return a.items=n.items,a}};ht.tag="tag:yaml.org,2002:omap";var Cm={collection:"seq",identify:e=>e instanceof Map,nodeClass:ht,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=_l.resolvePairs(e,t),i=[];for(let{key:n}of r.items)Rl.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new ht,r)},createNode:(e,t,r)=>ht.from(e,t,r)};co.YAMLOMap=ht;co.omap=Cm});var $l=g(uo=>{"use strict";var Al=M();function Il({value:e,source:t},r){return t&&(e?Tl:jl).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var Tl={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Al.Scalar(!0),stringify:Il},jl={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Al.Scalar(!1),stringify:Il};uo.falseTag=jl;uo.trueTag=Tl});var Ol=g(ln=>{"use strict";var Pm=M(),fo=Ot(),Rm={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fo.stringifyNumber},_m={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():fo.stringifyNumber(e)}},Am={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Pm.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let i=e.substring(r+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:fo.stringifyNumber};ln.float=Am;ln.floatExp=_m;ln.floatNaN=Rm});var Dl=g(xr=>{"use strict";var Hl=Ot(),Er=e=>typeof e=="bigint"||Number.isInteger(e);function un(e,t,r,{intAsBigInt:i}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let a=parseInt(e,r);return n==="-"?-1*a:a}function po(e,t,r){let{value:i}=e;if(Er(i)){let n=i.toString(t);return i<0?"-"+r+n.substr(1):r+n}return Hl.stringifyNumber(e)}var Im={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>un(e,2,2,r),stringify:e=>po(e,2,"0b")},Tm={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>un(e,1,8,r),stringify:e=>po(e,8,"0")},jm={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>un(e,0,10,r),stringify:Hl.stringifyNumber},$m={identify:Er,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>un(e,2,16,r),stringify:e=>po(e,16,"0x")};xr.int=jm;xr.intBin=Im;xr.intHex=$m;xr.intOct=Tm});var mo=g(ho=>{"use strict";var pn=R(),dn=Ge(),fn=Ke(),mt=class e extends fn.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let r;pn.isPair(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new dn.Pair(t.key,null):r=new dn.Pair(t,null),fn.findPair(this.items,r.key)||this.items.push(r)}get(t,r){let i=fn.findPair(this.items,t);return!r&&pn.isPair(i)?pn.isScalar(i.key)?i.key.value:i.key:i}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let i=fn.findPair(this.items,t);i&&!r?this.items.splice(this.items.indexOf(i),1):!i&&r&&this.items.push(new dn.Pair(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,i);throw new Error("Set items must all have null values")}static from(t,r,i){let{replacer:n}=i,a=new this(t);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof n=="function"&&(o=n.call(r,o,o)),a.items.push(dn.createPair(o,null,i));return a}};mt.tag="tag:yaml.org,2002:set";var Om={collection:"map",identify:e=>e instanceof Set,nodeClass:mt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>mt.from(e,t,r),resolve(e,t){if(pn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new mt,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};ho.YAMLSet=mt;ho.set=Om});var go=g(hn=>{"use strict";var Hm=Ot();function vo(e,t){let r=e[0],i=r==="-"||r==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),a=i.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return r==="-"?n(-1)*a:a}function Ll(e){let{value:t}=e,r=o=>o;if(typeof t=="bigint")r=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Hm.stringifyNumber(e);let i="";t<0&&(i="-",t*=r(-1));let n=r(60),a=[t%n];return t<60?a.unshift(0):(t=(t-a[0])/n,a.unshift(t%n),t>=60&&(t=(t-a[0])/n,a.unshift(t))),i+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Dm={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>vo(e,r),stringify:Ll},Lm={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>vo(e,!1),stringify:Ll},Ml={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Ml.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,i,n,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,i-1,n,a||0,o||0,s||0,c),u=t[8];if(u&&u!=="Z"){let d=vo(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};hn.floatTime=Lm;hn.intTime=Dm;hn.timestamp=Ml});var Vl=g(Bl=>{"use strict";var Mm=jt(),Fm=en(),Bm=$t(),Vm=br(),qm=ao(),Fl=$l(),wo=Ol(),mn=Dl(),Wm=Ji(),zm=lo(),Jm=cn(),Gm=mo(),yo=go(),Um=[Mm.map,Bm.seq,Vm.string,Fm.nullTag,Fl.trueTag,Fl.falseTag,mn.intBin,mn.intOct,mn.int,mn.intHex,wo.floatNaN,wo.floatExp,wo.float,qm.binary,Wm.merge,zm.omap,Jm.pairs,Gm.set,yo.intTime,yo.floatTime,yo.timestamp];Bl.schema=Um});var Ql=g(ko=>{"use strict";var Jl=jt(),Km=en(),Gl=$t(),Ym=br(),Xm=Xa(),No=Za(),bo=to(),Qm=bl(),Zm=El(),Ul=ao(),Cr=Ji(),Kl=lo(),Yl=cn(),ql=Vl(),Xl=mo(),vn=go(),Wl=new Map([["core",Qm.schema],["failsafe",[Jl.map,Gl.seq,Ym.string]],["json",Zm.schema],["yaml11",ql.schema],["yaml-1.1",ql.schema]]),zl={binary:Ul.binary,bool:Xm.boolTag,float:No.float,floatExp:No.floatExp,floatNaN:No.floatNaN,floatTime:vn.floatTime,int:bo.int,intHex:bo.intHex,intOct:bo.intOct,intTime:vn.intTime,map:Jl.map,merge:Cr.merge,null:Km.nullTag,omap:Kl.omap,pairs:Yl.pairs,seq:Gl.seq,set:Xl.set,timestamp:vn.timestamp},ev={"tag:yaml.org,2002:binary":Ul.binary,"tag:yaml.org,2002:merge":Cr.merge,"tag:yaml.org,2002:omap":Kl.omap,"tag:yaml.org,2002:pairs":Yl.pairs,"tag:yaml.org,2002:set":Xl.set,"tag:yaml.org,2002:timestamp":vn.timestamp};function tv(e,t,r){let i=Wl.get(t);if(i&&!e)return r&&!i.includes(Cr.merge)?i.concat(Cr.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let a=Array.from(Wl.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)n=n.concat(a);else typeof e=="function"&&(n=e(n.slice()));return r&&(n=n.concat(Cr.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?zl[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(zl).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}ko.coreKnownTags=ev;ko.getTags=tv});var xo=g(Zl=>{"use strict";var So=R(),rv=jt(),iv=$t(),nv=br(),gn=Ql(),av=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Eo=class e{constructor({compat:t,customTags:r,merge:i,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?gn.getTags(t,"compat"):t?gn.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?gn.coreKnownTags:{},this.tags=gn.getTags(r,this.name,i),this.toStringOptions=s??null,Object.defineProperty(this,So.MAP,{value:rv.map}),Object.defineProperty(this,So.SCALAR,{value:nv.string}),Object.defineProperty(this,So.SEQ,{value:iv.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?av:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Zl.Schema=Eo});var tu=g(eu=>{"use strict";var ov=R(),Co=wr(),Pr=hr();function sv(e,t){let r=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(r.push(c),i=!0):e.directives.docStart&&(i=!0)}i&&r.push("---");let n=Co.createStringifyContext(e,t),{commentString:a}=n.options;if(e.commentBefore){r.length!==1&&r.unshift("");let c=a(e.commentBefore);r.unshift(Pr.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(ov.isNode(e.contents)){if(e.contents.spaceBefore&&i&&r.push(""),e.contents.commentBefore){let u=a(e.contents.commentBefore);r.push(Pr.indentComment(u,""))}n.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=Co.stringify(e.contents,n,()=>s=null,c);s&&(l+=Pr.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(Co.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
- `)?(r.push("..."),r.push(Pr.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&r[r.length-1]!==""&&r.push(""),r.push(Pr.indentComment(a(c),"")))}return r.join(`
57
+ ${a.comment}`:i.comment}i=n}t.items[r]=On.isPair(i)?i:new Ko.Pair(i)}}else e("Expected a sequence for this tag");return t}function Eu(t,e,r){let{replacer:i}=r,n=new Wv.YAMLSeq(t);n.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(Ko.createPair(s,c,r))}return n}var zv={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Su,createNode:Eu};Hn.createPairs=Eu;Hn.pairs=zv;Hn.resolvePairs=Su});var Qo=w(Xo=>{"use strict";var xu=_(),Yo=Ze(),Vr=at(),Gv=ot(),Cu=Dn(),xt=class t extends Gv.YAMLSeq{constructor(){super(),this.add=Vr.YAMLMap.prototype.add.bind(this),this.delete=Vr.YAMLMap.prototype.delete.bind(this),this.get=Vr.YAMLMap.prototype.get.bind(this),this.has=Vr.YAMLMap.prototype.has.bind(this),this.set=Vr.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=new Map;r?.onCreate&&r.onCreate(i);for(let n of this.items){let a,o;if(xu.isPair(n)?(a=Yo.toJS(n.key,"",r),o=Yo.toJS(n.value,a,r)):a=Yo.toJS(n,"",r),i.has(a))throw new Error("Ordered maps must not include duplicate keys");i.set(a,o)}return i}static from(e,r,i){let n=Cu.createPairs(e,r,i),a=new this;return a.items=n.items,a}};xt.tag="tag:yaml.org,2002:omap";var Jv={collection:"seq",identify:t=>t instanceof Map,nodeClass:xt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Cu.resolvePairs(t,e),i=[];for(let{key:n}of r.items)xu.isScalar(n)&&(i.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new xt,r)},createNode:(t,e,r)=>xt.from(t,e,r)};Xo.YAMLOMap=xt;Xo.omap=Jv});var Iu=w(Zo=>{"use strict";var Pu=F();function Ru({value:t,source:e},r){return e&&(t?_u:Au).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var _u={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Pu.Scalar(!0),stringify:Ru},Au={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Pu.Scalar(!1),stringify:Ru};Zo.falseTag=Au;Zo.trueTag=_u});var Tu=w(Ln=>{"use strict";var Uv=F(),es=Xt(),Kv={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:es.stringifyNumber},Yv={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():es.stringifyNumber(t)}},Xv={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Uv.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let i=t.substring(r+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:es.stringifyNumber};Ln.float=Xv;Ln.floatExp=Yv;Ln.floatNaN=Kv});var ju=w(zr=>{"use strict";var $u=Xt(),Wr=t=>typeof t=="bigint"||Number.isInteger(t);function Bn(t,e,r,{intAsBigInt:i}){let n=t[0];if((n==="-"||n==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return n==="-"?BigInt(-1)*o:o}let a=parseInt(t,r);return n==="-"?-1*a:a}function ts(t,e,r){let{value:i}=t;if(Wr(i)){let n=i.toString(e);return i<0?"-"+r+n.substr(1):r+n}return $u.stringifyNumber(t)}var Qv={identify:Wr,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Bn(t,2,2,r),stringify:t=>ts(t,2,"0b")},Zv={identify:Wr,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Bn(t,1,8,r),stringify:t=>ts(t,8,"0")},eg={identify:Wr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Bn(t,0,10,r),stringify:$u.stringifyNumber},tg={identify:Wr,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Bn(t,2,16,r),stringify:t=>ts(t,16,"0x")};zr.int=eg;zr.intBin=Qv;zr.intHex=tg;zr.intOct=Zv});var is=w(rs=>{"use strict";var qn=_(),Mn=it(),Fn=at(),Ct=class t extends Fn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;qn.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Mn.Pair(e.key,null):r=new Mn.Pair(e,null),Fn.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let i=Fn.findPair(this.items,e);return!r&&qn.isPair(i)?qn.isScalar(i.key)?i.key.value:i.key:i}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let i=Fn.findPair(this.items,e);i&&!r?this.items.splice(this.items.indexOf(i),1):!i&&r&&this.items.push(new Mn.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,i);throw new Error("Set items must all have null values")}static from(e,r,i){let{replacer:n}=i,a=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof n=="function"&&(o=n.call(r,o,o)),a.items.push(Mn.createPair(o,null,i));return a}};Ct.tag="tag:yaml.org,2002:set";var rg={collection:"map",identify:t=>t instanceof Set,nodeClass:Ct,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ct.from(t,e,r),resolve(t,e){if(qn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ct,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};rs.YAMLSet=Ct;rs.set=rg});var as=w(Vn=>{"use strict";var ig=Xt();function ns(t,e){let r=t[0],i=r==="-"||r==="+"?t.substring(1):t,n=o=>e?BigInt(o):Number(o),a=i.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return r==="-"?n(-1)*a:a}function Ou(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return ig.stringifyNumber(t);let i="";e<0&&(i="-",e*=r(-1));let n=r(60),a=[e%n];return e<60?a.unshift(0):(e=(e-a[0])/n,a.unshift(e%n),e>=60&&(e=(e-a[0])/n,a.unshift(e))),i+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ng={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>ns(t,r),stringify:Ou},ag={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>ns(t,!1),stringify:Ou},Hu={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Hu.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,i,n,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,i-1,n,a||0,o||0,s||0,c),u=e[8];if(u&&u!=="Z"){let d=ns(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Vn.floatTime=ag;Vn.intTime=ng;Vn.timestamp=Hu});var Bu=w(Lu=>{"use strict";var og=Kt(),sg=An(),cg=Yt(),lg=Fr(),ug=Uo(),Du=Iu(),os=Tu(),Wn=ju(),dg=kn(),fg=Qo(),pg=Dn(),hg=is(),ss=as(),mg=[og.map,cg.seq,lg.string,sg.nullTag,Du.trueTag,Du.falseTag,Wn.intBin,Wn.intOct,Wn.int,Wn.intHex,os.floatNaN,os.floatExp,os.float,ug.binary,dg.merge,fg.omap,pg.pairs,hg.set,ss.intTime,ss.floatTime,ss.timestamp];Lu.schema=mg});var Ku=w(us=>{"use strict";var Vu=Kt(),vg=An(),Wu=Yt(),gg=Fr(),wg=Mo(),cs=qo(),ls=Wo(),yg=wu(),Ng=bu(),zu=Uo(),Gr=kn(),Gu=Qo(),Ju=Dn(),Mu=Bu(),Uu=is(),zn=as(),Fu=new Map([["core",yg.schema],["failsafe",[Vu.map,Wu.seq,gg.string]],["json",Ng.schema],["yaml11",Mu.schema],["yaml-1.1",Mu.schema]]),qu={binary:zu.binary,bool:wg.boolTag,float:cs.float,floatExp:cs.floatExp,floatNaN:cs.floatNaN,floatTime:zn.floatTime,int:ls.int,intHex:ls.intHex,intOct:ls.intOct,intTime:zn.intTime,map:Vu.map,merge:Gr.merge,null:vg.nullTag,omap:Gu.omap,pairs:Ju.pairs,seq:Wu.seq,set:Uu.set,timestamp:zn.timestamp},bg={"tag:yaml.org,2002:binary":zu.binary,"tag:yaml.org,2002:merge":Gr.merge,"tag:yaml.org,2002:omap":Gu.omap,"tag:yaml.org,2002:pairs":Ju.pairs,"tag:yaml.org,2002:set":Uu.set,"tag:yaml.org,2002:timestamp":zn.timestamp};function kg(t,e,r){let i=Fu.get(e);if(i&&!t)return r&&!i.includes(Gr.merge)?i.concat(Gr.merge):i.slice();let n=i;if(!n)if(Array.isArray(t))n=[];else{let a=Array.from(Fu.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)n=n.concat(a);else typeof t=="function"&&(n=t(n.slice()));return r&&(n=n.concat(Gr.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?qu[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(qu).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}us.coreKnownTags=bg;us.getTags=kg});var ps=w(Yu=>{"use strict";var ds=_(),Sg=Kt(),Eg=Yt(),xg=Fr(),Gn=Ku(),Cg=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,fs=class t{constructor({compat:e,customTags:r,merge:i,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?Gn.getTags(e,"compat"):e?Gn.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?Gn.coreKnownTags:{},this.tags=Gn.getTags(r,this.name,i),this.toStringOptions=s??null,Object.defineProperty(this,ds.MAP,{value:Sg.map}),Object.defineProperty(this,ds.SCALAR,{value:xg.string}),Object.defineProperty(this,ds.SEQ,{value:Eg.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Cg:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Yu.Schema=fs});var Qu=w(Xu=>{"use strict";var Pg=_(),hs=Lr(),Jr=jr();function Rg(t,e){let r=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&r.push("---");let n=hs.createStringifyContext(t,e),{commentString:a}=n.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=a(t.commentBefore);r.unshift(Jr.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(Pg.isNode(t.contents)){if(t.contents.spaceBefore&&i&&r.push(""),t.contents.commentBefore){let u=a(t.contents.commentBefore);r.push(Jr.indentComment(u,""))}n.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=hs.stringify(t.contents,n,()=>s=null,c);s&&(l+=Jr.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(hs.stringify(t.contents,n));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
58
+ `)?(r.push("..."),r.push(Jr.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&r[r.length-1]!==""&&r.push(""),r.push(Jr.indentComment(a(c),"")))}return r.join(`
59
59
  `)+`
60
- `}eu.stringifyDocument=sv});var Rr=g(ru=>{"use strict";var cv=fr(),Ht=Hi(),oe=R(),lv=Ge(),uv=qe(),dv=xo(),fv=tu(),Po=Ti(),pv=Aa(),hv=pr(),Ro=_a(),_o=class e{constructor(t,r,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,oe.NODE_TYPE,{value:oe.DOC});let n=null;typeof r=="function"||Array.isArray(r)?n=r:i===void 0&&r&&(i=r,r=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=a;let{version:o}=a;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Ro.Directives({version:o}),this.setSchema(o,i),this.contents=t===void 0?null:this.createNode(t,n,i)}clone(){let t=Object.create(e.prototype,{[oe.NODE_TYPE]:{value:oe.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=oe.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Dt(this.contents)&&this.contents.add(t)}addIn(t,r){Dt(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let i=Po.anchorNames(this);t.anchor=!r||i.has(r)?Po.findNewAnchor(r||"a",i):r}return new cv.Alias(t.anchor)}createNode(t,r,i){let n;if(typeof r=="function")t=r.call({"":t},"",t),n=r;else if(Array.isArray(r)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=r.filter(m).map(String);w.length>0&&(r=r.concat(w)),n=r}else i===void 0&&r&&(i=r,r=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=i??{},{onAnchor:d,setAnchors:f,sourceObjects:h}=Po.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:h},p=hv.createNode(t,u,v);return s&&oe.isCollection(p)&&(p.flow=!0),f(),p}createPair(t,r,i={}){let n=this.createNode(t,null,i),a=this.createNode(r,null,i);return new lv.Pair(n,a)}delete(t){return Dt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Ht.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Dt(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return oe.isCollection(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return Ht.isEmptyPath(t)?!r&&oe.isScalar(this.contents)?this.contents.value:this.contents:oe.isCollection(this.contents)?this.contents.getIn(t,r):void 0}has(t){return oe.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Ht.isEmptyPath(t)?this.contents!==void 0:oe.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=Ht.collectionFromPath(this.schema,[t],r):Dt(this.contents)&&this.contents.set(t,r)}setIn(t,r){Ht.isEmptyPath(t)?this.contents=r:this.contents==null?this.contents=Ht.collectionFromPath(this.schema,Array.from(t),r):Dt(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ro.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Ro.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(i)this.schema=new dv.Schema(Object.assign(i,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:i,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=uv.toJS(this.contents,r??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?pv.applyReviver(o,{"":c},"",c):c}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return fv.stringifyDocument(this,t)}};function Dt(e){if(oe.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}ru.Document=_o});var Ir=g(Ar=>{"use strict";var _r=class extends Error{constructor(t,r,i,n){super(),this.name=t,this.code=i,this.message=n,this.pos=r}},Ao=class extends _r{constructor(t,r,i){super("YAMLParseError",t,r,i)}},Io=class extends _r{constructor(t,r,i){super("YAMLWarning",t,r,i)}},mv=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(s=>t.linePos(s));let{line:i,col:n}=r.linePos[0];r.message+=` at line ${i}, column ${n}`;let a=n-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,a))){let s=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);s.length>80&&(s=s.substring(0,79)+`…
60
+ `}Xu.stringifyDocument=Rg});var Ur=w(Zu=>{"use strict";var _g=Tr(),Qt=fn(),de=_(),Ag=it(),Ig=Ze(),Tg=ps(),$g=Qu(),ms=cn(),jg=yo(),Og=$r(),vs=wo(),gs=class t{constructor(e,r,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,de.NODE_TYPE,{value:de.DOC});let n=null;typeof r=="function"||Array.isArray(r)?n=r:i===void 0&&r&&(i=r,r=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=a;let{version:o}=a;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new vs.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,n,i)}clone(){let e=Object.create(t.prototype,{[de.NODE_TYPE]:{value:de.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=de.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Zt(this.contents)&&this.contents.add(e)}addIn(e,r){Zt(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let i=ms.anchorNames(this);e.anchor=!r||i.has(r)?ms.findNewAnchor(r||"a",i):r}return new _g.Alias(e.anchor)}createNode(e,r,i){let n;if(typeof r=="function")e=r.call({"":e},"",e),n=r;else if(Array.isArray(r)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=r.filter(m).map(String);g.length>0&&(r=r.concat(g)),n=r}else i===void 0&&r&&(i=r,r=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=i??{},{onAnchor:d,setAnchors:f,sourceObjects:h}=ms.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:h},p=Og.createNode(e,u,v);return s&&de.isCollection(p)&&(p.flow=!0),f(),p}createPair(e,r,i={}){let n=this.createNode(e,null,i),a=this.createNode(r,null,i);return new Ag.Pair(n,a)}delete(e){return Zt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Zt(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return de.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Qt.isEmptyPath(e)?!r&&de.isScalar(this.contents)?this.contents.value:this.contents:de.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return de.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qt.isEmptyPath(e)?this.contents!==void 0:de.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Qt.collectionFromPath(this.schema,[e],r):Zt(this.contents)&&this.contents.set(e,r)}setIn(e,r){Qt.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Qt.collectionFromPath(this.schema,Array.from(e),r):Zt(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new vs.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new vs.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(i)this.schema=new Tg.Schema(Object.assign(i,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:i,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=Ig.toJS(this.contents,r??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?jg.applyReviver(o,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return $g.stringifyDocument(this,e)}};function Zt(t){if(de.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Zu.Document=gs});var Xr=w(Yr=>{"use strict";var Kr=class extends Error{constructor(e,r,i,n){super(),this.name=e,this.code=i,this.message=n,this.pos=r}},ws=class extends Kr{constructor(e,r,i){super("YAMLParseError",e,r,i)}},ys=class extends Kr{constructor(e,r,i){super("YAMLWarning",e,r,i)}},Hg=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(s=>e.linePos(s));let{line:i,col:n}=r.linePos[0];r.message+=` at line ${i}, column ${n}`;let a=n-1,o=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);s.length>80&&(s=s.substring(0,79)+`…
61
61
  `),o=s+o}if(/[^ ]/.test(o)){let s=1,c=r.linePos[1];c?.line===i&&c.col>n&&(s=Math.max(1,Math.min(c.col-n,80-a)));let l=" ".repeat(a)+"^".repeat(s);r.message+=`:
62
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};Ar.YAMLError=_r;Ar.YAMLParseError=Ao;Ar.YAMLWarning=Io;Ar.prettifyError=mv});var Tr=g(iu=>{"use strict";function vv(e,{flow:t,indicator:r,next:i,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d="",f="",h=!1,v=!1,p=null,m=null,w=null,y=null,b=null,S=null,E=null;for(let N of e)switch(v&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&a(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),p&&(l&&N.type!=="comment"&&N.type!=="newline"&&a(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),N.type){case"space":!t&&(r!=="doc-start"||i?.type!=="flow-collection")&&N.source.includes(" ")&&(p=N),u=!0;break;case"comment":{u||a(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let F=N.source.substring(1)||" ";d?d+=f+F:d=F,f="",l=!1;break}case"newline":l?d?d+=N.source:(!S||r!=="seq-item-ind")&&(c=!0):f+=N.source,l=!0,h=!0,(m||w)&&(y=N),u=!0;break;case"anchor":m&&a(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&a(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,E??(E=N.offset),l=!1,u=!1,v=!0;break;case"tag":{w&&a(N,"MULTIPLE_TAGS","A node can have at most one tag"),w=N,E??(E=N.offset),l=!1,u=!1,v=!0;break}case r:(m||w)&&a(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),S&&a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),S=N,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&a(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=N,l=!1,u=!1;break}default:a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,u=!1}let x=e[e.length-1],T=x?x.offset+x.source.length:n;return v&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&a(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&a(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:S,spaceBefore:c,comment:d,hasNewline:h,anchor:m,tag:w,newlineAfterProp:y,end:T,start:E??T}}iu.resolveProps=vv});var wn=g(nu=>{"use strict";function To(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
- `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(To(t.key)||To(t.value))return!0}return!1;default:return!0}}nu.containsNewline=To});var jo=g(au=>{"use strict";var gv=wn();function wv(e,t,r){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&gv.containsNewline(t)&&r(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}au.flowIndentCheck=wv});var $o=g(su=>{"use strict";var ou=R();function yv(e,t,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(a,o)=>a===o||ou.isScalar(a)&&ou.isScalar(o)&&a.value===o.value;return t.some(a=>n(a.key,r))}su.mapIncludes=yv});var pu=g(fu=>{"use strict";var cu=Ge(),Nv=Ke(),lu=Tr(),bv=wn(),uu=jo(),kv=$o(),du="All mapping items must start at the same column";function Sv({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=a?.nodeClass??Nv.YAMLMap,s=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=i.offset,l=null;for(let u of i.items){let{start:d,key:f,sep:h,value:v}=u,p=lu.resolveProps(d,{indicator:"explicit-key-ind",next:f??h?.[0],offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==i.indent&&n(c,"BAD_INDENT",du)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(s.comment?s.comment+=`
67
- `+p.comment:s.comment=p.comment);continue}(p.newlineAfterProp||bv.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&n(c,"BAD_INDENT",du);r.atKey=!0;let w=p.end,y=f?e(r,f,p,n):t(r,w,d,null,p,n);r.schema.compat&&uu.flowIndentCheck(i.indent,f,n),r.atKey=!1,kv.mapIncludes(r,s.items,y)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let b=lu.resolveProps(h??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:i.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){m&&(v?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&p.start<b.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=v?e(r,v,b,n):t(r,c,h,null,b,n);r.schema.compat&&uu.flowIndentCheck(i.indent,v,n),c=S.range[2];let E=new cu.Pair(y,S);r.options.keepSourceTokens&&(E.srcToken=u),s.items.push(E)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
68
- `+b.comment:y.comment=b.comment);let S=new cu.Pair(y);r.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[i.offset,c,l??c],s}fu.resolveBlockMap=Sv});var mu=g(hu=>{"use strict";var Ev=Ye(),xv=Tr(),Cv=jo();function Pv({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=a?.nodeClass??Ev.YAMLSeq,s=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=i.offset,l=null;for(let{start:u,value:d}of i.items){let f=xv.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let h=d?e(r,d,f,n):t(r,f.end,u,null,f,n);r.schema.compat&&Cv.flowIndentCheck(i.indent,d,n),c=h.range[2],s.items.push(h)}return s.range=[i.offset,c,l??c],s}hu.resolveBlockSeq=Pv});var Lt=g(vu=>{"use strict";function Rv(e,t,r,i){let n="";if(e){let a=!1,o="";for(let s of e){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{r&&!a&&i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),a=!0;break;default:i(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}vu.resolveEnd=Rv});var Nu=g(yu=>{"use strict";var _v=R(),Av=Ge(),gu=Ke(),Iv=Ye(),Tv=Lt(),wu=Tr(),jv=wn(),$v=$o(),Oo="Block collections are not allowed within flow collections",Ho=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Ov({composeNode:e,composeEmptyNode:t},r,i,n,a){let o=i.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?gu.YAMLMap:Iv.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let w=i.items[m],{start:y,key:b,sep:S,value:E}=w,x=wu.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??S?.[0],offset:d,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!S&&!E){m===0&&x.comma?n(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<i.items.length-1&&n(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),x.comment&&(l.comment?l.comment+=`
69
- `+x.comment:l.comment=x.comment),d=x.end;continue}!o&&r.options.strict&&jv.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)x.comma&&n(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(x.comma||n(x.start,"MISSING_CHAR",`Missing , between ${s} items`),x.comment){let T="";e:for(let N of y)switch(N.type){case"comma":case"space":break;case"comment":T=N.source.substring(1);break e;default:break e}if(T){let N=l.items[l.items.length-1];_v.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
- `+T:N.comment=T,x.comment=x.comment.substring(T.length+1)}}if(!o&&!S&&!x.found){let T=E?e(r,E,x,n):t(r,x.end,S,null,x,n);l.items.push(T),d=T.range[2],Ho(E)&&n(T.range,"BLOCK_IN_FLOW",Oo)}else{r.atKey=!0;let T=x.end,N=b?e(r,b,x,n):t(r,T,y,null,x,n);Ho(b)&&n(N.range,"BLOCK_IN_FLOW",Oo),r.atKey=!1;let F=wu.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:N.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(F.found){if(!o&&!x.found&&r.options.strict){if(S)for(let B of S){if(B===F.found)break;if(B.type==="newline"){n(B,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}x.start<F.found.offset-1024&&n(F.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?n(E,"MISSING_CHAR",`Missing space after : in ${s}`):n(F.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let Be=E?e(r,E,F,n):F.found?t(r,F.end,S,null,F,n):null;Be?Ho(E)&&n(Be.range,"BLOCK_IN_FLOW",Oo):F.comment&&(N.comment?N.comment+=`
71
- `+F.comment:N.comment=F.comment);let Rt=new Av.Pair(N,Be);if(r.options.keepSourceTokens&&(Rt.srcToken=w),o){let B=l;$v.mapIncludes(r,B.items,N)&&n(T,"DUPLICATE_KEY","Map keys must be unique"),B.items.push(Rt)}else{let B=new gu.YAMLMap(r.schema);B.flow=!0,B.items.push(Rt);let yc=(Be??N).range;B.range=[N.range[0],yc[1],yc[2]],l.items.push(B)}d=Be?Be.range[2]:F.end}}let f=o?"}":"]",[h,...v]=i.end,p=d;if(h?.source===f)p=h.offset+h.source.length;else{let m=s[0].toUpperCase()+s.substring(1),w=u?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&v.unshift(h)}if(v.length>0){let m=Tv.resolveEnd(v,p,r.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}yu.resolveFlowCollection=Ov});var ku=g(bu=>{"use strict";var Hv=R(),Dv=M(),Lv=Ke(),Mv=Ye(),Fv=pu(),Bv=mu(),Vv=Nu();function Do(e,t,r,i,n,a){let o=r.type==="block-map"?Fv.resolveBlockMap(e,t,r,i,a):r.type==="block-seq"?Bv.resolveBlockSeq(e,t,r,i,a):Vv.resolveFlowCollection(e,t,r,i,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function qv(e,t,r,i,n){let a=i.tag,o=a?t.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:h}=i,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!h||h.offset<v.offset)&&n(v,"MISSING_CHAR","Missing newline after block sequence props")}let s=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===Lv.YAMLMap.tagName&&s==="map"||o===Mv.YAMLSeq.tagName&&s==="seq")return Do(e,t,r,n,o);let c=t.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=t.schema.knownTags[o];if(f?.collection===s)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Do(e,t,r,n,o)}let l=Do(e,t,r,n,o,c),u=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),t.options)??l,d=Hv.isNode(u)?u:new Dv.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}bu.composeCollection=qv});var Mo=g(Su=>{"use strict";var Lo=M();function Wv(e,t,r){let i=t.offset,n=zv(t,e.options.strict,r);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let a=n.mode===">"?Lo.Scalar.BLOCK_FOLDED:Lo.Scalar.BLOCK_LITERAL,o=t.source?Jv(t.source):[],s=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")s=p;else break}if(s===0){let p=n.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",m=i+n.length;return t.source&&(m+=t.source.length),{value:p,type:a,comment:n.comment,range:[i,m,m]}}let c=t.indent+n.indent,l=t.offset+n.length,u=0;for(let p=0;p<s;++p){let[m,w]=o[p];if(w===""||w==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&r(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),u=p,c===0&&!e.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let p=o.length-1;p>=s;--p)o[p][0].length>c&&(s=p+1);let d="",f="",h=!1;for(let p=0;p<u;++p)d+=o[p][0].slice(c)+`
74
- `;for(let p=u;p<s;++p){let[m,w]=o[p];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let S=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;r(l-w.length-(y?2:1),"BAD_INDENT",S),m=""}a===Lo.Scalar.BLOCK_LITERAL?(d+=f+m.slice(c)+w,f=`
75
- `):m.length>c||w[0]===" "?(f===" "?f=`
65
+ `}};Yr.YAMLError=Kr;Yr.YAMLParseError=ws;Yr.YAMLWarning=ys;Yr.prettifyError=Hg});var Qr=w(ed=>{"use strict";function Dg(t,{flow:e,indicator:r,next:i,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d="",f="",h=!1,v=!1,p=null,m=null,g=null,y=null,N=null,S=null,x=null;for(let b of t)switch(v&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&a(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&a(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(r!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),u=!0;break;case"comment":{u||a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=b.source.substring(1)||" ";d?d+=f+q:d=q,f="",l=!1;break}case"newline":l?d?d+=b.source:(!S||r!=="seq-item-ind")&&(c=!0):f+=b.source,l=!0,h=!0,(m||g)&&(y=b),u=!0;break;case"anchor":m&&a(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&a(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,x??(x=b.offset),l=!1,u=!1,v=!0;break;case"tag":{g&&a(b,"MULTIPLE_TAGS","A node can have at most one tag"),g=b,x??(x=b.offset),l=!1,u=!1,v=!0;break}case r:(m||g)&&a(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),S&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),S=b,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){N&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),N=b,l=!1,u=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,u=!1}let E=t[t.length-1],j=E?E.offset+E.source.length:n;return v&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&a(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&a(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:N,found:S,spaceBefore:c,comment:d,hasNewline:h,anchor:m,tag:g,newlineAfterProp:y,end:j,start:x??j}}ed.resolveProps=Dg});var Jn=w(td=>{"use strict";function Ns(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(Ns(e.key)||Ns(e.value))return!0}return!1;default:return!0}}td.containsNewline=Ns});var bs=w(rd=>{"use strict";var Lg=Jn();function Bg(t,e,r){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&Lg.containsNewline(e)&&r(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}rd.flowIndentCheck=Bg});var ks=w(nd=>{"use strict";var id=_();function Mg(t,e,r){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let n=typeof i=="function"?i:(a,o)=>a===o||id.isScalar(a)&&id.isScalar(o)&&a.value===o.value;return e.some(a=>n(a.key,r))}nd.mapIncludes=Mg});var ud=w(ld=>{"use strict";var ad=it(),Fg=at(),od=Qr(),qg=Jn(),sd=bs(),Vg=ks(),cd="All mapping items must start at the same column";function Wg({composeNode:t,composeEmptyNode:e},r,i,n,a){let o=a?.nodeClass??Fg.YAMLMap,s=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=i.offset,l=null;for(let u of i.items){let{start:d,key:f,sep:h,value:v}=u,p=od.resolveProps(d,{indicator:"explicit-key-ind",next:f??h?.[0],offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==i.indent&&n(c,"BAD_INDENT",cd)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(s.comment?s.comment+=`
67
+ `+p.comment:s.comment=p.comment);continue}(p.newlineAfterProp||qg.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&n(c,"BAD_INDENT",cd);r.atKey=!0;let g=p.end,y=f?t(r,f,p,n):e(r,g,d,null,p,n);r.schema.compat&&sd.flowIndentCheck(i.indent,f,n),r.atKey=!1,Vg.mapIncludes(r,s.items,y)&&n(g,"DUPLICATE_KEY","Map keys must be unique");let N=od.resolveProps(h??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:i.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=N.end,N.found){m&&(v?.type==="block-map"&&!N.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&p.start<N.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=v?t(r,v,N,n):e(r,c,h,null,N,n);r.schema.compat&&sd.flowIndentCheck(i.indent,v,n),c=S.range[2];let x=new ad.Pair(y,S);r.options.keepSourceTokens&&(x.srcToken=u),s.items.push(x)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),N.comment&&(y.comment?y.comment+=`
68
+ `+N.comment:y.comment=N.comment);let S=new ad.Pair(y);r.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[i.offset,c,l??c],s}ld.resolveBlockMap=Wg});var fd=w(dd=>{"use strict";var zg=ot(),Gg=Qr(),Jg=bs();function Ug({composeNode:t,composeEmptyNode:e},r,i,n,a){let o=a?.nodeClass??zg.YAMLSeq,s=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=i.offset,l=null;for(let{start:u,value:d}of i.items){let f=Gg.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let h=d?t(r,d,f,n):e(r,f.end,u,null,f,n);r.schema.compat&&Jg.flowIndentCheck(i.indent,d,n),c=h.range[2],s.items.push(h)}return s.range=[i.offset,c,l??c],s}dd.resolveBlockSeq=Ug});var er=w(pd=>{"use strict";function Kg(t,e,r,i){let n="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{r&&!a&&i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),a=!0;break;default:i(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:n,offset:e}}pd.resolveEnd=Kg});var gd=w(vd=>{"use strict";var Yg=_(),Xg=it(),hd=at(),Qg=ot(),Zg=er(),md=Qr(),ew=Jn(),tw=ks(),Ss="Block collections are not allowed within flow collections",Es=t=>t&&(t.type==="block-map"||t.type==="block-seq");function rw({composeNode:t,composeEmptyNode:e},r,i,n,a){let o=i.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?hd.YAMLMap:Qg.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let g=i.items[m],{start:y,key:N,sep:S,value:x}=g,E=md.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:N??S?.[0],offset:d,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!S&&!x){m===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<i.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),d=E.end;continue}!o&&r.options.strict&&ew.containsNewline(N)&&n(N,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${s} items`),E.comment){let j="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":j=b.source.substring(1);break e;default:break e}if(j){let b=l.items[l.items.length-1];Yg.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
+ `+j:b.comment=j,E.comment=E.comment.substring(j.length+1)}}if(!o&&!S&&!E.found){let j=x?t(r,x,E,n):e(r,E.end,S,null,E,n);l.items.push(j),d=j.range[2],Es(x)&&n(j.range,"BLOCK_IN_FLOW",Ss)}else{r.atKey=!0;let j=E.end,b=N?t(r,N,E,n):e(r,j,y,null,E,n);Es(N)&&n(b.range,"BLOCK_IN_FLOW",Ss),r.atKey=!1;let q=md.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:x,offset:b.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(q.found){if(!o&&!E.found&&r.options.strict){if(S)for(let V of S){if(V===q.found)break;if(V.type==="newline"){n(V,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<q.found.offset-1024&&n(q.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else x&&("source"in x&&x.source?.[0]===":"?n(x,"MISSING_CHAR",`Missing space after : in ${s}`):n(q.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let Xe=x?t(r,x,q,n):q.found?e(r,q.end,S,null,q,n):null;Xe?Es(x)&&n(Xe.range,"BLOCK_IN_FLOW",Ss):q.comment&&(b.comment?b.comment+=`
71
+ `+q.comment:b.comment=q.comment);let Wt=new Xg.Pair(b,Xe);if(r.options.keepSourceTokens&&(Wt.srcToken=g),o){let V=l;tw.mapIncludes(r,V.items,b)&&n(j,"DUPLICATE_KEY","Map keys must be unique"),V.items.push(Wt)}else{let V=new hd.YAMLMap(r.schema);V.flow=!0,V.items.push(Wt);let vl=(Xe??b).range;V.range=[b.range[0],vl[1],vl[2]],l.items.push(V)}d=Xe?Xe.range[2]:q.end}}let f=o?"}":"]",[h,...v]=i.end,p=d;if(h?.source===f)p=h.offset+h.source.length;else{let m=s[0].toUpperCase()+s.substring(1),g=u?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",g),h&&h.source.length!==1&&v.unshift(h)}if(v.length>0){let m=Zg.resolveEnd(v,p,r.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}vd.resolveFlowCollection=rw});var yd=w(wd=>{"use strict";var iw=_(),nw=F(),aw=at(),ow=ot(),sw=ud(),cw=fd(),lw=gd();function xs(t,e,r,i,n,a){let o=r.type==="block-map"?sw.resolveBlockMap(t,e,r,i,a):r.type==="block-seq"?cw.resolveBlockSeq(t,e,r,i,a):lw.resolveFlowCollection(t,e,r,i,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function uw(t,e,r,i,n){let a=i.tag,o=a?e.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:h}=i,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!h||h.offset<v.offset)&&n(v,"MISSING_CHAR","Missing newline after block sequence props")}let s=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===aw.YAMLMap.tagName&&s==="map"||o===ow.YAMLSeq.tagName&&s==="seq")return xs(t,e,r,n,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=e.schema.knownTags[o];if(f?.collection===s)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),xs(t,e,r,n,o)}let l=xs(t,e,r,n,o,c),u=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),e.options)??l,d=iw.isNode(u)?u:new nw.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}wd.composeCollection=uw});var Ps=w(Nd=>{"use strict";var Cs=F();function dw(t,e,r){let i=e.offset,n=fw(e,t.options.strict,r);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let a=n.mode===">"?Cs.Scalar.BLOCK_FOLDED:Cs.Scalar.BLOCK_LITERAL,o=e.source?pw(e.source):[],s=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")s=p;else break}if(s===0){let p=n.chomp==="+"&&o.length>0?`
73
+ `.repeat(Math.max(1,o.length-1)):"",m=i+n.length;return e.source&&(m+=e.source.length),{value:p,type:a,comment:n.comment,range:[i,m,m]}}let c=e.indent+n.indent,l=e.offset+n.length,u=0;for(let p=0;p<s;++p){let[m,g]=o[p];if(g===""||g==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&r(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),u=p,c===0&&!t.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+g.length+1}for(let p=o.length-1;p>=s;--p)o[p][0].length>c&&(s=p+1);let d="",f="",h=!1;for(let p=0;p<u;++p)d+=o[p][0].slice(c)+`
74
+ `;for(let p=u;p<s;++p){let[m,g]=o[p];l+=m.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&m.length<c){let S=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;r(l-g.length-(y?2:1),"BAD_INDENT",S),m=""}a===Cs.Scalar.BLOCK_LITERAL?(d+=f+m.slice(c)+g,f=`
75
+ `):m.length>c||g[0]===" "?(f===" "?f=`
76
76
  `:!h&&f===`
77
77
  `&&(f=`
78
78
 
79
- `),d+=f+m.slice(c)+w,f=`
80
- `,h=!0):w===""?f===`
79
+ `),d+=f+m.slice(c)+g,f=`
80
+ `,h=!0):g===""?f===`
81
81
  `?d+=`
82
82
  `:f=`
83
- `:(d+=f+w,f=" ",h=!1)}switch(n.chomp){case"-":break;case"+":for(let p=s;p<o.length;++p)d+=`
83
+ `:(d+=f+g,f=" ",h=!1)}switch(n.chomp){case"-":break;case"+":for(let p=s;p<o.length;++p)d+=`
84
84
  `+o[p][0].slice(c);d[d.length-1]!==`
85
85
  `&&(d+=`
86
86
  `);break;default:d+=`
87
- `}let v=i+n.length+t.source.length;return{value:d,type:a,comment:n.comment,range:[i,v,v]}}function zv({offset:e,props:t},r,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let h=n[f];if(!s&&(h==="-"||h==="+"))s=h;else{let v=Number(h);!o&&v?o=v:c===-1&&(c=e+f)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let f=1;f<t.length;++f){let h=t[f];switch(h.type){case"space":l=!0;case"newline":d+=h.source.length;break;case"comment":r&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=h.source.length,u=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),d+=h.source.length;break;default:{let v=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",v);let p=h.source;p&&typeof p=="string"&&(d+=p.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Jv(e){let t=e.split(/\n( *)/),r=t[0],i=r.match(/^( *)/),a=[i?.[1]?[i[1],r.slice(i[1].length)]:["",r]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}Su.resolveBlockScalar=Wv});var Bo=g(xu=>{"use strict";var Fo=M(),Gv=Lt();function Uv(e,t,r){let{offset:i,type:n,source:a,end:o}=e,s,c,l=(f,h,v)=>r(i+f,h,v);switch(n){case"scalar":s=Fo.Scalar.PLAIN,c=Kv(a,l);break;case"single-quoted-scalar":s=Fo.Scalar.QUOTE_SINGLE,c=Yv(a,l);break;case"double-quoted-scalar":s=Fo.Scalar.QUOTE_DOUBLE,c=Xv(a,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+a.length,i+a.length]}}let u=i+a.length,d=Gv.resolveEnd(o,u,t,r);return{value:c,type:s,comment:d.comment,range:[i,u,d.offset]}}function Kv(e,t){let r="";switch(e[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Eu(e)}function Yv(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Eu(e.slice(1,-1)).replace(/''/g,"'")}function Eu(e){let t,r;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let v=i+n.length+e.source.length;return{value:d,type:a,comment:n.comment,range:[i,v,v]}}function fw({offset:t,props:e},r,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let h=n[f];if(!s&&(h==="-"||h==="+"))s=h;else{let v=Number(h);!o&&v?o=v:c===-1&&(c=t+f)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let f=1;f<e.length;++f){let h=e[f];switch(h.type){case"space":l=!0;case"newline":d+=h.source.length;break;case"comment":r&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=h.source.length,u=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),d+=h.source.length;break;default:{let v=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",v);let p=h.source;p&&typeof p=="string"&&(d+=p.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function pw(t){let e=t.split(/\n( *)/),r=e[0],i=r.match(/^( *)/),a=[i?.[1]?[i[1],r.slice(i[1].length)]:["",r]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}Nd.resolveBlockScalar=dw});var _s=w(kd=>{"use strict";var Rs=F(),hw=er();function mw(t,e,r){let{offset:i,type:n,source:a,end:o}=t,s,c,l=(f,h,v)=>r(i+f,h,v);switch(n){case"scalar":s=Rs.Scalar.PLAIN,c=vw(a,l);break;case"single-quoted-scalar":s=Rs.Scalar.QUOTE_SINGLE,c=gw(a,l);break;case"double-quoted-scalar":s=Rs.Scalar.QUOTE_DOUBLE,c=ww(a,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+a.length,i+a.length]}}let u=i+a.length,d=hw.resolveEnd(o,u,e,r);return{value:c,type:s,comment:d.comment,range:[i,u,d.offset]}}function vw(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),bd(t)}function gw(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),bd(t.slice(1,-1)).replace(/''/g,"'")}function bd(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let n=i[1],a=" ",o=t.lastIndex;for(r.lastIndex=o;i=r.exec(e);)i[1]===""?a===`
89
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(t);if(!i)return t;let n=i[1],a=" ",o=e.lastIndex;for(r.lastIndex=o;i=r.exec(t);)i[1]===""?a===`
90
90
  `?n+=a:a=`
91
- `:(n+=a+i[1],a=" "),o=r.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,i=s.exec(e),n+a+(i?.[1]??"")}function Xv(e,t){let r="";for(let i=1;i<e.length-1;++i){let n=e[i];if(!(n==="\r"&&e[i+1]===`
91
+ `:(n+=a+i[1],a=" "),o=r.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,i=s.exec(t),n+a+(i?.[1]??"")}function ww(t,e){let r="";for(let i=1;i<t.length-1;++i){let n=t[i];if(!(n==="\r"&&t[i+1]===`
92
92
  `))if(n===`
93
- `){let{fold:a,offset:o}=Qv(e,i);r+=a,i=o}else if(n==="\\"){let a=e[++i],o=Zv[a];if(o)r+=o;else if(a===`
94
- `)for(a=e[i+1];a===" "||a===" ";)a=e[++i+1];else if(a==="\r"&&e[i+1]===`
95
- `)for(a=e[++i+1];a===" "||a===" ";)a=e[++i+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;r+=eg(e,i+1,s,t),i+=s}else{let s=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),r+=s}}else if(n===" "||n===" "){let a=i,o=e[i+1];for(;o===" "||o===" ";)o=e[++i+1];o!==`
96
- `&&!(o==="\r"&&e[i+2]===`
97
- `)&&(r+=i>a?e.slice(a,i+1):n)}else r+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function Qv(e,t){let r="",i=e[t+1];for(;(i===" "||i===" "||i===`
98
- `||i==="\r")&&!(i==="\r"&&e[t+2]!==`
93
+ `){let{fold:a,offset:o}=yw(t,i);r+=a,i=o}else if(n==="\\"){let a=t[++i],o=Nw[a];if(o)r+=o;else if(a===`
94
+ `)for(a=t[i+1];a===" "||a===" ";)a=t[++i+1];else if(a==="\r"&&t[i+1]===`
95
+ `)for(a=t[++i+1];a===" "||a===" ";)a=t[++i+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;r+=bw(t,i+1,s,e),i+=s}else{let s=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),r+=s}}else if(n===" "||n===" "){let a=i,o=t[i+1];for(;o===" "||o===" ";)o=t[++i+1];o!==`
96
+ `&&!(o==="\r"&&t[i+2]===`
97
+ `)&&(r+=i>a?t.slice(a,i+1):n)}else r+=n}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function yw(t,e){let r="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
+ `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
99
  `);)i===`
100
100
  `&&(r+=`
101
- `),t+=1,i=e[t+1];return r||(r=" "),{fold:r,offset:t}}var Zv={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function eg(e,t,r,i){let n=e.substr(t,r),o=n.length===r&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,r+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}xu.resolveFlowScalar=Uv});var Ru=g(Pu=>{"use strict";var vt=R(),Cu=M(),tg=Mo(),rg=Bo();function ig(e,t,r,i){let{value:n,type:a,comment:o,range:s}=t.type==="block-scalar"?tg.resolveBlockScalar(e,t,i):rg.resolveFlowScalar(t,e.options.strict,i),c=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[vt.SCALAR]:c?l=ng(e.schema,n,c,r,i):t.type==="scalar"?l=ag(e,n,t,i):l=e.schema[vt.SCALAR];let u;try{let d=l.resolve(n,f=>i(r??t,"TAG_RESOLVE_FAILED",f),e.options);u=vt.isScalar(d)?d:new Cu.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);i(r??t,"TAG_RESOLVE_FAILED",f),u=new Cu.Scalar(n)}return u.range=s,u.source=n,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function ng(e,t,r,i,n){if(r==="!")return e[vt.SCALAR];let a=[];for(let s of e.tags)if(!s.collection&&s.tag===r)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(t))return s;let o=e.knownTags[r];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[vt.SCALAR])}function ag({atKey:e,directives:t,schema:r},i,n,a){let o=r.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(i))||r[vt.SCALAR];if(r.compat){let s=r.compat.find(c=>c.default&&c.test?.test(i))??r[vt.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",u,!0)}}return o}Pu.composeScalar=ig});var Au=g(_u=>{"use strict";function og(e,t,r){if(t){r??(r=t.length);for(let i=r-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];n?.type==="space";)e+=n.source.length,n=t[++i];break}}return e}_u.emptyScalarPosition=og});var ju=g(qo=>{"use strict";var sg=fr(),cg=R(),lg=ku(),Iu=Ru(),ug=Lt(),dg=Au(),fg={composeNode:Tu,composeEmptyNode:Vo};function Tu(e,t,r,i){let n=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=r,l,u=!0;switch(t.type){case"alias":l=pg(e,t,i),(s||c)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Iu.composeScalar(e,t,c,i),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=lg.composeCollection(fg,e,t,r,i),s&&(l.anchor=s.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);i(t,"RESOURCE_EXHAUSTION",f)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=Vo(e,t.offset,void 0,null,r,i)),s&&l.anchor===""&&i(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!cg.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Vo(e,t,r,i,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:dg.emptyScalarPosition(t,r,i),indent:-1,source:""},d=Iu.composeScalar(e,u,s,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),a&&(d.comment=a,d.range[2]=c),d}function pg({options:e},{offset:t,source:r,end:i},n){let a=new sg.Alias(r.substring(1));a.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+r.length,s=ug.resolveEnd(i,o,e.strict,n);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}qo.composeEmptyNode=Vo;qo.composeNode=Tu});var Hu=g(Ou=>{"use strict";var hg=Rr(),$u=ju(),mg=Lt(),vg=Tr();function gg(e,t,{offset:r,start:i,value:n,end:a},o){let s=Object.assign({_directives:t},e),c=new hg.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=vg.resolveProps(i,{indicator:"doc-start",next:n??a?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?$u.composeNode(l,n,u,o):$u.composeEmptyNode(l,u.end,i,null,u,o);let d=c.contents.range[2],f=mg.resolveEnd(a,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}Ou.composeDoc=gg});var zo=g(Mu=>{"use strict";var wg=Pi("process"),yg=_a(),Ng=Rr(),jr=Ir(),Du=R(),bg=Hu(),kg=Lt();function $r(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function Lu(e){let t="",r=!1,i=!1;for(let n=0;n<e.length;++n){let a=e[n];switch(a[0]){case"#":t+=(t===""?"":i?`
101
+ `),e+=1,i=t[e+1];return r||(r=" "),{fold:r,offset:e}}var Nw={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function bw(t,e,r,i){let n=t.substr(e,r),o=n.length===r&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,r+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}kd.resolveFlowScalar=mw});var xd=w(Ed=>{"use strict";var Pt=_(),Sd=F(),kw=Ps(),Sw=_s();function Ew(t,e,r,i){let{value:n,type:a,comment:o,range:s}=e.type==="block-scalar"?kw.resolveBlockScalar(t,e,i):Sw.resolveFlowScalar(e,t.options.strict,i),c=r?t.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Pt.SCALAR]:c?l=xw(t.schema,n,c,r,i):e.type==="scalar"?l=Cw(t,n,e,i):l=t.schema[Pt.SCALAR];let u;try{let d=l.resolve(n,f=>i(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=Pt.isScalar(d)?d:new Sd.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);i(r??e,"TAG_RESOLVE_FAILED",f),u=new Sd.Scalar(n)}return u.range=s,u.source=n,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function xw(t,e,r,i,n){if(r==="!")return t[Pt.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===r)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[r];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Pt.SCALAR])}function Cw({atKey:t,directives:e,schema:r},i,n,a){let o=r.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(i))||r[Pt.SCALAR];if(r.compat){let s=r.compat.find(c=>c.default&&c.test?.test(i))??r[Pt.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",u,!0)}}return o}Ed.composeScalar=Ew});var Pd=w(Cd=>{"use strict";function Pw(t,e,r){if(e){r??(r=e.length);for(let i=r-1;i>=0;--i){let n=e[i];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++i];n?.type==="space";)t+=n.source.length,n=e[++i];break}}return t}Cd.emptyScalarPosition=Pw});var Ad=w(Is=>{"use strict";var Rw=Tr(),_w=_(),Aw=yd(),Rd=xd(),Iw=er(),Tw=Pd(),$w={composeNode:_d,composeEmptyNode:As};function _d(t,e,r,i){let n=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=jw(t,e,i),(s||c)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Rd.composeScalar(t,e,c,i),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Aw.composeCollection($w,t,e,r,i),s&&(l.anchor=s.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);i(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=As(t,e.offset,void 0,null,r,i)),s&&l.anchor===""&&i(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&t.options.stringKeys&&(!_w.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function As(t,e,r,i,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:Tw.emptyScalarPosition(e,r,i),indent:-1,source:""},d=Rd.composeScalar(t,u,s,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),a&&(d.comment=a,d.range[2]=c),d}function jw({options:t},{offset:e,source:r,end:i},n){let a=new Rw.Alias(r.substring(1));a.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+r.length,s=Iw.resolveEnd(i,o,t.strict,n);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}Is.composeEmptyNode=As;Is.composeNode=_d});var $d=w(Td=>{"use strict";var Ow=Ur(),Id=Ad(),Hw=er(),Dw=Qr();function Lw(t,e,{offset:r,start:i,value:n,end:a},o){let s=Object.assign({_directives:e},t),c=new Ow.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Dw.resolveProps(i,{indicator:"doc-start",next:n??a?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Id.composeNode(l,n,u,o):Id.composeEmptyNode(l,u.end,i,null,u,o);let d=c.contents.range[2],f=Hw.resolveEnd(a,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}Td.composeDoc=Lw});var $s=w(Hd=>{"use strict";var Bw=rn("process"),Mw=wo(),Fw=Ur(),Zr=Xr(),jd=_(),qw=$d(),Vw=er();function ei(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function Od(t){let e="",r=!1,i=!1;for(let n=0;n<t.length;++n){let a=t[n];switch(a[0]){case"#":e+=(e===""?"":i?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),r=!0,i=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),r=!1;break;default:r||(i=!0),r=!1}}return{comment:t,afterEmptyLine:i}}var Wo=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,i,n,a)=>{let o=$r(r);a?this.warnings.push(new jr.YAMLWarning(o,i,n)):this.errors.push(new jr.YAMLParseError(o,i,n))},this.directives=new yg.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:i,afterEmptyLine:n}=Lu(this.prelude);if(i){let a=t.contents;if(r)t.comment=t.comment?`${t.comment}
106
- ${i}`:i;else if(n||t.directives.docStart||!a)t.commentBefore=i;else if(Du.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Du.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${i}
105
+ `)+(a.substring(1)||" "),r=!0,i=!1;break;case"%":t[n+1]?.[0]!=="#"&&(n+=1),r=!1;break;default:r||(i=!0),r=!1}}return{comment:e,afterEmptyLine:i}}var Ts=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,i,n,a)=>{let o=ei(r);a?this.warnings.push(new Zr.YAMLWarning(o,i,n)):this.errors.push(new Zr.YAMLParseError(o,i,n))},this.directives=new Mw.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:i,afterEmptyLine:n}=Od(this.prelude);if(i){let a=e.contents;if(r)e.comment=e.comment?`${e.comment}
106
+ ${i}`:i;else if(n||e.directives.docStart||!a)e.commentBefore=i;else if(jd.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];jd.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${i}
107
107
  ${s}`:i}else{let o=a.commentBefore;a.commentBefore=o?`${i}
108
- ${o}`:i}}if(r){for(let a=0;a<this.errors.length;++a)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Lu(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,r=!1,i=-1){for(let n of t)yield*this.next(n);yield*this.end(r,i)}*next(t){switch(wg.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(r,i,n)=>{let a=$r(t);a[0]+=r,this.onError(a,"BAD_DIRECTIVE",i,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=bg.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let r=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new jr.YAMLParseError($r(t),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new jr.YAMLParseError($r(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let r=kg.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
- ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new jr.YAMLParseError($r(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),n=new Ng.Document(void 0,i);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,r,r],this.decorate(n,!1),yield n}}};Mu.Composer=Wo});var Vu=g(yn=>{"use strict";var Sg=Mo(),Eg=Bo(),xg=Ir(),Fu=gr();function Cg(e,t=!0,r){if(e){let i=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(r)r(s,a,o);else throw new xg.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Eg.resolveFlowScalar(e,t,i);case"block-scalar":return Sg.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function Pg(e,t){let{implicitKey:r=!1,indent:i,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=t,s=Fu.stringifyString({type:o,value:e},{implicitKey:r,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:i,source:`
108
+ ${o}`:i}}if(r){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Od(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,i=-1){for(let n of e)yield*this.next(n);yield*this.end(r,i)}*next(e){switch(Bw.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(r,i,n)=>{let a=ei(e);a[0]+=r,this.onError(a,"BAD_DIRECTIVE",i,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=qw.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new Zr.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Zr.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let r=Vw.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
+ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Zr.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),n=new Fw.Document(void 0,i);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,r,r],this.decorate(n,!1),yield n}}};Hd.Composer=Ts});var Bd=w(Un=>{"use strict";var Ww=Ps(),zw=_s(),Gw=Xr(),Dd=Dr();function Jw(t,e=!0,r){if(t){let i=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(r)r(s,a,o);else throw new Gw.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return zw.resolveFlowScalar(t,e,i);case"block-scalar":return Ww.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Uw(t,e){let{implicitKey:r=!1,indent:i,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=e,s=Dd.stringifyString({type:o,value:t},{implicitKey:r,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
111
  `),u=s.substring(0,l),d=s.substring(l+1)+`
112
- `,f=[{type:"block-scalar-header",offset:a,indent:i,source:u}];return Bu(f,c)||f.push({type:"newline",offset:-1,indent:i,source:`
113
- `}),{type:"block-scalar",offset:a,indent:i,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:a,indent:i,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:i,source:s,end:c};default:return{type:"scalar",offset:a,indent:i,source:s,end:c}}}function Rg(e,t,r={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=r,s="indent"in e?e.indent:null;if(i&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Fu.stringifyString({type:o,value:t},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":_g(e,c);break;case'"':Jo(e,c,"double-quoted-scalar");break;case"'":Jo(e,c,"single-quoted-scalar");break;default:Jo(e,c,"scalar")}}function _g(e,t){let r=t.indexOf(`
114
- `),i=t.substring(0,r),n=t.substring(r+1)+`
115
- `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=i,e.source=n}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:i}];Bu(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:n})}}function Bu(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function Jo(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let a of i)a.offset+=n;delete e.props,Object.assign(e,{type:r,source:t,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
- `};delete e.items,Object.assign(e,{type:r,source:t,end:[n]});break}default:{let i="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:r,indent:i,source:t,end:n})}}}yn.createScalarToken=Pg;yn.resolveAsScalar=Cg;yn.setScalarValue=Rg});var Wu=g(qu=>{"use strict";var Ag=e=>"type"in e?bn(e):Nn(e);function bn(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=bn(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=Nn(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=Nn(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=Nn(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function Nn({start:e,key:t,sep:r,value:i}){let n="";for(let a of e)n+=a.source;if(t&&(n+=bn(t)),r)for(let a of r)n+=a.source;return i&&(n+=bn(i)),n}qu.stringify=Ag});var Uu=g(Gu=>{"use strict";var Go=Symbol("break visit"),Ig=Symbol("skip children"),zu=Symbol("remove item");function gt(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Ju(Object.freeze([]),e,t)}gt.BREAK=Go;gt.SKIP=Ig;gt.REMOVE=zu;gt.itemAtPath=(e,t)=>{let r=e;for(let[i,n]of t){let a=r?.[i];if(a&&"items"in a)r=a.items[n];else return}return r};gt.parentCollection=(e,t)=>{let r=gt.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],n=r?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Ju(e,t,r){let i=r(t,e);if(typeof i=="symbol")return i;for(let n of["key","value"]){let a=t[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Ju(Object.freeze(e.concat([[n,o]])),a.items[o],r);if(typeof s=="number")o=s-1;else{if(s===Go)return Go;s===zu&&(a.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}Gu.visit=gt});var kn=g(Z=>{"use strict";var Uo=Vu(),Tg=Wu(),jg=Uu(),Ko="\uFEFF",Yo="",Xo="",Qo="",$g=e=>!!e&&"items"in e,Og=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Hg(e){switch(e){case Ko:return"<BOM>";case Yo:return"<DOC>";case Xo:return"<FLOW_END>";case Qo:return"<SCALAR>";default:return JSON.stringify(e)}}function Dg(e){switch(e){case Ko:return"byte-order-mark";case Yo:return"doc-mode";case Xo:return"flow-error-end";case Qo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
112
+ `,f=[{type:"block-scalar-header",offset:a,indent:i,source:u}];return Ld(f,c)||f.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:a,indent:i,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:a,indent:i,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:i,source:s,end:c};default:return{type:"scalar",offset:a,indent:i,source:s,end:c}}}function Kw(t,e,r={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=r,s="indent"in t?t.indent:null;if(i&&typeof s=="number"&&(s+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Dd.stringifyString({type:o,value:e},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Yw(t,c);break;case'"':js(t,c,"double-quoted-scalar");break;case"'":js(t,c,"single-quoted-scalar");break;default:js(t,c,"scalar")}}function Yw(t,e){let r=e.indexOf(`
114
+ `),i=e.substring(0,r),n=e.substring(r+1)+`
115
+ `;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=i,t.source=n}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:i}];Ld(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:n})}}function Ld(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function js(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),n=e.length;t.props[0].type==="block-scalar-header"&&(n-=t.props[0].source.length);for(let a of i)a.offset+=n;delete t.props,Object.assign(t,{type:r,source:e,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:r,source:e,end:[n]});break}default:{let i="indent"in t?t.indent:-1,n="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:r,indent:i,source:e,end:n})}}}Un.createScalarToken=Uw;Un.resolveAsScalar=Jw;Un.setScalarValue=Kw});var Fd=w(Md=>{"use strict";var Xw=t=>"type"in t?Yn(t):Kn(t);function Yn(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Yn(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Kn(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Kn(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Kn(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Kn({start:t,key:e,sep:r,value:i}){let n="";for(let a of t)n+=a.source;if(e&&(n+=Yn(e)),r)for(let a of r)n+=a.source;return i&&(n+=Yn(i)),n}Md.stringify=Xw});var zd=w(Wd=>{"use strict";var Os=Symbol("break visit"),Qw=Symbol("skip children"),qd=Symbol("remove item");function Rt(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Vd(Object.freeze([]),t,e)}Rt.BREAK=Os;Rt.SKIP=Qw;Rt.REMOVE=qd;Rt.itemAtPath=(t,e)=>{let r=t;for(let[i,n]of e){let a=r?.[i];if(a&&"items"in a)r=a.items[n];else return}return r};Rt.parentCollection=(t,e)=>{let r=Rt.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],n=r?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Vd(t,e,r){let i=r(e,t);if(typeof i=="symbol")return i;for(let n of["key","value"]){let a=e[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Vd(Object.freeze(t.concat([[n,o]])),a.items[o],r);if(typeof s=="number")o=s-1;else{if(s===Os)return Os;s===qd&&(a.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}Wd.visit=Rt});var Xn=w(re=>{"use strict";var Hs=Bd(),Zw=Fd(),ey=zd(),Ds="\uFEFF",Ls="",Bs="",Ms="",ty=t=>!!t&&"items"in t,ry=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function iy(t){switch(t){case Ds:return"<BOM>";case Ls:return"<DOC>";case Bs:return"<FLOW_END>";case Ms:return"<SCALAR>";default:return JSON.stringify(t)}}function ny(t){switch(t){case Ds:return"byte-order-mark";case Ls:return"doc-mode";case Bs:return"flow-error-end";case Ms:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Z.createScalarToken=Uo.createScalarToken;Z.resolveAsScalar=Uo.resolveAsScalar;Z.setScalarValue=Uo.setScalarValue;Z.stringify=Tg.stringify;Z.visit=jg.visit;Z.BOM=Ko;Z.DOCUMENT=Yo;Z.FLOW_END=Xo;Z.SCALAR=Qo;Z.isCollection=$g;Z.isScalar=Og;Z.prettyToken=Hg;Z.tokenType=Dg});var ts=g(Yu=>{"use strict";var Or=kn();function pe(e){switch(e){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var Ku=new Set("0123456789ABCDEFabcdef"),Lg=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Sn=new Set(",[]{}"),Mg=new Set(` ,[]{}
121
- \r `),Zo=e=>!e||Mg.has(e),es=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let i=this.next??"stream";for(;i&&(r||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
122
- `?!0:r==="\r"?this.buffer[t+1]===`
123
- `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let r=this.buffer[t];if(this.indentNext>0){let i=0;for(;r===" ";)r=this.buffer[++i+t];if(r==="\r"){let n=this.buffer[i+t+1];if(n===`
124
- `||!n&&!this.atEnd)return t+i+1}return r===`
125
- `||i>=this.indentNext||!r&&!this.atEnd?t+i:-1}if(r==="-"||r==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&pe(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Or.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let r=t.length,i=t.indexOf("#");for(;i!==-1;){let a=t[i-1];if(a===" "||a===" "){r=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let a=t[r-1];if(a===" "||a===" ")r-=1;else break}let n=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-r),yield*this.pushNewline(),"stream"}return yield Or.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&pe(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!pe(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&pe(r)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Zo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,i=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=i=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&pe(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Or.FLOW_END,yield*this.parseLineStart();let a=0;for(;n[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),n[a]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Zo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||pe(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let a=0;for(;this.buffer[r-1-a]==="\\";)a+=1;if(a%2===0)break;r=this.buffer.indexOf('"',r+1)}let i=this.buffer.substring(0,r),n=i.indexOf(`
119
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}re.createScalarToken=Hs.createScalarToken;re.resolveAsScalar=Hs.resolveAsScalar;re.setScalarValue=Hs.setScalarValue;re.stringify=Zw.stringify;re.visit=ey.visit;re.BOM=Ds;re.DOCUMENT=Ls;re.FLOW_END=Bs;re.SCALAR=Ms;re.isCollection=ty;re.isScalar=ry;re.prettyToken=iy;re.tokenType=ny});var Vs=w(Jd=>{"use strict";var ti=Xn();function ye(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var Gd=new Set("0123456789ABCDEFabcdef"),ay=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Qn=new Set(",[]{}"),oy=new Set(` ,[]{}
121
+ \r `),Fs=t=>!t||oy.has(t),qs=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let i=this.next??"stream";for(;i&&(r||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===`
122
+ `?!0:r==="\r"?this.buffer[e+1]===`
123
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let i=0;for(;r===" ";)r=this.buffer[++i+e];if(r==="\r"){let n=this.buffer[i+e+1];if(n===`
124
+ `||!n&&!this.atEnd)return e+i+1}return r===`
125
+ `||i>=this.indentNext||!r&&!this.atEnd?e+i:-1}if(r==="-"||r==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&ye(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===ti.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,i=e.indexOf("#");for(;i!==-1;){let a=e[i-1];if(a===" "||a===" "){r=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let a=e[r-1];if(a===" "||a===" ")r-=1;else break}let n=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield ti.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&ye(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ye(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ye(r)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Fs),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,i=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=i=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&ye(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield ti.FLOW_END,yield*this.parseLineStart();let a=0;for(;n[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),n[a]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Fs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ye(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let a=0;for(;this.buffer[r-1-a]==="\\";)a+=1;if(a%2===0)break;r=this.buffer.indexOf('"',r+1)}let i=this.buffer.substring(0,r),n=i.indexOf(`
127
127
  `,this.pos);if(n!==-1){for(;n!==-1;){let a=this.continueScalar(n+1);if(a===-1)break;n=i.indexOf(`
128
- `,a)}n!==-1&&(r=n-(i[n-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let r=this.buffer[++t];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>pe(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,i;e:for(let a=this.pos;i=this.buffer[a];++a)switch(i){case" ":r+=1;break;case`
129
- `:t=a,r=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
- `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(t+1);if(a===-1)break;t=this.buffer.indexOf(`
131
- `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
- `;)i=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let a=t-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
- `&&a>=this.pos&&a+1+r>s)t=a;else break}while(!0);return yield Or.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let a=this.buffer[i+1];if(pe(a)||t&&Sn.has(a))break;r=i}else if(pe(n)){let a=this.buffer[i+1];if(n==="\r"&&(a===`
128
+ `,a)}n!==-1&&(r=n-(i[n-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>ye(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,i;e:for(let a=this.pos;i=this.buffer[a];++a)switch(i){case" ":r+=1;break;case`
129
+ `:e=a,r=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
+ `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
131
+ `,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
+ `;)i=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
+ `&&a>=this.pos&&a+1+r>s)e=a;else break}while(!0);return yield ti.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let a=this.buffer[i+1];if(ye(a)||e&&Qn.has(a))break;r=i}else if(ye(n)){let a=this.buffer[i+1];if(n==="\r"&&(a===`
134
134
  `?(i+=1,n=`
135
- `,a=this.buffer[i+1]):r=i),a==="#"||t&&Sn.has(a))break;if(n===`
136
- `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(t&&Sn.has(n))break;r=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Or.SCALAR,yield*this.pushToIndex(r+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,r){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(r&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Zo),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,i=this.charAt(1);if(pe(i)||r&&Sn.has(i)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!pe(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if(Lg.has(r))r=this.buffer[++t];else if(r==="%"&&Ku.has(this.buffer[t+1])&&Ku.has(this.buffer[t+2]))r=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
137
- `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(t){let r=this.pos-1,i;do i=this.buffer[++r];while(i===" "||t&&i===" ");let n=r-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=r),n}*pushUntil(t){let r=this.pos,i=this.buffer[r];for(;!t(i);)i=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};Yu.Lexer=es});var is=g(Xu=>{"use strict";var rs=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let r=0,i=this.lineStarts.length;for(;r<i;){let a=r+i>>1;this.lineStarts[a]<t?r=a+1:i=a}if(this.lineStarts[r]===t)return{line:r+1,col:1};if(r===0)return{line:0,col:t};let n=this.lineStarts[r-1];return{line:r,col:t-n+1}}}};Xu.LineCounter=rs});var as=g(rd=>{"use strict";var Fg=Pi("process"),Qu=kn(),Bg=ts();function Xe(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function Zu(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function td(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function En(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Mt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function xn(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function ed(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Xe(t.start,"explicit-key-ind")&&!Xe(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,td(t.value)?t.value.end?xn(t.value.end,t.sep):t.value.end=t.sep:xn(t.start,t.sep),delete t.sep)}var ns=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Bg.Lexer,this.onNewLine=t}*parse(t,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,r))yield*this.next(i);r||(yield*this.end())}*next(t){if(this.source=t,Fg.env.LOG_TOKENS&&console.log("|",Qu.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let r=Qu.tokenType(t);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let r=t??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let i=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in i?i.indent:0:r.type==="flow-collection"&&i.type==="document"&&(r.indent=0),r.type==="flow-collection"&&ed(r),i.type){case"document":i.value=r;break;case"block-scalar":i.props.push(r);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=r;else{Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:r}):n.value=r;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:r,sep:[]}):n.sep?n.value=r:Object.assign(n,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let n=r.items[r.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Zu(n.start)===-1&&(r.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<r.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{Zu(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let r=En(this.peek(2)),i=Mt(r),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
135
+ `,a=this.buffer[i+1]):r=i),a==="#"||e&&Qn.has(a))break;if(n===`
136
+ `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&Qn.has(n))break;r=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield ti.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Fs),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,i=this.charAt(1);if(ye(i)||r&&Qn.has(i)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!ye(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(ay.has(r))r=this.buffer[++e];else if(r==="%"&&Gd.has(this.buffer[e+1])&&Gd.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
+ `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,i;do i=this.buffer[++r];while(i===" "||e&&i===" ");let n=r-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=r),n}*pushUntil(e){let r=this.pos,i=this.buffer[r];for(;!e(i);)i=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};Jd.Lexer=qs});var zs=w(Ud=>{"use strict";var Ws=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,i=this.lineStarts.length;for(;r<i;){let a=r+i>>1;this.lineStarts[a]<e?r=a+1:i=a}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let n=this.lineStarts[r-1];return{line:r,col:e-n+1}}}};Ud.LineCounter=Ws});var Js=w(Zd=>{"use strict";var sy=rn("process"),Kd=Xn(),cy=Vs();function st(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function Yd(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Qd(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Zn(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function tr(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function ea(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r<e.length;++r)t.push(e[r])}function Xd(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!st(e.start,"explicit-key-ind")&&!st(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Qd(e.value)?e.value.end?ea(e.value.end,e.sep):e.value.end=e.sep:ea(e.start,e.sep),delete e.sep)}var Gs=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new cy.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,r))yield*this.next(i);r||(yield*this.end())}*next(e){if(this.source=e,sy.env.LOG_TOKENS&&console.log("|",Kd.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=Kd.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let i=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in i?i.indent:0:r.type==="flow-collection"&&i.type==="document"&&(r.indent=0),r.type==="flow-collection"&&Xd(r),i.type){case"document":i.value=r;break;case"block-scalar":i.props.push(r);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=r;else{Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:r}):n.value=r;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:r,sep:[]}):n.sep?n.value=r:Object.assign(n,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let n=r.items[r.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Yd(n.start)===-1&&(r.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<r.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Yd(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let r=Zn(this.peek(2)),i=tr(r),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
139
139
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
140
- `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){xn(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,n=i&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&r.sep&&!r.value){let o=[];for(let s=0;s<r.sep.length;++s){let c=r.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||r.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):n||r.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Xe(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(td(r.key)&&!Xe(r.sep,"newline")){let o=Mt(r.start),s=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?r.sep=r.sep.concat(a,this.sourceToken):r.sep.push(this.sourceToken);else if(Xe(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=Mt(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||n?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Xe(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||r.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Xe(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){xn(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||Xe(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:n,sep:[]}):r.sep?this.stack.push(n):Object.assign(r,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=En(i),a=Mt(n);ed(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
140
+ `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){ea(n,r.start),n.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,n=i&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&r.sep&&!r.value){let o=[];for(let s=0;s<r.sep.length;++s){let c=r.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||r.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):n||r.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(st(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(Qd(r.key)&&!st(r.sep,"newline")){let o=tr(r.start),s=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?r.sep=r.sep.concat(a,this.sourceToken):r.sep.push(this.sourceToken);else if(st(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=tr(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||n?e.items.push({start:a,key:null,sep:[this.sourceToken]}):st(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||r.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!st(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){ea(n,r.start),n.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||st(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:n,sep:[]}):r.sep?this.stack.push(n):Object.assign(r,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=Zn(i),a=tr(n);Xd(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
141
141
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
142
- `,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=En(t),i=Mt(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=En(t),i=Mt(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};rd.Parser=ns});var sd=g(Dr=>{"use strict";var id=zo(),Vg=Rr(),Hr=Ir(),qg=Va(),Wg=R(),zg=is(),nd=as();function ad(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new zg.LineCounter||null,prettyErrors:t}}function Jg(e,t={}){let{lineCounter:r,prettyErrors:i}=ad(t),n=new nd.Parser(r?.addNewLine),a=new id.Composer(t),o=Array.from(a.compose(n.parse(e)));if(i&&r)for(let s of o)s.errors.forEach(Hr.prettifyError(e,r)),s.warnings.forEach(Hr.prettifyError(e,r));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function od(e,t={}){let{lineCounter:r,prettyErrors:i}=ad(t),n=new nd.Parser(r?.addNewLine),a=new id.Composer(t),o=null;for(let s of a.compose(n.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Hr.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(o.errors.forEach(Hr.prettifyError(e,r)),o.warnings.forEach(Hr.prettifyError(e,r))),o}function Gg(e,t,r){let i;typeof t=="function"?i=t:r===void 0&&t&&typeof t=="object"&&(r=t);let n=od(e,r);if(!n)return null;if(n.warnings.forEach(a=>qg.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},r))}function Ug(e,t,r){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=r??t??{};if(!n)return}return Wg.isDocument(e)&&!i?e.toString(r):new Vg.Document(e,i,r).toString(r)}Dr.parse=Gg;Dr.parseAllDocuments=Jg;Dr.parseDocument=od;Dr.stringify=Ug});var $e=g(_=>{"use strict";var Kg=zo(),Yg=Rr(),Xg=xo(),os=Ir(),Qg=fr(),Qe=R(),Zg=Ge(),ew=M(),tw=Ke(),rw=Ye(),iw=kn(),nw=ts(),aw=is(),ow=as(),Cn=sd(),cd=cr();_.Composer=Kg.Composer;_.Document=Yg.Document;_.Schema=Xg.Schema;_.YAMLError=os.YAMLError;_.YAMLParseError=os.YAMLParseError;_.YAMLWarning=os.YAMLWarning;_.Alias=Qg.Alias;_.isAlias=Qe.isAlias;_.isCollection=Qe.isCollection;_.isDocument=Qe.isDocument;_.isMap=Qe.isMap;_.isNode=Qe.isNode;_.isPair=Qe.isPair;_.isScalar=Qe.isScalar;_.isSeq=Qe.isSeq;_.Pair=Zg.Pair;_.Scalar=ew.Scalar;_.YAMLMap=tw.YAMLMap;_.YAMLSeq=rw.YAMLSeq;_.CST=iw;_.Lexer=nw.Lexer;_.LineCounter=aw.LineCounter;_.Parser=ow.Parser;_.parse=Cn.parse;_.parseAllDocuments=Cn.parseAllDocuments;_.parseDocument=Cn.parseDocument;_.stringify=Cn.stringify;_.visit=cd.visit;_.visitAsync=cd.visitAsync});import Ze from"path";function hd(e,t){return Ft[t][e]}function dw(e,t,r,i){let n=/^(\s*)([a-z_]+):/u.exec(e);if(!n)return null;let a=n[1].length,o=n[2];if(a===0&&o in Ft.en)return o;if(a===2&&t){let s=`${t}.${o}`;if(s in Ft.en)return s}if(a===4&&t==="knowledge"&&i==="remote"){let s=`knowledge.remote.${o}`;if(s in Ft.en)return s}if(a===4&&t==="knowledge"&&i==="local"){let s=`knowledge.local.${o}`;if(s in Ft.en)return s}if(a===2&&t===null&&o==="hook")return"hook";if(a===2&&t==="hook"&&o==="allow_paths")return"hook.allow_paths";if(a===4&&t==="native"&&r==="snapshot"){let s=`native.snapshot.${o}`;if(s in Ft.en)return s}return null}function Vr(e,t){let r=[],i=null,n=null,a=null;for(let o of(0,Fr.stringify)(e).trimEnd().split(`
143
- `)){let s=dw(o,i,n,a);if(s){let c=o.match(/^\s*/u)?.[0]??"";for(let l of hd(s,t).split(`
142
+ `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Zn(e),i=tr(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Zn(e),i=tr(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Zd.Parser=Gs});var af=w(ii=>{"use strict";var ef=$s(),ly=Ur(),ri=Xr(),uy=Io(),dy=_(),fy=zs(),tf=Js();function rf(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fy.LineCounter||null,prettyErrors:e}}function py(t,e={}){let{lineCounter:r,prettyErrors:i}=rf(e),n=new tf.Parser(r?.addNewLine),a=new ef.Composer(e),o=Array.from(a.compose(n.parse(t)));if(i&&r)for(let s of o)s.errors.forEach(ri.prettifyError(t,r)),s.warnings.forEach(ri.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function nf(t,e={}){let{lineCounter:r,prettyErrors:i}=rf(e),n=new tf.Parser(r?.addNewLine),a=new ef.Composer(e),o=null;for(let s of a.compose(n.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new ri.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(o.errors.forEach(ri.prettifyError(t,r)),o.warnings.forEach(ri.prettifyError(t,r))),o}function hy(t,e,r){let i;typeof e=="function"?i=e:r===void 0&&e&&typeof e=="object"&&(r=e);let n=nf(t,r);if(!n)return null;if(n.warnings.forEach(a=>uy.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},r))}function my(t,e,r){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=r??e??{};if(!n)return}return dy.isDocument(t)&&!i?t.toString(r):new ly.Document(t,i,r).toString(r)}ii.parse=hy;ii.parseAllDocuments=py;ii.parseDocument=nf;ii.stringify=my});var ze=w(A=>{"use strict";var vy=$s(),gy=Ur(),wy=ps(),Us=Xr(),yy=Tr(),ct=_(),Ny=it(),by=F(),ky=at(),Sy=ot(),Ey=Xn(),xy=Vs(),Cy=zs(),Py=Js(),ta=af(),of=Rr();A.Composer=vy.Composer;A.Document=gy.Document;A.Schema=wy.Schema;A.YAMLError=Us.YAMLError;A.YAMLParseError=Us.YAMLParseError;A.YAMLWarning=Us.YAMLWarning;A.Alias=yy.Alias;A.isAlias=ct.isAlias;A.isCollection=ct.isCollection;A.isDocument=ct.isDocument;A.isMap=ct.isMap;A.isNode=ct.isNode;A.isPair=ct.isPair;A.isScalar=ct.isScalar;A.isSeq=ct.isSeq;A.Pair=Ny.Pair;A.Scalar=by.Scalar;A.YAMLMap=ky.YAMLMap;A.YAMLSeq=Sy.YAMLSeq;A.CST=Ey;A.Lexer=xy.Lexer;A.LineCounter=Cy.LineCounter;A.Parser=Py.Parser;A.parse=ta.parse;A.parseAllDocuments=ta.parseAllDocuments;A.parseDocument=ta.parseDocument;A.stringify=ta.stringify;A.visit=of.visit;A.visitAsync=of.visitAsync});import lt from"path";function ff(t,e){return rr[e][t]}function Ty(t,e,r,i){let n=/^(\s*)([a-z_]+):/u.exec(t);if(!n)return null;let a=n[1].length,o=n[2];if(a===0&&o in rr.en)return o;if(a===2&&e){let s=`${e}.${o}`;if(s in rr.en)return s}if(a===4&&e==="knowledge"&&i==="remote"){let s=`knowledge.remote.${o}`;if(s in rr.en)return s}if(a===4&&e==="knowledge"&&i==="local"){let s=`knowledge.local.${o}`;if(s in rr.en)return s}if(a===2&&e===null&&o==="hook")return"hook";if(a===2&&e==="hook"&&o==="allow_paths")return"hook.allow_paths";if(a===4&&e==="native"&&r==="snapshot"){let s=`native.snapshot.${o}`;if(s in rr.en)return s}return null}function ci(t,e){let r=[],i=null,n=null,a=null;for(let o of(0,oi.stringify)(t).trimEnd().split(`
143
+ `)){let s=Ty(o,i,n,a);if(s){let c=o.match(/^\s*/u)?.[0]??"";for(let l of ff(s,e).split(`
144
144
  `))r.push(`${c}${l}`)}r.push(o),/^[a-z_]+:/u.test(o)?(o.startsWith("native:")?i="native":o.startsWith("classic:")?i="classic":o.startsWith("hook:")?i="hook":o.startsWith("memory:")?i="memory":o.startsWith("knowledge:")?i="knowledge":i=null,n=null,a=null):/^ {2}[a-z_]+:/u.test(o)&&(i==="native"&&(n=o.startsWith(" snapshot:")?"snapshot":null),i==="knowledge"&&(a=o.startsWith(" local:")?"local":o.startsWith(" remote:")?"remote":null))}return r.push(""),r.join(`
145
- `)}function fw(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim();if(r.length===0||Ze.posix.isAbsolute(r)||Ze.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${t} must be a project-relative path`);if(r===".")return[];let i=r.replaceAll("\\","/").split("/");if(i.some(n=>n===".."))throw new Error(`${t} must stay inside the project root`);if(i.some(n=>n===""||n==="."))throw new Error(`${t} must not contain empty or dot path segments`);return i}function wt(e){let t=fw(e,"native.artifact_root");return t.length===0?".":t.join("/")}function md(e,t="docs"){let r=e??t;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function An(e,t,r=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim().replaceAll("\\","/");if(i.length===0||Ze.posix.isAbsolute(i)||Ze.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be relative to its declared path base`);let n=i.split("/");if(n.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(i))throw new Error(`${t} cannot contain wildcards`);return n.join("/")}function Oe(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function vd(e,t,r){let i=e??t;if(i!=="en"&&i!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return i}function ls(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>Pn)throw new Error(`${t} exceeds ${Pn} characters`);let r=0;for(let i=0;i<e.length;i+=1)e[i]==="?"?r+=1:e[i]==="*"&&(r+=1,e[i+1]==="*"&&(i+=1));if(r>Rn)throw new Error(`${t} contains more than ${Rn} wildcard tokens`);return e}function fd(e,t,r){if(e===void 0)return[...r];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(i=>ls(i,t)))].sort((i,n)=>i.localeCompare(n,"en"))}function Lr(e,t,r){let i=e??t;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${r} must be a positive integer`);return i}function pd(e,t,r){let i=Lr(e,t,r);if(i>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${r} is too large to convert to bytes safely`);return i}function pw(e){if(e===void 0)return{...ee,include:[...ee.include],exclude:[...ee.exclude]};let t=Oe(e,"native.snapshot");return{include:fd(t.include,"native.snapshot.include",ee.include),exclude:fd(t.exclude,"native.snapshot.exclude",ee.exclude),max_files:Lr(t.max_files,ee.max_files,"native.snapshot.max_files"),max_total_bytes:Lr(t.max_total_bytes,ee.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Lr(t.max_duration_ms,ee.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:Lr(t.max_selection_records,ee.max_selection_records,"native.snapshot.max_selection_records")}}function hw(e){if(e===void 0)return;let t=Oe(e,"native.pending_root_move"),r=t.id,i=t.from_artifact_root,n=t.to_artifact_root,a=t.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(t.cleanup!==void 0){let s=Oe(t.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:wt(i),toArtifactRoot:wt(n),stage:a,...o?{cleanup:o}:{}}}function mw(e){if(e===void 0)return;let t=Oe(e,"native.finish");if(t.pull_request===void 0)return{};let r=Oe(t.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let i=r.command.map((a,o)=>{if(typeof a!="string"||a.trim().length===0||a.length>4096||/[\0\r\n]/u.test(a))throw new Error(`native.finish.pull_request.command[${o}] must be a non-empty single-line string of at most 4096 characters`);return a});if(Ze.posix.isAbsolute(i[0])||Ze.win32.isAbsolute(i[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let n=r.timeout_ms??sw;if(!Number.isSafeInteger(n)||n<1||n>dd)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${dd}`);return{pull_request:{provider:"repository-command",command:i,timeout_ms:n}}}function vw(e,t={}){let r=Oe(e,"native"),i=r.artifact_root??(t.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let n=r.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=r.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=r.max_verify_failures??ss;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=r.document_writes??"allow";if(s!=="allow"&&s!=="revert")throw new Error("native.document_writes must be allow or revert");let c=hw(r.pending_root_move),l=mw(r.finish);return{artifact_root:wt(i),language:vd(r.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,...s==="revert"?{document_writes:s}:{},snapshot:pw(r.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function gw(e){let t=Oe(e,"classic"),r=t.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let i=t.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=t.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");let a=t.document_evidence??"neutral";if(a!=="neutral"&&a!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:md(t.artifact_layout),language:vd(t.language,"zh-CN","classic.language"),context_compression:r,review_mode:i,auto_transition:n,...a==="strict"?{document_evidence:a}:{}}}function ww(e){let r=Oe(e,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((i,n)=>An(i,`hook.allow_paths[${n}]`)))]}}function yw(e){if(e===void 0)return{...Mr};let t=Oe(e,"memory"),r=t.learning??Mr.learning,i=t.retrieval??Mr.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof i!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:i}}function us(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Nw(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||Ze.posix.isAbsolute(r)||Ze.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(n=>n===""||n==="."||n===".."))throw new Error(`${t} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${t} must target a Markdown file ending in .md`);if(r.length>ld)throw new Error(`${t} exceeds ${ld} characters`);let i=0;for(let n=0;n<r.length;n+=1)r[n]==="?"?i+=1:r[n]==="*"&&(i+=1,r[n+1]==="*"&&(n+=1));if(i>ud)throw new Error(`${t} contains more than ${ud} wildcard tokens`);return r}function bw(e){let t=us(e,"knowledge.local"),r=t.include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");let i={include:[...new Set(r.map((n,a)=>Nw(n,`knowledge.local.include[${a}]`)))],max_file_mb:pd(t.max_file_mb,_n.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:pd(t.max_total_mb,_n.max_total_mb,"knowledge.local.max_total_mb")};if(i.max_file_mb>i.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return i}function kw(e){if(typeof e!="string"||e.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let t;try{t=new URL(e)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=t.hostname.toLowerCase().replace(/^\[|\]$/gu,""),i=r==="localhost"||r==="127.0.0.1"||r==="::1";if(t.protocol!=="https:"&&!(t.protocol==="http:"&&i))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return t.toString()}function Sw(e){let t=us(e,"knowledge.remote"),r=kw(t.endpoint),i=t.token_env;if(i!==void 0&&(typeof i!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(i)))throw new Error("knowledge.remote.token_env must be an environment variable name");let n=t.scope;if(n!==void 0&&(typeof n!="string"||n.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let a=t.timeout_ms??5e3;if(typeof a!="number"||!Number.isSafeInteger(a)||a<100||a>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...i===void 0?{}:{token_env:i},...n===void 0?{}:{scope:n},timeout_ms:a}}function Ew(e){if(e===void 0)return{...cs};let t=us(e,"knowledge"),r=t.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let i=t.local===void 0?void 0:bw(t.local);if(r==="local")return{provider:r,...i?{local:i}:{}};let n=t.remote===void 0?void 0:Sw(t.remote);if(n===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...i?{local:i}:{},remote:n}}function xw(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function Cw(e,t,r,i,n,a,o,s){let c=e.schema!==void 0;if(!(c||e.default_workflow!==void 0||e.workflows!==void 0||!s.allowPartialProject&&e.native!==void 0)||s.allowPartialProject&&!c)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=e.workflows??[e.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(f=>f!=="native"&&f!=="classic"))throw new Error("workflows must contain native and/or classic");let d=[...new Set(u)];if(!d.includes(e.default_workflow))throw new Error("workflows must include default_workflow");if(d.includes("native")&&!n)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:d,ambient_resume:o,...t?{hook:t}:{},memory:r,knowledge:i,...n?{native:n}:{},...a?{classic:a}:{}}}function Bt(e,t={}){let r=(0,Fr.parseDocument)(e,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let i=r.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=i,a=xw(n.ambient_resume),o=n.hook===void 0?void 0:ww(n.hook),s=yw(n.memory),c=Ew(n.knowledge),l=n.native===void 0?void 0:vw(n.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),u=n.classic===void 0?void 0:gw(n.classic),d=Cw(n,o,s,c,l,u,a,{allowPartialProject:t.allowPartialProject??!1});return{value:n,config:d,ambient_resume:a,memory:s,knowledge:c,...o?{hook:o}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function gd(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function wd(e){let t=e.knowledge??{...cs};return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,memory:e.memory??{...Mr},knowledge:{provider:t.provider,...t.local?{local:{include:[...t.local.include],max_file_mb:t.local.max_file_mb??_n.max_file_mb,max_total_mb:t.local.max_total_mb??_n.max_total_mb}}:{},...t.remote?{remote:{endpoint:t.remote.endpoint,timeout_ms:t.remote.timeout_ms,...t.remote.token_env===void 0?{}:{token_env:t.remote.token_env},...t.remote.scope===void 0?{}:{scope:t.remote.scope}}}:{}},...e.hook?{hook:{allow_paths:[...e.hook.allow_paths]}}:{},...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,...e.native.document_writes?{document_writes:e.native.document_writes}:{},...e.native.finish?.pull_request?{finish:{pull_request:{provider:e.native.finish.pull_request.provider,command:[...e.native.finish.pull_request.command],timeout_ms:e.native.finish.pull_request.timeout_ms}}}:{},...e.native.pending_root_move?{pending_root_move:gd(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition,...e.classic.document_evidence?{document_evidence:e.classic.document_evidence}:{}}}:{}}}function ie(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function qr(e,t){let r=wd(t),i=Bt((0,Fr.stringify)(r)).config;if(!i)throw new Error("Unsupported Comet project schema");let n={...e,schema:i.schema,default_workflow:i.default_workflow,workflows:i.workflows,ambient_resume:i.ambient_resume};if(i.hook&&(n.hook={...ie(e.hook),allow_paths:[...i.hook.allow_paths]}),i.memory){let a=ie(e.memory);n.memory={...a,learning:i.memory.learning,retrieval:i.memory.retrieval}}if(i.knowledge){let a=ie(e.knowledge),o={...a,provider:i.knowledge.provider};if(i.knowledge.local?o.local={...ie(a.local),include:[...i.knowledge.local.include],max_file_mb:i.knowledge.local.max_file_mb,max_total_mb:i.knowledge.local.max_total_mb}:delete o.local,i.knowledge.remote){let c={...ie(a.remote),endpoint:i.knowledge.remote.endpoint,timeout_ms:i.knowledge.remote.timeout_ms,...i.knowledge.remote.token_env===void 0?{}:{token_env:i.knowledge.remote.token_env},...i.knowledge.remote.scope===void 0?{}:{scope:i.knowledge.remote.scope}};i.knowledge.remote.token_env===void 0&&delete c.token_env,i.knowledge.remote.scope===void 0&&delete c.scope,o.remote=c}else delete o.remote;n.knowledge=o}if(i.native){let a=ie(e.native),o={...a,artifact_root:i.native.artifact_root,language:i.native.language,clarification_mode:i.native.clarification_mode,archive_confirmation:i.native.archive_confirmation,max_verify_failures:i.native.max_verify_failures,...i.native.document_writes?{document_writes:i.native.document_writes}:{}};if(i.native.finish?.pull_request){let s=ie(a.finish);o.finish={...s,pull_request:{...ie(s.pull_request),provider:i.native.finish.pull_request.provider,command:[...i.native.finish.pull_request.command],timeout_ms:i.native.finish.pull_request.timeout_ms}}}else{let s={...ie(a.finish)};delete s.pull_request,Object.keys(s).length>0?o.finish=s:delete o.finish}if(delete o.snapshot,i.native.pending_root_move){let s=ie(a.pending_root_move),c=gd(i.native.pending_root_move),l=ie(s.cleanup),u=ie(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...u}}:{}}}else delete o.pending_root_move;n.native=o}return i.classic&&(n.classic={...ie(e.classic),artifact_layout:i.classic.artifact_layout,language:i.classic.language,context_compression:i.classic.context_compression,review_mode:i.classic.review_mode,auto_transition:i.classic.auto_transition,...i.classic.document_evidence?{document_evidence:i.classic.document_evidence}:{}}),n}function In(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...Mr},knowledge:{...cs},native:{artifact_root:wt(e),language:t,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:ss,snapshot:{...ee,include:[...ee.include],exclude:[...ee.exclude]}}}}var Fr,Br,Pn,Rn,ld,ud,ss,Mr,_n,cs,sw,dd,cw,lw,uw,ee,Ft,et=k(()=>{"use strict";Fr=Ve($e(),1),Br=Number.MAX_SAFE_INTEGER,Pn=1024,Rn=64,ld=1024,ud=64,ss=5,Mr={learning:!0,retrieval:!0},_n={include:[],max_file_mb:1,max_total_mb:32},cs={provider:"local"},sw=12e4,dd=6e5,cw=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],lw=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],uw=[...cw,...lw].sort((e,t)=>e.localeCompare(t,"en")),ee={include:["**/*"],exclude:[...uw],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4},Ft={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
145
+ `)}function $y(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||lt.posix.isAbsolute(r)||lt.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be a project-relative path`);if(r===".")return[];let i=r.replaceAll("\\","/").split("/");if(i.some(n=>n===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(n=>n===""||n==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function _t(t){let e=$y(t,"native.artifact_root");return e.length===0?".":e.join("/")}function pf(t,e="docs"){let r=t??e;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function aa(t,e,r=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||lt.posix.isAbsolute(i)||lt.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let n=i.split("/");if(n.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return n.join("/")}function Ge(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function hf(t,e,r){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return i}function Xs(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>ra)throw new Error(`${e} exceeds ${ra} characters`);let r=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?r+=1:t[i]==="*"&&(r+=1,t[i+1]==="*"&&(i+=1));if(r>ia)throw new Error(`${e} contains more than ${ia} wildcard tokens`);return t}function uf(t,e,r){if(t===void 0)return[...r];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(i=>Xs(i,e)))].sort((i,n)=>i.localeCompare(n,"en"))}function ni(t,e,r){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${r} must be a positive integer`);return i}function df(t,e,r){let i=ni(t,e,r);if(i>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${r} is too large to convert to bytes safely`);return i}function jy(t){if(t===void 0)return{...ie,include:[...ie.include],exclude:[...ie.exclude]};let e=Ge(t,"native.snapshot");return{include:uf(e.include,"native.snapshot.include",ie.include),exclude:uf(e.exclude,"native.snapshot.exclude",ie.exclude),max_files:ni(e.max_files,ie.max_files,"native.snapshot.max_files"),max_total_bytes:ni(e.max_total_bytes,ie.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:ni(e.max_duration_ms,ie.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:ni(e.max_selection_records,ie.max_selection_records,"native.snapshot.max_selection_records")}}function Oy(t){if(t===void 0)return;let e=Ge(t,"native.pending_root_move"),r=e.id,i=e.from_artifact_root,n=e.to_artifact_root,a=e.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=Ge(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:_t(i),toArtifactRoot:_t(n),stage:a,...o?{cleanup:o}:{}}}function Hy(t){if(t===void 0)return;let e=Ge(t,"native.finish");if(e.pull_request===void 0)return{};let r=Ge(e.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let i=r.command.map((a,o)=>{if(typeof a!="string"||a.trim().length===0||a.length>4096||/[\0\r\n]/u.test(a))throw new Error(`native.finish.pull_request.command[${o}] must be a non-empty single-line string of at most 4096 characters`);return a});if(lt.posix.isAbsolute(i[0])||lt.win32.isAbsolute(i[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let n=r.timeout_ms??Ry;if(!Number.isSafeInteger(n)||n<1||n>lf)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${lf}`);return{pull_request:{provider:"repository-command",command:i,timeout_ms:n}}}function Dy(t,e={}){let r=Ge(t,"native"),i=r.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let n=r.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=r.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=r.max_verify_failures??Ks;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=r.document_writes??"allow";if(s!=="allow"&&s!=="revert")throw new Error("native.document_writes must be allow or revert");let c=Oy(r.pending_root_move),l=Hy(r.finish);return{artifact_root:_t(i),language:hf(r.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,...s==="revert"?{document_writes:s}:{},snapshot:jy(r.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function Ly(t){let e=Ge(t,"classic"),r=e.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=e.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");let a=e.document_evidence??"neutral";if(a!=="neutral"&&a!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:pf(e.artifact_layout),language:hf(e.language,"zh-CN","classic.language"),context_compression:r,review_mode:i,auto_transition:n,...a==="strict"?{document_evidence:a}:{}}}function By(t){let r=Ge(t,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((i,n)=>aa(i,`hook.allow_paths[${n}]`)))]}}function My(t){if(t===void 0)return{...ai};let e=Ge(t,"memory"),r=e.learning??ai.learning,i=e.retrieval??ai.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof i!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:i}}function Qs(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Fy(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||lt.posix.isAbsolute(r)||lt.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(n=>n===""||n==="."||n===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(r.length>sf)throw new Error(`${e} exceeds ${sf} characters`);let i=0;for(let n=0;n<r.length;n+=1)r[n]==="?"?i+=1:r[n]==="*"&&(i+=1,r[n+1]==="*"&&(n+=1));if(i>cf)throw new Error(`${e} contains more than ${cf} wildcard tokens`);return r}function qy(t){let e=Qs(t,"knowledge.local"),r=e.include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");let i={include:[...new Set(r.map((n,a)=>Fy(n,`knowledge.local.include[${a}]`)))],max_file_mb:df(e.max_file_mb,na.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:df(e.max_total_mb,na.max_total_mb,"knowledge.local.max_total_mb")};if(i.max_file_mb>i.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return i}function Vy(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),i=r==="localhost"||r==="127.0.0.1"||r==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&i))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function Wy(t){let e=Qs(t,"knowledge.remote"),r=Vy(e.endpoint),i=e.token_env;if(i!==void 0&&(typeof i!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(i)))throw new Error("knowledge.remote.token_env must be an environment variable name");let n=e.scope;if(n!==void 0&&(typeof n!="string"||n.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let a=e.timeout_ms??5e3;if(typeof a!="number"||!Number.isSafeInteger(a)||a<100||a>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...i===void 0?{}:{token_env:i},...n===void 0?{}:{scope:n},timeout_ms:a}}function zy(t){if(t===void 0)return{...Ys};let e=Qs(t,"knowledge"),r=e.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let i=e.local===void 0?void 0:qy(e.local);if(r==="local")return{provider:r,...i?{local:i}:{}};let n=e.remote===void 0?void 0:Wy(e.remote);if(n===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...i?{local:i}:{},remote:n}}function Gy(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Jy(t,e,r,i,n,a,o,s){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!s.allowPartialProject&&t.native!==void 0)||s.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(f=>f!=="native"&&f!=="classic"))throw new Error("workflows must contain native and/or classic");let d=[...new Set(u)];if(!d.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(d.includes("native")&&!n)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:d,ambient_resume:o,...e?{hook:e}:{},memory:r,knowledge:i,...n?{native:n}:{},...a?{classic:a}:{}}}function ir(t,e={}){let r=(0,oi.parseDocument)(t,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let i=r.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=i,a=Gy(n.ambient_resume),o=n.hook===void 0?void 0:By(n.hook),s=My(n.memory),c=zy(n.knowledge),l=n.native===void 0?void 0:Dy(n.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=n.classic===void 0?void 0:Ly(n.classic),d=Jy(n,o,s,c,l,u,a,{allowPartialProject:e.allowPartialProject??!1});return{value:n,config:d,ambient_resume:a,memory:s,knowledge:c,...o?{hook:o}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function mf(t){return{id:t.id,from_artifact_root:t.fromArtifactRoot,to_artifact_root:t.toArtifactRoot,stage:t.stage,...t.cleanup?{cleanup:{kind:t.cleanup.kind,state:t.cleanup.state,manifest_hash:t.cleanup.manifestHash}}:{}}}function vf(t){let e=t.knowledge??{...Ys};return{schema:t.schema,default_workflow:t.default_workflow,workflows:t.workflows??[t.default_workflow],ambient_resume:t.ambient_resume,memory:t.memory??{...ai},knowledge:{provider:e.provider,...e.local?{local:{include:[...e.local.include],max_file_mb:e.local.max_file_mb??na.max_file_mb,max_total_mb:e.local.max_total_mb??na.max_total_mb}}:{},...e.remote?{remote:{endpoint:e.remote.endpoint,timeout_ms:e.remote.timeout_ms,...e.remote.token_env===void 0?{}:{token_env:e.remote.token_env},...e.remote.scope===void 0?{}:{scope:e.remote.scope}}}:{}},...t.hook?{hook:{allow_paths:[...t.hook.allow_paths]}}:{},...t.native?{native:{artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,...t.native.document_writes?{document_writes:t.native.document_writes}:{},...t.native.finish?.pull_request?{finish:{pull_request:{provider:t.native.finish.pull_request.provider,command:[...t.native.finish.pull_request.command],timeout_ms:t.native.finish.pull_request.timeout_ms}}}:{},...t.native.pending_root_move?{pending_root_move:mf(t.native.pending_root_move)}:{}}}:{},...t.classic?{classic:{artifact_layout:t.classic.artifact_layout,language:t.classic.language,context_compression:t.classic.context_compression,review_mode:t.classic.review_mode,auto_transition:t.classic.auto_transition,...t.classic.document_evidence?{document_evidence:t.classic.document_evidence}:{}}}:{}}}function se(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function li(t,e){let r=vf(e),i=ir((0,oi.stringify)(r)).config;if(!i)throw new Error("Unsupported Comet project schema");let n={...t,schema:i.schema,default_workflow:i.default_workflow,workflows:i.workflows,ambient_resume:i.ambient_resume};if(i.hook&&(n.hook={...se(t.hook),allow_paths:[...i.hook.allow_paths]}),i.memory){let a=se(t.memory);n.memory={...a,learning:i.memory.learning,retrieval:i.memory.retrieval}}if(i.knowledge){let a=se(t.knowledge),o={...a,provider:i.knowledge.provider};if(i.knowledge.local?o.local={...se(a.local),include:[...i.knowledge.local.include],max_file_mb:i.knowledge.local.max_file_mb,max_total_mb:i.knowledge.local.max_total_mb}:delete o.local,i.knowledge.remote){let c={...se(a.remote),endpoint:i.knowledge.remote.endpoint,timeout_ms:i.knowledge.remote.timeout_ms,...i.knowledge.remote.token_env===void 0?{}:{token_env:i.knowledge.remote.token_env},...i.knowledge.remote.scope===void 0?{}:{scope:i.knowledge.remote.scope}};i.knowledge.remote.token_env===void 0&&delete c.token_env,i.knowledge.remote.scope===void 0&&delete c.scope,o.remote=c}else delete o.remote;n.knowledge=o}if(i.native){let a=se(t.native),o={...a,artifact_root:i.native.artifact_root,language:i.native.language,clarification_mode:i.native.clarification_mode,archive_confirmation:i.native.archive_confirmation,max_verify_failures:i.native.max_verify_failures,...i.native.document_writes?{document_writes:i.native.document_writes}:{}};if(i.native.finish?.pull_request){let s=se(a.finish);o.finish={...s,pull_request:{...se(s.pull_request),provider:i.native.finish.pull_request.provider,command:[...i.native.finish.pull_request.command],timeout_ms:i.native.finish.pull_request.timeout_ms}}}else{let s={...se(a.finish)};delete s.pull_request,Object.keys(s).length>0?o.finish=s:delete o.finish}if(delete o.snapshot,i.native.pending_root_move){let s=se(a.pending_root_move),c=mf(i.native.pending_root_move),l=se(s.cleanup),u=se(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...u}}:{}}}else delete o.pending_root_move;n.native=o}return i.classic&&(n.classic={...se(t.classic),artifact_layout:i.classic.artifact_layout,language:i.classic.language,context_compression:i.classic.context_compression,review_mode:i.classic.review_mode,auto_transition:i.classic.auto_transition,...i.classic.document_evidence?{document_evidence:i.classic.document_evidence}:{}}),n}function oa(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...ai},knowledge:{...Ys},native:{artifact_root:_t(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ks,snapshot:{...ie,include:[...ie.include],exclude:[...ie.exclude]}}}}var oi,si,ra,ia,sf,cf,Ks,ai,na,Ys,Ry,lf,_y,Ay,Iy,ie,rr,ut=k(()=>{"use strict";oi=Qe(ze(),1),si=Number.MAX_SAFE_INTEGER,ra=1024,ia=64,sf=1024,cf=64,Ks=5,ai={learning:!0,retrieval:!0},na={include:[],max_file_mb:1,max_total_mb:32},Ys={provider:"local"},Ry=12e4,lf=6e5,_y=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Ay=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Iy=[..._y,...Ay].sort((t,e)=>t.localeCompare(e,"en")),ie={include:["**/*"],exclude:[...Iy],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4},rr={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
146
146
  # ambient_resume: true | false`,memory:"# Project policy for automatic personal-memory learning and retrieval.","memory.learning":`# Allows workflow events in this project to form new personal memories automatically.
147
147
  # learning: true | false`,"memory.retrieval":`# Allows personal memories to be injected into Agent context for this project.
148
148
  # retrieval: true | false`,knowledge:"# Project knowledge retrieval provider used by ordinary Comet tasks.","knowledge.provider":`# Provider for project knowledge.
@@ -170,41 +170,122 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
170
170
  # 可选值:off | beta`,"classic.review_mode":`# 新建 Classic change 默认使用的审查深度。
171
171
  # 可选值:off | standard | thorough`,"classic.auto_transition":`# Classic 阶段通过后是否自动进入下一阶段。
172
172
  # 可选值:true | false`,"classic.document_evidence":`# 文档编辑对已记录检查证据的影响:neutral 在只有文档文件变化时保持 build 和 verify 证据有效,strict 重新绑定工作区的全部文件。
173
- # 可选值:neutral | strict`}}});function tt(e){return e!==0&&e!==0n&&e!=="0"}function xe(e,t){return tt(e.dev)&&tt(t.dev)&&tt(e.ino)&&tt(t.ino)}function $(e,t){let r=tt(e.dev)&&tt(t.dev);if(r&&e.dev!==t.dev)return!1;let i=tt(e.ino)&&tt(t.ino);return i&&e.ino!==t.ino?!1:r&&i?!0:e.birthtime===t.birthtime}var Wr=k(()=>{"use strict"});import{constants as Tn,promises as yt}from"fs";function ds(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function yd(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function zr(e){return{dev:e.dev,ino:e.ino,birthtime:ds(e)}}function jn(e,t){let r=zr(e),i=zr(t);return xe(r,i)?$(r,i):$(r,i)&&ds(e)===ds(t)&&yd(e)===yd(t)&&e.size===t.size}async function Vt(e,t,r={}){if(!Number.isSafeInteger(t)||t<1)throw new Error("race-safe read byte limit must be a positive integer");let i=r.label??"file",n=r.bigint===!0,a=await yt.lstat(e,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new he("not-regular-file",`${i} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new he("too-large",`${i} exceeds ${t} bytes`);let o=await yt.realpath(e);await r.verify?.("pre-open",{realPath:o,identity:zr(a)});let s=process.platform==="win32"?Tn.O_RDONLY:Tn.O_RDONLY|Tn.O_NOFOLLOW|Tn.O_NONBLOCK,c;try{c=await yt.open(e,s)}catch(l){throw l.code==="ELOOP"?new he("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:n}),yt.lstat(e,{bigint:n}),yt.realpath(e)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!jn(a,l)||!jn(a,u))throw new he("changed",`${i} changed while opening`);await r.verify?.("post-open",{realPath:d,identity:zr(l)}),await r.hooks?.afterOpen?.();let f=[],h=0,v=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let y=t+1-h,{bytesRead:b}=await c.read(v,0,Math.min(v.length,y),null);if(b===0)break;if(h+=b,h>t)throw new he("too-large",`${i} exceeds ${t} bytes`);f.push(Buffer.from(v.subarray(0,b)))}await r.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat({bigint:n}),yt.lstat(e,{bigint:n}),yt.realpath(e)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!jn(a,p)||!jn(a,m))throw new he("changed",`${i} changed while reading`);return await r.verify?.("post-read",{realPath:w,identity:zr(p)}),{bytes:Buffer.concat(f,h),stat:p,realPath:w}}finally{await c.close()}}var he,Jr=k(()=>{"use strict";Wr();he=class extends Error{reason;constructor(t,r,i){super(r,i),this.name="RaceSafeReadError",this.reason=t}}});import{promises as $n}from"fs";import rt from"path";function Pw(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function fs(e,t){let r=rt.relative(e,t);return r===""||!rt.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${rt.sep}`)}async function Nd(e,t){let r=rt.resolve(e),i=await $n.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return $n.realpath(r)}async function bd(e,t,r,i){let n=e;for(let a=0;a<r.length;a++){n=rt.join(n,r[a]);let o;try{o=await $n.lstat(n)}catch(u){if(Pw(u))return{exists:!1,kind:"missing"};throw u}let s=rt.relative(e,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${s}`);let c=a===r.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${s} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await $n.realpath(n);if(!fs(t,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function qt(e,t,r){let i=An(t,r.label),n=rt.resolve(e),a=await Nd(n,r.label),o=i.split("/"),s=rt.resolve(n,...o);if(!fs(n,s))throw new Error(`${r.label} must stay inside the project root`);let c=await bd(n,a,o,r);return{projectRoot:n,target:s,relative:i,exists:c.exists,kind:c.kind}}async function He(e,t,r,i){let n=await qt(e,t,{label:i.label,expected:"file"});if(!n.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let a=await Nd(n.projectRoot,i.label);return Vt(n.target,r,{...i,verify:async(o,s)=>{if(!fs(a,s.realPath))throw new Error(`${i.label} resolves outside the project root`);await bd(n.projectRoot,a,n.relative.split("/"),{label:i.label,expected:"file"})}})}var it=k(()=>{"use strict";Jr();et()});import{createHash as Rw}from"crypto";function ps(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function _w(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function On(e,t={}){return(await Ur(e,t)).document}async function kd(e){try{return(await He(e,Gr,Br,{label:Gr})).bytes}catch(t){if(_w(t))return null;throw t}}function Sd(e){return e?{exists:!0,sha256:Rw("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function Hn(e){return Sd(await kd(e))}async function Ur(e,t={}){let r=await kd(e);return{document:r?Bt(r.toString("utf8"),t):null,identity:Sd(r)}}async function hs(e){return(await On(e))?.config??null}var Gr,Wt=k(()=>{"use strict";et();it();Gr=".comet/config.yaml"});import{promises as vs}from"node:fs";async function gs(e,t){let r;for(let i=0;i<=ms.length;i+=1)try{return await e()}catch(n){r=n;let a=n.code;if(i===ms.length||!Aw.has(a??""))throw n;await new Promise(o=>setTimeout(o,ms[i]))}throw r}async function ws(e,t){await gs(()=>vs.rename(e,t),`rename ${t}`)}async function ys(e){await gs(()=>vs.unlink(e),`unlink ${e}`)}async function Ns(e,t){await gs(()=>vs.link(e,t),`link ${t}`)}var Aw,ms,bs=k(()=>{"use strict";Aw=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),ms=[50,100,200]});var zt=k(()=>{"use strict";bs();Wr()});var AE,ks=k(()=>{"use strict";zt();Wt();it();AE=16*1024});async function Ss(e,t){if(!t)return;let r=await Hn(e);if(!ps(r,t))throw new Error("Project config changed before commit; rerun the operation")}var Es=k(()=>{"use strict";zt();et();Wt();it();ks()});var Ce=k(()=>{"use strict";Wr()});import{randomUUID as $w}from"crypto";import{promises as U}from"fs";import me from"path";function Dn(e,t){let r=me.relative(e,t);return r===""||!me.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${me.sep}`)}function Ow(e,t){return $({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Ln(e,t){return $({dev:e.dev,ino:e.ino,birthtime:e.birthtimeMs},{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs})}function Hw(e,t){return Ln(e,t)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Ed(e){let t=await U.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await U.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function Jt(e){for(let t of e){let r=await U.lstat(t.path);if(!r.isDirectory()||r.isSymbolicLink()||!Ow(t,r)||await U.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function Dw(e,t,r){let[i,n]=await Promise.all([U.lstat(e),U.realpath(e),r?Jt(r):Promise.resolve()]);if(!i.isFile()||i.isSymbolicLink()||!Ln(i,t)||r&&!Dn(r[0].realPath,n))throw new Error("Native atomic write temporary file changed after close");return i}async function Lw(e,t){let r=me.resolve(e),i=me.resolve(t);if(!Dn(r,i))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let n=[await Ed(r)],a=me.relative(r,i).split(me.sep).filter(Boolean),o=r;for(let s of a){await Jt(n),o=me.join(o,s);try{await U.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Ed(o);if(!Dn(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await Jt(n),n}async function Mw(e){let t;try{t=await U.open(e,"r"),await t.sync()}catch(r){let i=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw r}finally{await t?.close()}}async function xd(e,t,r={}){let i=me.dirname(e),n=r.containedRoot?await Lw(r.containedRoot,i):null;n||await U.mkdir(i,{recursive:!0});let a=me.join(i,`.${me.basename(e)}.${$w()}.tmp`),o,s,c;try{if(await r.beforeTemporaryOpen?.(),o=await U.open(a,"wx"),s=await o.stat(),n){let[l,u]=await Promise.all([U.lstat(a),U.realpath(a)]);if(await Jt(n),!l.isFile()||l.isSymbolicLink()||!Ln(s,l)||!Dn(n[0].realPath,u))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),c=await o.stat(),!Ln(s,c))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await r.afterTemporaryClose?.(),!c)throw new Error("Native atomic write temporary file was not written");if(c=await Dw(a,c,n),await r.beforeCommit?.(),n){await Jt(n);let l=await U.lstat(a);if(!l.isFile()||l.isSymbolicLink()||!c||!Hw(l,c))throw new Error("Native atomic write temporary file changed before commit")}r.exclusive?(await Ns(a,e),await ys(a)):await ws(a,e),await Mw(i)}catch(l){if(await o?.close(),!n)await U.rm(a,{force:!0});else try{await Jt(n),await U.rm(a,{force:!0})}catch{}throw l}}async function te(e,t,r={}){await xd(e,t,r)}async function Cd(e,t,r={}){await xd(e,t,r)}async function K(e,t,r={}){await te(e,JSON.stringify(t,null,2)+`
174
- `,r)}var H=k(()=>{"use strict";bs();Ce()});import{existsSync as Pd,promises as Nt}from"fs";import A from"path";import Fw from"os";async function xs(e){try{return await Nt.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Vw(e){try{let t=await Nt.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function Ut(e,t){let r=A.relative(e,t);return r===""||!A.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${A.sep}`)}async function Gt(e){let t=[],r=e;for(;!await xs(r);){let n=A.dirname(r);if(n===r)break;t.push(A.basename(r)),r=n}let i=await Nt.realpath(r);return A.resolve(i,...t.reverse())}async function Cs(e){try{return(await Nt.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Ps(e){let t=A.resolve(e);try{(await Nt.stat(t)).isDirectory()||(t=A.dirname(t))}catch(n){if(n.code!=="ENOENT")throw n}let r=t,i=A.resolve(Fw.homedir());for(;;){if(!(t===i&&r!==i)){let o=A.join(t,...Mn.split("/")),s=t===r||await Vw(o);if(await xs(o)&&s)return t}if(await xs(A.join(t,".git")))return t;let a=A.dirname(t);if(a===t)return r;t=a}}function Yr(e){return wt(e)}async function qw(e,t){let r=Yr(t),i=A.resolve(e,...r.split("/")),n=await Nt.realpath(e),a=await Gt(i);if(!Ut(n,a))throw new Error("native.artifact_root resolves outside the project root");return i}async function Pe(e,t){let r=Yr(t),i=await qw(e,r),n=A.join(i,"comet");if(await Cs(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([Gt(i),Gt(n)]);if(!Ut(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=A.resolve(e),c=A.join(s,".comet","runtime","native");if(await Cs(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,u]=await Promise.all([Nt.realpath(s),Gt(c)]);if(!Ut(l,u))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:A.join(e,...Mn.split("/")),artifactRoot:i,artifactRootRef:r,nativeRoot:n,specsDir:A.join(n,"specs"),changesDir:A.join(n,"changes"),archiveDir:A.join(n,"archive"),runtimeDir:c,changesRuntimeDir:A.join(c,"changes"),locksDir:A.join(c,"locks"),transactionsDir:A.join(c,"transactions")}}function Rd(e){if(!Bw.test(e))throw new Error(`Invalid Native change name: ${e}`)}function nt(e,t){Rd(t);let r=A.join(e.changesRuntimeDir,t);if(!J(e.changesRuntimeDir,r))throw new Error("Native change Runtime path escaped");return r}function Ww(e,t){Rd(t);let r=A.join(e.changesDir,t,"runtime");if(!J(e.changesDir,r))throw new Error("Legacy Native change Runtime path escaped");return r}function Re(e,t){let r=nt(e,t);if(Pd(r))return r;let i=Ww(e,t);return Pd(i)?i:r}function ve(e,t){let r=A.resolve(t);if(J(e.runtimeDir,r))return e.runtimeDir;if(J(e.nativeRoot,r))return e.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${t}`)}function J(e,t){return Ut(A.resolve(e),A.resolve(t))}async function D(e,t){let r=A.resolve(e),i=A.resolve(t);if(!Ut(r,i))throw new Error(`Path is outside the Native root: ${t}`);if(await Cs(r))throw new Error(`Native root must not be a symbolic link: ${e}`);let[n,a]=await Promise.all([Gt(r),Gt(i)]);if(!Ut(n,a))throw new Error(`Path resolves outside the Native root: ${t}`);return i}var Mn,Bw,j=k(()=>{"use strict";et();Mn=".comet/config.yaml",Bw=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u});import zw from"path";function _d(e="docs",t="en"){return In(e,t)}async function ne(e){let t=(await On(e))?.config??null;return t?.native?t:null}async function at(e,t,r={}){let i=await Ur(e,{allowPartialProject:!0}),n=qr(i.document?.value??{},t),a=zw.join(e,...Mn.split("/"));await te(a,Vr(n,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await r.beforeCommit?.(),await Ss(e,i.identity)}})}var re=k(()=>{"use strict";et();Wt();Es();H();j()});import{existsSync as Jw}from"node:fs";import Xr from"node:path";function Ad(e,t){let r=t.toLowerCase();return Object.entries(e).find(([i,n])=>i.toLowerCase()===r&&n!==void 0)?.[1]}function Uw(e){let t=(Ad(e,"PATHEXT")??".COM;.EXE;.BAT;.CMD").split(";").map(r=>r.trim().toLowerCase()).filter(Boolean);return[...new Set([...t,".ps1"])]}function Kw(e,t,r){let n=Xr.win32.isAbsolute(e)||/[\\/]/u.test(e)?[""]:(Ad(t,"PATH")??"").split(Xr.delimiter).map(s=>s.trim().replace(/^"(.*)"$/u,"$1")).filter(Boolean),o=Xr.win32.extname(e)?[e]:Uw(t).map(s=>`${e}${s}`);return n.flatMap(s=>o.map(c=>s?Xr.join(s,c):Xr.resolve(r,c)))}function Rs(e,t,r){return Kw(e,t,r).find(i=>Jw(i))??e}function _s(e){if(e.some(t=>Gw.test(t)))throw new Error("Windows batch check arguments must not contain shell syntax")}var Gw,cx,Fn=k(()=>{"use strict";Gw=/[&|<>()^%"!\r\n]/u,cx=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ")});import{execFileSync as Yw}from"node:child_process";import Id from"node:path";function Zw(e){return e instanceof Error&&(e.code==="ETIMEDOUT"||e.killed===!0&&e.signal==="SIGTERM")}function Bn(e,t,r={}){let i=r.timeoutMs??Xw,n=r.maxBufferBytes??Qw;if(!Number.isSafeInteger(i)||i<1)throw new Error("External command timeout must be a positive integer");if(!Number.isSafeInteger(n)||n<1)throw new Error("External command max buffer must be a positive integer");let a=Id.resolve(r.cwd??process.cwd()),o=r.env??process.env,s=process.platform==="win32"?Rs(e,o,a):e,c=Id.win32.extname(s).toLowerCase(),l=c===".bat"||c===".cmd";process.platform==="win32"&&l&&_s(t);try{return Yw(s,[...t],{cwd:a,env:o,...r.input!==void 0?{input:r.input}:{},encoding:"utf8",stdio:[r.input===void 0?"ignore":"pipe","pipe","pipe"],timeout:i,maxBuffer:n,windowsHide:!0,shell:process.platform==="win32"&&l})}catch(u){let d=typeof u.stderr=="string"?u.stderr.trim():Buffer.isBuffer(u.stderr)?u.stderr.toString("utf8").trim():"";throw new As(e,t,d,{cause:u,timedOut:Zw(u)})}}var Xw,Qw,As,Td=k(()=>{"use strict";Fn();Xw=6e4,Qw=8*1024*1024,As=class extends Error{constructor(r,i,n,a){super(`${r} ${i.join(" ")} failed${n?`: ${n}`:""}`,a);this.command=r;this.args=i;this.stderr=n;this.name="ExternalCommandError",this.timedOut=a?.timedOut===!0}command;args;stderr;timedOut}});import{promises as jd}from"node:fs";import $d from"node:path";function ry(e){let t=Ts.get(e);if(!t)return;let r=t.value===null?ty:ey;if(Date.now()-t.at>r){Ts.delete(e);return}return t.value}async function Qr(e){if(e===process.pid&&Is!==null)return Is;let t=ry(e);if(t!==void 0)return t;let r=await iy(e);return e===process.pid&&r!==null&&(Is=r),e!==process.pid&&Ts.set(e,{value:r,at:Date.now()}),r}async function iy(e){if(!Number.isSafeInteger(e)||e<=0)return null;try{if(process.platform==="linux"){let[t,r]=await Promise.all([jd.readFile(`/proc/${e}/stat`,"utf8"),jd.readFile("/proc/sys/kernel/random/boot_id","utf8")]),i=t.slice(t.lastIndexOf(")")+2).trim().split(/\s+/u)[19];return/^\d+$/u.test(i??"")?`linux:${r.trim()}:${i}`:null}if(process.platform==="win32")return await ay(e);if(process.platform==="darwin"){let t=Bn("/bin/ps",["-p",String(e),"-o","lstart="],{timeoutMs:5e3,maxBufferBytes:4096,env:{...process.env,LC_ALL:"C",TZ:"UTC0"}}).trim();return t?`darwin:${t}`:null}}catch{}return null}function ny(e){let t=e.trim();return/^\d+$/u.test(t)?`win32-ps:${t}`:null}async function ay(e){try{let n=Bn($d.win32.join(process.env.SystemRoot??"C:\\Windows","System32","wbem","WMIC.exe"),["process","where",`processid=${e}`,"get","creationdate","/value"],{timeoutMs:5e3,maxBufferBytes:4096}),a=/^CreationDate=(\S+)/mu.exec(n);if(a)return`win32-wmic:${a[1]}`}catch{}let t=process.env.SystemRoot??"C:\\Windows",r=$d.win32.join(t,"System32","WindowsPowerShell","v1.0","powershell.exe"),i=Bn(r,["-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${e} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks.ToString()`],{timeoutMs:8e3,maxBufferBytes:4096}).trim();return ny(i)}function Vn(e){let t=e.indexOf(":");return t===-1?"":e.slice(0,t)}async function js(e,t){if(!Number.isSafeInteger(e)||e<=0)return"alive";try{process.kill(e,0)}catch(i){if(i.code==="ESRCH")return"dead"}if(!t)return"unknown";let r=await Qr(e);return r===t?"alive":r===null||Vn(r)!==Vn(t)&&Od.has(Vn(r))&&Od.has(Vn(t))?"unknown":"dead"}var Is,ey,ty,Ts,Od,qn=k(()=>{"use strict";Td();Is=null,ey=6e4,ty=1e4,Ts=new Map;Od=new Set(["win32-wmic","win32-ps"])});import{AsyncLocalStorage as oy}from"async_hooks";import{randomUUID as Ld}from"crypto";import{promises as se}from"fs";import Md from"os";import Y from"path";function cy(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function ly(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let r=e;if(typeof r.id!="string"||r.id.length===0||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<1||typeof r.hostname!="string"||r.hostname.length===0||typeof r.createdAt!="string"||r.createdAt.length===0||typeof r.operation!="string"||r.operation.length===0||r.processIdentity!==void 0&&(typeof r.processIdentity!="string"||r.processIdentity.length===0))throw new Error(`Invalid Native lock metadata: ${t}`);return r}function Bd(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function zn(e,t){let r={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},i={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return xe(r,i)?$(r,i):$(r,i)&&e.size===t.size}function $s(e,t){return zn(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function De(e){let t,r;try{let i=await Vt(e,Hd,{bigint:!0,label:"Native lock"});t=i.bytes,r=i.stat}catch(i){if(i.code==="ENOENT")return null;throw i instanceof he?i.reason==="too-large"?new Error(`Native lock metadata exceeds ${Hd} bytes: ${e}`,{cause:i}):i.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:i}):new Error(`Native lock changed while reading: ${e}`,{cause:i}):i}return{file:e,owner:ly(JSON.parse(t.toString("utf8")),e),identity:Bd(r)}}async function uy(e){return(await De(e))?.owner??null}async function dy(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==Md.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=await js(e.owner.pid,e.owner.processIdentity);return{status:t==="alive"?"active":t==="dead"?"stale":"unknown",owner:e.owner,identity:e.identity}}async function fy(e,t){try{await se.lstat(t);return}catch(r){if(r.code!=="ENOENT")throw r}try{await se.rename(e,t)}catch(r){if(r.code!=="ENOENT")throw r}}async function Os(e,t){let r=await De(e.file);if(!r)return"missing";if(r.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!$s(r.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await se.mkdir(t,{recursive:!0});let i=Y.join(t,`${Y.basename(e.file)}.${e.owner.id}.${Ld()}.removed`);try{await se.rename(e.file,i)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await De(i);if(!n||n.owner.id!==e.owner.id||!zn(n.identity,e.identity))throw await fy(i,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await se.rm(i,{force:!0}),"removed"}async function Vd(e){let t=await Qr(process.pid);return{id:Ld(),pid:process.pid,hostname:Md.hostname(),createdAt:new Date().toISOString(),operation:e,...t===null?{}:{processIdentity:t}}}async function qd(e,t){let r;try{r=await se.open(e,"wx")}catch(a){if(a.code==="EEXIST"){let o=await uy(e);throw new Error(`Native lock is already held: ${e}${o?` by pid ${o.pid} for ${o.operation}`:""}`,{cause:a})}throw a}let i;try{await r.writeFile(JSON.stringify(t,null,2)+`
175
- `,"utf8"),await r.sync(),i=Bd(await r.stat({bigint:!0}))}finally{await r.close()}let n=await De(e);if(!i||!n||n.owner.id!==t.id||!zn(n.identity,i))throw new Error(`Native lock changed after write: ${e}`);return n.identity}async function py(e,t){let r=await D(e.runtimeDir,e.locksDir);await se.mkdir(r,{recursive:!0});let i=await D(e.runtimeDir,Y.join(r,Fd));await se.mkdir(i,{recursive:!0});let n=await Vd(t),a=Y.join(i,`.${n.id}.tmp`),o=Y.join(i,`${n.id}.claim`);try{let s=await qd(a,n);await se.rename(a,o);let c=await De(o);if(!c||!zn(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.runtimeDir,locksDir:r,owner:n,identity:c.identity}}finally{await se.rm(a,{force:!0})}}async function hy(e){let t=Y.dirname(e.file),r=!1,i=Y.basename(e.file);for(let n of await se.readdir(t,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=Y.join(t,n.name);if(Y.resolve(a)!==Y.resolve(e.file))try{let o=await De(a),s=await dy(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await Os(o,t);continue}n.name<i&&(r=!0)}catch{n.name<i&&(r=!0)}}return r}async function Wd(e){let t=await De(e.file);if(t){if(t.owner.id!==e.owner.id||!$s(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await Os(t,Y.dirname(e.file))}}async function my(e,t){let r=Date.now()+sy;for(;;){let i=await py(e,t);if(!await hy(i))return i;if(await Wd(i),Date.now()>=r)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function vy(e){let t=Wn.get(e)??Promise.resolve(),r,i=new Promise(a=>{r=a}),n=t.then(()=>i);return Wn.set(e,n),await t,()=>{r(),Wn.get(e)===n&&Wn.delete(e)}}async function zd(e,t,r){let i=Y.resolve(e.locksDir),n=Dd.getStore();if(n?.has(i))return r();let a=await vy(i);try{let o=await my(e,t),s=new Map(n??[]);return s.set(i,o),await Dd.run(s,async()=>{try{return await r()}finally{await Wd(o)}})}finally{a()}}async function Zr(e,t,r){return zd(e,`acquire ${t}`,async()=>{let i=await D(e.runtimeDir,e.locksDir);await se.mkdir(i,{recursive:!0});let n=await D(e.runtimeDir,Y.join(i,cy(t))),a=await Vd(r),o=await qd(n,a);return{file:n,nativeRoot:e.runtimeDir,locksDir:i,owner:a,identity:o}})}async function ei(e){await De(e.file)&&await zd({runtimeDir:e.nativeRoot,locksDir:e.locksDir},`release ${Y.basename(e.file)}`,async()=>{let t=await De(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!$s(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let r=Y.join(e.locksDir,Fd);await Os(t,r)})}var Hd,Fd,sy,Px,Dd,Wn,Kt=k(()=>{"use strict";Jr();qn();j();Ce();Hd=16*1024,Fd=".coordinator",sy=5e3,Px=900*1e3,Dd=new oy,Wn=new Map});import{createHash as Jd}from"node:crypto";import{constants as ot,promises as C}from"node:fs";import I from"node:path";function le(e,t){let r=I.relative(e,t);return r===""||!I.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${I.sep}`)}function Gd(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Jn(e,t){return $({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Hs(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function _e(e,t){return $({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function st(e,t){let r=await C.lstat(e);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await C.realpath(e),dev:r.dev,ino:r.ino,birthtimeMs:r.birthtimeMs}}async function Yt(e,t,r){let i=I.resolve(e),n=I.resolve(t);if(!le(i,n))throw new Error(`${r} is outside its managed root`);let a=[await st(i,r)],o=i;for(let s of I.relative(i,n).split(I.sep).filter(Boolean)){await L(a,r),o=I.join(o,s);let c=await st(o,r);if(!le(a[0].realPath,c.realPath))throw new Error(`${r} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,r),a}async function L(e,t){for(let r of e){let i=await C.lstat(r.path);if(!i.isDirectory()||i.isSymbolicLink()||!Jn(r,i)||await C.realpath(r.path)!==r.realPath)throw new Error(`${t} parent changed during I/O: ${r.path}`)}}async function gy(e,t,r){let i=[],n=0,a=Buffer.allocUnsafe(t===null?64*1024:Math.min(64*1024,t+1));for(;;){let o=t===null?a.length:t+1-n,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,t!==null&&n>t)throw new Error(`${r} exceeds ${t} bytes`);i.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(i,n)}async function ce(e){let t=e.maxBytes===null?null:Gd(e.maxBytes),r=I.resolve(e.file),i=await Yt(e.root,I.dirname(r),e.label),n=await Promise.all((e.forbiddenRoots??[]).map(u=>st(I.resolve(u),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(i,e.label);let a=await C.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(t!==null&&a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=Hs(a),s=await C.realpath(r);if(!le(i[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(n.some(u=>le(u.realPath,s)))throw new Error(`${e.label} resolves inside an excluded root`);let c=process.platform==="win32"?ot.O_RDONLY:ot.O_RDONLY|ot.O_NOFOLLOW|ot.O_NONBLOCK,l=await C.open(r,c);try{let u=await l.stat();await e.hooks?.afterOpen?.();let[d,f]=await Promise.all([C.lstat(r),C.realpath(r)]);if(await L(i,e.label),await L(n,e.label),!u.isFile()||!d.isFile()||d.isSymbolicLink()||f!==s||!_e(o,u)||!_e(o,d))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let h=await gy(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[v,p,m]=await Promise.all([l.stat(),C.lstat(r),C.realpath(r)]);if(await L(i,e.label),await L(n,e.label),!p.isFile()||p.isSymbolicLink()||m!==s||!_e(o,v)||!_e(o,p))throw new Error(`${e.label} changed while reading`);return{bytes:h,hash:Jd("sha256").update(h).digest("hex"),size:h.length}}finally{await l.close()}}async function Gn(e){let t=I.resolve(e.file),r=await Yt(e.root,I.dirname(t),e.label),i=await Promise.all((e.forbiddenRoots??[]).map(l=>st(I.resolve(l),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(r,e.label);let n=await C.lstat(t);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let a=Hs(n),o=await C.realpath(t);if(!le(r[0].realPath,o))throw new Error(`${e.label} resolves outside its managed root`);if(i.some(l=>le(l.realPath,o)))throw new Error(`${e.label} resolves inside an excluded root`);let s=process.platform==="win32"?ot.O_RDONLY:ot.O_RDONLY|ot.O_NOFOLLOW|ot.O_NONBLOCK,c=await C.open(t,s);try{let l=await c.stat();await e.hooks?.afterOpen?.();let[u,d]=await Promise.all([C.lstat(t),C.realpath(t)]);if(await L(r,e.label),await L(i,e.label),!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!_e(a,l)||!_e(a,u))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let f=Jd("sha256"),h=0,v=Buffer.allocUnsafe(64*1024);for(;;){let{bytesRead:y}=await c.read(v,0,v.length,null);if(y===0)break;h+=y,f.update(v.subarray(0,y))}await e.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat(),C.lstat(t),C.realpath(t)]);if(await L(r,e.label),await L(i,e.label),!m.isFile()||m.isSymbolicLink()||w!==o||!_e(a,p)||!_e(a,m))throw new Error(`${e.label} changed while reading`);return{hash:f.digest("hex"),size:h}}finally{await c.close()}}async function bt(e){let t=await Yt(e.root,e.directory,e.label),r;if(e.maxEntries===void 0)r=await C.readdir(e.directory,{withFileTypes:!0});else{let i=Gd(e.maxEntries);r=[];let n=await C.opendir(e.directory);try{for await(let a of n)if(r.push(a),r.length>i)throw new Error(`${e.label} exceeds ${i} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:r,verify:()=>L(t,e.label)}}async function wy(e){let t=I.resolve(e.directory),r=I.resolve(e.quarantine);if(I.dirname(r)!==I.dirname(t)||!le(I.resolve(e.root),r)||r===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let i=await Yt(e.root,I.dirname(t),e.label),n=await st(t,e.label);if(!le(i[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(i,e.label);let a=await C.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Jn(n,a)||await C.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await C.lstat(r),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await C.rename(t,r),await L(i,e.label);let o=await C.lstat(r);if(!o.isDirectory()||o.isSymbolicLink()||!Jn(n,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(r);try{throw await C.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:r,parentChain:i,identity:n}}async function Ud(e){await wy(e)}async function Ds(e){let t=I.resolve(e.file),r=await Yt(e.root,I.dirname(t),e.label),i=await C.lstat(t);if(!i.isFile()||i.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let n=Hs(i),a=await C.realpath(t);if(!le(r[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await ce({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([C.lstat(t),C.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!_e(n,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(r,e.label);let[l,u]=await Promise.all([C.lstat(t),C.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!_e(n,l)||u!==a)throw new Error(`${e.label} changed before removal`);await C.rm(t),await L(r,e.label)}async function Ls(e){let t=I.resolve(e.directory),r=await Yt(e.root,I.dirname(t),e.label),i=await st(t,e.label);if(!le(r[0].realPath,i.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(r,e.label);let n=await C.lstat(t);if(!n.isDirectory()||n.isSymbolicLink()||!Jn(i,n)||await C.realpath(t)!==i.realPath)throw new Error(`${e.label} changed before removal`);await C.rmdir(t),await L(r,e.label)}async function ti(e){let t=I.resolve(e.root),r=I.resolve(e.directory);if(!le(t,r))throw new Error(`${e.label} is outside its managed root`);let i=[await st(t,e.label)],n=t;for(let a of I.relative(t,r).split(I.sep).filter(Boolean)){await L(i,e.label),n=I.join(n,a);try{await C.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await st(n,e.label);if(!le(i[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${n}`);i.push(o)}await L(i,e.label)}async function ri(e){let t=await ce({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await Cd(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await C.lstat(e.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${e.label} target changed before commit`)}if((await ce({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let r=await ce({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(r.hash!==t.hash||r.size!==t.size)throw new Error(`${e.label} target could not be verified`);return r}var ge=k(()=>{"use strict";H();Ce()});import{promises as Kn}from"fs";import Le from"path";import{TextDecoder as yy}from"util";function ii(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function ni(e,t,r){let i=Object.keys(e).filter(n=>!t.has(n));if(i.length>0)throw new Error(`${r} has unknown field(s): ${i.join(", ")}`)}function Qt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function Ms(e,t){if(typeof e!="string"||e.length===0||Le.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Un(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function Kd(e,t){if(Ms(e,t),e.includes("\\")||e!==Le.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function xy(e,t){let r=ii(e,`transaction operations[${t}]`);if(ni(r,by,`transaction operations[${t}]`),typeof r.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.id))throw new Error(`transaction operations[${t}].id is invalid`);if(r.type!=="write"&&r.type!=="remove"&&r.type!=="move")throw new Error(`transaction operation ${r.id} has an invalid type`);Ms(r.target,`transaction operation ${r.id} target`);for(let i of["source","staged","backup"])r[i]!==void 0&&Ms(r[i],`transaction operation ${r.id} ${i}`);if(r.type==="write"){if(r.staged===void 0||r.source!==void 0)throw new Error(`write operation ${r.id} requires staged and forbids source`)}else if(r.type==="remove"){if(r.source!==void 0||r.staged!==void 0)throw new Error(`remove operation ${r.id} forbids source and staged`)}else if(r.source===void 0||r.staged!==void 0||r.backup!==void 0)throw new Error(`move operation ${r.id} requires source and forbids staged and backup`);return r}function ef(e){let t=ii(e,"Native Archive transaction journal");if(ni(t,ky,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!Xd.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!Qt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Un(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let r=t.operations.map((s,c)=>{let l=ii(s,`Archive transaction operations[${c}]`);if(ni(l,Sy,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);Kd(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&Kd(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Un(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Un(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Un(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),i=r.map(s=>s.id);if(new Set(i).size!==i.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${t.id}`,a=r.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.change}$`,"u").test(a[0].target)||r.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of r.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:r}}function Fs(e){let t=ii(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return ef(t);if(ni(t,Ny,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!Xd.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!Le.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!Le.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!Qt(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let r=t.operations.map(xy),i=r.map(n=>n.id);if(new Set(i).size!==i.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:r}}function tf(e,t){let r=ii(e,`Native transaction event at line ${t}`);if(ni(r,Ey,`Native transaction event at line ${t}`),r.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!Qt(r.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof r.type!="string"||!Qd.has(r.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let i=r.type==="operation-started"||r.type==="operation-completed";if(i&&(typeof r.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.operationId)||Buffer.byteLength(r.operationId,"utf8")>256)||!i&&r.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:r.sequence,timestamp:r.timestamp,type:r.type,...typeof r.operationId=="string"?{operationId:r.operationId}:{}}}function Cy(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let i=0;i<e.length;i+=1){let n=t[i],a=e[i];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let r=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[i,n,a,o]of r){if(e.length<=i)continue;let s=e.slice(i,Math.min(i+n,e.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!Qt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||Qt(e)}function Xt(e,t){return e.length<t.length&&t.startsWith(e)}function Py(e){let t='","operationId":"';if(Xt(e,t))return!0;if(!e.startsWith(t))return!1;let r=e.slice(t.length),i=r.indexOf('"');if(i===-1)return r.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(r);let n=r.slice(0,i);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?Xt(r.slice(i),'"}'):!1}function Ry(e,t){if(e.length===0)return!1;let r=`{"sequence":${t},"timestamp":"`;if(Xt(e,r))return!0;if(!e.startsWith(r))return!1;let i=e.slice(r.length),n=i.slice(0,Math.min(24,i.length));if(!Cy(n))return!1;if(i.length<24)return!0;if(!Qt(n))return!1;let a='","type":"',o=i.slice(24);if(Xt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of Qd){if(Xt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Py(l))return!0}else if(Xt(l,'"}'))return!0}return!1}function _y(e,t){if(e.length===0)throw new Error("Blank transaction event line");return tf(JSON.parse(e),t)}function Ay(e){let t=e.split(`
176
- `),r=t.at(-1)==="";if(r&&t.pop(),t.length>Yn)throw new Error(`Native transaction event log exceeds ${Yn} events`);let i=[];for(let n=0;n<t.length;n+=1){let a=n+1,o=t[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!r&&n===t.length-1;try{i.push(_y(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&Ry(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return i}function rf(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
173
+ # 可选值:neutral | strict`}}});function dt(t){return t!==0&&t!==0n&&t!=="0"}function Te(t,e){return dt(t.dev)&&dt(e.dev)&&dt(t.ino)&&dt(e.ino)}function H(t,e){let r=dt(t.dev)&&dt(e.dev);if(r&&t.dev!==e.dev)return!1;let i=dt(t.ino)&&dt(e.ino);return i&&t.ino!==e.ino?!1:r&&i?!0:t.birthtime===e.birthtime}var ui=k(()=>{"use strict"});import{constants as sa,promises as At}from"fs";function Zs(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function gf(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function di(t){return{dev:t.dev,ino:t.ino,birthtime:Zs(t)}}function ca(t,e){let r=di(t),i=di(e);return Te(r,i)?H(r,i):H(r,i)&&Zs(t)===Zs(e)&&gf(t)===gf(e)&&t.size===e.size}async function nr(t,e,r={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=r.label??"file",n=r.bigint===!0,a=await At.lstat(t,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new Ne("not-regular-file",`${i} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new Ne("too-large",`${i} exceeds ${e} bytes`);let o=await At.realpath(t);await r.verify?.("pre-open",{realPath:o,identity:di(a)});let s=process.platform==="win32"?sa.O_RDONLY:sa.O_RDONLY|sa.O_NOFOLLOW|sa.O_NONBLOCK,c;try{c=await At.open(t,s)}catch(l){throw l.code==="ELOOP"?new Ne("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:n}),At.lstat(t,{bigint:n}),At.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!ca(a,l)||!ca(a,u))throw new Ne("changed",`${i} changed while opening`);await r.verify?.("post-open",{realPath:d,identity:di(l)}),await r.hooks?.afterOpen?.();let f=[],h=0,v=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:N}=await c.read(v,0,Math.min(v.length,y),null);if(N===0)break;if(h+=N,h>e)throw new Ne("too-large",`${i} exceeds ${e} bytes`);f.push(Buffer.from(v.subarray(0,N)))}await r.hooks?.beforeFinalCheck?.();let[p,m,g]=await Promise.all([c.stat({bigint:n}),At.lstat(t,{bigint:n}),At.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||g!==o||!ca(a,p)||!ca(a,m))throw new Ne("changed",`${i} changed while reading`);return await r.verify?.("post-read",{realPath:g,identity:di(p)}),{bytes:Buffer.concat(f,h),stat:p,realPath:g}}finally{await c.close()}}var Ne,fi=k(()=>{"use strict";ui();Ne=class extends Error{reason;constructor(e,r,i){super(r,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as la}from"fs";import ft from"path";function Uy(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function ec(t,e){let r=ft.relative(t,e);return r===""||!ft.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${ft.sep}`)}async function wf(t,e){let r=ft.resolve(t),i=await la.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return la.realpath(r)}async function yf(t,e,r,i){let n=t;for(let a=0;a<r.length;a++){n=ft.join(n,r[a]);let o;try{o=await la.lstat(n)}catch(u){if(Uy(u))return{exists:!1,kind:"missing"};throw u}let s=ft.relative(t,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${s}`);let c=a===r.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${s} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await la.realpath(n);if(!ec(e,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function ar(t,e,r){let i=aa(e,r.label),n=ft.resolve(t),a=await wf(n,r.label),o=i.split("/"),s=ft.resolve(n,...o);if(!ec(n,s))throw new Error(`${r.label} must stay inside the project root`);let c=await yf(n,a,o,r);return{projectRoot:n,target:s,relative:i,exists:c.exists,kind:c.kind}}async function $e(t,e,r,i){let n=await ar(t,e,{label:i.label,expected:"file"});if(!n.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let a=await wf(n.projectRoot,i.label);return nr(n.target,r,{...i,verify:async(o,s)=>{if(!ec(a,s.realPath))throw new Error(`${i.label} resolves outside the project root`);await yf(n.projectRoot,a,n.relative.split("/"),{label:i.label,expected:"file"})}})}var Je=k(()=>{"use strict";fi();ut()});import{createHash as Ky}from"crypto";function tc(t,e){return t.exists===e.exists&&t.sha256===e.sha256}function Yy(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ua(t,e={}){return(await hi(t,e)).document}async function Nf(t){try{return(await $e(t,pi,si,{label:pi})).bytes}catch(e){if(Yy(e))return null;throw e}}function bf(t){return t?{exists:!0,sha256:Ky("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function da(t){return bf(await Nf(t))}async function hi(t,e={}){let r=await Nf(t);return{document:r?ir(r.toString("utf8"),e):null,identity:bf(r)}}async function rc(t){return(await ua(t))?.config??null}var pi,or=k(()=>{"use strict";ut();Je();pi=".comet/config.yaml"});import{promises as nc}from"node:fs";async function ac(t,e){let r;for(let i=0;i<=ic.length;i+=1)try{return await t()}catch(n){r=n;let a=n.code;if(i===ic.length||!Xy.has(a??""))throw n;await new Promise(o=>setTimeout(o,ic[i]))}throw r}async function oc(t,e){await ac(()=>nc.rename(t,e),`rename ${e}`)}async function sc(t){await ac(()=>nc.unlink(t),`unlink ${t}`)}async function cc(t,e){await ac(()=>nc.link(t,e),`link ${e}`)}var Xy,ic,lc=k(()=>{"use strict";Xy=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),ic=[50,100,200]});var sr=k(()=>{"use strict";lc();ui()});var pP,uc=k(()=>{"use strict";sr();or();Je();pP=16*1024});async function dc(t,e){if(!e)return;let r=await da(t);if(!tc(r,e))throw new Error("Project config changed before commit; rerun the operation")}var fc=k(()=>{"use strict";sr();ut();or();Je();uc()});var je=k(()=>{"use strict";ui()});import{randomUUID as tN}from"crypto";import{promises as Q}from"fs";import be from"path";function fa(t,e){let r=be.relative(t,e);return r===""||!be.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${be.sep}`)}function rN(t,e){return H({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function pa(t,e){return H({dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs},{dev:e.dev,ino:e.ino,birthtime:e.birthtimeMs})}function iN(t,e){return pa(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function kf(t){let e=await Q.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await Q.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function cr(t){for(let e of t){let r=await Q.lstat(e.path);if(!r.isDirectory()||r.isSymbolicLink()||!rN(e,r)||await Q.realpath(e.path)!==e.realPath)throw new Error(`Native atomic write parent changed before commit: ${e.path}`)}}async function nN(t,e,r){let[i,n]=await Promise.all([Q.lstat(t),Q.realpath(t),r?cr(r):Promise.resolve()]);if(!i.isFile()||i.isSymbolicLink()||!pa(i,e)||r&&!fa(r[0].realPath,n))throw new Error("Native atomic write temporary file changed after close");return i}async function aN(t,e){let r=be.resolve(t),i=be.resolve(e);if(!fa(r,i))throw new Error(`Native atomic write parent is outside its managed root: ${e}`);let n=[await kf(r)],a=be.relative(r,i).split(be.sep).filter(Boolean),o=r;for(let s of a){await cr(n),o=be.join(o,s);try{await Q.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await kf(o);if(!fa(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await cr(n),n}async function oN(t){let e;try{e=await Q.open(t,"r"),await e.sync()}catch(r){let i=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw r}finally{await e?.close()}}async function Sf(t,e,r={}){let i=be.dirname(t),n=r.containedRoot?await aN(r.containedRoot,i):null;n||await Q.mkdir(i,{recursive:!0});let a=be.join(i,`.${be.basename(t)}.${tN()}.tmp`),o,s,c;try{if(await r.beforeTemporaryOpen?.(),o=await Q.open(a,"wx"),s=await o.stat(),n){let[l,u]=await Promise.all([Q.lstat(a),Q.realpath(a)]);if(await cr(n),!l.isFile()||l.isSymbolicLink()||!pa(s,l)||!fa(n[0].realPath,u))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),c=await o.stat(),!pa(s,c))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await r.afterTemporaryClose?.(),!c)throw new Error("Native atomic write temporary file was not written");if(c=await nN(a,c,n),await r.beforeCommit?.(),n){await cr(n);let l=await Q.lstat(a);if(!l.isFile()||l.isSymbolicLink()||!c||!iN(l,c))throw new Error("Native atomic write temporary file changed before commit")}r.exclusive?(await cc(a,t),await sc(a)):await oc(a,t),await oN(i)}catch(l){if(await o?.close(),!n)await Q.rm(a,{force:!0});else try{await cr(n),await Q.rm(a,{force:!0})}catch{}throw l}}async function ne(t,e,r={}){await Sf(t,e,r)}async function Ef(t,e,r={}){await Sf(t,e,r)}async function Y(t,e,r={}){await ne(t,JSON.stringify(e,null,2)+`
174
+ `,r)}var L=k(()=>{"use strict";lc();je()});import{existsSync as xf,promises as It}from"fs";import I from"path";import sN from"os";async function pc(t){try{return await It.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function lN(t){try{let e=await It.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function ur(t,e){let r=I.relative(t,e);return r===""||!I.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${I.sep}`)}async function lr(t){let e=[],r=t;for(;!await pc(r);){let n=I.dirname(r);if(n===r)break;e.push(I.basename(r)),r=n}let i=await It.realpath(r);return I.resolve(i,...e.reverse())}async function hc(t){try{return(await It.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function mc(t){let e=I.resolve(t);try{(await It.stat(e)).isDirectory()||(e=I.dirname(e))}catch(n){if(n.code!=="ENOENT")throw n}let r=e,i=I.resolve(sN.homedir());for(;;){if(!(e===i&&r!==i)){let o=I.join(e,...ha.split("/")),s=e===r||await lN(o);if(await pc(o)&&s)return e}if(await pc(I.join(e,".git")))return e;let a=I.dirname(e);if(a===e)return r;e=a}}function vi(t){return _t(t)}async function uN(t,e){let r=vi(e),i=I.resolve(t,...r.split("/")),n=await It.realpath(t),a=await lr(i);if(!ur(n,a))throw new Error("native.artifact_root resolves outside the project root");return i}async function Oe(t,e){let r=vi(e),i=await uN(t,r),n=I.join(i,"comet");if(await hc(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([lr(i),lr(n)]);if(!ur(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=I.resolve(t),c=I.join(s,".comet","runtime","native");if(await hc(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,u]=await Promise.all([It.realpath(s),lr(c)]);if(!ur(l,u))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:I.join(t,...ha.split("/")),artifactRoot:i,artifactRootRef:r,nativeRoot:n,specsDir:I.join(n,"specs"),changesDir:I.join(n,"changes"),archiveDir:I.join(n,"archive"),runtimeDir:c,changesRuntimeDir:I.join(c,"changes"),locksDir:I.join(c,"locks"),transactionsDir:I.join(c,"transactions")}}function Cf(t){if(!cN.test(t))throw new Error(`Invalid Native change name: ${t}`)}function pt(t,e){Cf(e);let r=I.join(t.changesRuntimeDir,e);if(!U(t.changesRuntimeDir,r))throw new Error("Native change Runtime path escaped");return r}function dN(t,e){Cf(e);let r=I.join(t.changesDir,e,"runtime");if(!U(t.changesDir,r))throw new Error("Legacy Native change Runtime path escaped");return r}function He(t,e){let r=pt(t,e);if(xf(r))return r;let i=dN(t,e);return xf(i)?i:r}function ke(t,e){let r=I.resolve(e);if(U(t.runtimeDir,r))return t.runtimeDir;if(U(t.nativeRoot,r))return t.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${e}`)}function U(t,e){return ur(I.resolve(t),I.resolve(e))}async function B(t,e){let r=I.resolve(t),i=I.resolve(e);if(!ur(r,i))throw new Error(`Path is outside the Native root: ${e}`);if(await hc(r))throw new Error(`Native root must not be a symbolic link: ${t}`);let[n,a]=await Promise.all([lr(r),lr(i)]);if(!ur(n,a))throw new Error(`Path resolves outside the Native root: ${e}`);return i}var ha,cN,O=k(()=>{"use strict";ut();ha=".comet/config.yaml",cN=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u});import fN from"path";function Pf(t="docs",e="en"){return oa(t,e)}async function ce(t){let e=(await ua(t))?.config??null;return e?.native?e:null}async function ht(t,e,r={}){let i=await hi(t,{allowPartialProject:!0}),n=li(i.document?.value??{},e),a=fN.join(t,...ha.split("/"));await ne(a,ci(n,e.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:t,beforeCommit:async()=>{await r.beforeCommit?.(),await dc(t,i.identity)}})}var ae=k(()=>{"use strict";ut();or();fc();L();O()});import{AsyncLocalStorage as pN}from"node:async_hooks";import{performance as ma}from"node:perf_hooks";function vc(t=0){hN+=1,mN+=t;let e=vN.getStore();e&&(e.gitCommands+=1,e.gitDurationMs+=t)}function va(t){let e=ma.now();try{return t()}finally{vc(ma.now()-e)}}async function gc(t){let e=ma.now();try{return await t()}finally{vc(ma.now()-e)}}var hN,mN,vN,dr=k(()=>{"use strict";hN=0,mN=0,vN=new pN});import{existsSync as gN}from"node:fs";import gi from"node:path";function Rf(t,e){let r=e.toLowerCase();return Object.entries(t).find(([i,n])=>i.toLowerCase()===r&&n!==void 0)?.[1]}function yN(t){let e=(Rf(t,"PATHEXT")??".COM;.EXE;.BAT;.CMD").split(";").map(r=>r.trim().toLowerCase()).filter(Boolean);return[...new Set([...e,".ps1"])]}function NN(t,e,r){let n=gi.win32.isAbsolute(t)||/[\\/]/u.test(t)?[""]:(Rf(e,"PATH")??"").split(gi.delimiter).map(s=>s.trim().replace(/^"(.*)"$/u,"$1")).filter(Boolean),o=gi.win32.extname(t)?[t]:yN(e).map(s=>`${t}${s}`);return n.flatMap(s=>o.map(c=>s?gi.join(s,c):gi.resolve(r,c)))}function ga(t,e,r){return NN(t,e,r).find(i=>gN(i))??t}function wc(t){if(t.some(e=>wN.test(e)))throw new Error("Windows batch check arguments must not contain shell syntax")}var wN,UP,wi=k(()=>{"use strict";wN=/[&|<>()^%"!\r\n]/u,UP=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ")});import{execFile as bN,execFileSync as XP}from"node:child_process";import _f from"node:path";async function mt(t,e,r={}){let i=r.timeoutMs??kN,n=r.maxBufferBytes??SN;if(!Number.isSafeInteger(i)||i<1||!Number.isSafeInteger(n)||n<1)throw new Error("External command limits must be positive integers");let a=_f.resolve(r.cwd??process.cwd()),o=r.env??process.env,s=process.platform==="win32"?ga(t,o,a):t,c=process.platform==="win32"&&/\.(?:bat|cmd)$/iu.test(s);c&&wc(e);let l=()=>new Promise((u,d)=>{let f=!1,h=bN(s,[...e],{cwd:a,env:o,encoding:"utf8",maxBuffer:n,windowsHide:!0,shell:c},(g,y,N)=>{f||(f=!0,clearTimeout(m),r.signal?.removeEventListener("abort",p),g?d(new yi(t,e,N.trim(),{cause:g,timedOut:EN(g)})):u(y))}),v=g=>{f||(f=!0,clearTimeout(m),r.signal?.removeEventListener("abort",p),h.kill("SIGKILL"),h.stdin?.destroy(),h.stdout?.destroy(),h.stderr?.destroy(),h.unref(),d(new yi(t,e,"",{timedOut:g})))},p=()=>v(!1),m=setTimeout(()=>v(!0),i);r.signal?.addEventListener("abort",p,{once:!0}),r.signal?.aborted&&p(),h.stdin?.end(r.input)});return/^(?:git|git\.exe)$/iu.test(_f.win32.basename(t))?gc(l):l()}function EN(t){return t instanceof Error&&(t.code==="ETIMEDOUT"||t.killed===!0&&t.signal==="SIGTERM")}var kN,SN,yi,wa=k(()=>{"use strict";dr();wi();kN=6e4,SN=8*1024*1024;yi=class extends Error{constructor(r,i,n,a){super(`${r} ${i.join(" ")} failed${n?`: ${n}`:""}`,a);this.command=r;this.args=i;this.stderr=n;this.name="ExternalCommandError",this.timedOut=a?.timedOut===!0}command;args;stderr;timedOut}});import{createHash as Nc,randomUUID as xN}from"node:crypto";import{promises as le}from"node:fs";import CN from"node:os";import oe from"node:path";async function yc(t,e){let r=await le.lstat(t,{bigint:!0});if(!r.isFile()||r.isSymbolicLink()||r.size>BigInt(e))throw new Error("Invalid process probe cache");let i=await le.readFile(t),n=await le.lstat(t,{bigint:!0});if(r.ino!==n.ino||r.ctimeNs!==n.ctimeNs||r.size!==n.size)throw new Error("Process probe cache changed");return i}async function Tf(t){try{let e=JSON.parse((await yc(oe.join(t,"probe.json"),4096)).toString("utf8"));if(!/^probe-[a-f0-9-]+\.exe$/u.test(e.file??""))return null;let r=oe.join(t,e.file),i=await yc(r,65536);return Nc("sha256").update(i).digest("hex")===e.hash?r:null}catch{return null}}async function _N(t,e){let r,i=xN(),n=oe.join(t,`probe-${i}.cs`),a=oe.join(t,`probe-${i}.exe`),o=oe.join(t,`probe-${i}.json`);try{if(await le.mkdir(t,{recursive:!0,mode:448}),(await le.lstat(t)).isSymbolicLink())return null;r=await le.open(oe.join(t,"prepare.lock"),"wx",384);let s=await Tf(t);if(s)return s;await le.writeFile(n,If,{flag:"wx",mode:384});let c;for(let u of["Framework64","Framework"]){let d=oe.join(e,"Microsoft.NET",u,"v4.0.30319","csc.exe");try{await le.access(d),c=d;break}catch{}}if(!c)return null;await mt(c,["/nologo","/target:exe","/platform:anycpu",`/out:${a}`,n],{timeoutMs:1500,maxBufferBytes:4096});let l=Nc("sha256").update(await yc(a,65536)).digest("hex");return await le.writeFile(o,JSON.stringify({file:oe.basename(a),hash:l}),{flag:"wx",mode:384}),await le.rename(o,oe.join(t,"probe.json")),a}catch{return null}finally{await le.unlink(n).catch(()=>{}),await le.unlink(o).catch(()=>{}),r&&(await r.close().catch(()=>{}),await le.unlink(oe.join(t,"prepare.lock")).catch(()=>{}))}}async function Af(t,e,r){try{let i=await mt(oe.join(e,"System32","wbem","WMIC.exe"),["process","where",`processid=${t}`,"get","creationdate","/value"],{timeoutMs:300,maxBufferBytes:4096,signal:r}),n=/^CreationDate=(\S+)/mu.exec(i);if(n)return`win32-wmic:${n[1]}`}catch{}if(r.aborted)return null;try{let n=(await mt(oe.join(e,"System32","WindowsPowerShell","v1.0","powershell.exe"),["-NoLogo","-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${t} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks.ToString()`],{timeoutMs:1e3,maxBufferBytes:4096,signal:r})).trim();return/^\d+$/u.test(n)?`win32-ps:${n}`:null}catch{return null}}function AN(t,e){let r=ya.get(t);if(r&&performance.now()<r.retryAfter)return r.promise;let i={promise:_N(t,e),retryAfter:1/0};return ya.set(t,i),i.promise.then(n=>{ya.get(t)===i&&(n?ya.delete(t):i.retryAfter=performance.now()+RN)}),i.promise}async function $f(t,e={}){if(!Number.isSafeInteger(t)||t<=0)return null;let r=e.systemRoot??process.env.SystemRoot??"C:\\Windows",i=oe.join(e.cacheRoot??oe.join(CN.tmpdir(),"comet-process-identity"),PN),n=async l=>{if(!l)return null;try{let d=(await mt(l,[String(t)],{timeoutMs:1e3,maxBufferBytes:4096})).trim();return/^\d+$/u.test(d)?`win32-ps:${d}`:null}catch{return null}},a=await Tf(i);if(a){let l=await n(a);return l||Af(t,r,new AbortController().signal)}let o=AN(i,r),s=new AbortController,c=l=>{if(!l)throw new Error("Probe unavailable");return l};try{return await Promise.any([o.then(n).then(c),Af(t,r,s.signal).then(c)])}catch{return null}finally{s.abort()}}var If,PN,RN,ya,jf=k(()=>{"use strict";wa();If=`using System;
175
+ using System.Runtime.InteropServices;
176
+ class CometProcessIdentity {
177
+ [DllImport("kernel32.dll")] static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
178
+ [DllImport("kernel32.dll")] static extern bool GetProcessTimes(IntPtr process, out long creation, out long exit, out long kernel, out long user);
179
+ [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
180
+ static int Main(string[] args) {
181
+ int pid; if(args.Length != 1 || !int.TryParse(args[0], out pid) || pid <= 0) return 1;
182
+ IntPtr handle=OpenProcess(0x1000, false, pid); if(handle == IntPtr.Zero) return 1;
183
+ try { long creation, exit, kernel, user; if(!GetProcessTimes(handle,out creation,out exit,out kernel,out user)) return 1;
184
+ Console.WriteLine(DateTime.FromFileTimeUtc(creation).Ticks.ToString(System.Globalization.CultureInfo.InvariantCulture)); return 0;
185
+ } finally { CloseHandle(handle); }
186
+ }
187
+ }`,PN=Nc("sha256").update(If).digest("hex"),RN=1e4,ya=new Map});import{promises as Of}from"node:fs";function TN(t){let e=kc.get(t);if(e){if(Date.now()-e.at>IN){kc.delete(t);return}return e.value}}async function Ni(t){if(t===process.pid&&bc!==null)return bc;let e=TN(t);if(e!==void 0)return e;let r=Na.get(t);r||(r=$N(t),Na.set(t,r));let i=await r;return Na.get(t)===r&&Na.delete(t),t===process.pid&&i!==null&&(bc=i),i===null&&kc.set(t,{value:null,at:Date.now()}),i}async function $N(t){if(!Number.isSafeInteger(t)||t<=0)return null;try{if(process.platform==="linux"){let[e,r]=await Promise.all([Of.readFile(`/proc/${t}/stat`,"utf8"),Of.readFile("/proc/sys/kernel/random/boot_id","utf8")]),i=e.slice(e.lastIndexOf(")")+2).trim().split(/\s+/u)[19];return/^\d+$/u.test(i??"")?`linux:${r.trim()}:${i}`:null}if(process.platform==="win32")return await $f(t);if(process.platform==="darwin"){let e=(await mt("/bin/ps",["-p",String(t),"-o","lstart="],{timeoutMs:5e3,maxBufferBytes:4096,env:{...process.env,LC_ALL:"C",TZ:"UTC0"}})).trim();return e?`darwin:${e}`:null}}catch{}return null}function ba(t){let e=t.indexOf(":");return e===-1?"":t.slice(0,e)}async function Sc(t,e){if(!Number.isSafeInteger(t)||t<=0)return"alive";try{process.kill(t,0)}catch(i){if(i.code==="ESRCH")return"dead"}if(!e)return"unknown";let r=await Ni(t);return r===e?"alive":r===null||ba(r)!==ba(e)&&Hf.has(ba(r))&&Hf.has(ba(e))?"unknown":"dead"}var bc,IN,kc,Na,Hf,ka=k(()=>{"use strict";wa();jf();bc=null,IN=1e4,kc=new Map,Na=new Map;Hf=new Set(["win32-wmic","win32-ps"])});import{AsyncLocalStorage as jN}from"async_hooks";import{randomUUID as Bf}from"crypto";import{promises as fe}from"fs";import Mf from"os";import Z from"path";function HN(t){if(!/^[a-z][a-z0-9-]*$/u.test(t))throw new Error(`Invalid Native lock name: ${t}`);return`${t}.lock`}function DN(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid Native lock metadata: ${e}`);let r=t;if(typeof r.id!="string"||r.id.length===0||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<1||typeof r.hostname!="string"||r.hostname.length===0||typeof r.createdAt!="string"||r.createdAt.length===0||typeof r.operation!="string"||r.operation.length===0||r.processIdentity!==void 0&&(typeof r.processIdentity!="string"||r.processIdentity.length===0))throw new Error(`Invalid Native lock metadata: ${e}`);return r}function qf(t){return{device:t.dev.toString(),inode:t.ino.toString(),size:t.size.toString(),birthtimeNs:t.birthtimeNs.toString(),ctimeNs:t.ctimeNs.toString(),mtimeNs:t.mtimeNs.toString()}}function Ea(t,e){let r={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs},i={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs};return Te(r,i)?H(r,i):H(r,i)&&t.size===e.size}function xa(t,e){return Ea(t,e)&&t.size===e.size&&t.birthtimeNs===e.birthtimeNs&&t.ctimeNs===e.ctimeNs&&t.mtimeNs===e.mtimeNs}async function De(t){let e,r;try{let i=await nr(t,Df,{bigint:!0,label:"Native lock"});e=i.bytes,r=i.stat}catch(i){if(i.code==="ENOENT")return null;throw i instanceof Ne?i.reason==="too-large"?new Error(`Native lock metadata exceeds ${Df} bytes: ${t}`,{cause:i}):i.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${t}`,{cause:i}):new Error(`Native lock changed while reading: ${t}`,{cause:i}):i}return{file:t,owner:DN(JSON.parse(e.toString("utf8")),t),identity:qf(r)}}async function LN(t){return(await De(t))?.owner??null}async function BN(t){if(!t)return{status:"missing",owner:null,identity:null};if(t.owner.hostname!==Mf.hostname())return{status:"unknown",owner:t.owner,identity:t.identity};let e=await Sc(t.owner.pid,t.owner.processIdentity);return{status:e==="alive"?"active":e==="dead"?"stale":"unknown",owner:t.owner,identity:t.identity}}async function MN(t,e){try{await fe.lstat(e);return}catch(r){if(r.code!=="ENOENT")throw r}try{await fe.rename(t,e)}catch(r){if(r.code!=="ENOENT")throw r}}async function Ec(t,e){let r=await De(t.file);if(!r)return"missing";if(r.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!xa(r.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);await fe.mkdir(e,{recursive:!0});let i=Z.join(e,`${Z.basename(t.file)}.${t.owner.id}.${Bf()}.removed`);try{await fe.rename(t.file,i)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await De(i);if(!n||n.owner.id!==t.owner.id||!Ea(n.identity,t.identity))throw await MN(i,t.file),new Error(`Native lock changed before quarantine: ${t.file}`);return await fe.rm(i,{force:!0}),"removed"}async function Vf(t){let e=await Ni(process.pid);return{id:Bf(),pid:process.pid,hostname:Mf.hostname(),createdAt:new Date().toISOString(),operation:t,...e===null?{}:{processIdentity:e}}}async function Wf(t,e){let r;try{r=await fe.open(t,"wx")}catch(a){if(a.code==="EEXIST"){let o=await LN(t);throw new Error(`Native lock is already held: ${t}${o?` by pid ${o.pid} for ${o.operation}`:""}`,{cause:a})}throw a}let i;try{await r.writeFile(JSON.stringify(e,null,2)+`
188
+ `,"utf8"),await r.sync(),i=qf(await r.stat({bigint:!0}))}finally{await r.close()}let n=await De(t);if(!i||!n||n.owner.id!==e.id||!Ea(n.identity,i))throw new Error(`Native lock changed after write: ${t}`);return n.identity}async function FN(t,e){let r=await B(t.runtimeDir,t.locksDir);await fe.mkdir(r,{recursive:!0});let i=await B(t.runtimeDir,Z.join(r,Ff));await fe.mkdir(i,{recursive:!0});let n=await Vf(e),a=Z.join(i,`.${n.id}.tmp`),o=Z.join(i,`${n.id}.claim`);try{let s=await Wf(a,n);await fe.rename(a,o);let c=await De(o);if(!c||!Ea(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:t.runtimeDir,locksDir:r,owner:n,identity:c.identity}}finally{await fe.rm(a,{force:!0})}}async function qN(t){let e=Z.dirname(t.file),r=!1,i=Z.basename(t.file);for(let n of await fe.readdir(e,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=Z.join(e,n.name);if(Z.resolve(a)!==Z.resolve(t.file))try{let o=await De(a),s=await BN(o);if(s.status==="missing")continue;let c=await De(a);if(!c)continue;if(!o||c.owner.id!==o.owner.id||!xa(c.identity,o.identity)){n.name<i&&(r=!0);continue}if(s.status==="stale"&&o){await Ec(o,e);continue}n.name<i&&(r=!0)}catch{n.name<i&&(r=!0)}}return r}async function zf(t){let e=await De(t.file);if(e){if(e.owner.id!==t.owner.id||!xa(e.identity,t.identity))throw new Error(`Native lock coordinator ownership changed: ${t.file}`);await Ec(e,Z.dirname(t.file))}}async function VN(t,e){let r=Date.now()+ON;for(;;){let i=await FN(t,e);if(!await qN(i))return i;if(await zf(i),Date.now()>=r)throw new Error(`Native lock coordinator is busy: ${t.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function WN(t){let e=Sa.get(t)??Promise.resolve(),r,i=new Promise(a=>{r=a}),n=e.then(()=>i);return Sa.set(t,n),await e,()=>{r(),Sa.get(t)===n&&Sa.delete(t)}}async function Gf(t,e,r){let i=Z.resolve(t.locksDir),n=Lf.getStore();if(n?.has(i))return r();let a=await WN(i);try{let o=await VN(t,e),s=new Map(n??[]);return s.set(i,o),await Lf.run(s,async()=>{try{return await r()}finally{await zf(o)}})}finally{a()}}async function bi(t,e,r){return Gf(t,`acquire ${e}`,async()=>{let i=await B(t.runtimeDir,t.locksDir);await fe.mkdir(i,{recursive:!0});let n=await B(t.runtimeDir,Z.join(i,HN(e))),a=await Vf(r),o=await Wf(n,a);return{file:n,nativeRoot:t.runtimeDir,locksDir:i,owner:a,identity:o}})}async function ki(t){await De(t.file)&&await Gf({runtimeDir:t.nativeRoot,locksDir:t.locksDir},`release ${Z.basename(t.file)}`,async()=>{let e=await De(t.file);if(!e)return;if(e.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!xa(e.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);let r=Z.join(t.locksDir,Ff);await Ec(e,r)})}var Df,Ff,ON,bR,Lf,Sa,fr=k(()=>{"use strict";fi();ka();O();je();Df=16*1024,Ff=".coordinator",ON=5e3,bR=900*1e3,Lf=new jN,Sa=new Map});import{createHash as Jf}from"node:crypto";import{constants as vt,promises as C}from"node:fs";import T from"node:path";function he(t,e){let r=T.relative(t,e);return r===""||!T.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${T.sep}`)}function Uf(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Ca(t,e){return H({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function xc(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function Le(t,e){return H({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function gt(t,e){let r=await C.lstat(t);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await C.realpath(t),dev:r.dev,ino:r.ino,birthtimeMs:r.birthtimeMs}}async function pr(t,e,r){let i=T.resolve(t),n=T.resolve(e);if(!he(i,n))throw new Error(`${r} is outside its managed root`);let a=[await gt(i,r)],o=i;for(let s of T.relative(i,n).split(T.sep).filter(Boolean)){await M(a,r),o=T.join(o,s);let c=await gt(o,r);if(!he(a[0].realPath,c.realPath))throw new Error(`${r} parent resolves outside its managed root: ${o}`);a.push(c)}return await M(a,r),a}async function M(t,e){for(let r of t){let i=await C.lstat(r.path);if(!i.isDirectory()||i.isSymbolicLink()||!Ca(r,i)||await C.realpath(r.path)!==r.realPath)throw new Error(`${e} parent changed during I/O: ${r.path}`)}}async function zN(t,e,r){let i=[],n=0,a=Buffer.allocUnsafe(e===null?64*1024:Math.min(64*1024,e+1));for(;;){let o=e===null?a.length:e+1-n,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,e!==null&&n>e)throw new Error(`${r} exceeds ${e} bytes`);i.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(i,n)}async function pe(t){let e=t.maxBytes===null?null:Uf(t.maxBytes),r=T.resolve(t.file),i=await pr(t.root,T.dirname(r),t.label),n=await Promise.all((t.forbiddenRoots??[]).map(u=>gt(T.resolve(u),t.label)));await t.hooks?.afterParentChainCaptured?.(),await M(i,t.label);let a=await C.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(e!==null&&a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=xc(a),s=await C.realpath(r);if(!he(i[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(n.some(u=>he(u.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?vt.O_RDONLY:vt.O_RDONLY|vt.O_NOFOLLOW|vt.O_NONBLOCK,l=await C.open(r,c);try{let u=await l.stat();await t.hooks?.afterOpen?.();let[d,f]=await Promise.all([C.lstat(r),C.realpath(r)]);if(await M(i,t.label),await M(n,t.label),!u.isFile()||!d.isFile()||d.isSymbolicLink()||f!==s||!Le(o,u)||!Le(o,d))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let h=await zN(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[v,p,m]=await Promise.all([l.stat(),C.lstat(r),C.realpath(r)]);if(await M(i,t.label),await M(n,t.label),!p.isFile()||p.isSymbolicLink()||m!==s||!Le(o,v)||!Le(o,p))throw new Error(`${t.label} changed while reading`);return{bytes:h,hash:Jf("sha256").update(h).digest("hex"),size:h.length}}finally{await l.close()}}async function Pa(t){let e=T.resolve(t.file),r=await pr(t.root,T.dirname(e),t.label),i=await Promise.all((t.forbiddenRoots??[]).map(l=>gt(T.resolve(l),t.label)));await t.hooks?.afterParentChainCaptured?.(),await M(r,t.label);let n=await C.lstat(e);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);let a=xc(n),o=await C.realpath(e);if(!he(r[0].realPath,o))throw new Error(`${t.label} resolves outside its managed root`);if(i.some(l=>he(l.realPath,o)))throw new Error(`${t.label} resolves inside an excluded root`);let s=process.platform==="win32"?vt.O_RDONLY:vt.O_RDONLY|vt.O_NOFOLLOW|vt.O_NONBLOCK,c=await C.open(e,s);try{let l=await c.stat();await t.hooks?.afterOpen?.();let[u,d]=await Promise.all([C.lstat(e),C.realpath(e)]);if(await M(r,t.label),await M(i,t.label),!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!Le(a,l)||!Le(a,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let f=Jf("sha256"),h=0,v=Buffer.allocUnsafe(64*1024);for(;;){let{bytesRead:y}=await c.read(v,0,v.length,null);if(y===0)break;h+=y,f.update(v.subarray(0,y))}await t.hooks?.beforeFinalCheck?.();let[p,m,g]=await Promise.all([c.stat(),C.lstat(e),C.realpath(e)]);if(await M(r,t.label),await M(i,t.label),!m.isFile()||m.isSymbolicLink()||g!==o||!Le(a,p)||!Le(a,m))throw new Error(`${t.label} changed while reading`);return{hash:f.digest("hex"),size:h}}finally{await c.close()}}async function Tt(t){let e=await pr(t.root,t.directory,t.label),r;if(t.maxEntries===void 0)r=await C.readdir(t.directory,{withFileTypes:!0});else{let i=Uf(t.maxEntries);r=[];let n=await C.opendir(t.directory);try{for await(let a of n)if(r.push(a),r.length>i)throw new Error(`${t.label} exceeds ${i} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await M(e,t.label),{entries:r,verify:()=>M(e,t.label)}}async function GN(t){let e=T.resolve(t.directory),r=T.resolve(t.quarantine);if(T.dirname(r)!==T.dirname(e)||!he(T.resolve(t.root),r)||r===e)throw new Error(`${t.label} quarantine must be a distinct sibling inside its root`);let i=await pr(t.root,T.dirname(e),t.label),n=await gt(e,t.label);if(!he(i[0].realPath,n.realPath))throw new Error(`${t.label} resolves outside its managed root`);await t.beforeQuarantine?.(),await M(i,t.label);let a=await C.lstat(e);if(!a.isDirectory()||a.isSymbolicLink()||!Ca(n,a)||await C.realpath(e)!==n.realPath)throw new Error(`${t.label} changed before quarantine`);try{throw await C.lstat(r),new Error(`${t.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await C.rename(e,r),await M(i,t.label);let o=await C.lstat(r);if(!o.isDirectory()||o.isSymbolicLink()||!Ca(n,o))throw new Error(`${t.label} changed while quarantining`);await t.afterQuarantine?.(r);try{throw await C.lstat(e),new Error(`${t.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:r,parentChain:i,identity:n}}async function Kf(t){await GN(t)}async function Cc(t){let e=T.resolve(t.file),r=await pr(t.root,T.dirname(e),t.label),i=await C.lstat(e);if(!i.isFile()||i.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);let n=xc(i),a=await C.realpath(e);if(!he(r[0].realPath,a))throw new Error(`${t.label} resolves outside its managed root`);let o=await pe({root:t.root,file:e,maxBytes:t.maxBytes,label:t.label});if(o.hash!==t.expectedHash||o.size!==t.expectedSize)throw new Error(`${t.label} changed before removal`);let[s,c]=await Promise.all([C.lstat(e),C.realpath(e)]);if(!s.isFile()||s.isSymbolicLink()||!Le(n,s)||c!==a)throw new Error(`${t.label} changed while verifying removal`);await t.beforeRemove?.(),await M(r,t.label);let[l,u]=await Promise.all([C.lstat(e),C.realpath(e)]);if(!l.isFile()||l.isSymbolicLink()||!Le(n,l)||u!==a)throw new Error(`${t.label} changed before removal`);await C.rm(e),await M(r,t.label)}async function Pc(t){let e=T.resolve(t.directory),r=await pr(t.root,T.dirname(e),t.label),i=await gt(e,t.label);if(!he(r[0].realPath,i.realPath))throw new Error(`${t.label} resolves outside its managed root`);await t.beforeRemove?.(),await M(r,t.label);let n=await C.lstat(e);if(!n.isDirectory()||n.isSymbolicLink()||!Ca(i,n)||await C.realpath(e)!==i.realPath)throw new Error(`${t.label} changed before removal`);await C.rmdir(e),await M(r,t.label)}async function Si(t){let e=T.resolve(t.root),r=T.resolve(t.directory);if(!he(e,r))throw new Error(`${t.label} is outside its managed root`);let i=[await gt(e,t.label)],n=e;for(let a of T.relative(e,r).split(T.sep).filter(Boolean)){await M(i,t.label),n=T.join(n,a);try{await C.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await gt(n,t.label);if(!he(i[0].realPath,o.realPath))throw new Error(`${t.label} resolves outside its managed root: ${n}`);i.push(o)}await M(i,t.label)}async function Ei(t){let e=await pe({root:t.sourceRoot,file:t.source,maxBytes:t.maxBytes,label:t.label,hooks:t.hooks,forbiddenRoots:t.forbiddenRoots});if(t.expectedHash!==void 0&&e.hash!==t.expectedHash)throw new Error(`${t.label} content changed before copy`);await Ef(t.target,e.bytes,{containedRoot:t.targetRoot,exclusive:t.exclusive,beforeCommit:async()=>{if(await t.hooks?.beforeTargetCommit?.(),t.expectedTargetHash===void 0)return;if(t.expectedTargetHash===null){try{await C.lstat(t.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${t.label} target changed before commit`)}if((await pe({root:t.targetRoot,file:t.target,maxBytes:t.maxBytes,label:`${t.label} existing target`})).hash!==t.expectedTargetHash)throw new Error(`${t.label} target changed before commit`)}});let r=await pe({root:t.targetRoot,file:t.target,maxBytes:t.maxBytes,label:`${t.label} target`});if(r.hash!==e.hash||r.size!==e.size)throw new Error(`${t.label} target could not be verified`);return r}var Se=k(()=>{"use strict";L();je()});import{promises as _a}from"fs";import Ue from"path";import{TextDecoder as JN}from"util";function xi(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Ci(t,e,r){let i=Object.keys(t).filter(n=>!e.has(n));if(i.length>0)throw new Error(`${r} has unknown field(s): ${i.join(", ")}`)}function mr(t){if(typeof t!="string")return!1;let e=new Date(t);return!Number.isNaN(e.valueOf())&&e.toISOString()===t}function Rc(t,e){if(typeof t!="string"||t.length===0||Ue.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native root`)}function Ra(t,e){if(typeof t!="string"||!/^[a-f0-9]{64}$/u.test(t))throw new Error(`${e} must be a SHA-256 hash`)}function Yf(t,e){if(Rc(t,e),t.includes("\\")||t!==Ue.posix.normalize(t)||t.split("/").includes(".")||t.endsWith("/")||Buffer.byteLength(t,"utf8")>1024)throw new Error(`${e} must be a normalized Native-relative ref`)}function ZN(t,e){let r=xi(t,`transaction operations[${e}]`);if(Ci(r,KN,`transaction operations[${e}]`),typeof r.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.id))throw new Error(`transaction operations[${e}].id is invalid`);if(r.type!=="write"&&r.type!=="remove"&&r.type!=="move")throw new Error(`transaction operation ${r.id} has an invalid type`);Rc(r.target,`transaction operation ${r.id} target`);for(let i of["source","staged","backup"])r[i]!==void 0&&Rc(r[i],`transaction operation ${r.id} ${i}`);if(r.type==="write"){if(r.staged===void 0||r.source!==void 0)throw new Error(`write operation ${r.id} requires staged and forbids source`)}else if(r.type==="remove"){if(r.source!==void 0||r.staged!==void 0)throw new Error(`remove operation ${r.id} forbids source and staged`)}else if(r.source===void 0||r.staged!==void 0||r.backup!==void 0)throw new Error(`move operation ${r.id} requires source and forbids staged and backup`);return r}function tp(t){let e=xi(t,"Native Archive transaction journal");if(Ci(e,YN,"Native Archive transaction journal"),e.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native Archive transaction id is invalid");if(e.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof e.status!="string"||!Qf.has(e.status))throw new Error("Native Archive transaction status is invalid");if(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change))throw new Error("Native Archive transaction change name is invalid");if(!mr(e.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Ra(e.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(e.operations)||e.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let r=e.operations.map((s,c)=>{let l=xi(s,`Archive transaction operations[${c}]`);if(Ci(l,XN,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);Yf(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&Yf(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Ra(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Ra(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Ra(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),i=r.map(s=>s.id);if(new Set(i).size!==i.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${e.id}`,a=r.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${e.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${e.change}$`,"u").test(a[0].target)||r.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of r.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:e.id,kind:"archive",status:e.status,change:e.change,createdAt:e.createdAt,preflightHash:e.preflightHash,operations:r}}function _c(t){let e=xi(t,"Native transaction journal");if(e.schema==="comet.native.transaction.v2")return tp(e);if(Ci(e,UN,"Native transaction journal"),e.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native transaction id is invalid");if(e.kind!=="archive"&&e.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof e.status!="string"||!Qf.has(e.status))throw new Error("Native transaction status is invalid");if(typeof e.projectRoot!="string"||!Ue.isAbsolute(e.projectRoot)||typeof e.nativeRoot!="string"||!Ue.isAbsolute(e.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(e.change!==void 0&&(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change)))throw new Error("Native transaction change name is invalid");if(!mr(e.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(e.operations))throw new Error("Native transaction operations must be an array");let r=e.operations.map(ZN),i=r.map(n=>n.id);if(new Set(i).size!==i.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:e.id,kind:e.kind,status:e.status,projectRoot:e.projectRoot,nativeRoot:e.nativeRoot,...typeof e.change=="string"?{change:e.change}:{},createdAt:e.createdAt,operations:r}}function rp(t,e){let r=xi(t,`Native transaction event at line ${e}`);if(Ci(r,QN,`Native transaction event at line ${e}`),r.sequence!==e)throw new Error(`Native transaction event sequence at line ${e} must be ${e}`);if(!mr(r.timestamp))throw new Error(`Native transaction event timestamp at line ${e} is invalid`);if(typeof r.type!="string"||!Zf.has(r.type))throw new Error(`Native transaction event type at line ${e} is invalid`);let i=r.type==="operation-started"||r.type==="operation-completed";if(i&&(typeof r.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(r.operationId)||Buffer.byteLength(r.operationId,"utf8")>256)||!i&&r.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${e} is invalid`);return{sequence:r.sequence,timestamp:r.timestamp,type:r.type,...typeof r.operationId=="string"?{operationId:r.operationId}:{}}}function eb(t){if(t.length>24)return!1;let e="0000-00-00T00:00:00.000Z";for(let i=0;i<t.length;i+=1){let n=e[i],a=t[i];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let r=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[i,n,a,o]of r){if(t.length<=i)continue;let s=t.slice(i,Math.min(i+n,t.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return t.length>=10&&!mr(`${t.slice(0,10)}T00:00:00.000Z`)?!1:t.length<24||mr(t)}function hr(t,e){return t.length<e.length&&e.startsWith(t)}function tb(t){let e='","operationId":"';if(hr(t,e))return!0;if(!t.startsWith(e))return!1;let r=t.slice(e.length),i=r.indexOf('"');if(i===-1)return r.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(r);let n=r.slice(0,i);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?hr(r.slice(i),'"}'):!1}function rb(t,e){if(t.length===0)return!1;let r=`{"sequence":${e},"timestamp":"`;if(hr(t,r))return!0;if(!t.startsWith(r))return!1;let i=t.slice(r.length),n=i.slice(0,Math.min(24,i.length));if(!eb(n))return!1;if(i.length<24)return!0;if(!mr(n))return!1;let a='","type":"',o=i.slice(24);if(hr(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of Zf){if(hr(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(tb(l))return!0}else if(hr(l,'"}'))return!0}return!1}function ib(t,e){if(t.length===0)throw new Error("Blank transaction event line");return rp(JSON.parse(t),e)}function nb(t){let e=t.split(`
189
+ `),r=e.at(-1)==="";if(r&&e.pop(),e.length>Aa)throw new Error(`Native transaction event log exceeds ${Aa} events`);let i=[];for(let n=0;n<e.length;n+=1){let a=n+1,o=e[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!r&&n===e.length-1;try{i.push(ib(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&rb(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return i}function ip(t){return t.length===0?"":`${t.map(e=>JSON.stringify(e)).join(`
177
190
  `)}
178
- `}function Iy(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return Le.join(e.transactionsDir,t)}function Xn(e,t){let r=Iy(e,t);return{directory:r,journal:Le.join(r,"transaction.json"),events:Le.join(r,"events.jsonl"),staged:Le.join(r,"staged"),backups:Le.join(r,"backups")}}async function kt(e,t){let r=Xn(e,t);return await Promise.all(Object.values(r).map(i=>D(e.runtimeDir,i))),r}async function nf(e,t,r={}){let i=await kt(e,t);try{await Kn.lstat(i.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await ce({root:e.runtimeDir,file:i.events,maxBytes:null,label:`Native transaction event log ${t}`,hooks:r.hooks}),a;try{a=Zd.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=Ay(a),s=rf(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:n}):n}}async function Yd(e,t,r){let i=await nf(e,t);if(i.exists!==r.exists||i.hash!==r.hash||i.size!==r.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function Bs(e,t,r,i){let n=await kt(e,t),a=await nf(e,t),o=a.events.find(c=>c.type===r&&c.operationId===i);if(o)return a.needsRepair&&await te(n.events,a.canonicalSource,{containedRoot:e.runtimeDir,beforeCommit:()=>Yd(e,t,a)}),o;if(a.events.length>=Yn)throw new Error(`Native transaction event log ${t} exceeds ${Yn} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:r,...i?{operationId:i}:{}};return tf(s,s.sequence),await Kn.mkdir(n.directory,{recursive:!0}),await te(n.events,rf([...a.events,s]),{containedRoot:e.runtimeDir,beforeCommit:()=>Yd(e,t,a)}),s}async function af(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=Fs(t);let r=await kt(e,t.id);await Kn.mkdir(r.staged,{recursive:!0}),await Kn.mkdir(r.backups,{recursive:!0}),await K(r.journal,t,{containedRoot:e.runtimeDir}),await Bs(e,t.id,"prepared")}async function ai(e,t,r={}){let i=await kt(e,t),n=await ce({root:e.runtimeDir,file:i.journal,maxBytes:null,label:`Native transaction journal ${t}`,hooks:r.hooks}),a=JSON.parse(Zd.decode(n.bytes)),o=Fs(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function Ty(e,t,r){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let i=Fs({...t,status:r});return await K((await kt(e,t.id)).journal,i,{containedRoot:e.runtimeDir}),i}async function Vs(e,t,r){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await Bs(e,t.id,r),r==="commit"?Ty(e,t,"committed"):t}var Ny,by,ky,Sy,Ey,Xd,Qd,Yn,Zd,oi=k(()=>{"use strict";H();j();ge();Ny=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),by=new Set(["id","type","source","target","staged","backup"]),ky=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),Sy=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),Ey=new Set(["sequence","timestamp","type","operationId"]),Xd=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),Qd=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Yn=1024,Zd=new yy("utf-8",{fatal:!0})});function Dy(e){return e.toLowerCase().startsWith(".env")}function si(e){let r=e.replaceAll("\\","/").split("/").filter(Boolean).map(i=>i.toLowerCase());return r.some(i=>Dy(i))?"environment-file":r.some(i=>Hy.has(i))?"credential-config":r.includes(".git")?"git-metadata":r.some(i=>Oy.has(i))?"dependency-or-cache":r.join("/")===".comet/config.yaml"?"comet-config":r.join("/")===".comet/current-change.json"?"comet-selection":null}var Oy,Hy,ci=k(()=>{"use strict";Oy=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),Hy=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"])});import{createHash as Ly}from"node:crypto";import{promises as ye}from"node:fs";import ue from"node:path";import{TextDecoder as My}from"node:util";function zs(e,t){let r=ue.relative(e,t);return r===""||!ue.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${ue.sep}`)}function Fy(e){let t=ue.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||ue.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let r=e.toLowerCase(),i=si(e);if(i||r==="runtime"||r.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${i??"native-runtime"}): ${e}`);return e}function By(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function Vy(e,t){return $({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Zn(e,t){let r={...e,birthtime:e.birthtimeMs},i={...t,birthtime:t.birthtimeMs};return xe(r,i)?$(r,i):$(r,i)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function sf(e){let t=await ye.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await ye.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function qy(e,t){let r=ue.resolve(e),i=ue.resolve(t);if(!zs(r,i))throw new Error("Native artifact path is outside its root");let n=[await sf(r)],a=r;for(let o of ue.relative(r,i).split(ue.sep).filter(Boolean)){a=ue.join(a,o);let s=await sf(a);if(!zs(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function cf(e){for(let t of e){let r=await ye.lstat(t.path);if(!r.isDirectory()||r.isSymbolicLink()||!Vy(t,r)||await ye.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function Ne(e){let t=Fy(e.ref),r=e.maxBytes===null?null:By(e.maxBytes??lf),i=ue.resolve(e.root,...t.split("/")),n=await qy(e.root,ue.dirname(i));await e.hooks?.afterParentChainCaptured?.();let a=await ye.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(r!==null&&a.size>r)throw new Error(`Native artifact exceeds ${r} bytes: ${t}`);let o=await ye.realpath(i);if(!zs(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await ye.open(i,"r");try{let[c,l,u]=await Promise.all([s.stat(),ye.lstat(i),ye.realpath(i)]);if(await cf(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Zn(a,c)||!Zn(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let d=[],f=0,h=Buffer.allocUnsafe(r===null?64*1024:Math.min(64*1024,r+1));for(;;){let b=r===null?h.length:r+1-f,S=await s.read(h,0,Math.min(h.length,b),null);if(S.bytesRead===0)break;if(f+=S.bytesRead,r!==null&&f>r)throw new Error(`Native artifact exceeds ${r} bytes: ${t}`);d.push(Buffer.from(h.subarray(0,S.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[v,p,m]=await Promise.all([s.stat(),ye.lstat(i),ye.realpath(i)]);if(await cf(n),!p.isFile()||p.isSymbolicLink()||m!==o||!Zn(c,v)||!Zn(c,p))throw new Error(`Native artifact changed while reading: ${t}`);let w=Buffer.concat(d,f),y;try{y=new My("utf-8",{fatal:!0}).decode(w)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:b})}return{ref:t,size:f,hash:e.includeHash===!1?null:Ly("sha256").update(w).digest("hex"),text:y}}finally{await s.close()}}var lf,be=k(()=>{"use strict";ci();Ce();lf=1024*1024});var uf,Js=k(()=>{"use strict";uf=Ve($e(),1)});var li=k(()=>{"use strict"});var pf,nC,Jy,aC,ea=k(()=>{"use strict";li();pf=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],nC=new Set(pf),Jy=new Set([...pf,"minimum_runtime_version","revision"]),aC=new Set([...Jy,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"])});function Yy(e,t){return Gs[e][t]}function ta(e){return["outcome","scope","nonGoals","acceptanceExamples","constraints","decisions","openQuestions","verificationExpectations"].map(r=>`# ${Yy(e,r)}
179
- `).join(`
180
- `)}var Gs,Gy,Uy,Ky,hf,Et=k(()=>{"use strict";Gs={en:{outcome:"Outcome",scope:"Scope",nonGoals:"Non-goals",acceptanceExamples:"Acceptance examples",constraints:"Constraints and invariants",decisions:"Decisions",openQuestions:"Open questions",verificationExpectations:"Verification expectations"},"zh-CN":{outcome:"目标",scope:"范围",nonGoals:"非目标",acceptanceExamples:"验收示例",constraints:"约束与不变量",decisions:"决策",openQuestions:"待解决问题",verificationExpectations:"验证预期"}},Gy={en:{verification:"Verification",currentResult:"Current result",acceptance:"Acceptance",checks:"Checks",blockers:"Blockers",risks:"Risks and skipped work",previousIterations:"Previous iterations",conclusion:"Conclusion"},"zh-CN":{verification:"验证",currentResult:"当前结果",acceptance:"验收",checks:"检查",blockers:"阻塞项",risks:"风险与跳过的工作",previousIterations:"之前的迭代",conclusion:"结论"}},Uy={en:{acceptanceEvidence:"Acceptance evidence",commandsAndResults:"Commands and results",skippedChecks:"Skipped checks",specConsistency:"Spec consistency",knownLimitationsAndRisks:"Known limitations and risks",conclusion:"Conclusion"},"zh-CN":{acceptanceEvidence:"验收证据",commandsAndResults:"命令与结果",skippedChecks:"跳过的检查",specConsistency:"规格一致性",knownLimitationsAndRisks:"已知限制与风险",conclusion:"结论"}},Ky=new Map,hf=new Map;for(let e of Object.keys(Gs)){for(let[t,r]of Object.entries(Gs[e]))Ky.set(r.toLocaleLowerCase("en-US"),t);for(let[t,r]of Object.entries(Gy[e]))hf.set(r.toLocaleLowerCase("en-US"),t);for(let[t,r]of Object.entries(Uy[e]))hf.set(r.toLocaleLowerCase("en-US"),t)}});import{createHash as Xy}from"crypto";function ke(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function Qy(e,t){t.has(e)&&ke("cyclic structures are not supported"),t.add(e);try{let r=Object.keys(e);for(let i=0;i<e.length;i+=1)Object.prototype.hasOwnProperty.call(e,i)||ke("sparse arrays are not supported");return(r.length!==e.length||r.some((i,n)=>i!==String(n)))&&ke("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&ke("symbol properties are not supported"),`[${e.map(i=>Us(i,t)).join(",")}]`}finally{t.delete(e)}}function Zy(e,t){let r=Object.getPrototypeOf(e);r!==Object.prototype&&r!==null&&ke("only plain objects are supported"),t.has(e)&&ke("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&ke("symbol properties are not supported"),t.add(e);try{let i=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=i[o];return(!s||!("value"in s))&&ke("accessor properties are not supported"),`${JSON.stringify(o)}:${Us(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function Us(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||ke("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?Qy(e,t):Zy(e,t);case"bigint":case"function":case"symbol":case"undefined":return ke(`${typeof e} values are not supported`)}return ke("unsupported value type")}function Ks(e){return Us(e,new Set)}function q(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return Xy("sha256").update(`${e}
181
- ${Ks(t)}`).digest("hex")}var W=k(()=>{"use strict"});var fC,mf,ra=k(()=>{"use strict";Et();W();fC=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),mf=Object.freeze({maxCriteria:1024})});var Ys=k(()=>{"use strict";ra()});var ia=k(()=>{"use strict"});var vf,ct=k(()=>{"use strict";vf=Ve($e(),1);H();ia()});var xt=k(()=>{"use strict"});var Nf=k(()=>{"use strict";ea();Ys();ct();xt();ia();li()});var bf,OC,HC,Xs=k(()=>{"use strict";be();Js();Nf();bf="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",OC=new RegExp(`^portable-archive-(${bf})\\.json$`,"u"),HC=new RegExp(`^portable-migration-(${bf})\\.json$`,"u")});var G=k(()=>{"use strict";re();Kt();Xs();oi()});import{createHash as jN}from"crypto";function de(e){return jN("sha256").update(e).digest("hex")}var Ae=k(()=>{"use strict"});var DP,LP,MP,FP,BP,VP,hi=k(()=>{"use strict";H();re();Ae();Ce();j();ge();ci();DP={maxFiles:1e4,maxFileBytes:1024*1024*1024,maxTotalBytes:1024*1024*1024,maxManifestBytes:1024*1024*1024},LP=64*1024,MP=64*1024,FP={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},BP={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024},VP=(1n<<256n)-1n});var Gf,er=k(()=>{"use strict";W();hi();Gf=1024*1024});var Ct=k(()=>{"use strict"});var pa=k(()=>{"use strict";W();Ct();ci();er()});var Kf,nb,ab,ob,CA,sb,PA,nc=k(()=>{"use strict";W();Kf="scoped-text-safety",nb=1,ab=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128}),ob="comet.native.checker-policy.v1",CA=q(ob,{policy:Kf,version:nb,limits:ab,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"}),sb=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],PA=new Set(sb)});var ha=k(()=>{"use strict";W();nc();Ct()});var ub,WA,tr=k(()=>{"use strict";H();j();Ce();er();pa();ha();ub=Gf,WA=3*ub});var ac=k(()=>{"use strict"});var tp=k(()=>{"use strict"});var d$,Fe=k(()=>{"use strict";tp();d$=8*1024*1024});var qb,va=k(()=>{"use strict";qb=Ve($e(),1);be()});var ga,oc=k(()=>{"use strict";ga=class extends Error{issues;constructor(t){let r=[t.missingFields.length?`missing: ${t.missingFields.join(", ")}`:"",t.unknownFields.length?`unknown: ${t.unknownFields.join(", ")}`:""].filter(Boolean).join("; ");super(`${t.context} fields are invalid at ${t.path||"/"} (${r})`),this.name="NativeInputValidationError",this.issues=[t]}}});var yi=k(()=>{"use strict"});var wa=k(()=>{"use strict";oc();yi()});var ir=k(()=>{"use strict";W();wa()});var dt=k(()=>{"use strict";H();W();va();j();ir()});var ya=k(()=>{"use strict";Fn();ac();Ct()});var ip=k(()=>{"use strict";Fe();ya();W()});var sc=k(()=>{"use strict";Fe();H()});re();j();H();re();Kt();j();ge();oi();import{createHash as hN,randomUUID as mN}from"crypto";import{promises as ut}from"fs";import O from"path";import{createHash as sN}from"node:crypto";import{promises as aa}from"node:fs";import lt from"node:path";import{execFileSync as jy}from"child_process";import $y from"fs";import qs from"path";function Qn(e,t){return jy("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Ws(e,t){return of(e)===of(t)}function of(e){let t=qs.resolve(e);try{let r=$y.realpathSync.native(t);return process.platform==="win32"?r.toLowerCase():r}catch{return process.platform==="win32"?t.toLowerCase():t}}function we(e){try{let t=qs.resolve(Qn(e,["rev-parse","--show-toplevel"])),i=Qn(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=i?qs.resolve(i.slice(9)):t,a=null;try{a=Qn(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Ws(t,n),currentWorktreeRoot:t,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function St(e,t){try{let r=Qn(e,["rev-parse","--verify",`${t}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(r)?r:null}catch{return null}}H();be();G();j();var di=/^[a-f0-9]{64}$/u,Sf=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,cN=16*1024,Zs=process.platform;function Pf(e,t){let r=lt.relative(e,t);return lt.isAbsolute(r)||r===".."||r.startsWith(`..${lt.sep}`)?null:r.replaceAll("\\","/")||"."}function Rf(e){return Array.from(e).some(t=>{let r=t.codePointAt(0)??0;return r<=31||r===127})}function _f(e,t){if(e.length===0||Rf(e)||e.includes("\\")||lt.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let r=lt.posix.normalize(e);if(r!==e||r===".."||r.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return r}function ec(e,t){return sN("sha256").update(`${e}
182
- ${t}`).digest("hex")}async function Ef(e,t){let r=await aa.realpath(t),i=await aa.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Zs==="win32"?lt.normalize(r).toLowerCase():r;return ec(e,`${n}
191
+ `}function ab(t,e){if(!/^[a-f0-9-]{8,}$/u.test(e))throw new Error(`Invalid Native transaction id: ${e}`);return Ue.join(t.transactionsDir,e)}function Ia(t,e){let r=ab(t,e);return{directory:r,journal:Ue.join(r,"transaction.json"),events:Ue.join(r,"events.jsonl"),staged:Ue.join(r,"staged"),backups:Ue.join(r,"backups")}}async function $t(t,e){let r=Ia(t,e);return await Promise.all(Object.values(r).map(i=>B(t.runtimeDir,i))),r}async function np(t,e,r={}){let i=await $t(t,e);try{await _a.lstat(i.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await pe({root:t.runtimeDir,file:i.events,maxBytes:null,label:`Native transaction event log ${e}`,hooks:r.hooks}),a;try{a=ep.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${e} is not valid UTF-8`,{cause:c})}let o=nb(a),s=ip(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${e} changed while reading`,{cause:n}):n}}async function Xf(t,e,r){let i=await np(t,e);if(i.exists!==r.exists||i.hash!==r.hash||i.size!==r.size)throw new Error(`Native transaction event log ${e} changed before append`)}async function Ac(t,e,r,i){let n=await $t(t,e),a=await np(t,e),o=a.events.find(c=>c.type===r&&c.operationId===i);if(o)return a.needsRepair&&await ne(n.events,a.canonicalSource,{containedRoot:t.runtimeDir,beforeCommit:()=>Xf(t,e,a)}),o;if(a.events.length>=Aa)throw new Error(`Native transaction event log ${e} exceeds ${Aa} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:r,...i?{operationId:i}:{}};return rp(s,s.sequence),await _a.mkdir(n.directory,{recursive:!0}),await ne(n.events,ip([...a.events,s]),{containedRoot:t.runtimeDir,beforeCommit:()=>Xf(t,e,a)}),s}async function ap(t,e){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");e=_c(e);let r=await $t(t,e.id);await _a.mkdir(r.staged,{recursive:!0}),await _a.mkdir(r.backups,{recursive:!0}),await Y(r.journal,e,{containedRoot:t.runtimeDir}),await Ac(t,e.id,"prepared")}async function Pi(t,e,r={}){let i=await $t(t,e),n=await pe({root:t.runtimeDir,file:i.journal,maxBytes:null,label:`Native transaction journal ${e}`,hooks:r.hooks}),a=JSON.parse(ep.decode(n.bytes)),o=_c(a);if(o.id!==e)throw new Error(`Invalid Native transaction journal: ${e}`);return o}async function ob(t,e,r){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let i=_c({...e,status:r});return await Y((await $t(t,e.id)).journal,i,{containedRoot:t.runtimeDir}),i}async function Ic(t,e,r){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await Ac(t,e.id,r),r==="commit"?ob(t,e,"committed"):e}var UN,KN,YN,XN,QN,Qf,Zf,Aa,ep,Ri=k(()=>{"use strict";L();O();Se();UN=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),KN=new Set(["id","type","source","target","staged","backup"]),YN=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),XN=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),QN=new Set(["sequence","timestamp","type","operationId"]),Qf=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),Zf=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Aa=1024,ep=new JN("utf-8",{fatal:!0})});function mb(t){return t.toLowerCase().startsWith(".env")}function Ai(t){let r=t.replaceAll("\\","/").split("/").filter(Boolean).map(i=>i.toLowerCase());return r.some(i=>mb(i))?"environment-file":r.some(i=>hb.has(i))?"credential-config":r.includes(".git")?"git-metadata":r.some(i=>pb.has(i))?"dependency-or-cache":r.join("/")===".comet/config.yaml"?"comet-config":r.join("/")===".comet/current-change.json"?"comet-selection":null}var pb,hb,Ii=k(()=>{"use strict";pb=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),hb=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"])});import{createHash as vb}from"node:crypto";import{promises as xe}from"node:fs";import me from"node:path";import{TextDecoder as gb}from"node:util";function Tc(t,e){let r=me.relative(t,e);return r===""||!me.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${me.sep}`)}function wb(t){let e=me.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||me.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let r=t.toLowerCase(),i=Ai(t);if(i||r==="runtime"||r.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${i??"native-runtime"}): ${t}`);return t}function yb(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function Nb(t,e){return H({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function $a(t,e){let r={...t,birthtime:t.birthtimeMs},i={...e,birthtime:e.birthtimeMs};return Te(r,i)?H(r,i):H(r,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function lp(t){let e=await xe.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await xe.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function bb(t,e){let r=me.resolve(t),i=me.resolve(e);if(!Tc(r,i))throw new Error("Native artifact path is outside its root");let n=[await lp(r)],a=r;for(let o of me.relative(r,i).split(me.sep).filter(Boolean)){a=me.join(a,o);let s=await lp(a);if(!Tc(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function up(t){for(let e of t){let r=await xe.lstat(e.path);if(!r.isDirectory()||r.isSymbolicLink()||!Nb(e,r)||await xe.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function Ce(t){let e=wb(t.ref),r=t.maxBytes===null?null:yb(t.maxBytes??dp),i=me.resolve(t.root,...e.split("/")),n=await bb(t.root,me.dirname(i));await t.hooks?.afterParentChainCaptured?.();let a=await xe.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(r!==null&&a.size>r)throw new Error(`Native artifact exceeds ${r} bytes: ${e}`);let o=await xe.realpath(i);if(!Tc(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await xe.open(i,"r");try{let[c,l,u]=await Promise.all([s.stat(),xe.lstat(i),xe.realpath(i)]);if(await up(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!$a(a,c)||!$a(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let d=[],f=0,h=Buffer.allocUnsafe(r===null?64*1024:Math.min(64*1024,r+1));for(;;){let N=r===null?h.length:r+1-f,S=await s.read(h,0,Math.min(h.length,N),null);if(S.bytesRead===0)break;if(f+=S.bytesRead,r!==null&&f>r)throw new Error(`Native artifact exceeds ${r} bytes: ${e}`);d.push(Buffer.from(h.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[v,p,m]=await Promise.all([s.stat(),xe.lstat(i),xe.realpath(i)]);if(await up(n),!p.isFile()||p.isSymbolicLink()||m!==o||!$a(c,v)||!$a(c,p))throw new Error(`Native artifact changed while reading: ${e}`);let g=Buffer.concat(d,f),y;try{y=new gb("utf-8",{fatal:!0}).decode(g)}catch(N){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:N})}return{ref:e,size:f,hash:t.includeHash===!1?null:vb("sha256").update(g).digest("hex"),text:y}}finally{await s.close()}}var dp,Pe=k(()=>{"use strict";Ii();je();dp=1024*1024});var fp,$c=k(()=>{"use strict";fp=Qe(ze(),1)});var Ti=k(()=>{"use strict"});var mp,a_,Eb,o_,ja=k(()=>{"use strict";Ti();mp=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],a_=new Set(mp),Eb=new Set([...mp,"minimum_runtime_version","revision"]),o_=new Set([...Eb,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"])});function gp(t,e){return jc[t][e]}function Ab(t){return $i[t].section}function Ib(t,e){return $i[t].subsections[e]}function Oa(t,e={}){let r=["outcome","scope","nonGoals","acceptanceExamples"];return e.compact||r.push("constraints","decisions","openQuestions","verificationExpectations"),r.map(i=>{if(i!=="scope")return`# ${gp(t,i)}
192
+ `;let n=[`# ${gp(t,i)}
193
+ `];n.push(`## ${Ab(t)}
194
+ `);for(let a of wp)n.push(`### ${Ib(t,a)}
195
+ `);return n.join(`
196
+ `)}).join(`
197
+ `)}var wp,jc,xb,Cb,Pb,vp,Rb,_b,$i,Ht=k(()=>{"use strict";wp=["created","modified","deleted","notCreated"],jc={en:{outcome:"Outcome",scope:"Scope",nonGoals:"Non-goals",acceptanceExamples:"Acceptance examples",constraints:"Constraints and invariants",decisions:"Decisions",openQuestions:"Open questions",verificationExpectations:"Verification expectations"},"zh-CN":{outcome:"目标",scope:"范围",nonGoals:"非目标",acceptanceExamples:"验收示例",constraints:"约束与不变量",decisions:"决策",openQuestions:"待解决问题",verificationExpectations:"验证预期"}},xb={en:{verification:"Verification",currentResult:"Current result",acceptance:"Acceptance",checks:"Checks",blockers:"Blockers",risks:"Risks and skipped work",previousIterations:"Previous iterations",conclusion:"Conclusion"},"zh-CN":{verification:"验证",currentResult:"当前结果",acceptance:"验收",checks:"检查",blockers:"阻塞项",risks:"风险与跳过的工作",previousIterations:"之前的迭代",conclusion:"结论"}},Cb={en:{acceptanceEvidence:"Acceptance evidence",commandsAndResults:"Commands and results",skippedChecks:"Skipped checks",specConsistency:"Spec consistency",knownLimitationsAndRisks:"Known limitations and risks",conclusion:"Conclusion"},"zh-CN":{acceptanceEvidence:"验收证据",commandsAndResults:"命令与结果",skippedChecks:"跳过的检查",specConsistency:"规格一致性",knownLimitationsAndRisks:"已知限制与风险",conclusion:"结论"}},Pb=new Map,vp=new Map,Rb=new Set,_b=new Map,$i={en:{section:"Directory structure",subsections:{created:"Created",modified:"Modified",deleted:"Deleted",notCreated:"Not created"}},"zh-CN":{section:"目录结构",subsections:{created:"新建",modified:"修改",deleted:"删除",notCreated:"明确不建"}}};for(let t of Object.keys(jc)){for(let[e,r]of Object.entries(jc[t]))Pb.set(r.toLocaleLowerCase("en-US"),e);for(let[e,r]of Object.entries(xb[t]))vp.set(r.toLocaleLowerCase("en-US"),e);for(let[e,r]of Object.entries(Cb[t]))vp.set(r.toLocaleLowerCase("en-US"),e)}for(let t of Object.keys($i)){Rb.add($i[t].section.toLocaleLowerCase("en-US"));for(let[e,r]of Object.entries($i[t].subsections))_b.set(r.toLocaleLowerCase("en-US"),e)}});import{createHash as Tb}from"crypto";function Re(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function $b(t,e){e.has(t)&&Re("cyclic structures are not supported"),e.add(t);try{let r=Object.keys(t);for(let i=0;i<t.length;i+=1)Object.prototype.hasOwnProperty.call(t,i)||Re("sparse arrays are not supported");return(r.length!==t.length||r.some((i,n)=>i!==String(n)))&&Re("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&Re("symbol properties are not supported"),`[${t.map(i=>Oc(i,e)).join(",")}]`}finally{e.delete(t)}}function jb(t,e){let r=Object.getPrototypeOf(t);r!==Object.prototype&&r!==null&&Re("only plain objects are supported"),e.has(t)&&Re("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&Re("symbol properties are not supported"),e.add(t);try{let i=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=i[o];return(!s||!("value"in s))&&Re("accessor properties are not supported"),`${JSON.stringify(o)}:${Oc(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function Oc(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||Re("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?$b(t,e):jb(t,e);case"bigint":case"function":case"symbol":case"undefined":return Re(`${typeof t} values are not supported`)}return Re("unsupported value type")}function Hc(t){return Oc(t,new Set)}function z(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return Tb("sha256").update(`${t}
198
+ ${Hc(e)}`).digest("hex")}var G=k(()=>{"use strict"});var p_,yp,Ha=k(()=>{"use strict";Ht();G();p_=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),yp=Object.freeze({maxCriteria:1024})});var Dc=k(()=>{"use strict";Ha()});var Da,La=k(()=>{"use strict";Da=class extends Error{issues;constructor(e){let r=[e.missingFields.length?`missing: ${e.missingFields.join(", ")}`:"",e.unknownFields.length?`unknown: ${e.unknownFields.join(", ")}`:""].filter(Boolean).join("; ");super(`${e.context} fields are invalid at ${e.path||"/"} (${r})`),this.name="NativeInputValidationError",this.issues=[e]}}});var Ba,Ma=k(()=>{"use strict";La();Ba=class extends Error{constructor(r,i){super(`Native Builder handoff is incomplete${r.length?`; missing: ${r.join(", ")}`:""}${i.length?`; not ready: ${i.join(", ")}`:""}. Complete acceptance_review for every requirement and its evidence before Verify`);this.missingIds=r;this.incompleteIds=i}missingIds;incompleteIds}});var Fa=k(()=>{"use strict"});var Np,wt=k(()=>{"use strict";Ma();Np=Qe(ze(),1);L();Fa()});var Dt=k(()=>{"use strict"});var Ep=k(()=>{"use strict";ja();Dc();wt();Dt();Fa();Ti()});var xp,M_,F_,Lc=k(()=>{"use strict";Pe();$c();Ep();xp="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",M_=new RegExp(`^portable-archive-(${xp})\\.json$`,"u"),F_=new RegExp(`^portable-migration-(${xp})\\.json$`,"u")});var K=k(()=>{"use strict";ae();fr();Lc();Ri()});import{createHash as gk}from"crypto";function ve(t){return gk("sha256").update(t).digest("hex")}var Be=k(()=>{"use strict"});var VA,WA,zA,GA,JA,UA,Li=k(()=>{"use strict";dr();L();ae();Be();je();O();Se();Ii();VA={maxFiles:1e4,maxFileBytes:1024*1024*1024,maxTotalBytes:1024*1024*1024,maxManifestBytes:1024*1024*1024},WA=64*1024,zA=64*1024,GA={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},JA={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024},UA=(1n<<256n)-1n});var Xp,yr=k(()=>{"use strict";G();Li();Xp=1024*1024});var Lt=k(()=>{"use strict"});var Xa=k(()=>{"use strict";G();Lt();Ii();yr()});var Zp,Wk,zk,Gk,H$,Jk,D$,zc=k(()=>{"use strict";G();Zp="scoped-text-safety",Wk=1,zk=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128}),Gk="comet.native.checker-policy.v1",H$=z(Gk,{policy:Zp,version:Wk,limits:zk,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"}),Jk=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],D$=new Set(Jk)});var Qa=k(()=>{"use strict";G();zc();Lt()});var Yk,ej,Nr=k(()=>{"use strict";L();O();je();yr();Xa();Qa();Yk=Xp,ej=3*Yk});var Gc=k(()=>{"use strict"});var NH,Me=k(()=>{"use strict";dr();NH=8*1024*1024});var CE,ao=k(()=>{"use strict";CE=Qe(ze(),1);Pe()});var Ui=k(()=>{"use strict"});var oo=k(()=>{"use strict";La();Ui()});var Er=k(()=>{"use strict";G();oo()});var kt=k(()=>{"use strict";L();G();ao();O();Er()});var so=k(()=>{"use strict";wi();Gc();Lt()});var Sh=k(()=>{"use strict";Me();so();G()});var nl=k(()=>{"use strict";Me();L()});ae();O();L();ae();fr();O();Se();Ri();import{createHash as Qb,randomUUID as Zb}from"crypto";import{promises as Nt}from"fs";import D from"path";import{createHash as zb}from"node:crypto";import{promises as Va}from"node:fs";import yt from"node:path";dr();wa();import{execFileSync as sb}from"child_process";import cb from"fs";import jt from"path";import{AsyncLocalStorage as sp}from"node:async_hooks";wi();var vr=new sp,lb=new sp;function cp(t){return vr.getStore()?t():vr.run(new Map,t)}function ub(t){let e=vr.getStore();for(let r of t)e?.set(gr(r.root),t);return t}function Ta(t,e){return va(()=>sb("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim())}function _i(t,e){return gr(t)===gr(e)}function gr(t){let e=jt.resolve(t);try{let r=cb.realpathSync.native(e);return process.platform==="win32"?r.toLowerCase():r}catch{return process.platform==="win32"?e.toLowerCase():e}}function Ee(t){try{let e=lb.getStore()?.get(gr(t)),r=vr.getStore()?.get(e??gr(t));if(r){let c=op(e??t,r);if(c)return c;if(r.length===0)return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}let i=jt.resolve(Ta(t,["rev-parse","--show-toplevel"])),n=vr.getStore()?.get(gr(i))??db(t),a=op(i,n);if(vr.getStore()&&a)return a;let o=n[0]?.root??i,s=null;try{s=Ta(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!_i(i,o),currentWorktreeRoot:i,primaryWorktreeRoot:o,currentBranch:s}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function db(t){let e=fb(Ta(t,["worktree","list","--porcelain","-z"]));return ub(e),e.map(r=>({...r}))}function fb(t){let e=t.split("\0"),r=[],i=null;for(let n of e)n.startsWith("worktree ")?(i&&r.push(i),i={root:jt.resolve(n.slice(9)),branch:null,detached:!1}):i&&n.startsWith("branch refs/heads/")?i.branch=n.slice(18):i&&n==="detached"&&(i.detached=!0);return i&&r.push(i),r}function op(t,e){let r=e.find(a=>_i(jt.resolve(a.root),jt.resolve(t)));if(!r)return null;let i=jt.resolve(e[0].root),n=jt.resolve(r.root);return{isGitWorktree:!0,isSecondaryWorktree:!_i(i,n),currentWorktreeRoot:n,primaryWorktreeRoot:i,currentBranch:r.branch}}function Ot(t,e){try{let r=Ta(t,["rev-parse","--verify",`${e}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(r)?r:null}catch{return null}}L();Pe();K();O();var Oi=/^[a-f0-9]{64}$/u,Pp=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,Gb=16*1024,Mc=process.platform;function Ip(t,e){let r=yt.relative(t,e);return yt.isAbsolute(r)||r===".."||r.startsWith(`..${yt.sep}`)?null:r.replaceAll("\\","/")||"."}function Tp(t){return Array.from(t).some(e=>{let r=e.codePointAt(0)??0;return r<=31||r===127})}function $p(t,e){if(t.length===0||Tp(t)||t.includes("\\")||yt.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes(".."))throw new Error(`${e} must be a portable project-relative path`);let r=yt.posix.normalize(t);if(r!==t||r===".."||r.startsWith("../"))throw new Error(`${e} must be a normalized project-relative path`);return r}function Fc(t,e){return zb("sha256").update(`${t}
199
+ ${e}`).digest("hex")}async function Rp(t,e){let r=await Va.realpath(e),i=await Va.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Mc==="win32"?yt.normalize(r).toLowerCase():r;return Fc(t,`${n}
183
200
  ${i.dev}
184
201
  ${i.ino}
185
- ${i.birthtimeMs}`)}async function xf(e,t){let r=await aa.realpath(t),i=await aa.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Zs==="win32"?lt.normalize(r).toLowerCase():r;return ec(e,n)}function lN(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function Qs(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||Rf(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Af(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(Qs(e.changeBranch,"Native workspace change branch"),Qs(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function uN(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace Git provenance must be an object");let t=e,r=new Set(["provider","baseCommit","targetBranch","targetCommit"]),i=Object.keys(t).filter(n=>!r.has(n));if(i.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${i.join(", ")}`);if(t.provider!=="git"||typeof t.baseCommit!="string"||!Sf.test(t.baseCommit)||typeof t.targetCommit!="string"||!Sf.test(t.targetCommit))throw new Error("Native workspace Git provenance is invalid");Qs(t.targetBranch,"Native workspace Git target branch")}function oa(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,r=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),i=Object.keys(t).filter(o=>!r.has(o));if(i.length>0)throw new Error(`Native workspace identity has unknown field(s): ${i.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!di.test(String(t.projectRootId))||!di.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");lN(t.capturedAt),_f(t.nativeRootRef,"Native workspace root ref");let n=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!di.test(String(t.projectRootPathId))||a&&!di.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!di.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.git!==void 0&&uN(t.git),t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Af(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function If(e,t){return lt.join(Re(e,t),"workspace.json")}function dN(e,t){let r=If(e,t),i=ve(e,r),n=Pf(i,r);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:i,ref:_f(n,"Native workspace file ref")}}async function fN(e,t){try{let r=dN(e,t),i=await Ne({root:r.root,ref:r.ref,maxBytes:cN});return JSON.parse(i.text)}catch(r){if(r.code==="ENOENT")return null;throw r}}async function Tf(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=Pf(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let r=we(e.paths.projectRoot),i=r.isGitWorktree?St(e.paths.projectRoot,"HEAD"):null,n=e.binding?.targetBranch??r.currentBranch,a=n==null?null:St(e.paths.projectRoot,n),o=i!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:i,targetBranch:n,targetCommit:a}:void 0,[s,c,l,u]=await Promise.all([Ef("comet.native.workspace-project-root.v2",e.paths.projectRoot),Ef("comet.native.workspace-native-root.v2",e.paths.nativeRoot),xf("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),xf("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),d=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Af(e.binding);let f={capturedAt:d,capturedRevision:e.revision,nativeRootRef:t,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:u,...o?{git:o}:{},...e.sessionId?{sessionHash:ec("comet.native.workspace-session.v2",`${s}
202
+ ${i.birthtimeMs}`)}async function _p(t,e){let r=await Va.realpath(e),i=await Va.lstat(r);if(!i.isDirectory()||i.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Mc==="win32"?yt.normalize(r).toLowerCase():r;return Fc(t,n)}function Jb(t){if(typeof t!="string")throw new Error("Native workspace capturedAt is invalid");let e=new Date(t);if(!Number.isFinite(e.getTime())||e.toISOString()!==t)throw new Error("Native workspace capturedAt is invalid");return t}function Bc(t,e){if(t===null)return null;if(typeof t!="string"||t.length===0||t.trim()!==t||Tp(t))throw new Error(`${e} must be a non-empty branch name or null`);return t}function jp(t){if(!new Set(["current","branch","worktree"]).has(t.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(Bc(t.changeBranch,"Native workspace change branch"),Bc(t.targetBranch,"Native workspace target branch"),(t.isolation==="branch"||t.isolation==="worktree")&&(t.changeBranch===null||t.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function Ub(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace Git provenance must be an object");let e=t,r=new Set(["provider","baseCommit","targetBranch","targetCommit"]),i=Object.keys(e).filter(n=>!r.has(n));if(i.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${i.join(", ")}`);if(e.provider!=="git"||typeof e.baseCommit!="string"||!Pp.test(e.baseCommit)||typeof e.targetCommit!="string"||!Pp.test(e.targetCommit))throw new Error("Native workspace Git provenance is invalid");Bc(e.targetBranch,"Native workspace Git target branch")}function Wa(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace identity must be an object");let e=t,r=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),i=Object.keys(e).filter(o=>!r.has(o));if(i.length>0)throw new Error(`Native workspace identity has unknown field(s): ${i.join(", ")}`);if(e.schema!=="comet.native.workspace.v2"&&e.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(e.capturedRevision)||e.capturedRevision<1||typeof e.nativeRootRef!="string"||!Oi.test(String(e.projectRootId))||!Oi.test(String(e.nativeRootId)))throw new Error("Native workspace identity is invalid");Jb(e.capturedAt),$p(e.nativeRootRef,"Native workspace root ref");let n=e.projectRootPathId!==void 0,a=e.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!Oi.test(String(e.projectRootPathId))||a&&!Oi.test(String(e.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(e.sessionHash!==void 0&&!Oi.test(String(e.sessionHash)))throw new Error("Native workspace session hash is invalid");if(e.git!==void 0&&Ub(e.git),e.schema==="comet.native.workspace.v2"){if(e.isolation!==void 0||e.changeBranch!==void 0||e.targetBranch!==void 0||e.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof e.isolation!="string"||e.changeBranch===void 0||e.targetBranch===void 0||e.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(jp(e),e.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(e.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function Op(t,e){return yt.join(He(t,e),"workspace.json")}function Kb(t,e){let r=Op(t,e),i=ke(t,r),n=Ip(i,r);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:i,ref:$p(n,"Native workspace file ref")}}async function Yb(t,e){try{let r=Kb(t,e),i=await Ce({root:r.root,ref:r.ref,maxBytes:Gb});return JSON.parse(i.text)}catch(r){if(r.code==="ENOENT")return null;throw r}}async function Hp(t){if(!Number.isSafeInteger(t.revision)||t.revision<1)throw new Error("Native workspace revision must be a positive integer");let e=Ip(t.paths.projectRoot,t.paths.nativeRoot);if(!e)throw new Error("Native root is outside the project root");let r=Ee(t.paths.projectRoot),i=r.isGitWorktree?Ot(t.paths.projectRoot,"HEAD"):null,n=t.binding?.targetBranch??r.currentBranch,a=n==null?null:Ot(t.paths.projectRoot,n),o=i!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:i,targetBranch:n,targetCommit:a}:void 0,[s,c,l,u]=await Promise.all([Rp("comet.native.workspace-project-root.v2",t.paths.projectRoot),Rp("comet.native.workspace-native-root.v2",t.paths.nativeRoot),_p("comet.native.workspace-project-root-path.v2",t.paths.projectRoot),_p("comet.native.workspace-native-root-path.v2",t.paths.nativeRoot)]),d=(t.now??new Date).toISOString();if(t.finish&&!t.binding)throw new Error("Native workspace finish requires a workspace binding");t.binding&&jp(t.binding);let f={capturedAt:d,capturedRevision:t.revision,nativeRootRef:e,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:u,...o?{git:o}:{},...t.sessionId?{sessionHash:Fc("comet.native.workspace-session.v2",`${s}
186
203
  ${c}
187
- ${e.sessionId}`)}:{}},h=e.binding?{schema:"comet.native.workspace.v3",...f,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...f};return oa(h),h}async function tc(e){let t=await Tf(e),r=If(e.paths,e.name),i=ve(e.paths,r);return await D(i,r),await K(r,t,{containedRoot:i}),t}async function Zt(e,t){let r=await fN(e,t);return r===null||r&&typeof r=="object"&&!Array.isArray(r)&&r.schema==="comet.native.workspace.v1"?null:(oa(r),r)}async function sa(e){oa(e.identity);let t=await Tf({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),r=[],i=[];return t.nativeRootRef!==e.identity.nativeRootRef&&r.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&r.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&r.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&r.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&r.push("native-root-legacy-identity")),Zs==="win32"&&r.length>0&&r.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?i.push("workspace-inspection-unavailable"):r.length>0&&i.push("workspace-root-changed"),{state:i.length===0?"aligned":i.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:i,driftComponents:r}}async function rc(e){if(oa(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await sa(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let r=we(e.paths.projectRoot);return e.identity.changeBranch===null?r.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:r.isGitWorktree?r.currentBranch!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${r.currentBranch??"detached HEAD"}`}:e.identity.isolation==="worktree"&&!r.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}async function ae(e){try{return await ut.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function vN(e){let t;try{t=await ut.readdir(e.transactionsDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t){if(!r.isDirectory()||r.isSymbolicLink())continue;let i;try{i=await ai(e,r.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${r.name} has no journal; run doctor before moving`,{cause:n}):n}if(i.status!=="committed"&&i.status!=="rolled-back")throw new Error(`Native transaction ${i.id} is unfinished; recover it before moving`)}}async function gN(e,t){for(let r of await ut.readdir(e.locksDir,{withFileTypes:!0})){let i=O.join(e.locksDir,r.name);if(O.resolve(i)!==O.resolve(t)&&(r.isFile()||r.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${i}`)}}async function wN(e){let t;try{t=await ut.readdir(e.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t.sort((i,n)=>i.name.localeCompare(n.name))){if(!r.isDirectory()||r.isSymbolicLink())continue;let i=await Zt(e,r.name);if(i){await tc({paths:e,name:r.name,revision:i.capturedRevision,...i.schema==="comet.native.workspace.v3"?{binding:{isolation:i.isolation,changeBranch:i.changeBranch,targetBranch:i.targetBranch},...i.finish?{finish:i.finish}:{}}:{}});continue}}}async function yN(e){let t;try{t=await ut.readdir(e.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of t.sort((i,n)=>i.name.localeCompare(n.name)))if(!(!r.isDirectory()||r.isSymbolicLink()))try{let i=await Zt(e,r.name);if(i?.schema==="comet.native.workspace.v3"){let n=await rc({paths:e,identity:i});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(i){let n=await sa({paths:e,identity:i});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(i){throw new Error(`Native workspace identity for ${r.name} must be aligned and repaired before moving the root`,{cause:i})}}async function pi(e,t){let r=[];async function i(n){let a=await bt({root:e,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=O.join(n,s.name);if(t.excludedFiles?.has(O.resolve(c))){await a.verify();continue}let l=await ut.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())r.push({ref:O.relative(e,c).split(O.sep).join("/"),type:"directory"}),await i(c);else if(s.isFile()&&l.isFile()){let u=await Gn({root:e,file:c,label:`Native root file ${O.relative(e,c)}`});r.push({ref:O.relative(e,c).split(O.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await i(e),r.sort((n,a)=>n.ref.localeCompare(a.ref))}async function NN(e,t,r,i){await ti({root:i,directory:t,label:"Native root move staging directory"});async function n(a,o){let s=await bt({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=O.join(a,l.name);if(O.resolve(u)===O.resolve(r)){await s.verify();continue}let d=await ut.lstat(u);if(l.isSymbolicLink()||d.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let f=O.join(o,l.name);if(l.isDirectory()&&d.isDirectory())await ti({root:i,directory:f,label:"Native root move staging directory"}),await n(u,f);else if(l.isFile()&&d.isFile())await ri({sourceRoot:e,source:u,targetRoot:i,target:f,maxBytes:null,label:`Native root move file ${O.relative(e,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await n(e,t)}async function ca(e,t,r,i){let n=await pi(e,{rejectSymlinks:!0,excludedFiles:r?new Set([O.resolve(r)]):void 0}),a=await pi(t,{rejectSymlinks:!0,excludedFiles:i?new Set([O.resolve(i)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function bN(e,t){return O.join(e.artifactRoot,`.comet-native-move-${t}`)}function kN(e,t){return O.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function SN(e){return`${e}.removing`}function Hf(e,t,r){return O.join(Xn(e,t).directory,`root-move-cleanup-${r}.json`)}function EN(e){return JSON.stringify(e,null,2)+`
188
- `}function xN(e){return hN("sha256").update(e).digest("hex")}function CN(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let r=e,i=Object.keys(r).sort(),n=r.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(i)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof r.ref!="string"||r.ref.length===0||r.ref.includes("\\")||O.posix.normalize(r.ref)!==r.ref||r.ref.startsWith("/")||r.ref.split("/").includes("..")||Buffer.byteLength(r.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(r.type==="directory")return{ref:r.ref,type:"directory"};if(r.type!=="file"||typeof r.size!="number"||!Number.isSafeInteger(r.size)||r.size<0||typeof r.hash!="string"||!/^[a-f0-9]{64}$/u.test(r.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:r.ref,type:"file",size:r.size,hash:r.hash}}function PN(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let i=e;if(JSON.stringify(Object.keys(i).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||i.schema!=="comet.native.root-move-cleanup.v1"||i.transactionId!==t||i.kind!==r||!Array.isArray(i.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=i.entries.map(CN);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=O.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:r,entries:n}}async function RN(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},r=EN(t);return await te(Hf(e.paths,e.id,e.kind),r,{containedRoot:e.paths.runtimeDir}),xN(r)}async function _N(e){let t=await ce({root:e.paths.runtimeDir,file:Hf(e.paths,e.id,e.cleanup.kind),maxBytes:null,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return PN(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function ic(e){let t=await pi(e.quarantine,{rejectSymlinks:!0}),r=new Map(e.manifest.entries.map(i=>[i.ref,i]));for(let i of t){let n=r.get(i.ref);if(!n||JSON.stringify(n)!==JSON.stringify(i))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${i.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function jf(e){return e.ref.split("/").length}async function AN(e){let r=[...await ic({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((n,a)=>jf(a)-jf(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),i=0;for(let n of r){let a=O.join(e.quarantine,...n.ref.split("/"));n.type==="file"?await Ds({root:e.projectRoot,file:a,maxBytes:null,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await Ls({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),i+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,n.ref,i)}await ic({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await Ls({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function la(e,t,r=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:r,pending_root_move:t}}}function IN(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function $f(e){let t=la(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await at(e.projectRoot,t),t}async function fi(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let r=la(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await at(e.projectRoot,r),r}async function Of(e){let t=e.config,r=t.native.pending_root_move;if(!r||r.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=r.cleanup;if(i&&i.kind!==e.kind)throw new Error(`Native root move has unfinished ${i.kind} cleanup; cannot start ${e.kind}`);let n=await ae(e.target),a=await ae(e.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!i){if(!n&&!a)return t;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await RN({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await pi(e.target,{rejectSymlinks:!0})});i={kind:e.kind,state:"prepared",manifestHash:s},t=await fi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})}let o=await _N({paths:e.stablePaths,id:e.id,cleanup:i});if(n=await ae(e.target),a=await ae(e.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(n){if(i.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await Ud({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(i.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return fi({projectRoot:e.projectRoot,config:t,id:e.id})}return await ic({quarantine:e.quarantine,manifest:o,exact:i.state!=="deleting"}),i.state==="prepared"&&(i={...i,state:"quarantined"},t=await fi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})),i.state==="quarantined"&&(i={...i,state:"deleting"},t=await fi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:i})),await AN({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),fi({projectRoot:e.projectRoot,config:t,id:e.id})}async function TN(e){let t=e.config,r=t.native.pending_root_move.stage;if(r==="copying"){if(!await ae(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=SN(e.staging);t=await Of({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await pi(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([O.resolve(e.lockFile)])}),await NN(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await ca(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await $f({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),r="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(r==="ready"){if(await ae(e.destinationPaths.nativeRoot)){if(await ae(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await ca(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await ae(e.staging))throw new Error("Native move staging tree is missing");await ca(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await ut.rename(e.staging,e.destinationPaths.nativeRoot)}t=await $f({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),r="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(r!=="switched")throw new Error(`Unsupported Native root-move stage: ${r}`);if(!await ae(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let i=kN(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await ae(e.sourcePaths.nativeRoot)&&await ca(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Of({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:i,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await wN(e.destinationPaths);let n=await ai(e.destinationPaths,e.pending.id);await Vs(e.destinationPaths,n,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await at(e.projectRoot,o),o}async function Df(e){let t=await ne(e.projectRoot)??_d("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let r=Yr(e.toArtifactRoot);if(r===t.native.artifact_root)throw new Error(`Native artifact root is already ${r}`);let i=await Pe(e.projectRoot,t.native.artifact_root),n=await Pe(e.projectRoot,r);if(J(i.nativeRoot,n.nativeRoot)||J(n.nativeRoot,i.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await ae(i.nativeRoot))throw new Error(`Native source root does not exist: ${i.nativeRoot}`);if(await vN(i),await ae(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await Zr(i,"root-move",`move root to ${r}`),o=mN(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:r,stage:"copying"},c=IN({id:o,paths:i,now:e.now??new Date}),l=bN(n,o);try{if(await gN(i,a.file),await yN(i),await ae(l))throw new Error(`Native move staging path is occupied: ${l}`);return await at(e.projectRoot,la(t,s)),await af(i,c),await e.hooks?.afterRootMoveStage?.("copying",c),await TN({projectRoot:e.projectRoot,config:la(t,s),pending:s,sourcePaths:i,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:i.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await ei(a)}}Jr();import Ci from"path";import{realpathSync as Hk}from"fs";function Lf(e,t){let r=u=>u!==null&&typeof u=="object"&&!Array.isArray(u)?u:{},i=r(e),n=r(i.entry),a=r(i.state??n.state??i),o=r(i.preparation??i.workspace??n.workspace),s=r(i.continuation??n.continuation),c=typeof o.projectRoot=="string"&&o.projectRoot!=="."?o.projectRoot:t??null,l=a.stateVersion??a.state_version;return{phase:typeof a.phase=="string"?a.phase:null,status:typeof a.status=="string"?a.status:null,stateVersion:typeof l=="number"?l:null,workspace:{cwd:c},continuation:Object.keys(s).length?{...s,cwd:c}:null}}var Me={next:"NEXT:",relay:"RELAY TO USER:",detail:"DETAIL:",details:"--- machine projection (run with --json to consume it) ---"};function Mf(e){return e?e.command?`${Me.next} ${e.command}`:e.ask_user?`${Me.next} ${e.ask_user}`:null:null}function Ff(e,t){let r=[e.summary],i=Mf(e.next);return i&&r.push(i),e.user_message&&r.push("",Me.relay,e.user_message),t!==void 0&&r.push("",Me.details,JSON.stringify(t,null,2)),`${r.join(`
204
+ ${t.sessionId}`)}:{}},h=t.binding?{schema:"comet.native.workspace.v3",...f,...t.binding,finish:t.finish??null}:{schema:"comet.native.workspace.v2",...f};return Wa(h),h}async function qc(t){let e=await Hp(t),r=Op(t.paths,t.name),i=ke(t.paths,r);return await B(i,r),await Y(r,e,{containedRoot:i}),e}async function wr(t,e){let r=await Yb(t,e);return r===null||r&&typeof r=="object"&&!Array.isArray(r)&&r.schema==="comet.native.workspace.v1"?null:(Wa(r),r)}async function za(t){Wa(t.identity);let e=await Hp({paths:t.paths,name:"workspace-advisory",revision:t.identity.capturedRevision}),r=[],i=[];return e.nativeRootRef!==t.identity.nativeRootRef&&r.push("native-root-ref"),t.identity.projectRootPathId&&t.identity.nativeRootPathId?(e.projectRootPathId!==t.identity.projectRootPathId&&r.push("project-root-path"),e.nativeRootPathId!==t.identity.nativeRootPathId&&r.push("native-root-path")):(e.projectRootId!==t.identity.projectRootId&&r.push("project-root-legacy-identity"),e.nativeRootId!==t.identity.nativeRootId&&r.push("native-root-legacy-identity")),Mc==="win32"&&r.length>0&&r.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?i.push("workspace-inspection-unavailable"):r.length>0&&i.push("workspace-root-changed"),{state:i.length===0?"aligned":i.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:i,driftComponents:r}}async function Vc(t){if(Wa(t.identity),t.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await za(t)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let r=Ee(t.paths.projectRoot);return t.identity.changeBranch===null?r.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:r.isGitWorktree?r.currentBranch!==t.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${t.identity.changeBranch}, but the current branch is ${r.currentBranch??"detached HEAD"}`}:t.identity.isolation==="worktree"&&!r.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}async function ue(t){try{return await Nt.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ek(t){let e;try{e=await Nt.readdir(t.transactionsDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of e){if(!r.isDirectory()||r.isSymbolicLink())continue;let i;try{i=await Pi(t,r.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${r.name} has no journal; run doctor before moving`,{cause:n}):n}if(i.status!=="committed"&&i.status!=="rolled-back")throw new Error(`Native transaction ${i.id} is unfinished; recover it before moving`)}}async function tk(t,e){for(let r of await Nt.readdir(t.locksDir,{withFileTypes:!0})){let i=D.join(t.locksDir,r.name);if(D.resolve(i)!==D.resolve(e)&&(r.isFile()||r.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${i}`)}}async function rk(t){let e;try{e=await Nt.readdir(t.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of e.sort((i,n)=>i.name.localeCompare(n.name))){if(!r.isDirectory()||r.isSymbolicLink())continue;let i=await wr(t,r.name);if(i){await qc({paths:t,name:r.name,revision:i.capturedRevision,...i.schema==="comet.native.workspace.v3"?{binding:{isolation:i.isolation,changeBranch:i.changeBranch,targetBranch:i.targetBranch},...i.finish?{finish:i.finish}:{}}:{}});continue}}}async function ik(t){let e;try{e=await Nt.readdir(t.changesDir,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;throw r}for(let r of e.sort((i,n)=>i.name.localeCompare(n.name)))if(!(!r.isDirectory()||r.isSymbolicLink()))try{let i=await wr(t,r.name);if(i?.schema==="comet.native.workspace.v3"){let n=await Vc({paths:t,identity:i});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(i){let n=await za({paths:t,identity:i});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(i){throw new Error(`Native workspace identity for ${r.name} must be aligned and repaired before moving the root`,{cause:i})}}async function Di(t,e){let r=[];async function i(n){let a=await Tt({root:t,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=D.join(n,s.name);if(e.excludedFiles?.has(D.resolve(c))){await a.verify();continue}let l=await Nt.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(e.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())r.push({ref:D.relative(t,c).split(D.sep).join("/"),type:"directory"}),await i(c);else if(s.isFile()&&l.isFile()){let u=await Pa({root:t,file:c,label:`Native root file ${D.relative(t,c)}`});r.push({ref:D.relative(t,c).split(D.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await i(t),r.sort((n,a)=>n.ref.localeCompare(a.ref))}async function nk(t,e,r,i){await Si({root:i,directory:e,label:"Native root move staging directory"});async function n(a,o){let s=await Tt({root:t,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=D.join(a,l.name);if(D.resolve(u)===D.resolve(r)){await s.verify();continue}let d=await Nt.lstat(u);if(l.isSymbolicLink()||d.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let f=D.join(o,l.name);if(l.isDirectory()&&d.isDirectory())await Si({root:i,directory:f,label:"Native root move staging directory"}),await n(u,f);else if(l.isFile()&&d.isFile())await Ei({sourceRoot:t,source:u,targetRoot:i,target:f,maxBytes:null,label:`Native root move file ${D.relative(t,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await n(t,e)}async function Ga(t,e,r,i){let n=await Di(t,{rejectSymlinks:!0,excludedFiles:r?new Set([D.resolve(r)]):void 0}),a=await Di(e,{rejectSymlinks:!0,excludedFiles:i?new Set([D.resolve(i)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${t} and ${e}`)}function ak(t,e){return D.join(t.artifactRoot,`.comet-native-move-${e}`)}function ok(t,e){return D.join(t.artifactRoot,`.comet-native-source-${e}.removing`)}function sk(t){return`${t}.removing`}function Mp(t,e,r){return D.join(Ia(t,e).directory,`root-move-cleanup-${r}.json`)}function ck(t){return JSON.stringify(t,null,2)+`
205
+ `}function lk(t){return Qb("sha256").update(t).digest("hex")}function uk(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Native root-move cleanup manifest entry ${e} must be an object`);let r=t,i=Object.keys(r).sort(),n=r.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(i)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${e} has invalid fields`);if(typeof r.ref!="string"||r.ref.length===0||r.ref.includes("\\")||D.posix.normalize(r.ref)!==r.ref||r.ref.startsWith("/")||r.ref.split("/").includes("..")||Buffer.byteLength(r.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${e} has an invalid ref`);if(r.type==="directory")return{ref:r.ref,type:"directory"};if(r.type!=="file"||typeof r.size!="number"||!Number.isSafeInteger(r.size)||r.size<0||typeof r.hash!="string"||!/^[a-f0-9]{64}$/u.test(r.hash))throw new Error(`Native root-move cleanup manifest entry ${e} is invalid`);return{ref:r.ref,type:"file",size:r.size,hash:r.hash}}function dk(t,e,r){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native root-move cleanup manifest must be an object");let i=t;if(JSON.stringify(Object.keys(i).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||i.schema!=="comet.native.root-move-cleanup.v1"||i.transactionId!==e||i.kind!==r||!Array.isArray(i.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=i.entries.map(uk);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=D.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:e,kind:r,entries:n}}async function fk(t){let e={schema:"comet.native.root-move-cleanup.v1",transactionId:t.id,kind:t.kind,entries:t.entries},r=ck(e);return await ne(Mp(t.paths,t.id,t.kind),r,{containedRoot:t.paths.runtimeDir}),lk(r)}async function pk(t){let e=await pe({root:t.paths.runtimeDir,file:Mp(t.paths,t.id,t.cleanup.kind),maxBytes:null,label:`Native root-move cleanup manifest ${t.cleanup.kind}`});if(e.hash!==t.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return dk(JSON.parse(e.bytes.toString("utf8")),t.id,t.cleanup.kind)}async function Wc(t){let e=await Di(t.quarantine,{rejectSymlinks:!0}),r=new Map(t.manifest.entries.map(i=>[i.ref,i]));for(let i of e){let n=r.get(i.ref);if(!n||JSON.stringify(n)!==JSON.stringify(i))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${i.ref}`)}if(t.exact&&e.length!==t.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return e}function Dp(t){return t.ref.split("/").length}async function hk(t){let r=[...await Wc({quarantine:t.quarantine,manifest:t.manifest,exact:!1})].sort((n,a)=>Dp(a)-Dp(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),i=0;for(let n of r){let a=D.join(t.quarantine,...n.ref.split("/"));n.type==="file"?await Cc({root:t.projectRoot,file:a,maxBytes:null,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await Pc({root:t.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),i+=1,await t.hooks?.afterRootMoveCleanupEntryRemoved?.(t.manifest.kind,n.ref,i)}await Wc({quarantine:t.quarantine,manifest:t.manifest,exact:!1}),await Pc({root:t.projectRoot,directory:t.quarantine,label:`Native root-move cleanup quarantine ${t.manifest.kind}`})}function Ja(t,e,r=t.native.artifact_root){return{...t,native:{...t.native,artifact_root:r,pending_root_move:e}}}function mk(t){return{schema:"comet.native.transaction.v1",id:t.id,kind:"root-move",status:"prepared",projectRoot:t.paths.projectRoot,nativeRoot:t.paths.nativeRoot,createdAt:t.now.toISOString(),operations:[]}}async function Lp(t){let e=Ja(t.config,{...t.pending,stage:t.stage},t.activeArtifactRoot);return await ht(t.projectRoot,e),e}async function Hi(t){let e=t.config.native.pending_root_move;if(!e||e.id!==t.id)throw new Error(`Native root-move cleanup ${t.id} lost its pending configuration`);let r=Ja(t.config,{id:e.id,fromArtifactRoot:e.fromArtifactRoot,toArtifactRoot:e.toArtifactRoot,stage:e.stage,...t.cleanup?{cleanup:t.cleanup}:{}},t.config.native.artifact_root);return await ht(t.projectRoot,r),r}async function Bp(t){let e=t.config,r=e.native.pending_root_move;if(!r||r.id!==t.id)throw new Error(`Native root-move cleanup ${t.id} lost its pending configuration`);let i=r.cleanup;if(i&&i.kind!==t.kind)throw new Error(`Native root move has unfinished ${i.kind} cleanup; cannot start ${t.kind}`);let n=await ue(t.target),a=await ue(t.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${t.kind}`);if(!i){if(!n&&!a)return e;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${t.kind}`);let s=await fk({paths:t.stablePaths,id:t.id,kind:t.kind,entries:await Di(t.target,{rejectSymlinks:!0})});i={kind:t.kind,state:"prepared",manifestHash:s},e=await Hi({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:i})}let o=await pk({paths:t.stablePaths,id:t.id,cleanup:i});if(n=await ue(t.target),a=await ue(t.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${t.kind}`);if(n){if(i.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${t.kind}`);await Kf({root:t.projectRoot,directory:t.target,quarantine:t.quarantine,label:t.label,beforeQuarantine:t.beforeQuarantine,afterQuarantine:t.afterQuarantine}),a=!0}if(!a){if(i.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${t.kind}`);return Hi({projectRoot:t.projectRoot,config:e,id:t.id})}return await Wc({quarantine:t.quarantine,manifest:o,exact:i.state!=="deleting"}),i.state==="prepared"&&(i={...i,state:"quarantined"},e=await Hi({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:i})),i.state==="quarantined"&&(i={...i,state:"deleting"},e=await Hi({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:i})),await hk({projectRoot:t.projectRoot,quarantine:t.quarantine,manifest:o,hooks:t.hooks}),Hi({projectRoot:t.projectRoot,config:e,id:t.id})}async function vk(t){let e=t.config,r=e.native.pending_root_move.stage;if(r==="copying"){if(!await ue(t.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${t.sourcePaths.nativeRoot}`);let s=sk(t.staging);e=await Bp({projectRoot:t.projectRoot,config:e,id:t.pending.id,kind:"restart-staging",stablePaths:t.sourcePaths,target:t.staging,quarantine:s,label:"Native root move stale staging removal",hooks:t.hooks}),await Di(t.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([D.resolve(t.lockFile)])}),await nk(t.sourcePaths.nativeRoot,t.staging,t.lockFile,t.destinationPaths.projectRoot),await Ga(t.sourcePaths.nativeRoot,t.staging,t.lockFile),e=await Lp({projectRoot:t.projectRoot,config:e,pending:t.pending,stage:"ready"}),r="ready",await t.hooks?.afterRootMoveStage?.("ready",t.journal)}if(r==="ready"){if(await ue(t.destinationPaths.nativeRoot)){if(await ue(t.staging))throw new Error(`Native destination is occupied: ${t.destinationPaths.nativeRoot}`);await Ga(t.sourcePaths.nativeRoot,t.destinationPaths.nativeRoot,t.lockFile)}else{if(!await ue(t.staging))throw new Error("Native move staging tree is missing");await Ga(t.sourcePaths.nativeRoot,t.staging,t.lockFile),await Nt.rename(t.staging,t.destinationPaths.nativeRoot)}e=await Lp({projectRoot:t.projectRoot,config:e,pending:t.pending,stage:"switched",activeArtifactRoot:t.pending.toArtifactRoot}),r="switched",await t.hooks?.afterRootMoveStage?.("switched",t.journal)}if(r!=="switched")throw new Error(`Unsupported Native root-move stage: ${r}`);if(!await ue(t.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${t.destinationPaths.nativeRoot}`);let i=ok(t.sourcePaths,t.pending.id);!e.native.pending_root_move?.cleanup&&await ue(t.sourcePaths.nativeRoot)&&await Ga(t.sourcePaths.nativeRoot,t.destinationPaths.nativeRoot,t.lockFile),e=await Bp({projectRoot:t.projectRoot,config:e,id:t.pending.id,kind:"forward-source",stablePaths:t.destinationPaths,target:t.sourcePaths.nativeRoot,quarantine:i,label:"Native root move source removal",beforeQuarantine:()=>t.hooks?.beforeRootMoveSourceRemove?.(t.sourcePaths.nativeRoot),afterQuarantine:s=>t.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:t.hooks}),await rk(t.destinationPaths);let n=await Pi(t.destinationPaths,t.pending.id);await Ic(t.destinationPaths,n,"commit");let a={artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,snapshot:e.native.snapshot},o={...e,native:{...a,artifact_root:t.pending.toArtifactRoot}};return await ht(t.projectRoot,o),o}async function Fp(t){let e=await ce(t.projectRoot)??Pf("docs");if(e.native.pending_root_move)throw new Error(`Native root move ${e.native.pending_root_move.id} is already incomplete`);let r=vi(t.toArtifactRoot);if(r===e.native.artifact_root)throw new Error(`Native artifact root is already ${r}`);let i=await Oe(t.projectRoot,e.native.artifact_root),n=await Oe(t.projectRoot,r);if(U(i.nativeRoot,n.nativeRoot)||U(n.nativeRoot,i.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await ue(i.nativeRoot))throw new Error(`Native source root does not exist: ${i.nativeRoot}`);if(await ek(i),await ue(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await bi(i,"root-move",`move root to ${r}`),o=Zb(),s={id:o,fromArtifactRoot:e.native.artifact_root,toArtifactRoot:r,stage:"copying"},c=mk({id:o,paths:i,now:t.now??new Date}),l=ak(n,o);try{if(await tk(i,a.file),await ik(i),await ue(l))throw new Error(`Native move staging path is occupied: ${l}`);return await ht(t.projectRoot,Ja(e,s)),await ap(i,c),await t.hooks?.afterRootMoveStage?.("copying",c),await vk({projectRoot:t.projectRoot,config:Ja(e,s),pending:s,sourcePaths:i,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:t.hooks}),{fromNativeRoot:i.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await ki(a)}}fi();import tn from"path";import{realpathSync as yx}from"fs";function qp(t,e){let r=u=>u!==null&&typeof u=="object"&&!Array.isArray(u)?u:{},i=r(t),n=r(i.entry),a=r(i.state??n.state??i),o=r(i.preparation??i.workspace??n.workspace),s=r(i.continuation??n.continuation),c=typeof o.projectRoot=="string"&&o.projectRoot!=="."?o.projectRoot:e??null,l=a.stateVersion??a.state_version;return{phase:typeof a.phase=="string"?a.phase:null,status:typeof a.status=="string"?a.status:null,stateVersion:typeof l=="number"?l:null,workspace:{cwd:c},continuation:Object.keys(s).length?{...s,cwd:c}:null}}var Ke={next:"NEXT:",relay:"RELAY TO USER:",detail:"DETAIL:",details:"--- machine projection (run with --json to consume it) ---"};function Vp(t){return t?t.command?`${Ke.next} ${t.command}`:t.ask_user?`${Ke.next} ${t.ask_user}`:null:null}function Wp(t,e){let r=[t.summary],i=Vp(t.next);return i&&r.push(i),t.user_message&&r.push("",Ke.relay,t.user_message),e!==void 0&&r.push("",Ke.details,JSON.stringify(e,null,2)),`${r.join(`
189
206
  `)}
190
- `}function Bf(e,t,r){let i=[e.summary],n=Mf(e.next);return n&&i.push(n),e.user_message&&i.push("",Me.relay,e.user_message),i.push("",`${Me.detail} ${t}`),r!==void 0&&i.push("",Me.details,JSON.stringify(r,null,2)),i.join(`
191
- `)}Et();var Jf=Ve($e(),1);be();H();Et();re();G();j();ge();hi();G();j();zt();et();var FN=Ve($e(),1);zt();et();it();it();Wt();Es();zt();it();var nR=4*1024*1024;var BN=null;function VN(e,t){let r=e;for(let i of t)r+="\0"+(typeof i=="string"?i:JSON.stringify(i));return r}function Vf(e,t){return(...r)=>{let i=BN;if(i===null)return t(...r);let n=VN(`async:${e}`,r),a=i.entries.get(n);if(a)return a.value;let o=t(...r).catch(s=>{throw i.entries.delete(n),s});return i.entries.set(n,{value:o}),o}}Wt();var lR=Vf("hookWritePolicy",async e=>(await hs(e))?.hook??{allow_paths:[]});Jr();var qN=16*1024;ks();Wr();var l_=Number.MAX_SAFE_INTEGER;H();Ce();var k_={runStateBytes:Number.MAX_SAFE_INTEGER,trajectoryBytes:Number.MAX_SAFE_INTEGER,trajectoryEvents:4096,trajectoryEventBytes:Number.MAX_SAFE_INTEGER,checkpointBytes:Number.MAX_SAFE_INTEGER,pendingActionBytes:Number.MAX_SAFE_INTEGER,contextBytes:Number.MAX_SAFE_INTEGER,artifactsBytes:Number.MAX_SAFE_INTEGER};li();ea();ea();var ua=class extends Error{constructor(r,i,n){super(`Native change ${r} revision conflict: expected ${i}, actual ${n}`);this.change=r;this.expectedRevision=i;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},mi=class extends Error{constructor(r,i){super(`Native working directory already contains active change${i.length===1?"":"s"} ${i.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=r;this.activeChanges=i;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},da=class extends Error{constructor(r,i,n,a,o,s=null,c=null){super(`Native change ${r} baseline is incomplete (${i} omitted entr${i===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=r;this.omittedCount=i;this.omittedByReason=n;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},eA=ta("en");be();Ae();j();var rb=["outcome","scope","nonGoals","acceptanceExamples"],lA=[...rb,"constraints","decisions","openQuestions","verificationExpectations"];W();be();W();var ib=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});tr();ge();re();j();H();Ae();Kt();G();j();ge();Ct();W();W();pa();er();Ae();var Yf={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},fb=de("comet-native-runtime:v3:scope-reopen"),gI=[{skillVersion:"3",skillHash:de("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:de("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:de("comet-native-runtime:v1")}];Ae();Ae();li();var Qf=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],XI=new Set(Qf),yb=new Set([...Qf,"minimum_runtime_version","revision"]),QI=new Set([...yb,"operation"]),Nb=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),ZI=new Set([...Nb,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);ra();be();be();ra();W();var nT={maxAcceptanceCriteria:mf.maxCriteria};tr();hi();er();pa();import{execFile as Ib}from"node:child_process";Fn();ac();import{promisify as Tb}from"node:util";H();Ae();j();ge();ci();Ct();G();H();nc();j();Ce();tr();G();Ct();var wi=class extends Error{recovery;constructor(t,r){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=r}};hi();ha();er();var sj=64*1024;var cj=3600*1e3;var lj=Tb(Ib);ha();var ma=class extends Error{details;constructor(t){let r=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(i=>`${i.ref}${i.acceptanceId?`[${i.acceptanceId}]`:""} -> ${i.mismatches.join("; ")}`).join(" | ")}`;super(r),this.name="NativeVerificationReceiptBindingError",this.details=t}};Ae();ge();H();Ce();j();ge();oi();H();Et();tr();var o$=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});Ae();Kt();G();j();ge();re();G();Fe();H();ia();ct();j();H();be();W();var lk=Ve($e(),1);Fe();be();W();re();j();ct();va();va();ir();dt();Fe();qn();H();W();ya();G();j();ip();ir();dt();sc();Fe();re();sc();Kt();j();var Na=class extends Error{constructor(r,i,n){super(r,n);this.preparation=i;this.name="NativeWorkspacePreparationError"}preparation};Fe();re();G();ir();dt();ct();xt();yi();wa();G();Ys();Js();ct();xt();H();Et();yi();j();Et();tr();re();var cp=Ve($e(),1);it();var G0=new Set("a an and are as at be by for from in is it of on or that the this to with you your".split(" "));var Z0=256*1024;ct();xt();dt();var gk=ta("en");re();G();ir();dt();ct();xt();Fe();qn();W();ya();G();xt();j();var $D=1024*1024*1024;G();wa();yi();dt();G();dt();G();Xs();var PM=16*1024;oi();var Sa=class extends Error{constructor(r,i,n,a){super(`Canonical spec conflict for ${r}: expected ${i??"(missing)"}, actual ${n??"(missing)"}`);this.capability=r;this.expectedHash=i;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},Ea=class extends Error{constructor(r,i=r.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${r.findingCodes.join(", ")}`){super(i);this.preflight=r;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};j();re();function P(e,t,r){return e==="zh-CN"?r:t}var uc={shape:{en:"Shape (agreeing on requirements)",zh:"Shape(需求共识)"},build:{en:"Build",zh:"Build(实现)"},verify:{en:"Verify",zh:"Verify(验证)"},archive:{en:"Archive",zh:"Archive(归档)"}};function pp(e,t){return typeof e=="string"&&uc[e]?P(t,uc[e].en,uc[e].zh):typeof e=="string"?e:""}function dc(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.total=="number"&&typeof t.passed=="number"&&typeof t.failed=="number"&&typeof t.blocked=="number"&&typeof t.pending=="number"}function bk(e){let t={total:e.length,passed:0,failed:0,blocked:0,pending:0};for(let r of e){if(!r||typeof r!="object")return null;let i=r.result;if(i!=="passed"&&i!=="failed"&&i!=="blocked"&&i!=="pending")return null;t[i]+=1}return t}function hp(e,t){let r=[];e.failed>0&&r.push(P(t,`${e.failed} failed`,`${e.failed} 项失败`)),e.blocked>0&&r.push(P(t,`${e.blocked} blocked`,`${e.blocked} 项受阻`)),e.pending>0&&r.push(P(t,`${e.pending} pending`,`${e.pending} 项待验`));let i=P(t,`acceptance ${e.passed}/${e.total} passed`,`验收 ${e.passed}/${e.total} 通过`);return r.length>0?`${i} (${r.join(", ")})`:i}function mp(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;if(typeof t.change!="string"||t.disposition!=="continue"&&t.disposition!=="await-user"&&t.disposition!=="blocked"&&t.disposition!=="done"||t.commandArgs!==null&&t.commandArgs!==void 0&&!Array.isArray(t.commandArgs))return!1;let r=t.userCommunication;return!!(r&&typeof r=="object"&&typeof r.required=="boolean"&&(r.message===null||typeof r.message=="string")&&typeof r.agentInstruction=="string")}function fc(e){return/[\u4e00-\u9fff]/u.test(e.userCommunication.agentInstruction)?"zh-CN":"en"}function kk(e,t,r){return e==="done"?P(r,"complete","已完成"):e==="await-user"?P(r,"waiting for a user decision","等待用户决定"):e==="blocked"?P(r,"paused: needs attention","已暂停,需要处理"):t?P(r,"waiting for a user decision","等待用户决定"):P(r,"ready to continue","可继续推进")}function Sk(e,t,r){let i=fc(e),n=[];r&&n.push(r);let a=P(i,`Change ${e.change}`,`需求 ${e.change}`),o=pp(e.phase,i),s=kk(e.disposition,e.userCommunication.required,i);n.push([a,o||null,s].filter(Boolean).join(" · ")),t&&t.total>0&&n.push(hp(t,i));let c=e.userCommunication,l=vp(e,i);return{summary:n.join("; "),...l?{next:l}:{},...c.required&&c.message?{user_message:c.message}:{}}}function vp(e,t){let r=e.userCommunication;if(e.disposition==="await-user"&&r.required)return{ask_user:P(t,"Relay the message below, wait for the user decision, then run the matching option (run with --json to see the exact alternative commands).","先转述下方信息并等待用户选择,再执行对应命令(完整候选命令以 --json 输出为准)。")};if(e.commandArgs&&e.commandArgs.length>0)return{command:e.commandArgs.join(" ")};if(e.disposition==="done")return{ask_user:P(t,"No further workflow action; report the completed change to the user.","工作流已无后续动作;向用户报告该需求已完成即可。")};if(e.disposition==="blocked")return{ask_user:r.required&&r.message?r.agentInstruction:P(t,"Resolve the paused condition before continuing; run with --json for the structured diagnosis.","先解除暂停原因再继续;结构化诊断信息以 --json 输出为准。")}}function Ek(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.total=="number"&&Array.isArray(t.items)}function xk(e,t){let r=typeof e.name=="string"?e.name:"(unnamed)",i=pp(e.phase,t),n=e.status==="await-user"?P(t,"waiting for a user decision","等待用户决定"):e.status==="blocked"?P(t,"paused","已暂停"):e.status==="done"?P(t,"complete","已完成"):P(t,"in progress","进行中"),a=dc(e.acceptance)?`${P(t,", ",",")}${hp(e.acceptance,t)}`:"";return` ${r} · ${i||String(e.phase??"?")} · ${n}${a}`}function Ck(e){for(let t of e){let r=t.continuation;if(r?.userCommunication&&typeof r.userCommunication.agentInstruction=="string"&&/[\u4e00-\u9fff]/u.test(r.userCommunication.agentInstruction))return"zh-CN"}return"en"}function Pk(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.healthy!="boolean"?!1:t.findings===void 0||Array.isArray(t.findings)}function Rk(e){if(e.healthy){let i=e.repaired?P("en","Diagnostics passed and the reported problem was repaired automatically.","诊断通过,报告的问题已自动修复。"):P("en","Diagnostics passed: no problems found.","诊断通过:未发现问题。"),n=_k(e.continuation);return n?{summary:i,next:n}:{summary:i}}let r=Array.isArray(e.findings)?e.findings.length:0;return{summary:P("en",r>0?`Diagnostics found ${r} problem${r===1?"":"s"} that need attention before this change can continue.`:"Diagnostics found problems that need attention before this change can continue.",r>0?`诊断发现 ${r} 个需要处理的问题,处理后该需求才能继续。`:"诊断发现需要处理的问题,处理后该需求才能继续。"),next:{ask_user:P("en","Run with --json to read the structured findings; re-run with --repair once the cause is understood.","结构化诊断以 --json 输出为准;确认原因后再用 --repair 修复。")}}}function _k(e){return mp(e)?vp(e,fc(e)):void 0}function gp(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(Pk(t))return Rk(t);if(Ek(t)){let i=Ck(t.items);return{summary:[t.total===t.items.length?P(i,`Native changes (${t.total})`,`Native 需求列表(共 ${t.total} 条)`):P(i,`Native changes (showing ${t.items.length} of ${t.total})`,`Native 需求列表(显示 ${t.items.length}/${t.total} 条)`),...t.items.map(a=>xk(a,i))].join(`
192
- `)}}let r=t.continuation;if(mp(r)){let i=fc(r),n=Sk(r,Ak(t),Tk(t,i));return Ik(t)==="unconfirmed"?{...n,summary:`${n.summary}${P(i,"; the dispatched Verifier has not confirmed startup yet — verify the subagent actually launched before waiting on it",";已派发的 Verifier 尚未确认启动——先核实子代理确实启动,再继续等待")}`}:n}if(typeof t.artifactRoot=="string"&&typeof t.nativeRoot=="string"){let i=t.language==="zh-CN"?"zh-CN":"en",n="pendingRootMove"in t;return{summary:P(i,n?`Comet Native artifacts live under ${t.artifactRoot} (state root: ${t.nativeRoot}).`:`Initialized Comet Native at ${t.nativeRoot} (artifacts: ${t.artifactRoot}).`,n?`Comet Native 产物位于 ${t.artifactRoot}(状态根目录:${t.nativeRoot})。`:`Comet Native 已初始化于 ${t.nativeRoot}(产物目录:${t.artifactRoot})。`)}}}function Ak(e){if(dc(e.acceptance))return e.acceptance;let t=e.state;if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;if(dc(r.acceptance))return r.acceptance;if(Array.isArray(r.acceptance))return bk(r.acceptance)}return null}function Ik(e){let t=e.localExecution;if(!t||typeof t!="object"||Array.isArray(t))return;let r=t.verifierStartup;if(!(!r||typeof r!="object"||Array.isArray(r)))return r.confirmation}function Tk(e,t){if(e.selected!==void 0&&typeof e.selected=="string")return P(t,`Selected ${e.selected}.`,`已选择需求 ${e.selected}。`);let r=e.migration;return r&&typeof r=="object"&&r.completed===!0?P(t,"Upgraded this change to the current Native format.","已将该需求升级到当前 Native 格式。"):null}function wp(e){let r=e.data&&typeof e.data=="object"&&!Array.isArray(e.data)?e.data:{};switch(e.code){case"conflict":return{summary:P("en","This change was updated elsewhere while the command ran, so the command stopped without changing anything. Nothing was lost — reload the latest state and continue from there.","这条需求刚被另一个会话更新,本次命令未做任何改动。没有工作丢失——重新读取最新状态后继续即可。"),...typeof r.change=="string"?{next:{command:`comet native status ${r.change} --json`}}:{}};case"baseline-incomplete":return{summary:P("en","The safety snapshot for this change exceeded its configured size budget, so the command stopped before changing anything. Raise the snapshot limits in .comet/config.yaml or exclude out-of-scope data, then retry.","该需求的安全快照超出配置的容量预算,命令在改动任何内容前已停止。请在 .comet/config.yaml 中调高快照上限,或将范围外的数据加入排除列表后重试。"),next:{ask_user:P("en","Run with --json to see the exact limits, omitted paths, and supported fixes.","具体上限、被省略的路径和支持的修复方式以 --json 输出为准。")}};case"workspace-isolation-required":return{summary:P("en","This change runs in its own Git worktree to keep work isolated. Create the linked worktree first, then continue inside it.","这条需求需要在独立的 Git worktree 中执行以保证隔离。请先创建关联的 worktree,然后在其中继续。"),next:{ask_user:P("en","Run with --json to see the exact worktree creation command.","完整的 worktree 创建命令以 --json 输出为准。")}};case"workspace-preparation-incomplete":return{summary:P("en","The change workspace is not fully prepared (for example a branch or worktree is missing). Finish the preparation steps, then retry.","需求的工作区尚未准备完成(例如分支或 worktree 缺失)。请先完成准备步骤,再重试。"),next:{ask_user:P("en","Run with --json to see the remaining preparation steps.","剩余的准备步骤以 --json 输出为准。")}};case"implementation-scope-stale":return{summary:P("en","The recorded implementation scope no longer matches the current files. Refresh the scope, then retry.","记录的实现范围与当前文件不再一致。请刷新范围后重试。"),next:{ask_user:P("en","Run with --json to see the exact recovery steps.","具体恢复步骤以 --json 输出为准。")}};default:return}}oc();var yp=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--verbose Append the raw machine projection after the human/agent text.","--help Show help without requiring an initialized project."],pc=Object.freeze({"":{usage:"comet native <command> [options]",purpose:"Create, inspect, recover, and archive portable Native changes through Runtime-enforced, skill-coordinated steps.",agentQuickStart:["Run `comet native status --json` to discover active changes.","Select an existing change with `select`, or create one with `new`.","In `agent.workspace.cwd`, execute the exact `agent.continuation.commandArgs` returned by Runtime.","Use `agent.continuation.inputOptions` templates for JSON input; do not reconstruct fields from memory."],subcommands:["init Initialize Native project configuration.","root show Inspect the configured artifact root.","root move <artifact-root> Move the configured artifact root.","new <change-name> Create a change and prepare its workspace.","spec disassociate Revoke a capability association through Runtime.","spec remove Record a complete capability removal intent.","spec sync <change-name> <capability> --input <json-file> Audit local Markdown reference corrections.","show <change-name> Read formal artifacts and portable state.","status [<change-name>] Discover stable boundaries and Runner actions.","select <change-name> Select a change in its bound workspace.","next <change-name> Confirm or recover a stable workflow boundary.","archive <change-name> Preview and execute Archive plus workspace finish.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:yp,output:"A human summary plus a NEXT step by default (RELAY TO USER blocks carry user decisions); use --json for the structured envelope, --verbose to append the raw machine projection.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--task <text>] [--capability <id>] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--task <text> Search Project Knowledge for an existing capability and save a revocable association draft.","--capability <id> Directly validate and associate an existing capability without retrieval.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, canonical artifact paths, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN",'comet native new add-sms-login --task "add SMS login to authentication"',"comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:`comet native spec disassociate <change-name> --expected-state-version <n> --expected-action disassociate-capability
207
+ `}function zp(t,e,r){let i=[t.summary],n=Vp(t.next);return n&&i.push(n),t.user_message&&i.push("",Ke.relay,t.user_message),i.push("",`${Ke.detail} ${e}`),r!==void 0&&i.push("",Ke.details,JSON.stringify(r,null,2)),i.join(`
208
+ `)}Ht();var Yp=Qe(ze(),1);Pe();L();Ht();ae();K();O();Se();Li();K();O();sr();ut();var Ek=Qe(ze(),1);sr();ut();Je();Je();or();fc();sr();Je();var uI=4*1024*1024;import{AsyncLocalStorage as xk}from"node:async_hooks";var Ck=new xk;function Pk(){let t=Ck.getStore();return t?.active?t:null}function Rk(t,e){let r=t;for(let i of e)r+="\0"+(typeof i=="string"?i:JSON.stringify(i));return r}function Gp(t,e){return(...r)=>{let i=Pk();if(i===null)return e(...r);let n=Rk(`async:${t}`,r),a=i.entries.get(n);if(a)return a.value;let o=e(...r).catch(s=>{throw i.entries.get(n)?.value===o&&i.entries.delete(n),s});return i.entries.set(n,{value:o}),o}}or();var vI=Gp("hookWritePolicy",async t=>(await rc(t))?.hook??{allow_paths:[]});fi();var _k=16*1024;uc();ui();var vT=Number.MAX_SAFE_INTEGER;L();je();var _T={runStateBytes:Number.MAX_SAFE_INTEGER,trajectoryBytes:Number.MAX_SAFE_INTEGER,trajectoryEvents:4096,trajectoryEventBytes:Number.MAX_SAFE_INTEGER,checkpointBytes:Number.MAX_SAFE_INTEGER,pendingActionBytes:Number.MAX_SAFE_INTEGER,contextBytes:Number.MAX_SAFE_INTEGER,artifactsBytes:Number.MAX_SAFE_INTEGER};Ti();ja();ja();var Ua=class extends Error{constructor(r,i,n){super(`Native change ${r} revision conflict: expected ${i}, actual ${n}`);this.change=r;this.expectedRevision=i;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},Bi=class extends Error{constructor(r,i){super(`Native working directory already contains active change${i.length===1?"":"s"} ${i.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=r;this.activeChanges=i;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},Ka=class extends Error{constructor(r,i,n,a,o,s=null,c=null){super(`Native change ${r} baseline is incomplete (${i} omitted entr${i===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=r;this.omittedCount=i;this.omittedByReason=n;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},s$=Oa("en");Pe();Be();O();var qk=["outcome","scope","nonGoals","acceptanceExamples"],y$=[...qk,"constraints","decisions","openQuestions","verificationExpectations"];var Mi=class extends Error{constructor(r,i,n){super(r);this.findings=i;this.change=n;this.name="NativeDocumentConstraintError"}findings;change};G();Pe();G();var Vk=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});Nr();Se();ae();O();L();Be();fr();K();O();Se();Lt();G();G();Xa();yr();Be();var eh={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},Qk=ve("comet-native-runtime:v3:scope-reopen"),Pj=[{skillVersion:"3",skillHash:ve("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:ve("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:ve("comet-native-runtime:v1")}];Be();Be();Ti();var rh=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],s0=new Set(rh),aS=new Set([...rh,"minimum_runtime_version","revision"]),c0=new Set([...aS,"operation"]),oS=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),l0=new Set([...oS,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);Ha();Pe();Pe();Ha();G();var h0={maxAcceptanceCriteria:yp.maxCriteria};Nr();Li();yr();Xa();import{execFile as gS}from"node:child_process";dr();wi();Gc();import{promisify as wS}from"node:util";L();Be();O();Se();Ii();Lt();K();L();zc();O();je();Nr();K();Lt();var Vi=class extends Error{recovery;constructor(e,r){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=r}};Li();Qa();yr();var wO=64*1024;var yO=3600*1e3;var NO=wS(gS);Qa();var Za=class extends Error{details;constructor(e){let r=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(i=>`${i.ref}${i.acceptanceId?`[${i.acceptanceId}]`:""} -> ${i.mismatches.join("; ")}`).join(" | ")}`;super(r),this.name="NativeVerificationReceiptBindingError",this.details=e}};Be();Se();L();je();O();Se();Ri();L();Ht();Nr();var gH=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});Be();fr();K();O();Se();ae();K();Me();L();Fa();wt();O();function Yc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ft=Yc();function ph(t){Ft=t}var Bt={exec:()=>null};function kr(t){let e=[];return r=>{let i=Math.max(0,Math.min(3,r-1)),n=e[i];return n||(n=t(i),e[i]=n),n}}function R(t,e=""){let r=typeof t=="string"?t:t.source,i={replace:(n,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(X.caret,"$1"),r=r.replace(n,o),i},getRegex:()=>new RegExp(r,e)};return i}var _S=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),X={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:kr(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:kr(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:kr(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:kr(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:kr(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:kr(t=>new RegExp(`^ {0,${t}}>`))},AS=/^(?:[ \t]*(?:\n|$))+/,IS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,TS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Gi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$S=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xc=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,hh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,mh=R(hh).replace(/bull/g,Xc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),jS=R(hh).replace(/bull/g,Xc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Qc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,OS=/^[^\n]+/,Zc=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,HS=R(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Zc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),DS=R(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Xc).getRegex(),no="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",el=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,LS=R("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",el).replace("tag",no).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vh=t=>R(Qc).replace("hr",Gi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",no).getRegex(),BS=vh(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),MS=vh(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),FS=R(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",MS).getRegex(),tl={blockquote:FS,code:IS,def:HS,fences:TS,heading:$S,hr:Gi,html:LS,lheading:mh,list:DS,newline:AS,paragraph:BS,table:Bt,text:OS},oh=R("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Gi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",no).getRegex(),qS={...tl,lheading:jS,table:oh,paragraph:R(Qc).replace("hr",Gi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",oh).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",no).getRegex()},VS={...tl,html:R(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",el).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Bt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:R(Qc).replace("hr",Gi).replace("heading",` *#{1,6} *[^
209
+ ]`).replace("lheading",mh).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},WS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,gh=/^( {2,}|\\)\n(?!\s*$)/,GS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ye=/[\p{P}\p{S}]/u,Sr=/[\s\p{P}\p{S}]/u,Ji=/[^\s\p{P}\p{S}]/u,JS=R(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Sr).getRegex(),US=/[\p{Pi}\p{Ps}"']/u,wh=/(?!~)[\p{P}\p{S}]/u,KS=/(?!~)[\s\p{P}\p{S}]/u,YS=/(?:[^\s\p{P}\p{S}]|~)/u,XS=R(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",_S?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),yh=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,QS=R(yh,"u").replace(/punct/g,Ye).getRegex(),ZS=R(yh,"u").replace(/punct/g,wh).getRegex(),eE=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,tE=R(eE,"u").replace(/openQuote/g,US).replace(/punct/g,Ye).getRegex(),Nh="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",rE=R(Nh,"gu").replace(/notPunctSpace/g,Ji).replace(/punctSpace/g,Sr).replace(/punct/g,Ye).getRegex(),iE=R(Nh,"gu").replace(/notPunctSpace/g,YS).replace(/punctSpace/g,KS).replace(/punct/g,wh).getRegex(),nE="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",aE=R(nE,"gu").replace(/notPunctSpace/g,Ji).replace(/punctSpace/g,Sr).replace(/punct/g,Ye).getRegex(),oE=R("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ji).replace(/punctSpace/g,Sr).replace(/punct/g,Ye).getRegex(),sE="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",cE=R(sE,"gu").replace(/notPunctSpace/g,Ji).replace(/punctSpace/g,Sr).replace(/punct/g,Ye).getRegex(),lE=R(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ye).getRegex(),uE="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",dE=R(uE,"gu").replace(/notPunctSpace/g,Ji).replace(/punctSpace/g,Sr).replace(/punct/g,Ye).getRegex(),fE=R(/\\(punct)/,"gu").replace(/punct/g,Ye).getRegex(),pE=R(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),hE=R(el).replace("(?:-->|$)","-->").getRegex(),mE=R("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",hE).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),to=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,vE=R(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",to).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bh=R(/^!?\[(label)\]\[(ref)\]/).replace("label",to).replace("ref",Zc).getRegex(),kh=R(/^!?\[(ref)\](?:\[\])?/).replace("ref",Zc).getRegex(),gE=R("reflink|nolink(?!\\()","g").replace("reflink",bh).replace("nolink",kh).getRegex(),sh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,rl={_backpedal:Bt,anyPunctuation:fE,autolink:pE,blockSkip:XS,br:gh,code:zS,del:Bt,delLDelim:Bt,delRDelim:Bt,emStrongLDelim:QS,emStrongRDelimAst:rE,emStrongRDelimUnd:oE,escape:WS,link:vE,nolink:kh,punctuation:JS,reflink:bh,reflinkSearch:gE,tag:mE,text:GS,url:Bt},wE={...rl,emStrongLDelim:tE,emStrongRDelimAst:aE,emStrongRDelimUnd:cE,link:R(/^!?\[(label)\]\((.*?)\)/).replace("label",to).getRegex(),reflink:R(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",to).getRegex()},Jc={...rl,emStrongRDelimAst:iE,emStrongLDelim:ZS,delLDelim:lE,delRDelim:dE,url:R(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",sh).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:R(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",sh).getRegex()},yE={...Jc,br:R(gh).replace("{2,}","*").getRegex(),text:R(Jc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},eo={normal:tl,gfm:qS,pedantic:VS},Wi={normal:rl,gfm:Jc,breaks:yE,pedantic:wE},NE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ch=t=>NE[t];function Fe(t,e){if(e){if(X.escapeTest.test(t))return t.replace(X.escapeReplace,ch)}else if(X.escapeTestNoEncode.test(t))return t.replace(X.escapeReplaceNoEncode,ch);return t}function lh(t){try{t=encodeURI(t).replace(X.percentDecode,"%")}catch{return null}return t}function uh(t,e){let r=t.replace(X.findPipe,(a,o,s)=>{let c=!1,l=o;for(;--l>=0&&s[l]==="\\";)c=!c;return c?"|":" |"}),i=r.split(X.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(X.slashPipe,"|");return i}function bt(t,e,r){let i=t.length;if(i===0)return"";let n=0;for(;n<i;){let a=t.charAt(i-n-1);if(a===e&&!r)n++;else if(a!==e&&r)n++;else break}return t.slice(0,i-n)}function dh(t){let e=t.split(`
210
+ `),r=e.length-1;for(;r>=0&&X.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(`
211
+ `)}function bE(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])r++;else if(t[i]===e[1]&&(r--,r<0))return i;return r>0?-2:-1}function kE(t,e=0){let r=e,i="";for(let n of t)if(n===" "){let a=4-r%4;i+=" ".repeat(a),r+=a}else i+=n,r++;return i}function fh(t,e,r,i,n){let a=e.href,o=e.title||null,s=t[1].replace(n.other.outputLinkReplace,"$1"),c=t[0].charAt(0)==="!";i.state.inLink=!0;let l=i.state.linkEmitted,u=i.state.inRawBlock;i.state.linkEmitted=!1;let d=i.inlineTokens(s),f=i.state.linkEmitted;if(i.state.linkEmitted=l,i.state.inLink=!1,!c){if(f){i.state.inRawBlock=u;return}i.state.linkEmitted=!0}return{type:c?"image":"link",raw:r,href:a,title:o,text:s,tokens:d}}function SE(t,e,r){let i=t.match(r.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
212
+ `).map(a=>{let o=a.match(r.other.beginningSpace);if(o===null)return a;let[s]=o;return s.length>=n.length?a.slice(n.length):a}).join(`
213
+ `)}var ro=class{options;rules;lexer;constructor(t){this.options=t||Ft}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:dh(e[0]),i=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:i}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],i=SE(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let i=bt(r,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(r=i.trim())}return{type:"heading",raw:bt(e[0],`
214
+ `),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:bt(e[0],`
215
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=bt(e[0],`
216
+ `).split(`
217
+ `),i="",n="",a=[];for(;r.length>0;){let o=!1,s=[],c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))s.push(r[c]),o=!0;else if(!o)s.push(r[c]);else break;r=r.slice(c);let l=s.join(`
218
+ `),u=l.replace(this.rules.other.blockquoteSetextReplace,`
219
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
220
+ ${l}`:l,n=n?`${n}
221
+ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,a,!0),this.lexer.state.top=d,r.length===0)break;let f=a.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let h=f,v=r.join(`
222
+ `),p=h.raw+`
223
+ `+v.replace(this.rules.other.blockquoteSetextReplace2,""),m=this.blockquote(p);a[a.length-1]=m,i=`${i}
224
+ ${v}`,n=n.substring(0,n.length-h.text.length)+m.text;break}else if(f?.type==="list"){let h=f,v=h.raw+`
225
+ `+r.join(`
226
+ `),p=this.list(v);a[a.length-1]=p,i=i.substring(0,i.length-f.raw.length)+p.raw,n=n.substring(0,n.length-h.raw.length)+p.raw,r=v.substring(a.at(-1).raw.length).split(`
227
+ `);continue}}return{type:"blockquote",raw:i,tokens:a,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim(),i=r.length>1,n={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");let a=this.rules.other.listItemRegex(r),o=!1;for(;t;){let c=!1,l="",u="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;l=e[0],t=t.substring(l.length);let d=kE(e[2].split(`
228
+ `,1)[0],e[1].length),f=t.split(`
229
+ `,1)[0],h=!d.trim(),v=0;if(this.options.pedantic?(v=2,u=d.trimStart()):h?v=e[1].length+1:(v=d.search(this.rules.other.nonSpaceChar),v=v>4?1:v,u=d.slice(v),v+=e[1].length),h&&this.rules.other.blankLine.test(f)&&(l+=f+`
230
+ `,t=t.substring(f.length+1),c=!0),!c){let p=this.rules.other.nextBulletRegex(v),m=this.rules.other.hrRegex(v),g=this.rules.other.fencesBeginRegex(v),y=this.rules.other.headingBeginRegex(v),N=this.rules.other.htmlBeginRegex(v),S=this.rules.other.blockquoteBeginRegex(v);for(;t;){let x=t.split(`
231
+ `,1)[0],E;if(f=x,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),E=f):E=f.replace(this.rules.other.tabCharGlobal," "),g.test(f)||y.test(f)||N.test(f)||S.test(f)||p.test(f)||m.test(f))break;if(E.search(this.rules.other.nonSpaceChar)>=v||!f.trim())u+=`
232
+ `+E.slice(v);else{if(h||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(d)||y.test(d)||m.test(d))break;u+=`
233
+ `+f}h=!f.trim(),l+=x+`
234
+ `,t=t.substring(x.length+1),d=E.slice(v)}}n.loose||(o?n.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(o=!0)),n.items.push({type:"list_item",raw:l,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),n.raw+=l}let s=n.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c of n.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!n.loose){let l=c.tokens.filter(d=>d.type==="space"),u=l.length>0&&l.some(d=>this.rules.other.anyLine.test(d.raw));n.loose=u}for(let c of n.items){let l=c.tokens[0];if(c.task&&(l?.type==="text"||l?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),l.raw=l.raw.replace(this.rules.other.listReplaceTask,""),l.text=l.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let d={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=d.checked,n.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=d.raw+c.tokens[0].raw,c.tokens[0].text=d.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(d)):c.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):c.tokens.unshift(d)}}else c.task&&(c.task=!1)}if(n.loose)for(let c of n.items){c.loose=!0;for(let l of c.tokens)l.type==="text"&&(l.type="paragraph")}return n}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=dh(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:bt(e[0],`
235
+ `),href:i,title:n}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=uh(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
236
+ `):[],a={type:"table",raw:bt(e[0],`
237
+ `),header:[],align:[],rows:[]};if(r.length===i.length){for(let o of i)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<r.length;o++)a.header.push({text:r[o],tokens:this.lexer.inline(r[o]),header:!0,align:a.align[o]});for(let o of n)a.rows.push(uh(o,a.header.length).map((s,c)=>({text:s,tokens:this.lexer.inline(s),header:!1,align:a.align[c]})));return a}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:bt(e[0],`
238
+ `),depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
239
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let a=bt(r.slice(0,-1),"\\");if((r.length-a.length)%2===0)return}else{let a=bE(e[2],"()");if(a===-2)return;if(a>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],n="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(i);a&&(i=a[1],n=a[3])}else n=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i=i.slice(1):i=i.slice(1,-1)),fh(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let i=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[i.toLowerCase()];if(!n){let a=r[0].charAt(0);return{type:"text",raw:a,text:a}}return fh(r,n,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!r||this.rules.inline.punctuation.exec(r))){let n=[...i[0]].length-1,a,o,s=n,c=0,l=i[0][0],u=r===l,d=l==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*t.length+n);(i=d.exec(e))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){s+=o;continue}else if(i[5]||i[6]){if(n%3&&!((n+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let f=[...i[0]][0].length,h=t.slice(0,n+i.index+f+o);if(Math.min(n,o)%2){let p=h.slice(1,-1);return{type:"em",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}let v=h.slice(2,-2);return{type:"strong",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return i&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let i=this.rules.inline.delLDelim.exec(t);if(i&&(!i[1]||!r||this.rules.inline.punctuation.exec(r))){let n=[...i[0]].length-1,a,o,s=n,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*t.length+n);(i=c.exec(e))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a||(o=[...a].length,o!==n))continue;if(i[3]||i[4]){s+=o;continue}if(s-=o,s>0)continue;o=Math.min(o,o+s);let l=[...i[0]][0].length,u=t.slice(0,n+i.index+l+o),d=u.slice(n,-n);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,i;return e[2]==="@"?(r=e[1],i="mailto:"+r):(r=e[1],i=r),{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},ge=class Uc{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ft,this.options.tokenizer=this.options.tokenizer||new ro,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let r={other:X,block:eo.normal,inline:Wi.normal};this.options.pedantic?(r.block=eo.pedantic,r.inline=Wi.pedantic):this.options.gfm&&(r.block=eo.gfm,this.options.breaks?r.inline=Wi.breaks:r.inline=Wi.gfm),this.tokenizer.rules=r}static get rules(){return{block:eo,inline:Wi}}static lex(e,r){return new Uc(r).lex(e)}static lexInline(e,r){return new Uc(r).inlineTokens(e)}lex(e){e=e.replace(X.carriageReturn,`
240
+ `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let i=this.inlineQueue[r];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],i=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(X.tabCharGlobal," ").replace(X.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let a;if(this.options.extensions?.block?.some(s=>(a=s.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let s=r.at(-1);a.raw.length===1&&s!==void 0?s.raw+=`
241
+ `:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
242
+ `)?"":`
243
+ `)+a.raw,s.text+=`
244
+ `+a.text,this.inlineQueue.at(-1).src=s.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
245
+ `)?"":`
246
+ `)+a.raw,s.text+=`
247
+ `+a.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},r.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),r.push(a);continue}let o=e;if(this.options.extensions?.startBlock){let s=1/0,c=e.slice(1),l;this.options.extensions.startBlock.forEach(u=>{l=u.call({lexer:this},c),typeof l=="number"&&l>=0&&(s=Math.min(s,l))}),s<1/0&&s>=0&&(o=e.substring(0,s+1))}if(this.state.top&&(a=this.tokenizer.paragraph(o))){let s=r.at(-1);i&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
248
+ `)?"":`
249
+ `)+a.raw,s.text+=`
250
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(a),i=o.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let s=r.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
251
+ `)?"":`
252
+ `)+a.raw,s.text+=`
253
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}linkInText(e){if(!e.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let i of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(i[0])&&e.charAt(i.index-1)!=="!")return!0;for(let i of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let n=i[0],a=n.lastIndexOf("[");if(!(n.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,n.slice(a+1,-1)))&&!(a>1&&this.linkInText(n.slice(1,a-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let i=e;if(this.tokens.links&&e.includes("[")){let s=this.tokenizer.rules.inline.reflinkSearch,c=l=>{let u=l.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,l.slice(u+1,-1)))return l;if(u>1&&l.charAt(0)!=="!"){let d=l.slice(1,u-1);if(this.linkInText(d))return"["+d.replace(s,c)+"]["+"a".repeat(l.length-u-2)+"]"}return"["+"a".repeat(l.length-2)+"]"};i=i.replace(s,c)}i=i.replace(this.tokenizer.rules.inline.anyPunctuation,s=>"+".repeat(s.length)),i=i.replace(this.tokenizer.rules.inline.blockSkip,(s,c,l)=>{let u=l?l.length:0;return s.slice(0,u)+"["+"a".repeat(s.length-u-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let n=!1,a="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}n||(a=""),n=!1;let s;if(this.options.extensions?.inline?.some(l=>(s=l.call({lexer:this},e,r))?(e=e.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);let l=r.at(-1);s.type==="text"&&l?.type==="text"?(l.raw+=s.raw,l.text+=s.text):r.push(s);continue}if(s=this.tokenizer.emStrong(e,i,a)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.del(e,i,a)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),r.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),r.push(s);continue}let c=e;if(this.options.extensions?.startInline){let l=1/0,u=e.slice(1),d;this.options.extensions.startInline.forEach(f=>{d=f.call({lexer:this},u),typeof d=="number"&&d>=0&&(l=Math.min(l,d))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(s=this.tokenizer.inlineText(c)){e=e.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(a=s.raw.slice(-1)),n=!0;let l=r.at(-1);l?.type==="text"?(l.raw+=s.raw,l.text+=s.text):r.push(s);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw new Error(r)}},io=class{options;parser;constructor(t){this.options=t||Ft}space(t){return""}code({text:t,lang:e,escaped:r}){let i=(e||"").match(X.notSpaceStart)?.[0],n=t.replace(X.endingNewline,"")+`
254
+ `;return i?'<pre><code class="language-'+Fe(i)+'">'+(r?n:Fe(n,!0))+`</code></pre>
255
+ `:"<pre><code>"+(r?n:Fe(n,!0))+`</code></pre>
256
+ `}blockquote({tokens:t}){return`<blockquote>
257
+ ${this.parser.parse(t)}</blockquote>
258
+ `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
259
+ `}hr(t){return`<hr>
260
+ `}list(t){let e=t.ordered,r=t.start,i="";for(let o=0;o<t.items.length;o++){let s=t.items[o];i+=this.listitem(s)}let n=e?"ol":"ul",a=e&&r!==1?' start="'+r+'"':"";return"<"+n+a+`>
261
+ `+i+"</"+n+`>
262
+ `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
263
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
264
+ `}table(t){let e="",r="";for(let n=0;n<t.header.length;n++)r+=this.tablecell(t.header[n]);e+=this.tablerow({text:r});let i="";for(let n=0;n<t.rows.length;n++){let a=t.rows[n];r="";for(let o=0;o<a.length;o++)r+=this.tablecell(a[o]);i+=this.tablerow({text:r})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
265
+ <thead>
266
+ `+e+`</thead>
267
+ `+i+`</table>
268
+ `}tablerow({text:t}){return`<tr>
269
+ ${t}</tr>
270
+ `}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
271
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Fe(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let i=this.parser.parseInline(r),n=lh(t);if(n===null)return i;t=n;let a='<a href="'+t+'"';return e&&(a+=' title="'+Fe(e)+'"'),a+=">"+i+"</a>",a}image({href:t,title:e,text:r,tokens:i}){i&&(r=this.parser.parseInline(i,this.parser.textRenderer));let n=lh(t);if(n===null)return Fe(r);t=n;let a=`<img src="${t}" alt="${Fe(r)}"`;return e&&(a+=` title="${Fe(e)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Fe(t.text)}},il=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},_e=class Kc{options;renderer;textRenderer;constructor(e){this.options=e||Ft,this.options.renderer=this.options.renderer||new io,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new il}static parse(e,r){return new Kc(r).parse(e)}static parseInline(e,r){return new Kc(r).parseInline(e)}parse(e){this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let o=n,s=this.options.extensions.renderers[o.type].call({parser:this},o);if(s!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){r+=s||"";continue}}let a=n;switch(a.type){case"space":{r+=this.renderer.space(a);break}case"hr":{r+=this.renderer.hr(a);break}case"heading":{r+=this.renderer.heading(a);break}case"code":{r+=this.renderer.code(a);break}case"table":{r+=this.renderer.table(a);break}case"blockquote":{r+=this.renderer.blockquote(a);break}case"list":{r+=this.renderer.list(a);break}case"checkbox":{r+=this.renderer.checkbox(a);break}case"html":{r+=this.renderer.html(a);break}case"def":{r+=this.renderer.def(a);break}case"paragraph":{r+=this.renderer.paragraph(a);break}case"text":{r+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return r}parseInline(e,r=this.renderer){this.renderer.parser=this;let i="";for(let n=0;n<e.length;n++){let a=e[n];if(this.options.extensions?.renderers?.[a.type]){let s=this.options.extensions.renderers[a.type].call({parser:this},a);if(s!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(a.type)){i+=s||"";continue}}let o=a;switch(o.type){case"escape":{i+=r.text(o);break}case"html":{i+=r.html(o);break}case"link":{i+=r.link(o);break}case"image":{i+=r.image(o);break}case"checkbox":{i+=r.checkbox(o);break}case"strong":{i+=r.strong(o);break}case"em":{i+=r.em(o);break}case"codespan":{i+=r.codespan(o);break}case"br":{i+=r.br(o);break}case"del":{i+=r.del(o);break}case"text":{i+=r.text(o);break}default:{let s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return i}},zi=class{options;block;constructor(t){this.options=t||Ft}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?ge.lex:ge.lexInline}provideParser(t=this.block){return t?_e.parse:_e.parseInline}},EE=class{defaults=Yc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_e;Renderer=io;TextRenderer=il;Lexer=ge;Tokenizer=ro;Hooks=zi;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(let i of t)switch(r=r.concat(e.call(this,i)),i.type){case"table":{let n=i;for(let a of n.header)r=r.concat(this.walkTokens(a.tokens,e));for(let a of n.rows)for(let o of a)r=r.concat(this.walkTokens(o.tokens,e));break}case"list":{let n=i;r=r.concat(this.walkTokens(n.items,e));break}default:{let n=i;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(a=>{let o=n[a].flat(1/0);r=r.concat(this.walkTokens(o,e))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let a=e.renderers[n.name];a?e.renderers[n.name]=function(...o){let s=n.renderer.apply(this,o);return s===!1&&(s=a.apply(this,o)),s}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[n.level];a?a.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),r.renderer){let n=this.defaults.renderer||new io(this.defaults);for(let a in r.renderer){if(!(a in n))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,s=r.renderer[o],c=n[o];n[o]=(...l)=>{let u=s.apply(n,l);return u===!1&&(u=c.apply(n,l)),u||""}}i.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new ro(this.defaults);for(let a in r.tokenizer){if(!(a in n))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,s=r.tokenizer[o],c=n[o];n[o]=(...l)=>{let u=s.apply(n,l);return u===!1&&(u=c.apply(n,l)),u}}i.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new zi;for(let a in r.hooks){if(!(a in n))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,s=r.hooks[o],c=n[o];zi.passThroughHooks.has(a)?n[o]=l=>{if(this.defaults.async&&zi.passThroughHooksRespectAsync.has(a))return(async()=>{let d=await s.call(n,l);return c.call(n,d)})();let u=s.call(n,l);return c.call(n,u)}:n[o]=(...l)=>{if(this.defaults.async)return(async()=>{let d=await s.apply(n,l);return d===!1&&(d=await c.apply(n,l)),d})();let u=s.apply(n,l);return u===!1&&(u=c.apply(n,l)),u}}i.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,a=r.walkTokens;i.walkTokens=function(o){let s=[];return s.push(a.call(this,o)),n&&(s=s.concat(n.call(this,o))),s}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ge.lex(t,e??this.defaults)}parser(t,e){return _e.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let i={...r},n={...this.defaults,...i},a=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=t),n.async)return(async()=>{let o=n.hooks?await n.hooks.preprocess(e):e,s=await(n.hooks?await n.hooks.provideLexer(t):t?ge.lex:ge.lexInline)(o,n),c=n.hooks?await n.hooks.processAllTokens(s):s;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let l=await(n.hooks?await n.hooks.provideParser(t):t?_e.parse:_e.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(l):l})().catch(a);try{n.hooks&&(e=n.hooks.preprocess(e));let o=(n.hooks?n.hooks.provideLexer(t):t?ge.lex:ge.lexInline)(e,n);n.hooks&&(o=n.hooks.processAllTokens(o)),n.walkTokens&&this.walkTokens(o,n.walkTokens);let s=(n.hooks?n.hooks.provideParser(t):t?_e.parse:_e.parseInline)(o,n);return n.hooks&&(s=n.hooks.postprocess(s)),s}catch(o){return a(o)}}}onError(t,e){return r=>{if(r.message+=`
272
+ Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+Fe(r.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(r);throw r}}},Mt=new EE;function $(t,e){return Mt.parse(t,e)}$.options=$.setOptions=function(t){return Mt.setOptions(t),$.defaults=Mt.defaults,ph($.defaults),$};$.getDefaults=Yc;$.defaults=Ft;function xE(...t){return Mt.use(...t),$.defaults=Mt.defaults,ph($.defaults),$}$.use=xE;$.walkTokens=function(t,e){return Mt.walkTokens(t,e)};$.parseInline=Mt.parseInline;$.Parser=_e;$.parser=_e.parse;$.Renderer=io;$.TextRenderer=il;$.Lexer=ge;$.lexer=ge.lex;$.Tokenizer=ro;$.Hooks=zi;$.parse=$;var jH=$.options,OH=$.setOptions,HH=$.walkTokens,DH=$.parseInline;var LH=_e.parse,BH=ge.lex;L();Pe();G();var GE=Qe(ze(),1);Me();Pe();G();ae();O();wt();ao();ao();Er();kt();Me();ka();L();G();so();K();O();Sh();Er();kt();nl();Me();ae();nl();fr();O();var co=class extends Error{constructor(r,i,n){super(r,n);this.preparation=i;this.name="NativeWorkspacePreparationError"}preparation};Me();ae();K();Er();kt();Ma();wt();Dt();Ui();oo();K();Dc();$c();wt();Dt();L();Ht();Ui();O();Ht();Nr();ae();var Rh=Qe(ze(),1);Je();var p1=new Set("a an and are as at be by for from in is it of on or that the this to with you your".split(" "));var y1=256*1024;wt();Dt();kt();var ex=Oa("en",{compact:!0});ae();K();Er();kt();wt();Dt();Me();ka();G();Me();Je();L();var BB=8*1024*1024;so();K();Dt();O();var cM=1024*1024*1024;K();oo();Ui();kt();K();kt();K();Lc();var rq=16*1024;Ri();var fo=class extends Error{constructor(r,i,n,a){super(`Canonical spec conflict for ${r}: expected ${i??"(missing)"}, actual ${n??"(missing)"}`);this.capability=r;this.expectedHash=i;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},po=class extends Error{constructor(r,i=r.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${r.findingCodes.join(", ")}`){super(i);this.preflight=r;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};O();ae();function P(t,e,r){return t==="zh-CN"?r:e}var sl={shape:{en:"Shape (agreeing on requirements)",zh:"Shape(需求共识)"},build:{en:"Build",zh:"Build(实现)"},verify:{en:"Verify",zh:"Verify(验证)"},archive:{en:"Archive",zh:"Archive(归档)"}};function $h(t,e){return typeof t=="string"&&sl[t]?P(e,sl[t].en,sl[t].zh):typeof t=="string"?t:""}function cl(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return typeof e.total=="number"&&typeof e.passed=="number"&&typeof e.failed=="number"&&typeof e.blocked=="number"&&typeof e.pending=="number"}function nx(t){let e={total:t.length,passed:0,failed:0,blocked:0,pending:0};for(let r of t){if(!r||typeof r!="object")return null;let i=r.result;if(i!=="passed"&&i!=="failed"&&i!=="blocked"&&i!=="pending")return null;e[i]+=1}return e}function jh(t,e){let r=[];t.failed>0&&r.push(P(e,`${t.failed} failed`,`${t.failed} 项失败`)),t.blocked>0&&r.push(P(e,`${t.blocked} blocked`,`${t.blocked} 项受阻`)),t.pending>0&&r.push(P(e,`${t.pending} pending`,`${t.pending} 项待验`));let i=P(e,`acceptance ${t.passed}/${t.total} passed`,`验收 ${t.passed}/${t.total} 通过`);return r.length>0?`${i} (${r.join(", ")})`:i}function Oh(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;if(typeof e.change!="string"||e.disposition!=="continue"&&e.disposition!=="await-user"&&e.disposition!=="blocked"&&e.disposition!=="done"||e.commandArgs!==null&&e.commandArgs!==void 0&&!Array.isArray(e.commandArgs))return!1;let r=e.userCommunication;return!!(r&&typeof r=="object"&&typeof r.required=="boolean"&&(r.message===null||typeof r.message=="string")&&typeof r.agentInstruction=="string")}function ll(t){return/[\u4e00-\u9fff]/u.test(t.userCommunication.agentInstruction)?"zh-CN":"en"}function ax(t,e,r){return t==="done"?P(r,"complete","已完成"):t==="await-user"?P(r,"waiting for a user decision","等待用户决定"):t==="blocked"?P(r,"paused: needs attention","已暂停,需要处理"):e?P(r,"waiting for a user decision","等待用户决定"):P(r,"ready to continue","可继续推进")}function ox(t,e,r){let i=ll(t),n=[];r&&n.push(r);let a=P(i,`Change ${t.change}`,`需求 ${t.change}`),o=$h(t.phase,i),s=ax(t.disposition,t.userCommunication.required,i);n.push([a,o||null,s].filter(Boolean).join(" · ")),e&&e.total>0&&n.push(jh(e,i));let c=t.userCommunication,l=Hh(t,i);return{summary:n.join("; "),...l?{next:l}:{},...c.required&&c.message?{user_message:c.message}:{}}}function Hh(t,e){let r=t.userCommunication;if(t.disposition==="await-user"&&r.required)return{ask_user:P(e,"Relay the message below, wait for the user decision, then run the matching option (run with --json to see the exact alternative commands).","先转述下方信息并等待用户选择,再执行对应命令(完整候选命令以 --json 输出为准)。")};if(t.commandArgs&&t.commandArgs.length>0)return{command:t.commandArgs.join(" ")};if(t.disposition==="done")return{ask_user:P(e,"No further workflow action; report the completed change to the user.","工作流已无后续动作;向用户报告该需求已完成即可。")};if(t.disposition==="blocked")return{ask_user:r.required&&r.message?r.agentInstruction:P(e,"Resolve the paused condition before continuing; run with --json for the structured diagnosis.","先解除暂停原因再继续;结构化诊断信息以 --json 输出为准。")}}function sx(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return typeof e.total=="number"&&Array.isArray(e.items)}function cx(t,e){let r=typeof t.name=="string"?t.name:"(unnamed)",i=$h(t.phase,e),n=t.status==="await-user"?P(e,"waiting for a user decision","等待用户决定"):t.status==="blocked"?P(e,"paused","已暂停"):t.status==="done"?P(e,"complete","已完成"):P(e,"in progress","进行中"),a=cl(t.acceptance)?`${P(e,", ",",")}${jh(t.acceptance,e)}`:"";return` ${r} · ${i||String(t.phase??"?")} · ${n}${a}`}function lx(t){for(let e of t){let r=e.continuation;if(r?.userCommunication&&typeof r.userCommunication.agentInstruction=="string"&&/[\u4e00-\u9fff]/u.test(r.userCommunication.agentInstruction))return"zh-CN"}return"en"}function ux(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return typeof e.healthy!="boolean"?!1:e.findings===void 0||Array.isArray(e.findings)}function dx(t){if(t.healthy){let i=t.repaired?P("en","Diagnostics passed and the reported problem was repaired automatically.","诊断通过,报告的问题已自动修复。"):P("en","Diagnostics passed: no problems found.","诊断通过:未发现问题。"),n=fx(t.continuation);return n?{summary:i,next:n}:{summary:i}}let r=Array.isArray(t.findings)?t.findings.length:0;return{summary:P("en",r>0?`Diagnostics found ${r} problem${r===1?"":"s"} that need attention before this change can continue.`:"Diagnostics found problems that need attention before this change can continue.",r>0?`诊断发现 ${r} 个需要处理的问题,处理后该需求才能继续。`:"诊断发现需要处理的问题,处理后该需求才能继续。"),next:{ask_user:P("en","Run with --json to read the structured findings; re-run with --repair once the cause is understood.","结构化诊断以 --json 输出为准;确认原因后再用 --repair 修复。")}}}function fx(t){return Oh(t)?Hh(t,ll(t)):void 0}function Dh(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t;if(ux(e))return dx(e);if(sx(e)){let i=lx(e.items);return{summary:[e.total===e.items.length?P(i,`Native changes (${e.total})`,`Native 需求列表(共 ${e.total} 条)`):P(i,`Native changes (showing ${e.items.length} of ${e.total})`,`Native 需求列表(显示 ${e.items.length}/${e.total} 条)`),...e.items.map(a=>cx(a,i))].join(`
273
+ `)}}let r=e.continuation;if(Oh(r)){let i=ll(r),n=ox(r,px(e),mx(e,i));return hx(e)==="unconfirmed"?{...n,summary:`${n.summary}${P(i,"; the dispatched Verifier has not confirmed startup yet — verify the subagent actually launched before waiting on it",";已派发的 Verifier 尚未确认启动——先核实子代理确实启动,再继续等待")}`}:n}if(typeof e.artifactRoot=="string"&&typeof e.nativeRoot=="string"){let i=e.language==="zh-CN"?"zh-CN":"en",n="pendingRootMove"in e;return{summary:P(i,n?`Comet Native artifacts live under ${e.artifactRoot} (state root: ${e.nativeRoot}).`:`Initialized Comet Native at ${e.nativeRoot} (artifacts: ${e.artifactRoot}).`,n?`Comet Native 产物位于 ${e.artifactRoot}(状态根目录:${e.nativeRoot})。`:`Comet Native 已初始化于 ${e.nativeRoot}(产物目录:${e.artifactRoot})。`)}}}function px(t){if(cl(t.acceptance))return t.acceptance;let e=t.state;if(e&&typeof e=="object"&&!Array.isArray(e)){let r=e;if(cl(r.acceptance))return r.acceptance;if(Array.isArray(r.acceptance))return nx(r.acceptance)}return null}function hx(t){let e=t.localExecution;if(!e||typeof e!="object"||Array.isArray(e))return;let r=e.verifierStartup;if(!(!r||typeof r!="object"||Array.isArray(r)))return r.confirmation}function mx(t,e){if(t.selected!==void 0&&typeof t.selected=="string")return P(e,`Selected ${t.selected}.`,`已选择需求 ${t.selected}。`);let r=t.migration;return r&&typeof r=="object"&&r.completed===!0?P(e,"Upgraded this change to the current Native format.","已将该需求升级到当前 Native 格式。"):null}function Lh(t){let r=t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?t.data:{};switch(t.code){case"document-invalid":return{summary:t.message,...typeof r.change=="string"?{next:{command:`comet native next ${r.change} --summary <summary>`}}:{}};case"conflict":return{summary:P("en","This change was updated elsewhere while the command ran, so the command stopped without changing anything. Nothing was lost — reload the latest state and continue from there.","这条需求刚被另一个会话更新,本次命令未做任何改动。没有工作丢失——重新读取最新状态后继续即可。"),...typeof r.change=="string"?{next:{command:`comet native status ${r.change} --json`}}:{}};case"baseline-incomplete":return{summary:P("en","The safety snapshot for this change exceeded its configured size budget, so the command stopped before changing anything. Raise the snapshot limits in .comet/config.yaml or exclude out-of-scope data, then retry.","该需求的安全快照超出配置的容量预算,命令在改动任何内容前已停止。请在 .comet/config.yaml 中调高快照上限,或将范围外的数据加入排除列表后重试。"),next:{ask_user:P("en","Run with --json to see the exact limits, omitted paths, and supported fixes.","具体上限、被省略的路径和支持的修复方式以 --json 输出为准。")}};case"workspace-isolation-required":return{summary:P("en","This change runs in its own Git worktree to keep work isolated. Create the linked worktree first, then continue inside it.","这条需求需要在独立的 Git worktree 中执行以保证隔离。请先创建关联的 worktree,然后在其中继续。"),next:{ask_user:P("en","Run with --json to see the exact worktree creation command.","完整的 worktree 创建命令以 --json 输出为准。")}};case"workspace-preparation-incomplete":return{summary:P("en","The change workspace is not fully prepared (for example a branch or worktree is missing). Finish the preparation steps, then retry.","需求的工作区尚未准备完成(例如分支或 worktree 缺失)。请先完成准备步骤,再重试。"),next:{ask_user:P("en","Run with --json to see the remaining preparation steps.","剩余的准备步骤以 --json 输出为准。")}};case"implementation-scope-stale":return{summary:P("en","The recorded implementation scope no longer matches the current files. Refresh the scope, then retry.","记录的实现范围与当前文件不再一致。请刷新范围后重试。"),next:{ask_user:P("en","Run with --json to see the exact recovery steps.","具体恢复步骤以 --json 输出为准。")}};default:return}}La();Ma();var Bh=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--verbose Append the raw machine projection after the human/agent text.","--help Show help without requiring an initialized project."],ul=Object.freeze({"":{usage:"comet native <command> [options]",purpose:"Create, inspect, recover, and archive portable Native changes through Runtime-enforced, skill-coordinated steps.",agentQuickStart:["Run `comet native status --json` to discover active changes.","Select an existing change with `select`, or create one with `new`.","In `agent.workspace.cwd`, execute the exact `agent.continuation.commandArgs` returned by Runtime.","Use `agent.continuation.inputOptions` templates for JSON input; do not reconstruct fields from memory."],subcommands:["init Initialize Native project configuration.","root show Inspect the configured artifact root.","root move <artifact-root> Move the configured artifact root.","new <change-name> Create a change and prepare its workspace.","spec disassociate Revoke a capability association through Runtime.","spec remove Record a complete capability removal intent.","spec sync <change-name> <capability> --input <json-file> Audit local Markdown reference corrections.","show <change-name> Read formal artifacts and portable state.","status [<change-name>] Discover stable boundaries and Runner actions.","select <change-name> Select a change in its bound workspace.","next <change-name> Confirm or recover a stable workflow boundary.","archive <change-name> Preview and execute Archive plus workspace finish.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:Bh,output:"A human summary plus a NEXT step by default (RELAY TO USER blocks carry user decisions); use --json for the structured envelope, --verbose to append the raw machine projection.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--task <text>] [--capability <id>] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--task <text> Search Project Knowledge for an existing capability and save a revocable association draft.","--capability <id> Directly validate and associate an existing capability without retrieval.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, canonical artifact paths, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN",'comet native new add-sms-login --task "add SMS login to authentication"',"comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:`comet native spec disassociate <change-name> --expected-state-version <n> --expected-action disassociate-capability
193
274
  comet native spec remove <change-name> <capability>
194
275
  comet native spec sync <change-name> <capability> --input <json-file>`,purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["disassociate <change-name> Revoke a capability association and return to Shape.","remove <change-name> <capability> Record a capability removal.","sync <change-name> <capability> --input <json-file> Audit local Markdown reference corrections without changing prose or acceptance."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},"spec disassociate":{usage:"comet native spec disassociate <change-name> --expected-state-version <n> --expected-action disassociate-capability",purpose:"Revoke a capability association through Runtime without hand-editing artifacts.",options:["--expected-state-version <n> State version returned by the latest status response.","--expected-action <action> Must be disassociate-capability."],output:"The updated portable state and continuation with the next Runner action."},"spec sync":{usage:"comet native spec sync <change-name> <capability> --input <json-file>",purpose:"Sync local Markdown link destinations in an already confirmed target spec; semantic edits require Shape.",options:["--input <json-file> Fields: expectedStateVersion, actor, reason, affectedAcceptanceIds, replacements [{from,to}]. Include all acceptance IDs from the affected spec."],output:"The audited portable state, preserved unaffected acceptance results and Build continuation for re-verification."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"A compact summary and NEXT action by default. Use --json to read canonical artifact paths, the portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required. Fill command-template placeholders before executing NEXT commands."},check:{usage:"comet native check <change-name>",purpose:"Legacy-only verification command; not supported for current portable changes.",output:"For current changes, run comet native status <change-name> --json and follow the continuation to dispatch verification through comet native next."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries, parent child readiness, or the exact next Runner action.",options:["--cursor <token> Continue a status-list page, or a named details/history page.","--details Include one fixed-size page of acceptance, Spec, handoff, verification, history, workspace, and report details."],output:"A compact v2 status page or one compact Loop projection with canonical artifact paths and local execution availability. Use --details and --cursor to read fixed-size detail pages; parent changes expose childSummary and readyChildren.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--coordination-mode multi-session|single-session] [--max-parallel <n>] [--expected-state-version <n>] [--expected-action <action>]
195
276
  comet native next <change-name> --summary <text> [--confirmed|--accept-result|--revise-implementation|--revise-requirements|--retry-verifier|--resolve-verifier-blocker] [--expected-state-version <n>] [--expected-action <action>]
196
- comet native next <change-name> --runner-input <json-file> [--validate-only]`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, handle Supervisor task operations, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm the persisted Shape boundary with both expected guards, or confirm an explicitly degraded verifier-unavailable fallback before Archive.","--coordination-mode multi-session|single-session Select how a multi-child Supervisor proceeds while preparing its Shape confirmation; final Shape confirmation is a later, separate step.","--accept-result Accept the current skill-coordinated Verify result and make it archive-ready.","--revise-implementation Keep confirmed requirements unchanged and return Verify to Build for implementation revision.","--revise-requirements Return Verify or Archive to Shape when user-visible goals or acceptance criteria must change.","--retry-verifier Retry a failed or unavailable Verifier when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--max-parallel <n> Supervisor task concurrency cap; defaults to 2, use 1 for serial fallback.","--expected-state-version <n> Continuation-issued guard that rejects stale public transition decisions.","--expected-action <action> Continuation-issued guard that binds the public transition decision to its intended action.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, retry-checks, verifier-response, verifier-started, verifier-execution-error, or verifier-unavailable. Builder/dispatch identity fields are rejected; verifier responses must echo the current candidateId and verifierExecutionRef from the Verifier dispatch.","--validate-only Validate the Runner JSON shape and current boundary without writing state or starting a process; requires --runner-input."," Choose one object template from an inputOptions exclusiveGroup and save it as UTF-8 JSON (BOM accepted). Field errors return issues with JSON pointer, missingFields and unknownFields. Execute agent.continuation in agent.workspace.cwd; Supervisor results use task.returnAction."," builder-handoff fields: kind, summary, addressed_acceptance_ids, checks, verification_checks, known_limits, optional review. checks summarize development feedback. verification_checks is an optional Runtime plan executed after the candidate is frozen; a passing plan is reused without executing the same plan twice when dispatch-verifier receives the unchanged plan. If review is supplied, its fields are status=passed, summary, reviewer_execution_ref from a separate read-only review."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," retry-checks fields: kind, check_ids for repeatable interrupted Runtime checks from the current candidate; each check can be retried at most three times."," verifier-response fields: kind, candidateId, verifierExecutionRef, response (request-checks or final-result); copy the two binding fields from the current continuation."," verifier-started fields: kind, candidateId, verifierExecutionRef copied from verifierDispatch; the dispatched Verifier submits it as its first Runtime action so status can distinguish a registered dispatch from a Verifier that actually started. Repeating it is accepted without side effects."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."," Supervisor task fields: supervisor-builder-result (child, runId, candidateCommit), supervisor-builder-failure (child, runId, reason), supervisor-verifier-result (child, runId, verdict, verification data), supervisor-reconnect (child, runId), supervisor-cancel (child, runId, reason), or supervisor-integrate (child, checks)."," supervisor-checks fields: kind, child, runId, checks (non-empty repeatable Runtime check plans), materials [{name,content}], and optional retry_check_ids for interrupted checks from the same candidate, machine and workspace. Returns per-check execution state plus operationId, status and receiptRef. Repeated running plans return the same handle."," supervisor-verifier-result evidence fields: summary, checks (informal notes), acceptance [{id,result,reason}], receiptRef. verdict is pass, fail or blocked; every task acceptance ID must appear exactly once. Runtime receipts determine formal check status; receiptRef may be null for fail or blocked."," supervisor-integrate checks are non-empty Runtime check plans executed after the merge in the integration worktree, not declared statuses."],output:'A compact portable state summary, explicit skill-coordinated label, Runtime-owned check results, scoped verifierDispatch, bounded request-check response, continuation.runnerAction, machine-readable continuation.inputOptions, and continuation.userCommunication with a user-ready message and Agent relay guidance. Read acceptance text and other long fields from paged status --details output. Human-readable verification statuses include "Host independently verified", "Checks completed, but your confirmation is required", "Full verification was unavailable; only automatic checks completed", and "You accepted the incomplete verification result". This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.',examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed --expected-state-version <n> --expected-action confirm-shape','comet native next session-timeout --summary "Current result accepted" --accept-result','comet native next session-timeout --summary "Implementation needs revision" --revise-implementation','comet native next session-timeout --summary "Acceptance criteria changed" --revise-requirements','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep]
197
- comet native archive <change-name> [--confirmed] [--serial-first <current-change>]`,purpose:"Preview or execute deterministic Archive after the portable state reaches archive-ready.",options:["--dry-run Run the complete read-only Archive and workspace-finish readiness check; it persists only an explicit --finish choice.","--finish <action> Persist merge, push, pull-request, or keep for an isolated workspace.","--serial-first <current-change> During execution only, confirm that this change archives before detected capability peers; the value must equal <change-name>.","--confirmed Confirm Archive when project policy requires it."],output:"Readiness, every blocker, and the exact next continuation, or the completed Archive transaction and workspace finish result. Execute the returned confirmed command only after ready is true; Archive does not repeat verification."},doctor:{usage:"comet native doctor [<change-name>] [--repair]",purpose:"Inspect portable state, migrate a legacy active change, or rebuild its local execution overlay.",options:["--repair Apply deterministic migration or rebuild from the portable stable boundary."],output:"Health, migration or recovery details, and the continuation with the next Runner action."}});function xa(e,t){return`${e}:
198
- ${t.map(r=>` ${r}`).join(`
199
- `)}`}function jk(e){let t=e.filter(i=>i!=="--help");if(t.length===0)return"";let r=t.slice(0,2).join(" ");return pc[r]||t.length>1&&pc[t[0]]?.subcommands?r:t[0]}function $k(e=[]){let t=jk(e),r=pc[t];if(!r)throw new Error(`Unknown Native help topic: ${t}`);let i=[`Usage: ${r.usage}`,"",r.purpose];r.agentQuickStart&&i.push("",xa("Agent Quick Start",r.agentQuickStart)),r.subcommands&&i.push("",xa("Commands",r.subcommands));let n=t===""?r.options:[...r.options??[],...yp];return n&&n.length>0&&i.push("",xa("Options",n)),i.push("",`Output:
200
- ${r.output}`),r.examples&&i.push("",xa("Examples",r.examples)),t===""&&i.push("","Run `comet native <command> --help` for command-specific details."),{topic:t,usage:`${i.join(`
277
+ comet native next <change-name> --runner-input <json-file> [--validate-only]`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, handle Supervisor task operations, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm the persisted Shape boundary with both expected guards, or confirm an explicitly degraded verifier-unavailable fallback before Archive.","--coordination-mode multi-session|single-session Choose how a multi-child Supervisor proceeds. Supply it with --confirmed at the persisted Shape boundary to confirm the full plan and mode together, or select it during preparation and confirm the plan afterward.","--accept-result Accept the current skill-coordinated Verify result and make it archive-ready.","--finish keep|merge|push|pull-request With --accept-result, record the explicitly chosen isolated-workspace finish in the same guarded decision.","--revise-implementation Keep confirmed requirements unchanged and return Verify to Build for implementation revision.","--revise-requirements Return Verify or Archive to Shape when user-visible goals or acceptance criteria must change.","--retry-verifier Retry a failed or unavailable Verifier when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--max-parallel <n> Supervisor task concurrency cap; defaults to 2, use 1 for serial fallback.","--expected-state-version <n> Continuation-issued guard that rejects stale public transition decisions.","--expected-action <action> Continuation-issued guard that binds the public transition decision to its intended action.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, retry-checks, verifier-response, verifier-started, verifier-execution-error, or verifier-unavailable. Builder/dispatch identity fields are rejected; verifier responses must echo the current candidateId and verifierExecutionRef from the Verifier dispatch.","--validate-only Validate the Runner JSON shape and current boundary without writing state or starting a process; requires --runner-input."," Choose one object template from an inputOptions exclusiveGroup and save it as UTF-8 JSON (BOM accepted). Field errors return issues with JSON pointer, missingFields and unknownFields. Execute agent.continuation in agent.workspace.cwd; Supervisor results use task.returnAction."," builder-handoff fields: kind, summary, addressed_acceptance_ids, acceptance_review, checks, verification_checks, known_limits, optional review. acceptance_review must cover every confirmed ID exactly once with id, status, evidence (concrete references or observations), and note. Only implemented-with-evidence with nonempty evidence is ready for handoff; implemented-no-evidence, not-implemented, and known-fail remain in Build. This Builder declaration does not replace independent verification. checks summarize development feedback. verification_checks is an optional Runtime plan executed after the candidate is frozen; a passing plan returns the Verifier dispatch immediately. Completed Runtime checks can carry to a new candidate only when the implementation, confirmed documents, plan, workspace, environment, and saved evidence still match. If review is supplied, its fields are status=passed, summary, reviewer_execution_ref from a separate read-only review."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," retry-checks fields: kind, check_ids for repeatable interrupted Runtime checks from the current candidate; each check can be retried at most three times."," verifier-response fields: kind, candidateId, verifierExecutionRef, response (request-checks or final-result); copy the two binding fields from the current continuation."," verifier-started fields: kind, candidateId, verifierExecutionRef copied from verifierDispatch; the dispatched Verifier submits it as its first Runtime action so status can distinguish a registered dispatch from a Verifier that actually started. Repeating it is accepted without side effects."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."," Supervisor task fields: supervisor-builder-result (child, runId, candidateCommit), supervisor-builder-failure (child, runId, reason), supervisor-verifier-result (child, runId, verdict, verification data), supervisor-reconnect (child, runId), supervisor-cancel (child, runId, reason), or supervisor-integrate (child, checks)."," supervisor-checks fields: kind, child, runId, checks (non-empty repeatable Runtime check plans), materials [{name,content}], and optional retry_check_ids for interrupted checks from the same candidate, machine and workspace. Returns per-check execution state plus operationId, status and receiptRef. Repeated running plans return the same handle."," supervisor-verifier-result evidence fields: summary, checks (informal notes), acceptance [{id,result,reason}], receiptRef. verdict is pass, fail or blocked; every task acceptance ID must appear exactly once. Runtime receipts determine formal check status; receiptRef may be null for fail or blocked."," supervisor-integrate checks are non-empty Runtime check plans executed after the merge in the integration worktree, not declared statuses."],output:'A compact portable state summary, explicit skill-coordinated label, Runtime-owned check results, scoped verifierDispatch, bounded request-check response, continuation.runnerAction, machine-readable continuation.inputOptions, and continuation.userCommunication with a user-ready message and Agent relay guidance. Read acceptance text and other long fields from paged status --details output. Human-readable verification statuses include "Host independently verified", "Checks completed, but your confirmation is required", "Full verification was unavailable; only automatic checks completed", and "You accepted the incomplete verification result". This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.',examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed --expected-state-version <n> --expected-action confirm-shape','comet native next session-timeout --summary "Current result accepted" --accept-result','comet native next session-timeout --summary "Implementation needs revision" --revise-implementation','comet native next session-timeout --summary "Acceptance criteria changed" --revise-requirements','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep] [--commit-message <text>] [--merge-message <text>]
278
+ comet native archive <change-name> [--confirmed] [--serial-first <current-change>] [--commit-message <text>] [--merge-message <text>]`,purpose:"Preview or execute deterministic Archive after the portable state reaches archive-ready.",options:["--dry-run Run the complete read-only Archive and workspace-finish readiness check; it persists only an explicit --finish choice.","--finish <action> Persist merge, push, pull-request, or keep for an isolated workspace.","--expected-state-version <n> Preserve this continuation-issued guard when confirming a new finish choice; stale choices are rejected before it is recorded.","--commit-message <text> Set the archive commit message; Unicode and multiline text are supported. Git hooks still run.","--merge-message <text> Set the local merge commit message; requires merge finish. Omit it to use Git defaults.","--serial-first <current-change> During execution only, confirm that this change archives before detected capability peers; the value must equal <change-name>.","--confirmed Confirm Archive when project policy requires it."],output:"Readiness, every blocker, actual prepared commitMessages (mergeMessage is null when no merge is planned), and the exact next continuation, or the completed Archive transaction and workspace finish result. Messages are retained for retries. After a Git hook rejects a message, provide a corrected message with --confirmed for the unfinished step; completed commits are never rewritten. Execute the returned confirmed command only after ready is true; Archive does not repeat verification."},doctor:{usage:"comet native doctor [<change-name>] [--repair]",purpose:"Inspect portable state, migrate a legacy active change, or rebuild its local execution overlay.",options:["--repair Apply deterministic migration or rebuild from the portable stable boundary."],output:"Health, migration or recovery details, and the continuation with the next Runner action."}});function ho(t,e){return`${t}:
279
+ ${e.map(r=>` ${r}`).join(`
280
+ `)}`}function vx(t){let e=t.filter(i=>i!=="--help");if(e.length===0)return"";let r=e.slice(0,2).join(" ");return ul[r]||e.length>1&&ul[e[0]]?.subcommands?r:e[0]}function gx(t=[]){let e=vx(t),r=ul[e];if(!r)throw new Error(`Unknown Native help topic: ${e}`);let i=[`Usage: ${r.usage}`,"",r.purpose];r.agentQuickStart&&i.push("",ho("Agent Quick Start",r.agentQuickStart)),r.subcommands&&i.push("",ho("Commands",r.subcommands));let n=e===""?r.options:[...r.options??[],...Bh];return n&&n.length>0&&i.push("",ho("Options",n)),i.push("",`Output:
281
+ ${r.output}`),r.examples&&i.push("",ho("Examples",r.examples)),e===""&&i.push("","Run `comet native <command> --help` for command-specific details."),{topic:e,usage:`${i.join(`
201
282
  `)}
202
- `}}var Ok=$k().usage;var $F=10*1024*1024,Ie=class extends Error{};function mc(e,t){let r=e.flatMap((i,n)=>i===t?[n]:[]);if(r.length>1)throw new Ie(`${t} may only be provided once`);return r.length===0?!1:(e.splice(r[0],1),!0)}function bp(e,t){let r=e.flatMap((a,o)=>a===t?[o]:[]);if(r.length>1)throw new Ie(`${t} may only be provided once`);if(r.length===0)return;let i=r[0],n=e[i+1];if(n===void 0||n.startsWith("--"))throw new Ie(`${t} requires a value`);return e.splice(i,2),n}function vc(e){if(e.length>0)throw new Ie(`Unexpected argument: ${e[0]}`)}function gc(e,t){let r=e.shift();if(!r||r.startsWith("--"))throw new Ie(`${t} is required`);return r}function hc(e,t){let r=Ci.normalize(Np(e)),i=Ci.normalize(Np(t));return process.platform==="win32"?r.toLowerCase()===i.toLowerCase():r===i}function Np(e){let t=Ci.resolve(e);try{return Hk.native(t)}catch{return t}}function Dk(e){let t=Ci.resolve(e),r=we(process.cwd());if(!r.isSecondaryWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null)return t;let i=we(t);return!i.isGitWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null||!hc(r.primaryWorktreeRoot,i.primaryWorktreeRoot)||hc(r.currentWorktreeRoot,i.currentWorktreeRoot)?t:hc(process.cwd(),r.currentWorktreeRoot)?Ci.resolve(process.cwd()):r.currentWorktreeRoot}async function kp(e){return e?Dk(e):Ps(process.cwd())}function Sp(e){return JSON.stringify(e,null,2)+`
203
- `}function wc(e,t,r){return{command:e,exitCode:0,data:t,text:r??Sp(t)}}function Lk(e,t){if(t instanceof ga)return{command:e,exitCode:65,error:{code:"invalid-data",message:t.message,issues:t.issues}};if(t instanceof Ie)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof Sa)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof Ea)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof ua)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof mi)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof Na)return{command:e,exitCode:73,data:{preparation:t.preparation},error:{code:"workspace-preparation-incomplete",message:t.message}};if(t instanceof da)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:t.message}};if(t instanceof ma)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof wi)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let r=t.code;if(r&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(r))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let i=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:i?73:65,error:{code:i?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function Ep(e,t){let r=Lk(e,t),i=r.error;if(!i)return r;let n=wp({code:i.code,message:i.message,data:r.data});return n?{...r,envelope:n}:r}function Mk(e,t,r=!1){let i=e.envelope??gp(e.data);return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,agent:Lf(e.data,e.executionCwd),...i===void 0?{}:{summary:i.summary,...i.next===void 0?{}:{next:i.next},...i.user_message===void 0?{}:{user_message:i.user_message}},...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
204
- `}:e.error?{exitCode:e.exitCode,stderr:i?Bf(i,e.error.message,r?e.data:void 0):e.error.message}:i?{exitCode:e.exitCode,stdout:Ff(i,r?e.data:void 0)}:r&&e.text!==void 0&&e.data!==void 0&&e.text!==Sp(e.data)?{exitCode:e.exitCode,stdout:`${e.text}
205
- ${Me.details}
206
- ${JSON.stringify(e.data,null,2)}
207
- `}:{exitCode:e.exitCode,stdout:e.text}}function Fk(e,t,r=!1){let i=Mk(e,t,r),n=!1;if(i.stdout?.trim())try{let a=JSON.parse(i.stdout);n=!!a&&typeof a=="object"&&!Array.isArray(a)}catch{n=!1}return{output:i,structuredDataVisible:n}}function xp(e,t,r=!1){return Fk(e,t,r).output}async function Cp(e,t){let r=gc(e,"root subcommand");if(r==="show"){vc(e);let i=await ne(t);if(!i)throw new Error(".comet/config.yaml was not found");let n=await Pe(t,i.native.artifact_root);return wc("root show",{projectRoot:t,artifactRoot:i.native.artifact_root,language:i.native.language,nativeRoot:n.nativeRoot,pendingRootMove:i.native.pending_root_move??null})}if(r==="move"){let i=gc(e,"artifact root");vc(e);let n=await Df({projectRoot:t,toArtifactRoot:i});return wc("root move",n,`Moved Comet Native to ${n.toNativeRoot}
208
- `)}throw new Ie(`Unknown root command: ${r}`)}async function Pp(e,t,r=process.argv.slice(2)){let i=r.indexOf("--"),n=i<0?[...r]:r.slice(0,i),a=i<0?[]:r.slice(i),o=n.includes("--json"),s=n.includes("--verbose"),c,l;try{mc(n,"--json"),mc(n,"--verbose"),c=bp(n,"--project-root");let d=[...n,...a],f=await kp(c);l={executionCwd:f,...await t(d,f)}}catch(d){l=Ep(e,d)}let u=xp(l,o,s);return u.stdout&&process.stdout.write(u.stdout),u.stderr&&process.stderr.write(u.stderr+(u.stderr.endsWith(`
283
+ `}}var wx=gx().usage;var dV=10*1024*1024,qe=class extends Error{};function fl(t,e){let r=t.flatMap((i,n)=>i===e?[n]:[]);if(r.length>1)throw new qe(`${e} may only be provided once`);return r.length===0?!1:(t.splice(r[0],1),!0)}function Fh(t,e){let r=t.flatMap((a,o)=>a===e?[o]:[]);if(r.length>1)throw new qe(`${e} may only be provided once`);if(r.length===0)return;let i=r[0],n=t[i+1];if(n===void 0||n.startsWith("--"))throw new qe(`${e} requires a value`);return t.splice(i,2),n}function pl(t){if(t.length>0)throw new qe(`Unexpected argument: ${t[0]}`)}function hl(t,e){let r=t.shift();if(!r||r.startsWith("--"))throw new qe(`${e} is required`);return r}function dl(t,e){let r=tn.normalize(Mh(t)),i=tn.normalize(Mh(e));return process.platform==="win32"?r.toLowerCase()===i.toLowerCase():r===i}function Mh(t){let e=tn.resolve(t);try{return yx.native(e)}catch{return e}}function Nx(t,e){let r=tn.resolve(e,t),i=Ee(e);if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return r;let n=Ee(r);return!n.isGitWorktree||n.currentWorktreeRoot===null||n.primaryWorktreeRoot===null||!dl(i.primaryWorktreeRoot,n.primaryWorktreeRoot)||dl(i.currentWorktreeRoot,n.currentWorktreeRoot)?r:dl(e,i.currentWorktreeRoot)?tn.resolve(e):i.currentWorktreeRoot}async function qh(t,e=process.cwd()){return t?Nx(t,e):mc(e)}function Vh(t,e){return t==="status"||t==="show"||t==="root"&&e[0]==="show"}function Wh(t){return JSON.stringify(t,null,2)+`
284
+ `}function ml(t,e,r){return{command:t,exitCode:0,data:e,text:r??Wh(e)}}function bx(t,e){if(e instanceof Mi)return{command:t,exitCode:65,data:{change:e.change,findings:e.findings},error:{code:"document-invalid",message:e.message}};if(e instanceof Ba)return{command:t,exitCode:65,data:{builderReadiness:{ready:!1,missingIds:e.missingIds,incompleteIds:e.incompleteIds}},error:{code:"invalid-data",message:e.message}};if(e instanceof Da)return{command:t,exitCode:65,error:{code:"invalid-data",message:e.message,issues:e.issues}};if(e instanceof qe)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof fo)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof po)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof Ua)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof Bi)return{command:t,exitCode:73,data:{requestedIsolation:e.requestedIsolation,activeChanges:e.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:e.message}};if(e instanceof co)return{command:t,exitCode:73,data:{preparation:e.preparation},error:{code:"workspace-preparation-incomplete",message:e.message}};if(e instanceof Ka)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof Za)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof Vi)return{command:t,exitCode:65,data:e.recovery,error:{code:"implementation-scope-stale",message:e.message}};if(e instanceof Error){let r=e.code;if(r&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(r))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let i=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:i?73:65,error:{code:i?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function zh(t,e){let r=bx(t,e),i=r.error;if(!i)return r;let n=Lh({code:i.code,message:i.message,data:r.data});return n?{...r,envelope:n}:r}function kx(t,e,r=!1){let i=t.envelope??Dh(t.data);return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,agent:qp(t.data,t.executionCwd),...i===void 0?{}:{summary:i.summary,...i.next===void 0?{}:{next:i.next},...i.user_message===void 0?{}:{user_message:i.user_message}},...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
285
+ `}:t.error?{exitCode:t.exitCode,stderr:i?zp(i,t.error.message,r?t.data:void 0):t.error.message}:i?{exitCode:t.exitCode,stdout:Wp(i,r?t.data:void 0)}:r&&t.text!==void 0&&t.data!==void 0&&t.text!==Wh(t.data)?{exitCode:t.exitCode,stdout:`${t.text}
286
+ ${Ke.details}
287
+ ${JSON.stringify(t.data,null,2)}
288
+ `}:{exitCode:t.exitCode,stdout:t.text}}function Sx(t,e,r=!1){let i=kx(t,e,r),n=!1;if(i.stdout?.trim())try{let a=JSON.parse(i.stdout);n=!!a&&typeof a=="object"&&!Array.isArray(a)}catch{n=!1}return{output:i,structuredDataVisible:n}}function Gh(t,e,r=!1){return Sx(t,e,r).output}async function Jh(t,e){let r=hl(t,"root subcommand");if(r==="show"){pl(t);let i=await ce(e);if(!i)throw new Error(".comet/config.yaml was not found");let n=await Oe(e,i.native.artifact_root);return ml("root show",{projectRoot:e,artifactRoot:i.native.artifact_root,language:i.native.language,nativeRoot:n.nativeRoot,pendingRootMove:i.native.pending_root_move??null})}if(r==="move"){let i=hl(t,"artifact root");pl(t);let n=await Fp({projectRoot:e,toArtifactRoot:i});return ml("root move",n,`Moved Comet Native to ${n.toNativeRoot}
289
+ `)}throw new qe(`Unknown root command: ${r}`)}async function Uh(t,e,r=process.argv.slice(2)){let i=r.indexOf("--"),n=i<0?[...r]:r.slice(0,i),a=i<0?[]:r.slice(i),o=n.includes("--json"),s=n.includes("--verbose"),c,l;try{fl(n,"--json"),fl(n,"--verbose"),c=Fh(n,"--project-root");let d=[...n,...a],f=async()=>{let h=await qh(c);return{executionCwd:h,...await e(d,h)}};l=Vh(t,d)?await cp(f):await f()}catch(d){l=zh(t,d)}let u=Gh(l,o,s);return u.stdout&&process.stdout.write(u.stdout),u.stderr&&process.stderr.write(u.stderr+(u.stderr.endsWith(`
209
290
  `)?"":`
210
- `)),u.exitCode}process.exitCode=await Pp("root",Cp);
291
+ `)),u.exitCode}process.exitCode=await Uh("root",Jh);