@rpamis/comet 0.4.0-beta.12 → 0.4.0-beta.13

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 (428) hide show
  1. package/assets/manifest.json +15 -1
  2. package/assets/skills/comet/SKILL.md +5 -11
  3. package/assets/skills/comet/reference/comet-yaml-fields.md +1 -1
  4. package/assets/skills/comet/reference/context-recovery.md +3 -3
  5. package/assets/skills/comet/reference/decision-point.md +4 -5
  6. package/assets/skills/comet/reference/scripts.md +17 -47
  7. package/assets/skills/comet/reference/subagent-dispatch.md +8 -8
  8. package/assets/skills/comet/rules/comet-phase-guard.en.md +2 -2
  9. package/assets/skills/comet/rules/comet-phase-guard.md +2 -2
  10. package/assets/skills/comet/scripts/comet-archive.mjs +165 -2
  11. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +146 -8071
  12. package/assets/skills/comet/scripts/comet-guard.mjs +207 -2
  13. package/assets/skills/comet/scripts/comet-handoff.mjs +165 -2
  14. package/assets/skills/comet/scripts/comet-hook-guard.mjs +151 -2
  15. package/assets/skills/comet/scripts/comet-hook-router.mjs +155 -12101
  16. package/assets/skills/comet/scripts/comet-intent.mjs +10 -2
  17. package/assets/skills/comet/scripts/comet-resume-probe.mjs +148 -2
  18. package/assets/skills/comet/scripts/comet-runtime.mjs +286 -19170
  19. package/assets/skills/comet/scripts/comet-state.mjs +164 -2
  20. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +149 -2
  21. package/assets/skills/comet-archive/SKILL.md +1 -1
  22. package/assets/skills/comet-build/SKILL.md +13 -14
  23. package/assets/skills/comet-classic/SKILL.md +9 -9
  24. package/assets/skills/comet-design/SKILL.md +4 -4
  25. package/assets/skills/comet-hotfix/SKILL.md +2 -2
  26. package/assets/skills/comet-native/SKILL.md +17 -2
  27. package/assets/skills/comet-native/reference/commands.md +12 -0
  28. package/assets/skills/comet-native/reference/recovery.md +2 -0
  29. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +178 -0
  30. package/assets/skills/comet-native/scripts/comet-native-check.mjs +173 -0
  31. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +179 -0
  32. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +207 -0
  33. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +151 -0
  34. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +150 -2
  35. package/assets/skills/comet-native/scripts/comet-native-init.mjs +171 -0
  36. package/assets/skills/comet-native/scripts/comet-native-new.mjs +200 -0
  37. package/assets/skills/comet-native/scripts/comet-native-next.mjs +182 -0
  38. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +179 -0
  39. package/assets/skills/comet-native/scripts/comet-native-root.mjs +185 -0
  40. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +227 -31299
  41. package/assets/skills/comet-native/scripts/comet-native-select.mjs +178 -0
  42. package/assets/skills/comet-native/scripts/comet-native-show.mjs +151 -0
  43. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +181 -0
  44. package/assets/skills/comet-native/scripts/comet-native-status.mjs +175 -0
  45. package/assets/skills/comet-tweak/SKILL.md +2 -2
  46. package/assets/skills/comet-verify/SKILL.md +3 -3
  47. package/assets/skills-zh/comet/SKILL.md +5 -11
  48. package/assets/skills-zh/comet/reference/comet-yaml-fields.md +1 -1
  49. package/assets/skills-zh/comet/reference/context-recovery.md +3 -3
  50. package/assets/skills-zh/comet/reference/decision-point.md +4 -5
  51. package/assets/skills-zh/comet/reference/scripts.md +9 -39
  52. package/assets/skills-zh/comet/reference/subagent-dispatch.md +8 -8
  53. package/assets/skills-zh/comet-archive/SKILL.md +1 -1
  54. package/assets/skills-zh/comet-build/SKILL.md +13 -14
  55. package/assets/skills-zh/comet-classic/SKILL.md +7 -7
  56. package/assets/skills-zh/comet-design/SKILL.md +5 -5
  57. package/assets/skills-zh/comet-hotfix/SKILL.md +2 -2
  58. package/assets/skills-zh/comet-native/SKILL.md +17 -2
  59. package/assets/skills-zh/comet-native/reference/commands.md +12 -0
  60. package/assets/skills-zh/comet-native/reference/recovery.md +2 -0
  61. package/assets/skills-zh/comet-tweak/SKILL.md +2 -2
  62. package/assets/skills-zh/comet-verify/SKILL.md +3 -3
  63. package/bin/comet.js +5 -1
  64. package/bin/fast-runtime-router.js +82 -0
  65. package/dist/app/cli/index.js +57 -18
  66. package/dist/app/cli/index.js.map +1 -1
  67. package/dist/app/commands/dashboard.js +2 -2
  68. package/dist/app/commands/dashboard.js.map +1 -1
  69. package/dist/app/commands/i18n.d.ts +1 -1
  70. package/dist/app/commands/i18n.d.ts.map +1 -1
  71. package/dist/app/commands/i18n.js +10 -0
  72. package/dist/app/commands/i18n.js.map +1 -1
  73. package/dist/app/commands/init.d.ts.map +1 -1
  74. package/dist/app/commands/init.js +9 -5
  75. package/dist/app/commands/init.js.map +1 -1
  76. package/dist/app/commands/uninstall.d.ts.map +1 -1
  77. package/dist/app/commands/uninstall.js +150 -8
  78. package/dist/app/commands/uninstall.js.map +1 -1
  79. package/dist/app/commands/update.d.ts +1 -0
  80. package/dist/app/commands/update.d.ts.map +1 -1
  81. package/dist/app/commands/update.js +166 -24
  82. package/dist/app/commands/update.js.map +1 -1
  83. package/dist/config/repository-layout.json +33 -3
  84. package/dist/domains/comet-classic/classic-archive-entry.js +1 -1
  85. package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
  86. package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
  87. package/dist/domains/comet-classic/classic-branch-binding.js +8 -2
  88. package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
  89. package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
  90. package/dist/domains/comet-classic/classic-current-change.js +6 -1
  91. package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
  92. package/dist/domains/comet-classic/classic-guard-entry.js +1 -1
  93. package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
  94. package/dist/domains/comet-classic/classic-guard.js +1 -1
  95. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  96. package/dist/domains/comet-classic/classic-handoff-entry.js +1 -1
  97. package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
  98. package/dist/domains/comet-classic/classic-hook-guard-entry.js +1 -1
  99. package/dist/domains/comet-classic/classic-hook-guard-entry.js.map +1 -1
  100. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  101. package/dist/domains/comet-classic/classic-hook-guard.js +7 -4
  102. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  103. package/dist/domains/comet-classic/classic-intent-entry.js +1 -1
  104. package/dist/domains/comet-classic/classic-intent-entry.js.map +1 -1
  105. package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
  106. package/dist/domains/comet-classic/classic-layout-initialization.js +18 -11
  107. package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
  108. package/dist/domains/comet-classic/classic-layout.d.ts +7 -4
  109. package/dist/domains/comet-classic/classic-layout.d.ts.map +1 -1
  110. package/dist/domains/comet-classic/classic-layout.js +9 -9
  111. package/dist/domains/comet-classic/classic-layout.js.map +1 -1
  112. package/dist/domains/comet-classic/classic-resume-probe-entry.js +1 -1
  113. package/dist/domains/comet-classic/classic-resume-probe-entry.js.map +1 -1
  114. package/dist/domains/comet-classic/classic-script-entry.d.ts +2 -2
  115. package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
  116. package/dist/domains/comet-classic/classic-script-entry.js +4 -3
  117. package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
  118. package/dist/domains/comet-classic/classic-state-command.js +6 -6
  119. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  120. package/dist/domains/comet-classic/classic-state-entry.js +1 -1
  121. package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
  122. package/dist/domains/comet-classic/classic-validate-entry.js +1 -1
  123. package/dist/domains/comet-classic/classic-validate-entry.js.map +1 -1
  124. package/dist/domains/comet-entry/entry-reads.d.ts +17 -0
  125. package/dist/domains/comet-entry/entry-reads.d.ts.map +1 -0
  126. package/dist/domains/comet-entry/entry-reads.js +20 -0
  127. package/dist/domains/comet-entry/entry-reads.js.map +1 -0
  128. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  129. package/dist/domains/comet-entry/hook-router-entry.js +3 -1
  130. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  131. package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
  132. package/dist/domains/comet-entry/hook-router.js +8 -3
  133. package/dist/domains/comet-entry/hook-router.js.map +1 -1
  134. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  135. package/dist/domains/comet-entry/init-workflow.js +7 -8
  136. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  137. package/dist/domains/comet-entry/resolve-entry.d.ts.map +1 -1
  138. package/dist/domains/comet-entry/resolve-entry.js +3 -4
  139. package/dist/domains/comet-entry/resolve-entry.js.map +1 -1
  140. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  141. package/dist/domains/comet-entry/resume-probe.js +16 -5
  142. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  143. package/dist/domains/comet-native/native-archive-command.d.ts +3 -0
  144. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -0
  145. package/dist/domains/comet-native/native-archive-command.js +49 -0
  146. package/dist/domains/comet-native/native-archive-command.js.map +1 -0
  147. package/dist/domains/comet-native/native-archive-entry.d.ts +2 -0
  148. package/dist/domains/comet-native/native-archive-entry.d.ts.map +1 -0
  149. package/dist/domains/comet-native/native-archive-entry.js +4 -0
  150. package/dist/domains/comet-native/native-archive-entry.js.map +1 -0
  151. package/dist/domains/comet-native/native-check-command.d.ts +3 -0
  152. package/dist/domains/comet-native/native-check-command.d.ts.map +1 -0
  153. package/dist/domains/comet-native/native-check-command.js +30 -0
  154. package/dist/domains/comet-native/native-check-command.js.map +1 -0
  155. package/dist/domains/comet-native/native-check-entry.d.ts +2 -0
  156. package/dist/domains/comet-native/native-check-entry.d.ts.map +1 -0
  157. package/dist/domains/comet-native/native-check-entry.js +4 -0
  158. package/dist/domains/comet-native/native-check-entry.js.map +1 -0
  159. package/dist/domains/comet-native/native-checkpoint-command.d.ts +3 -0
  160. package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -0
  161. package/dist/domains/comet-native/native-checkpoint-command.js +39 -0
  162. package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -0
  163. package/dist/domains/comet-native/native-checkpoint-entry.d.ts +2 -0
  164. package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +1 -0
  165. package/dist/domains/comet-native/native-checkpoint-entry.js +4 -0
  166. package/dist/domains/comet-native/native-checkpoint-entry.js.map +1 -0
  167. package/dist/domains/comet-native/native-cli-shared.d.ts +40 -0
  168. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -0
  169. package/dist/domains/comet-native/native-cli-shared.js +272 -0
  170. package/dist/domains/comet-native/native-cli-shared.js.map +1 -0
  171. package/dist/domains/comet-native/native-cli.d.ts +2 -5
  172. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  173. package/dist/domains/comet-native/native-cli.js +37 -785
  174. package/dist/domains/comet-native/native-cli.js.map +1 -1
  175. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-continuation.js +16 -0
  177. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  178. package/dist/domains/comet-native/native-doctor-command.d.ts +3 -0
  179. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -0
  180. package/dist/domains/comet-native/native-doctor-command.js +29 -0
  181. package/dist/domains/comet-native/native-doctor-command.js.map +1 -0
  182. package/dist/domains/comet-native/native-doctor-entry.d.ts +2 -0
  183. package/dist/domains/comet-native/native-doctor-entry.d.ts.map +1 -0
  184. package/dist/domains/comet-native/native-doctor-entry.js +4 -0
  185. package/dist/domains/comet-native/native-doctor-entry.js.map +1 -0
  186. package/dist/domains/comet-native/native-evidence-command.d.ts +3 -0
  187. package/dist/domains/comet-native/native-evidence-command.d.ts.map +1 -0
  188. package/dist/domains/comet-native/native-evidence-command.js +35 -0
  189. package/dist/domains/comet-native/native-evidence-command.js.map +1 -0
  190. package/dist/domains/comet-native/native-evidence-entry.d.ts +2 -0
  191. package/dist/domains/comet-native/native-evidence-entry.d.ts.map +1 -0
  192. package/dist/domains/comet-native/native-evidence-entry.js +4 -0
  193. package/dist/domains/comet-native/native-evidence-entry.js.map +1 -0
  194. package/dist/domains/comet-native/native-evidence-storage.d.ts +17 -6
  195. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  196. package/dist/domains/comet-native/native-evidence-storage.js +89 -23
  197. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  198. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  199. package/dist/domains/comet-native/native-findings.js +18 -0
  200. package/dist/domains/comet-native/native-findings.js.map +1 -1
  201. package/dist/domains/comet-native/native-hook-guard-command.d.ts +3 -0
  202. package/dist/domains/comet-native/native-hook-guard-command.d.ts.map +1 -0
  203. package/dist/domains/comet-native/native-hook-guard-command.js +32 -0
  204. package/dist/domains/comet-native/native-hook-guard-command.js.map +1 -0
  205. package/dist/domains/comet-native/native-hook-guard-entry.d.ts +2 -0
  206. package/dist/domains/comet-native/native-hook-guard-entry.d.ts.map +1 -0
  207. package/dist/domains/comet-native/native-hook-guard-entry.js +4 -0
  208. package/dist/domains/comet-native/native-hook-guard-entry.js.map +1 -0
  209. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  210. package/dist/domains/comet-native/native-hook-guard.js +7 -1
  211. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  212. package/dist/domains/comet-native/native-init-command.d.ts +3 -0
  213. package/dist/domains/comet-native/native-init-command.d.ts.map +1 -0
  214. package/dist/domains/comet-native/native-init-command.js +29 -0
  215. package/dist/domains/comet-native/native-init-command.js.map +1 -0
  216. package/dist/domains/comet-native/native-init-entry.d.ts +2 -0
  217. package/dist/domains/comet-native/native-init-entry.d.ts.map +1 -0
  218. package/dist/domains/comet-native/native-init-entry.js +4 -0
  219. package/dist/domains/comet-native/native-init-entry.js.map +1 -0
  220. package/dist/domains/comet-native/native-new-command.d.ts +3 -0
  221. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -0
  222. package/dist/domains/comet-native/native-new-command.js +35 -0
  223. package/dist/domains/comet-native/native-new-command.js.map +1 -0
  224. package/dist/domains/comet-native/native-new-entry.d.ts +2 -0
  225. package/dist/domains/comet-native/native-new-entry.d.ts.map +1 -0
  226. package/dist/domains/comet-native/native-new-entry.js +4 -0
  227. package/dist/domains/comet-native/native-new-entry.js.map +1 -0
  228. package/dist/domains/comet-native/native-next-command.d.ts +3 -0
  229. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -0
  230. package/dist/domains/comet-native/native-next-command.js +82 -0
  231. package/dist/domains/comet-native/native-next-command.js.map +1 -0
  232. package/dist/domains/comet-native/native-next-entry.d.ts +2 -0
  233. package/dist/domains/comet-native/native-next-entry.d.ts.map +1 -0
  234. package/dist/domains/comet-native/native-next-entry.js +4 -0
  235. package/dist/domains/comet-native/native-next-entry.js.map +1 -0
  236. package/dist/domains/comet-native/native-receipt-command.d.ts +3 -0
  237. package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -0
  238. package/dist/domains/comet-native/native-receipt-command.js +107 -0
  239. package/dist/domains/comet-native/native-receipt-command.js.map +1 -0
  240. package/dist/domains/comet-native/native-receipt-entry.d.ts +2 -0
  241. package/dist/domains/comet-native/native-receipt-entry.d.ts.map +1 -0
  242. package/dist/domains/comet-native/native-receipt-entry.js +4 -0
  243. package/dist/domains/comet-native/native-receipt-entry.js.map +1 -0
  244. package/dist/domains/comet-native/native-receipt-refresh.d.ts +86 -0
  245. package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -0
  246. package/dist/domains/comet-native/native-receipt-refresh.js +232 -0
  247. package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -0
  248. package/dist/domains/comet-native/native-root-command.d.ts +3 -0
  249. package/dist/domains/comet-native/native-root-command.d.ts.map +1 -0
  250. package/dist/domains/comet-native/native-root-command.js +29 -0
  251. package/dist/domains/comet-native/native-root-command.js.map +1 -0
  252. package/dist/domains/comet-native/native-root-entry.d.ts +2 -0
  253. package/dist/domains/comet-native/native-root-entry.d.ts.map +1 -0
  254. package/dist/domains/comet-native/native-root-entry.js +4 -0
  255. package/dist/domains/comet-native/native-root-entry.js.map +1 -0
  256. package/dist/domains/comet-native/native-script-entry.d.ts +12 -0
  257. package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -0
  258. package/dist/domains/comet-native/native-script-entry.js +44 -0
  259. package/dist/domains/comet-native/native-script-entry.js.map +1 -0
  260. package/dist/domains/comet-native/native-select-command.d.ts +3 -0
  261. package/dist/domains/comet-native/native-select-command.d.ts.map +1 -0
  262. package/dist/domains/comet-native/native-select-command.js +15 -0
  263. package/dist/domains/comet-native/native-select-command.js.map +1 -0
  264. package/dist/domains/comet-native/native-select-entry.d.ts +2 -0
  265. package/dist/domains/comet-native/native-select-entry.d.ts.map +1 -0
  266. package/dist/domains/comet-native/native-select-entry.js +4 -0
  267. package/dist/domains/comet-native/native-select-entry.js.map +1 -0
  268. package/dist/domains/comet-native/native-show-command.d.ts +3 -0
  269. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -0
  270. package/dist/domains/comet-native/native-show-command.js +41 -0
  271. package/dist/domains/comet-native/native-show-command.js.map +1 -0
  272. package/dist/domains/comet-native/native-show-entry.d.ts +2 -0
  273. package/dist/domains/comet-native/native-show-entry.d.ts.map +1 -0
  274. package/dist/domains/comet-native/native-show-entry.js +4 -0
  275. package/dist/domains/comet-native/native-show-entry.js.map +1 -0
  276. package/dist/domains/comet-native/native-snapshot.d.ts +9 -0
  277. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  278. package/dist/domains/comet-native/native-snapshot.js +141 -5
  279. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  280. package/dist/domains/comet-native/native-spec-command.d.ts +3 -0
  281. package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -0
  282. package/dist/domains/comet-native/native-spec-command.js +34 -0
  283. package/dist/domains/comet-native/native-spec-command.js.map +1 -0
  284. package/dist/domains/comet-native/native-spec-entry.d.ts +2 -0
  285. package/dist/domains/comet-native/native-spec-entry.d.ts.map +1 -0
  286. package/dist/domains/comet-native/native-spec-entry.js +4 -0
  287. package/dist/domains/comet-native/native-spec-entry.js.map +1 -0
  288. package/dist/domains/comet-native/native-status-command.d.ts +3 -0
  289. package/dist/domains/comet-native/native-status-command.d.ts.map +1 -0
  290. package/dist/domains/comet-native/native-status-command.js +36 -0
  291. package/dist/domains/comet-native/native-status-command.js.map +1 -0
  292. package/dist/domains/comet-native/native-status-entry.d.ts +2 -0
  293. package/dist/domains/comet-native/native-status-entry.d.ts.map +1 -0
  294. package/dist/domains/comet-native/native-status-entry.js +4 -0
  295. package/dist/domains/comet-native/native-status-entry.js.map +1 -0
  296. package/dist/domains/comet-native/native-transitions.d.ts +4 -0
  297. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  298. package/dist/domains/comet-native/native-transitions.js +28 -4
  299. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  300. package/dist/domains/comet-native/native-types.d.ts +8 -0
  301. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  302. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +14 -0
  303. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  304. package/dist/domains/comet-native/native-verification-receipt-runtime.js +29 -1
  305. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  306. package/dist/domains/comet-native/native-verification-runtime.d.ts +28 -1
  307. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  308. package/dist/domains/comet-native/native-verification-runtime.js +92 -14
  309. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  310. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  311. package/dist/domains/dashboard/collector.js +53 -41
  312. package/dist/domains/dashboard/collector.js.map +1 -1
  313. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  314. package/dist/domains/dashboard/native-collector.js +13 -3
  315. package/dist/domains/dashboard/native-collector.js.map +1 -1
  316. package/dist/domains/dashboard/project-directory.d.ts +20 -0
  317. package/dist/domains/dashboard/project-directory.d.ts.map +1 -0
  318. package/dist/domains/dashboard/project-directory.js +87 -0
  319. package/dist/domains/dashboard/project-directory.js.map +1 -0
  320. package/dist/domains/dashboard/project-root.d.ts +8 -0
  321. package/dist/domains/dashboard/project-root.d.ts.map +1 -0
  322. package/dist/domains/dashboard/project-root.js +68 -0
  323. package/dist/domains/dashboard/project-root.js.map +1 -0
  324. package/dist/domains/dashboard/server.d.ts +1 -0
  325. package/dist/domains/dashboard/server.d.ts.map +1 -1
  326. package/dist/domains/dashboard/server.js +50 -10
  327. package/dist/domains/dashboard/server.js.map +1 -1
  328. package/dist/domains/dashboard/web/assets/{arc-BXDAG6Qx.js → arc-mNt_SS1l.js} +1 -1
  329. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-Bc5akVD6.js +36 -0
  330. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-STNPWdDl.js → blockDiagram-GPEHLZMM-C43zhVBe.js} +2 -2
  331. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Bh-rUIcJ.js → c4Diagram-AAUBKEIU-dToETarK.js} +2 -2
  332. package/dist/domains/dashboard/web/assets/channel-b2wWDG4F.js +1 -0
  333. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-BRhFNAFH.js → chunk-2J33WTMH-C0oO137R.js} +1 -1
  334. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-CwA3zkFS.js → chunk-4BX2VUAB-CGms1fgI.js} +1 -1
  335. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-C1tqAl_E.js → chunk-55IACEB6-Bugl8v6f.js} +1 -1
  336. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-DDefBoUS.js → chunk-727SXJPM-8ATNMlBG.js} +1 -1
  337. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-Dq-0Yi9D.js → chunk-AQP2D5EJ-BNYjSSqU.js} +1 -1
  338. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-DC-MVNgk.js → chunk-FMBD7UC4-_nJAqSbe.js} +1 -1
  339. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-BLWZ8zWd.js → chunk-ND2GUHAM-lyxYm5NX.js} +1 -1
  340. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-DaK5rvZu.js → chunk-QZHKN3VN-PUMVeWpd.js} +1 -1
  341. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-B9SWZywo.js +1 -0
  342. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-B9SWZywo.js +1 -0
  343. package/dist/domains/dashboard/web/assets/cose-bilkent-S5V4N54A-DzMqjexn.js +1 -0
  344. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-CBaY4KFj.js → cynefin-VYW2F7L2-B67ET0eq.js} +1 -1
  345. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-CQPMvRLK.js +4 -0
  346. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-BRpLrFHM.js +43 -0
  347. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-CPGWuGrE.js +10 -0
  348. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BZcengGf.js → diagram-KO2AKTUF-D2wpX2iO.js} +2 -2
  349. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-D54mAbDu.js +24 -0
  350. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-ZGQDpSs_.js +24 -0
  351. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-BBrwULhs.js → erDiagram-TEJ5UH35-C3qDo7sd.js} +2 -2
  352. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-DiNn0Yzp.js → flowDiagram-I6XJVG4X-B7hStPd9.js} +2 -2
  353. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-IqcLFbTK.js +292 -0
  354. package/dist/domains/dashboard/web/assets/gitGraphDiagram-PVQCEYII-YrMZpzUu.js +106 -0
  355. package/dist/domains/dashboard/web/assets/index-DhtBssCt.js +257 -0
  356. package/dist/domains/dashboard/web/assets/{index-QO0z6F4w.js → index-icxk8_BP.js} +1 -1
  357. package/dist/domains/dashboard/web/assets/index-pr3axVDI.css +1 -0
  358. package/dist/domains/dashboard/web/assets/infoDiagram-5YYISTIA-CcIgGK_7.js +2 -0
  359. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-DCPPspol.js → ishikawaDiagram-YF4QCWOH-1x3rNjGP.js} +2 -2
  360. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C_v8b1Os.js → journeyDiagram-JHISSGLW-B2XiqMNP.js} +2 -2
  361. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-CgpE9lG7.js → kanban-definition-UN3LZRKU-x46cGuo3.js} +2 -2
  362. package/dist/domains/dashboard/web/assets/{linear-jSddcREx.js → linear-DFLqGZWl.js} +1 -1
  363. package/dist/domains/dashboard/web/assets/{mermaid.core-5Ibr28Ig.js → mermaid.core-g3J6BACc.js} +69 -69
  364. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-XPCohX0x.js → mindmap-definition-RKZ34NQL-CTdeKmcX.js} +2 -2
  365. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-DvhxgQWl.js → pieDiagram-4H26LBE5-C_obwjIf.js} +2 -2
  366. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CCUxdF-S.js → quadrantDiagram-W4KKPZXB-B6Gnfz9M.js} +4 -4
  367. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-FS3TCmdX.js → requirementDiagram-4Y6WPE33-nX4PObnB.js} +2 -2
  368. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-r129rscN.js → sankeyDiagram-5OEKKPKP-QjDwwHgl.js} +2 -2
  369. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK--DCY0bvU.js → sequenceDiagram-3UESZ5HK-BEEe0j6B.js} +2 -2
  370. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-CXfAaBgM.js +1 -0
  371. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-CD3nS4cC.js +1 -0
  372. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-NlqCuFuo.js → timeline-definition-PNZ67QCA-BOzX2EnD.js} +2 -2
  373. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-B4W_d1Nq.js → vennDiagram-CIIHVFJN-C40vhXRq.js} +2 -2
  374. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-Bex-_jWd.js → wardleyDiagram-YWT4CUSO-B1rm89JH.js} +2 -2
  375. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-CmxeVM2Z.js → xychartDiagram-2RQKCTM6-BlMr59qK.js} +2 -2
  376. package/dist/domains/dashboard/web/index.html +2 -2
  377. package/dist/domains/integrations/openspec.d.ts +1 -0
  378. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  379. package/dist/domains/integrations/openspec.js +6 -0
  380. package/dist/domains/integrations/openspec.js.map +1 -1
  381. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  382. package/dist/domains/skill/platform-install.js +4 -6
  383. package/dist/domains/skill/platform-install.js.map +1 -1
  384. package/dist/domains/skill/uninstall.d.ts +6 -2
  385. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  386. package/dist/domains/skill/uninstall.js +128 -19
  387. package/dist/domains/skill/uninstall.js.map +1 -1
  388. package/dist/domains/workflow-contract/project-config.d.ts +1 -0
  389. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  390. package/dist/domains/workflow-contract/project-config.js +45 -1
  391. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  392. package/dist/platform/install/detect.d.ts +1 -0
  393. package/dist/platform/install/detect.d.ts.map +1 -1
  394. package/dist/platform/install/detect.js +2 -0
  395. package/dist/platform/install/detect.js.map +1 -1
  396. package/dist/platform/process/hook-read-cache.d.ts +45 -0
  397. package/dist/platform/process/hook-read-cache.d.ts.map +1 -0
  398. package/dist/platform/process/hook-read-cache.js +102 -0
  399. package/dist/platform/process/hook-read-cache.js.map +1 -0
  400. package/dist/platform/version/version.d.ts.map +1 -1
  401. package/dist/platform/version/version.js +9 -2
  402. package/dist/platform/version/version.js.map +1 -1
  403. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +2 -0
  404. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -0
  405. package/eval/local/tasks/comet-native-workflow/instruction.md +3 -3
  406. package/eval/local/tasks/comet-native-workflow/task.toml +4 -2
  407. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +212 -75
  408. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +114 -39
  409. package/eval/local/tests/scaffold/test_tasks.py +5 -1
  410. package/package.json +7 -3
  411. package/dist/domains/dashboard/web/assets/_commonjsHelpers-CqkleIqs.js +0 -1
  412. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-R2JyCv0i.js +0 -36
  413. package/dist/domains/dashboard/web/assets/channel-XR_5gd6D.js +0 -1
  414. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CG_TnucZ.js +0 -1
  415. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CG_TnucZ.js +0 -1
  416. package/dist/domains/dashboard/web/assets/cose-bilkent-S5V4N54A-DCPgAyMU.js +0 -1
  417. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-CLKQ6BQM.js +0 -4
  418. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-DCup336F.js +0 -43
  419. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-DgpDOFTE.js +0 -10
  420. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-DSECilBo.js +0 -24
  421. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-3FuzANXW.js +0 -24
  422. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-DcvbTHnu.js +0 -292
  423. package/dist/domains/dashboard/web/assets/gitGraphDiagram-PVQCEYII-CgCY3MJo.js +0 -106
  424. package/dist/domains/dashboard/web/assets/index-BR3wUr2k.css +0 -1
  425. package/dist/domains/dashboard/web/assets/index-CovQUq5W.js +0 -24
  426. package/dist/domains/dashboard/web/assets/infoDiagram-5YYISTIA-hzBGAEue.js +0 -2
  427. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-yHkUByrT.js +0 -1
  428. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-XHzDdqcm.js +0 -1
@@ -1,3 +1,165 @@
1
1
  #!/usr/bin/env node
2
- import { main } from './comet-runtime.mjs';
3
- process.exitCode = await main(["state", ...process.argv.slice(2)]);
2
+ import { createRequire as __cometCreateRequire } from 'module';
3
+ const require = __cometCreateRequire(import.meta.url);
4
+ var vf=Object.create;var Cr=Object.defineProperty;var bf=Object.getOwnPropertyDescriptor;var kf=Object.getOwnPropertyNames;var Sf=Object.getPrototypeOf,Cf=Object.prototype.hasOwnProperty;var qn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var U=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Ef=(t,e)=>{for(var n in e)Cr(t,n,{get:e[n],enumerable:!0})},Rf=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of kf(e))!Cf.call(t,r)&&r!==n&&Cr(t,r,{get:()=>e[r],enumerable:!(i=bf(e,r))||i.enumerable});return t};var Pt=(t,e,n)=>(n=t!=null?vf(Sf(t)):{},Rf(e||!t||!t.__esModule?Cr(n,"default",{value:t,enumerable:!0}):n,t));var P=w(W=>{"use strict";var Er=Symbol.for("yaml.alias"),zo=Symbol.for("yaml.document"),Ln=Symbol.for("yaml.map"),Qo=Symbol.for("yaml.pair"),Rr=Symbol.for("yaml.scalar"),Dn=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),_f=t=>!!t&&typeof t=="object"&&t[ge]===Er,xf=t=>!!t&&typeof t=="object"&&t[ge]===zo,Pf=t=>!!t&&typeof t=="object"&&t[ge]===Ln,Of=t=>!!t&&typeof t=="object"&&t[ge]===Qo,Xo=t=>!!t&&typeof t=="object"&&t[ge]===Rr,Af=t=>!!t&&typeof t=="object"&&t[ge]===Dn;function Zo(t){if(t&&typeof t=="object")switch(t[ge]){case Ln:case Dn:return!0}return!1}function Nf(t){if(t&&typeof t=="object")switch(t[ge]){case Er:case Ln:case Rr:case Dn:return!0}return!1}var Tf=t=>(Xo(t)||Zo(t))&&!!t.anchor;W.ALIAS=Er;W.DOC=zo;W.MAP=Ln;W.NODE_TYPE=ge;W.PAIR=Qo;W.SCALAR=Rr;W.SEQ=Dn;W.hasAnchor=Tf;W.isAlias=_f;W.isCollection=Zo;W.isDocument=xf;W.isMap=Pf;W.isNode=Nf;W.isPair=Of;W.isScalar=Xo;W.isSeq=Af});var Ot=w(_r=>{"use strict";var D=P(),G=Symbol("break visit"),ea=Symbol("skip children"),ce=Symbol("remove node");function Mn(t,e){let n=ta(e);D.isDocument(t)?rt(null,t.contents,n,Object.freeze([t]))===ce&&(t.contents=null):rt(null,t,n,Object.freeze([]))}Mn.BREAK=G;Mn.SKIP=ea;Mn.REMOVE=ce;function rt(t,e,n,i){let r=na(t,e,n,i);if(D.isNode(r)||D.isPair(r))return ia(t,i,r),rt(t,r,n,i);if(typeof r!="symbol"){if(D.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=rt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===G)return G;o===ce&&(e.items.splice(s,1),s-=1)}}}else if(D.isPair(e)){i=Object.freeze(i.concat(e));let s=rt("key",e.key,n,i);if(s===G)return G;s===ce&&(e.key=null);let o=rt("value",e.value,n,i);if(o===G)return G;o===ce&&(e.value=null)}}return r}async function Fn(t,e){let n=ta(e);D.isDocument(t)?await st(null,t.contents,n,Object.freeze([t]))===ce&&(t.contents=null):await st(null,t,n,Object.freeze([]))}Fn.BREAK=G;Fn.SKIP=ea;Fn.REMOVE=ce;async function st(t,e,n,i){let r=await na(t,e,n,i);if(D.isNode(r)||D.isPair(r))return ia(t,i,r),st(t,r,n,i);if(typeof r!="symbol"){if(D.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await st(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===G)return G;o===ce&&(e.items.splice(s,1),s-=1)}}}else if(D.isPair(e)){i=Object.freeze(i.concat(e));let s=await st("key",e.key,n,i);if(s===G)return G;s===ce&&(e.key=null);let o=await st("value",e.value,n,i);if(o===G)return G;o===ce&&(e.value=null)}}return r}function ta(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 na(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(D.isMap(e))return n.Map?.(t,e,i);if(D.isSeq(e))return n.Seq?.(t,e,i);if(D.isPair(e))return n.Pair?.(t,e,i);if(D.isScalar(e))return n.Scalar?.(t,e,i);if(D.isAlias(e))return n.Alias?.(t,e,i)}function ia(t,e,n){let i=e[e.length-1];if(D.isCollection(i))i.items[t]=n;else if(D.isPair(i))t==="key"?i.key=n:i.value=n;else if(D.isDocument(i))i.contents=n;else{let r=D.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}_r.visit=Mn;_r.visitAsync=Fn});var xr=w(sa=>{"use strict";var ra=P(),If=Ot(),jf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$f=t=>t.replace(/[!,[\]{}]/g,e=>jf[e]),At=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}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,n){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]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[s,o]=i;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=i;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let s=this.tags[i];if(s)try{return s+decodeURIComponent(r)}catch(o){return n(String(o)),null}return i==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,i]of Object.entries(this.tags))if(e.startsWith(i))return n+$f(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&ra.isNode(e.contents)){let s={};If.visit(e.contents,(o,a)=>{ra.isNode(a)&&a.tag&&(s[a.tag]=!0)}),r=Object.keys(s)}else r=[];for(let[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
5
+ `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};sa.Directives=At});var Wn=w(Nt=>{"use strict";var oa=P(),qf=Ot();function Lf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function aa(t){let e=new Set;return qf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function ca(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function Df(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=aa(t));let o=ca(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(oa.isScalar(o.node)||oa.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:i}}Nt.anchorIsValid=Lf;Nt.anchorNames=aa;Nt.createNodeAnchors=Df;Nt.findNewAnchor=ca});var Pr=w(la=>{"use strict";function Tt(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r){let o=i[r],a=Tt(t,i,String(r),o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let s=i.get(r),o=Tt(t,i,r,s);o===void 0?i.delete(r):o!==s&&i.set(r,o)}else if(i instanceof Set)for(let r of Array.from(i)){let s=Tt(t,i,r,r);s===void 0?i.delete(r):s!==r&&(i.delete(r),i.add(s))}else for(let[r,s]of Object.entries(i)){let o=Tt(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}la.applyReviver=Tt});var _e=w(fa=>{"use strict";var Mf=P();function ua(t,e,n){if(Array.isArray(t))return t.map((i,r)=>ua(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!Mf.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=s=>{i.res=s,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}fa.toJS=ua});var Bn=w(pa=>{"use strict";var Ff=Pr(),da=P(),Wf=_e(),Or=class{constructor(e){Object.defineProperty(this,da.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:n,maxAliasCount:i,onAnchor:r,reviver:s}={}){if(!da.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=Wf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?Ff.applyReviver(s,{"":a},"",a):a}};pa.NodeBase=Or});var It=w(ma=>{"use strict";var Bf=Wn(),Kf=Ot(),ot=P(),Uf=Bn(),Yf=_e(),Ar=class extends Uf.NodeBase{constructor(e){super(ot.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],Kf.visit(e,{Node:(s,o)=>{(ot.isAlias(o)||ot.hasAnchor(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let r;for(let s of i){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:s}=n,o=this.resolve(r,n);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(o);if(a||(Yf.toJS(o,null,n),a=i.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Kn(r,o,i)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,i){let r=`*${this.source}`;if(e){if(Bf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${r} `}return r}};function Kn(t,e,n){if(ot.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(ot.isCollection(e)){let i=0;for(let r of e.items){let s=Kn(t,r,n);s>i&&(i=s)}return i}else if(ot.isPair(e)){let i=Kn(t,e.key,n),r=Kn(t,e.value,n);return Math.max(i,r)}return 1}ma.Alias=Ar});var $=w(Nr=>{"use strict";var Vf=P(),Jf=Bn(),Hf=_e(),Gf=t=>!t||typeof t!="function"&&typeof t!="object",xe=class extends Jf.NodeBase{constructor(e){super(Vf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Hf.toJS(this.value,e,n)}toString(){return String(this.value)}};xe.BLOCK_FOLDED="BLOCK_FOLDED";xe.BLOCK_LITERAL="BLOCK_LITERAL";xe.PLAIN="PLAIN";xe.QUOTE_DOUBLE="QUOTE_DOUBLE";xe.QUOTE_SINGLE="QUOTE_SINGLE";Nr.Scalar=xe;Nr.isScalarValue=Gf});var jt=w(ga=>{"use strict";var zf=It(),Je=P(),ha=$(),Qf="tag:yaml.org,2002:";function Xf(t,e,n){if(e){let i=n.filter(s=>s.tag===e),r=i.find(s=>!s.format)??i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(i=>i.identify?.(t)&&!i.format)}function Zf(t,e,n){if(Je.isDocument(t)&&(t=t.contents),Je.isNode(t))return t;if(Je.isPair(t)){let f=n.schema[Je.MAP].createNode?.(n.schema,null,n);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:s,schema:o,sourceObjects:a}=n,c;if(i&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=r(t)),new zf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Qf+e.slice(2));let l=Xf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new ha.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?o[Je.MAP]:Symbol.iterator in Object(t)?o[Je.SEQ]:o[Je.MAP]}s&&(s(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new ha.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}ga.createNode=Zf});var Yn=w(Un=>{"use strict";var ed=jt(),le=P(),td=Bn();function Tr(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let s=e[r];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=i,i=o}else i=new Map([[s,i]])}return ed.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 wa=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ir=class extends td.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(i=>le.isNode(i)||le.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(wa(e))this.add(n);else{let[i,...r]=e,s=this.get(i,!0);if(le.isCollection(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,Tr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(e){let[n,...i]=e;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(le.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,s=this.get(i,!0);return r.length===0?!n&&le.isScalar(s)?s.value:s:le.isCollection(s)?s.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!le.isPair(n))return!1;let i=n.value;return i==null||e&&le.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[n,...i]=e;if(i.length===0)return this.has(n);let r=this.get(n,!0);return le.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let s=this.get(i,!0);if(le.isCollection(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,Tr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Un.Collection=Ir;Un.collectionFromPath=Tr;Un.isEmptyPath=wa});var $t=w(Vn=>{"use strict";var nd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function jr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var id=(t,e,n)=>t.endsWith(`
6
+ `)?jr(n,e):n.includes(`
7
+ `)?`
8
+ `+jr(n,e):(t.endsWith(" ")?"":" ")+n;Vn.indentComment=jr;Vn.lineComment=id;Vn.stringifyComment=nd});var va=w(qt=>{"use strict";var rd="flow",$r="block",Jn="quoted";function sd(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return t;r<s&&(s=0);let c=Math.max(1+s,1+r-e.length);if(t.length<=c)return t;let l=[],u={},f=r-e.length;typeof i=="number"&&(i>r-Math.max(2,s)?l.push(0):f=r-i);let d,m,g=!1,p=-1,h=-1,y=-1;n===$r&&(p=ya(t,p,e.length),p!==-1&&(f=p+c));for(let S;S=t[p+=1];){if(n===Jn&&S==="\\"){switch(h=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}y=p}if(S===`
9
+ `)n===$r&&(p=ya(t,p,e.length)),f=p+e.length+c,d=void 0;else{if(S===" "&&m&&m!==" "&&m!==`
10
+ `&&m!==" "){let R=t[p+1];R&&R!==" "&&R!==`
11
+ `&&R!==" "&&(d=p)}if(p>=f)if(d)l.push(d),f=d+c,d=void 0;else if(n===Jn){for(;m===" "||m===" ";)m=S,S=t[p+=1],g=!0;let R=p>y+1?p-2:h-1;if(u[R])return t;l.push(R),u[R]=!0,f=R+c,d=void 0}else g=!0}m=S}if(g&&a&&a(),l.length===0)return t;o&&o();let v=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let R=l[S],E=l[S+1]||t.length;R===0?v=`
12
+ ${e}${t.slice(0,E)}`:(n===Jn&&u[R]&&(v+=`${t[R]}\\`),v+=`
13
+ ${e}${t.slice(R+1,E)}`)}return v}function ya(t,e,n){let i=e,r=e+1,s=t[r];for(;s===" "||s===" ";)if(e<r+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
14
+ `);i=e,r=e+1,s=t[r]}return i}qt.FOLD_BLOCK=$r;qt.FOLD_FLOW=rd;qt.FOLD_QUOTED=Jn;qt.foldFlowLines=sd});var Dt=w(ba=>{"use strict";var ne=$(),Pe=va(),Gn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),zn=t=>/^(%|---|\.\.\.)/m.test(t);function od(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let s=0,o=0;s<r;++s)if(t[s]===`
15
+ `){if(s-o>i)return!0;if(o=s+1,r-o<=i)return!1}return!0}function Lt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(zn(t)?" ":""),o="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let u=n.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+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||n[c+2]==='"'||n.length<r)c+=1;else{for(o+=n.slice(a,c)+`
16
+
17
+ `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
18
+ `,c+=2;o+=s,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,i?o:Pe.foldFlowLines(o,s,Pe.FOLD_QUOTED,Gn(e,!1))}function qr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return Lt(t,e);let n=e.indent||(zn(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?i:Pe.foldFlowLines(i,n,Pe.FOLD_FLOW,Gn(e,!1))}function at(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=Lt;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=qr:s&&!r?i=Lt:i=n?qr:Lt}return i(t,e)}var Lr;try{Lr=new RegExp(`(^|(?<!
21
+ ))
22
+ +(?!
23
+ |$)`,"g")}catch{Lr=/\n+(?!\n|$)/g}function Hn({comment:t,type:e,value:n},i,r,s){let{blockQuote:o,commentString:a,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(n))return at(n,i);let l=i.indent||(i.forceBlockIndent||zn(n)?" ":""),u=o==="literal"?!0:o==="folded"||e===ne.Scalar.BLOCK_FOLDED?!1:e===ne.Scalar.BLOCK_LITERAL?!0:!od(n,c,l.length);if(!n)return u?`|
24
+ `:`>
25
+ `;let f,d;for(d=n.length;d>0;--d){let E=n[d-1];if(E!==`
26
+ `&&E!==" "&&E!==" ")break}let m=n.substring(d),g=m.indexOf(`
27
+ `);g===-1?f="-":n===m||g!==m.length-1?(f="+",s&&s()):f="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
28
+ `&&(m=m.slice(0,-1)),m=m.replace(Lr,`$&${l}`));let p=!1,h,y=-1;for(h=0;h<n.length;++h){let E=n[h];if(E===" ")p=!0;else if(E===`
29
+ `)y=h;else break}let v=n.substring(0,y<h?y+1:h);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${l}`));let R=(p?l?"2":"1":"")+f;if(t&&(R+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!u){let E=n.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),_=!1,N=Gn(i,!0);o!=="folded"&&e!==ne.Scalar.BLOCK_FOLDED&&(N.onOverflow=()=>{_=!0});let k=Pe.foldFlowLines(`${v}${E}${m}`,l,Pe.FOLD_BLOCK,N);if(!_)return`>${R}
31
+ ${l}${k}`}return n=n.replace(/\n+/g,`$&${l}`),`|${R}
32
+ ${l}${v}${n}${m}`}function ad(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&s.includes(`
33
+ `)||u&&/[[\]{},]/.test(s))return at(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||u||!s.includes(`
34
+ `)?at(s,e):Hn(t,e,n,i);if(!a&&!u&&r!==ne.Scalar.PLAIN&&s.includes(`
35
+ `))return Hn(t,e,n,i);if(zn(s)){if(c==="")return e.forceBlockIndent=!0,Hn(t,e,n,i);if(a&&c===l)return at(s,e)}let f=s.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(f),{compat:m,tags:g}=e.doc.schema;if(g.some(d)||m?.some(d))return at(s,e)}return a?f:Pe.foldFlowLines(f,c,Pe.FOLD_FLOW,Gn(e,!1))}function cd(t,e,n,i){let{implicitKey:r,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ne.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ne.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ne.Scalar.BLOCK_FOLDED:case ne.Scalar.BLOCK_LITERAL:return r||s?at(o.value,e):Hn(o,e,n,i);case ne.Scalar.QUOTE_DOUBLE:return Lt(o.value,e);case ne.Scalar.QUOTE_SINGLE:return qr(o.value,e);case ne.Scalar.PLAIN:return ad(o,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=r&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}ba.stringifyString=cd});var Mt=w(Dr=>{"use strict";var ld=Wn(),Oe=P(),ud=$t(),fd=Dt();function dd(t,e){let n=Object.assign({blockQuote:!0,commentString:ud.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(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function pd(t,e){if(e.tag){let r=t.filter(s=>s.tag===e.tag);if(r.length>0)return r.find(s=>s.format===e.format)??r[0]}let n,i;if(Oe.isScalar(e)){i=e.value;let r=t.filter(s=>s.identify?.(i));if(r.length>1){let s=r.filter(o=>o.test);s.length>0&&(r=s)}n=r.find(s=>s.format===e.format)??r.find(s=>!s.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function md(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(Oe.isScalar(t)||Oe.isCollection(t))&&t.anchor;s&&ld.anchorIsValid(s)&&(n.add(s),r.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(i.directives.tagString(o)),r.join(" ")}function hd(t,e,n,i){if(Oe.isPair(t))return t.toString(e,n,i);if(Oe.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 r,s=Oe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=pd(e.doc.schema.tags,s));let o=md(s,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(s,e,n,i):Oe.isScalar(s)?fd.stringifyString(s,e,n,i):s.toString(e,n,i);return o?Oe.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
+ ${e.indent}${a}`:a}Dr.createStringifyContext=dd;Dr.stringify=hd});var Ea=w(Ca=>{"use strict";var we=P(),ka=$(),Sa=Mt(),Ft=$t();function gd({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=n,d=we.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let N="With simple keys, collection cannot be used as a key value";throw new Error(N)}}let m=!f&&(!t||d&&e==null&&!n.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===ka.Scalar.BLOCK_FOLDED||t.type===ka.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(f||!s),indent:a+c});let g=!1,p=!1,h=Sa.stringify(t,n,()=>g=!0,()=>p=!0);if(!m&&!n.inFlow&&h.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(s||e==null)return g&&i&&i(),h===""?"?":m?`? ${h}`:h}else if(s&&!f||e==null&&m)return h=`? ${h}`,d&&!g?h+=Ft.lineComment(h,n.indent,l(d)):p&&r&&r(),h;g&&(d=null),m?(d&&(h+=Ft.lineComment(h,n.indent,l(d))),h=`? ${h}
38
+ ${a}:`):(h=`${h}:`,d&&(h+=Ft.lineComment(h,n.indent,l(d))));let y,v,S;we.isNode(e)?(y=!!e.spaceBefore,v=e.commentBefore,S=e.comment):(y=!1,v=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!m&&!d&&we.isScalar(e)&&(n.indentAtStart=h.length+1),p=!1,!u&&c.length>=2&&!n.inFlow&&!m&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let R=!1,E=Sa.stringify(e,n,()=>R=!0,()=>p=!0),_=" ";if(d||y||v){if(_=y?`
39
+ `:"",v){let N=l(v);_+=`
40
+ ${Ft.indentComment(N,n.indent)}`}E===""&&!n.inFlow?_===`
41
+ `&&S&&(_=`
42
+
43
+ `):_+=`
44
+ ${n.indent}`}else if(!m&&we.isCollection(e)){let N=E[0],k=E.indexOf(`
45
+ `),q=k!==-1,Re=n.inFlow??e.flow??e.items.length===0;if(q||!Re){let it=!1;if(q&&(N==="&"||N==="!")){let L=E.indexOf(" ");N==="&"&&L!==-1&&L<k&&E[L+1]==="!"&&(L=E.indexOf(" ",L+1)),(L===-1||k<L)&&(it=!0)}it||(_=`
46
+ ${n.indent}`)}}else(E===""||E[0]===`
47
+ `)&&(_="");return h+=_+E,n.inFlow?R&&i&&i():S&&!R?h+=Ft.lineComment(h,n.indent,l(S)):p&&r&&r(),h}Ca.stringifyPair=gd});var Fr=w(Mr=>{"use strict";var Ra=qn("process");function wd(t,...e){t==="debug"&&console.log(...e)}function yd(t,e){(t==="debug"||t==="warn")&&(typeof Ra.emitWarning=="function"?Ra.emitWarning(e):console.warn(e))}Mr.debug=wd;Mr.warn=yd});var ti=w(ei=>{"use strict";var Zn=P(),_a=$(),Qn="<<",Xn={identify:t=>t===Qn||typeof t=="symbol"&&t.description===Qn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new _a.Scalar(Symbol(Qn)),{addToJSMap:xa}),stringify:()=>Qn},vd=(t,e)=>(Xn.identify(e)||Zn.isScalar(e)&&(!e.type||e.type===_a.Scalar.PLAIN)&&Xn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Xn.tag&&n.default);function xa(t,e,n){let i=Pa(t,n);if(Zn.isSeq(i))for(let r of i.items)Wr(t,e,r);else if(Array.isArray(i))for(let r of i)Wr(t,e,r);else Wr(t,e,i)}function Wr(t,e,n){let i=Pa(t,n);if(!Zn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[s,o]of r)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Pa(t,e){return t&&Zn.isAlias(e)?e.resolve(t.doc,t):e}ei.addMergeToJSMap=xa;ei.isMergeKey=vd;ei.merge=Xn});var Kr=w(Na=>{"use strict";var bd=Fr(),Oa=ti(),kd=Mt(),Aa=P(),Br=_e();function Sd(t,e,{key:n,value:i}){if(Aa.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(Oa.isMergeKey(t,n))Oa.addMergeToJSMap(t,e,i);else{let r=Br.toJS(n,"",t);if(e instanceof Map)e.set(r,Br.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=Cd(n,r,t),o=Br.toJS(i,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function Cd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Aa.isNode(t)&&n?.doc){let i=kd.createStringifyContext(n.doc,{});i.anchors=new Set;for(let s of n.anchors.keys())i.anchors.add(s.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let s=JSON.stringify(r);s.length>40&&(s=s.substring(0,36)+'..."'),bd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}Na.addPairToJSMap=Sd});var Ae=w(Ur=>{"use strict";var Ta=jt(),Ed=Ea(),Rd=Kr(),ni=P();function _d(t,e,n){let i=Ta.createNode(t,void 0,n),r=Ta.createNode(e,void 0,n);return new ii(i,r)}var ii=class t{constructor(e,n=null){Object.defineProperty(this,ni.NODE_TYPE,{value:ni.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return ni.isNode(n)&&(n=n.clone(e)),ni.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return Rd.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?Ed.stringifyPair(this,e,n,i):JSON.stringify(this)}};Ur.Pair=ii;Ur.createPair=_d});var Yr=w(ja=>{"use strict";var He=P(),Ia=Mt(),ri=$t();function xd(t,e,n){return(e.inFlow??t.flow?Od:Pd)(t,e,n)}function Pd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:s,type:null}),f=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],h=null;if(He.isNode(p))!f&&p.spaceBefore&&d.push(""),si(n,d,p.commentBefore,f),p.comment&&(h=p.comment);else if(He.isPair(p)){let v=He.isNode(p.key)?p.key:null;v&&(!f&&v.spaceBefore&&d.push(""),si(n,d,v.commentBefore,f))}f=!1;let y=Ia.stringify(p,u,()=>h=null,()=>f=!0);h&&(y+=ri.lineComment(y,s,l(h))),f&&h&&(f=!1),d.push(i+y)}let m;if(d.length===0)m=r.start+r.end;else{m=d[0];for(let g=1;g<d.length;++g){let p=d[g];m+=p?`
48
+ ${c}${p}`:`
49
+ `}}return t?(m+=`
50
+ `+ri.indentComment(l(t),c),a&&a()):f&&o&&o(),m}function Od({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;i+=s;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<t.length;++g){let p=t[g],h=null;if(He.isNode(p))p.spaceBefore&&f.push(""),si(e,f,p.commentBefore,!1),p.comment&&(h=p.comment);else if(He.isPair(p)){let v=He.isNode(p.key)?p.key:null;v&&(v.spaceBefore&&f.push(""),si(e,f,v.commentBefore,!1),v.comment&&(l=!0));let S=He.isNode(p.value)?p.value:null;S?(S.comment&&(h=S.comment),S.commentBefore&&(l=!0)):p.value==null&&v?.comment&&(h=v.comment)}h&&(l=!0);let y=Ia.stringify(p,c,()=>h=null);l||(l=f.length>u||y.includes(`
51
+ `)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((v,S)=>v+S.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),h&&(y+=ri.lineComment(y,i,a(h))),f.push(y),u=f.length}let{start:d,end:m}=n;if(f.length===0)return d+m;if(!l){let g=f.reduce((p,h)=>p+h.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of f)g+=p?`
52
+ ${s}${r}${p}`:`
53
+ `;return`${g}
54
+ ${r}${m}`}else return`${d}${o}${f.join(" ")}${o}${m}`}function si({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=ri.indentComment(e(i),t);n.push(s.trimStart())}}ja.stringifyCollection=xd});var Te=w(Jr=>{"use strict";var Ad=Yr(),Nd=Kr(),Td=Yn(),Ne=P(),oi=Ae(),Id=$();function Wt(t,e){let n=Ne.isScalar(e)?e.value:e;for(let i of t)if(Ne.isPair(i)&&(i.key===e||i.key===n||Ne.isScalar(i.key)&&i.key.value===n))return i}var Vr=class extends Td.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ne.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:s}=i,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||r)&&o.items.push(oi.createPair(c,l,i))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let i;Ne.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new oi.Pair(e,e?.value):i=new oi.Pair(e.key,e.value);let r=Wt(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Ne.isScalar(r.value)&&Id.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(s){let o=this.items.findIndex(a=>s(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let n=Wt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Wt(this.items,e)?.value;return(!n&&Ne.isScalar(r)?r.value:r)??void 0}has(e){return!!Wt(this.items,e)}set(e,n){this.add(new oi.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let s of this.items)Nd.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Ne.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ad.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Jr.YAMLMap=Vr;Jr.findPair=Wt});var ct=w(qa=>{"use strict";var jd=P(),$a=Te(),$d={collection:"map",default:!0,nodeClass:$a.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return jd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>$a.YAMLMap.from(t,e,n)};qa.map=$d});var Ie=w(La=>{"use strict";var qd=jt(),Ld=Yr(),Dd=Yn(),ci=P(),Md=$(),Fd=_e(),Hr=class extends Dd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ci.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=ai(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=ai(e);if(typeof i!="number")return;let r=this.items[i];return!n&&ci.isScalar(r)?r.value:r}has(e){let n=ai(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=ai(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];ci.isScalar(r)&&Md.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(e,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let s of this.items)i.push(Fd.toJS(s,String(r++),n));return i}toString(e,n,i){return e?Ld.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(o++);a=r.call(n,c,a)}s.items.push(qd.createNode(a,void 0,i))}}return s}};function ai(t){let e=ci.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}La.YAMLSeq=Hr});var lt=w(Ma=>{"use strict";var Wd=P(),Da=Ie(),Bd={collection:"seq",default:!0,nodeClass:Da.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Wd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Da.YAMLSeq.from(t,e,n)};Ma.seq=Bd});var Bt=w(Fa=>{"use strict";var Kd=Dt(),Ud={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,i){return e=Object.assign({actualString:!0},e),Kd.stringifyString(t,e,n,i)}};Fa.string=Ud});var li=w(Ka=>{"use strict";var Wa=$(),Ba={identify:t=>t==null,createNode:()=>new Wa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Wa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Ba.test.test(t)?t:e.options.nullStr};Ka.nullTag=Ba});var Gr=w(Ya=>{"use strict";var Yd=$(),Ua={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Yd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Ua.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Ya.boolTag=Ua});var ut=w(Va=>{"use strict";function Vd({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}Va.stringifyNumber=Vd});var Qr=w(ui=>{"use strict";var Jd=$(),zr=ut(),Hd={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:zr.stringifyNumber},Gd={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():zr.stringifyNumber(t)}},zd={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 Jd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:zr.stringifyNumber};ui.float=zd;ui.floatExp=Gd;ui.floatNaN=Hd});var Zr=w(di=>{"use strict";var Ja=ut(),fi=t=>typeof t=="bigint"||Number.isInteger(t),Xr=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function Ha(t,e,n){let{value:i}=t;return fi(i)&&i>=0?n+i.toString(e):Ja.stringifyNumber(t)}var Qd={identify:t=>fi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Xr(t,2,8,n),stringify:t=>Ha(t,8,"0o")},Xd={identify:fi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Xr(t,0,10,n),stringify:Ja.stringifyNumber},Zd={identify:t=>fi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Xr(t,2,16,n),stringify:t=>Ha(t,16,"0x")};di.int=Xd;di.intHex=Zd;di.intOct=Qd});var za=w(Ga=>{"use strict";var ep=ct(),tp=li(),np=lt(),ip=Bt(),rp=Gr(),es=Qr(),ts=Zr(),sp=[ep.map,np.seq,ip.string,tp.nullTag,rp.boolTag,ts.intOct,ts.int,ts.intHex,es.floatNaN,es.floatExp,es.float];Ga.schema=sp});var Za=w(Xa=>{"use strict";var op=$(),ap=ct(),cp=lt();function Qa(t){return typeof t=="bigint"||Number.isInteger(t)}var pi=({value:t})=>JSON.stringify(t),lp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:pi},{identify:t=>t==null,createNode:()=>new op.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:pi},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:pi},{identify:Qa,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Qa(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:pi}],up={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},fp=[ap.map,cp.seq].concat(lp,up);Xa.schema=fp});var is=w(ec=>{"use strict";var Kt=qn("buffer"),ns=$(),dp=Dt(),pp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Kt.Buffer=="function")return Kt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);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:n},i,r,s){if(!n)return"";let o=n,a;if(typeof Kt.Buffer=="function")a=o instanceof Kt.Buffer?o.toString("base64"):Kt.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]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=ns.Scalar.BLOCK_LITERAL),e!==ns.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=a.substr(d,c);a=u.join(e===ns.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return dp.stringifyString({comment:t,type:e,value:a},i,r,s)}};ec.binary=pp});var gi=w(hi=>{"use strict";var mi=P(),rs=Ae(),mp=$(),hp=Ie();function tc(t,e){if(mi.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!mi.isPair(i)){if(mi.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new rs.Pair(new mp.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
+ ${r.key.commentBefore}`:i.commentBefore),i.comment){let s=r.value??r.key;s.comment=s.comment?`${i.comment}
57
+ ${s.comment}`:i.comment}i=r}t.items[n]=mi.isPair(i)?i:new rs.Pair(i)}}else e("Expected a sequence for this tag");return t}function nc(t,e,n){let{replacer:i}=n,r=new hp.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=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)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;r.items.push(rs.createPair(a,c,n))}return r}var gp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:tc,createNode:nc};hi.createPairs=nc;hi.pairs=gp;hi.resolvePairs=tc});var as=w(os=>{"use strict";var ic=P(),ss=_e(),Ut=Te(),wp=Ie(),rc=gi(),Ge=class t extends wp.YAMLSeq{constructor(){super(),this.add=Ut.YAMLMap.prototype.add.bind(this),this.delete=Ut.YAMLMap.prototype.delete.bind(this),this.get=Ut.YAMLMap.prototype.get.bind(this),this.has=Ut.YAMLMap.prototype.has.bind(this),this.set=Ut.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let s,o;if(ic.isPair(r)?(s=ss.toJS(r.key,"",n),o=ss.toJS(r.value,s,n)):s=ss.toJS(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(e,n,i){let r=rc.createPairs(e,n,i),s=new this;return s.items=r.items,s}};Ge.tag="tag:yaml.org,2002:omap";var yp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=rc.resolvePairs(t,e),i=[];for(let{key:r}of n.items)ic.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Ge,n)},createNode:(t,e,n)=>Ge.from(t,e,n)};os.YAMLOMap=Ge;os.omap=yp});var lc=w(cs=>{"use strict";var sc=$();function oc({value:t,source:e},n){return e&&(t?ac:cc).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var ac={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 sc.Scalar(!0),stringify:oc},cc={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 sc.Scalar(!1),stringify:oc};cs.falseTag=cc;cs.trueTag=ac});var uc=w(wi=>{"use strict";var vp=$(),ls=ut(),bp={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:ls.stringifyNumber},kp={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():ls.stringifyNumber(t)}},Sp={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 vp.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:ls.stringifyNumber};wi.float=Sp;wi.floatExp=kp;wi.floatNaN=bp});var dc=w(Vt=>{"use strict";var fc=ut(),Yt=t=>typeof t=="bigint"||Number.isInteger(t);function yi(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let s=parseInt(t,n);return r==="-"?-1*s:s}function us(t,e,n){let{value:i}=t;if(Yt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return fc.stringifyNumber(t)}var Cp={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>yi(t,2,2,n),stringify:t=>us(t,2,"0b")},Ep={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>yi(t,1,8,n),stringify:t=>us(t,8,"0")},Rp={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>yi(t,0,10,n),stringify:fc.stringifyNumber},_p={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>yi(t,2,16,n),stringify:t=>us(t,16,"0x")};Vt.int=Rp;Vt.intBin=Cp;Vt.intHex=_p;Vt.intOct=Ep});var ds=w(fs=>{"use strict";var ki=P(),vi=Ae(),bi=Te(),ze=class t extends bi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;ki.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new vi.Pair(e.key,null):n=new vi.Pair(e,null),bi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=bi.findPair(this.items,e);return!n&&ki.isPair(i)?ki.isScalar(i.key)?i.key.value:i.key:i}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=bi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new vi.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(vi.createPair(o,null,i));return s}};ze.tag="tag:yaml.org,2002:set";var xp={collection:"map",identify:t=>t instanceof Set,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>ze.from(t,e,n),resolve(t,e){if(ki.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ze,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};fs.YAMLSet=ze;fs.set=xp});var ms=w(Si=>{"use strict";var Pp=ut();function ps(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*s:s}function pc(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Pp.stringifyNumber(t);let i="";e<0&&(i="-",e*=n(-1));let r=n(60),s=[e%r];return e<60?s.unshift(0):(e=(e-s[0])/r,s.unshift(e%r),e>=60&&(e=(e-s[0])/r,s.unshift(e))),i+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Op={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:n})=>ps(t,n),stringify:pc},Ap={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=>ps(t,!1),stringify:pc},mc={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(mc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,s||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let f=ps(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Si.floatTime=Ap;Si.intTime=Op;Si.timestamp=mc});var wc=w(gc=>{"use strict";var Np=ct(),Tp=li(),Ip=lt(),jp=Bt(),$p=is(),hc=lc(),hs=uc(),Ci=dc(),qp=ti(),Lp=as(),Dp=gi(),Mp=ds(),gs=ms(),Fp=[Np.map,Ip.seq,jp.string,Tp.nullTag,hc.trueTag,hc.falseTag,Ci.intBin,Ci.intOct,Ci.int,Ci.intHex,hs.floatNaN,hs.floatExp,hs.float,$p.binary,qp.merge,Lp.omap,Dp.pairs,Mp.set,gs.intTime,gs.floatTime,gs.timestamp];gc.schema=Fp});var xc=w(vs=>{"use strict";var kc=ct(),Wp=li(),Sc=lt(),Bp=Bt(),Kp=Gr(),ws=Qr(),ys=Zr(),Up=za(),Yp=Za(),Cc=is(),Jt=ti(),Ec=as(),Rc=gi(),yc=wc(),_c=ds(),Ei=ms(),vc=new Map([["core",Up.schema],["failsafe",[kc.map,Sc.seq,Bp.string]],["json",Yp.schema],["yaml11",yc.schema],["yaml-1.1",yc.schema]]),bc={binary:Cc.binary,bool:Kp.boolTag,float:ws.float,floatExp:ws.floatExp,floatNaN:ws.floatNaN,floatTime:Ei.floatTime,int:ys.int,intHex:ys.intHex,intOct:ys.intOct,intTime:Ei.intTime,map:kc.map,merge:Jt.merge,null:Wp.nullTag,omap:Ec.omap,pairs:Rc.pairs,seq:Sc.seq,set:_c.set,timestamp:Ei.timestamp},Vp={"tag:yaml.org,2002:binary":Cc.binary,"tag:yaml.org,2002:merge":Jt.merge,"tag:yaml.org,2002:omap":Ec.omap,"tag:yaml.org,2002:pairs":Rc.pairs,"tag:yaml.org,2002:set":_c.set,"tag:yaml.org,2002:timestamp":Ei.timestamp};function Jp(t,e,n){let i=vc.get(e);if(i&&!t)return n&&!i.includes(Jt.merge)?i.concat(Jt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(vc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)r=r.concat(s);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Jt.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?bc[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(bc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}vs.coreKnownTags=Vp;vs.getTags=Jp});var Ss=w(Pc=>{"use strict";var bs=P(),Hp=ct(),Gp=lt(),zp=Bt(),Ri=xc(),Qp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ks=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Ri.getTags(e,"compat"):e?Ri.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?Ri.coreKnownTags:{},this.tags=Ri.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,bs.MAP,{value:Hp.map}),Object.defineProperty(this,bs.SCALAR,{value:zp.string}),Object.defineProperty(this,bs.SEQ,{value:Gp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Qp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Pc.Schema=ks});var Ac=w(Oc=>{"use strict";var Xp=P(),Cs=Mt(),Ht=$t();function Zp(t,e){let n=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&n.push("---");let r=Cs.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Ht.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(Xp.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);n.push(Ht.indentComment(u,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=Cs.stringify(t.contents,r,()=>a=null,c);a&&(l+=Ht.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(Cs.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
+ `)?(n.push("..."),n.push(Ht.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Ht.indentComment(s(c),"")))}return n.join(`
59
+ `)+`
60
+ `}Oc.stringifyDocument=Zp});var Gt=w(Nc=>{"use strict";var em=It(),ft=Yn(),ee=P(),tm=Ae(),nm=_e(),im=Ss(),rm=Ac(),Es=Wn(),sm=Pr(),om=jt(),Rs=xr(),_s=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ee.NODE_TYPE,{value:ee.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Rs.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[ee.NODE_TYPE]:{value:ee.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=ee.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){dt(this.contents)&&this.contents.add(e)}addIn(e,n){dt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=Es.anchorNames(this);e.anchor=!n||i.has(n)?Es.findNewAnchor(n||"a",i):n}return new em.Alias(e.anchor)}createNode(e,n,i){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let h=v=>typeof v=="number"||v instanceof String||v instanceof Number,y=n.filter(h).map(String);y.length>0&&(n=n.concat(y)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:u}=i??{},{onAnchor:f,setAnchors:d,sourceObjects:m}=Es.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},p=om.createNode(e,u,g);return a&&ee.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),s=this.createNode(n,null,i);return new tm.Pair(r,s)}delete(e){return dt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ft.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):dt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return ee.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return ft.isEmptyPath(e)?!n&&ee.isScalar(this.contents)?this.contents.value:this.contents:ee.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return ee.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ft.isEmptyPath(e)?this.contents!==void 0:ee.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=ft.collectionFromPath(this.schema,[e],n):dt(this.contents)&&this.contents.set(e,n)}setIn(e,n){ft.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=ft.collectionFromPath(this.schema,Array.from(e),n):dt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Rs.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 Rs.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new im.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=nm.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:u}of a.anchors.values())s(u,l);return typeof o=="function"?sm.applyReviver(o,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return rm.stringifyDocument(this,e)}};function dt(t){if(ee.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Nc.Document=_s});var Xt=w(Qt=>{"use strict";var zt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},xs=class extends zt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},Ps=class extends zt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},am=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let s=r-1,o=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="…"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`…
61
+ `),o=a+o}if(/[^ ]/.test(o)){let a=1,c=n.linePos[1];c?.line===i&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-s)));let l=" ".repeat(s)+"^".repeat(a);n.message+=`:
62
+
63
+ ${o}
64
+ ${l}
65
+ `}};Qt.YAMLError=zt;Qt.YAMLParseError=xs;Qt.YAMLWarning=Ps;Qt.prettifyError=am});var Zt=w(Tc=>{"use strict";function cm(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,u=a,f="",d="",m=!1,g=!1,p=null,h=null,y=null,v=null,S=null,R=null,E=null;for(let k of t)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&s(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&k.type!=="comment"&&k.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),u=!0;break;case"comment":{u||s(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=k.source.substring(1)||" ";f?f+=d+q:f=q,d="",l=!1;break}case"newline":l?f?f+=k.source:(!R||n!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,m=!0,(h||y)&&(v=k),u=!0;break;case"anchor":h&&s(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&s(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=k,E??(E=k.offset),l=!1,u=!1,g=!0;break;case"tag":{y&&s(k,"MULTIPLE_TAGS","A node can have at most one tag"),y=k,E??(E=k.offset),l=!1,u=!1,g=!0;break}case n:(h||y)&&s(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),R&&s(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),R=k,l=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&s(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,l=!1,u=!1;break}default:s(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,u=!1}let _=t[t.length-1],N=_?_.offset+_.source.length:r;return g&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&s(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")&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:R,spaceBefore:c,comment:f,hasNewline:m,anchor:h,tag:y,newlineAfterProp:v,end:N,start:E??N}}Tc.resolveProps=cm});var _i=w(Ic=>{"use strict";function Os(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 n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Os(e.key)||Os(e.value))return!0}return!1;default:return!0}}Ic.containsNewline=Os});var As=w(jc=>{"use strict";var lm=_i();function um(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&lm.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}jc.flowIndentCheck=um});var Ns=w(qc=>{"use strict";var $c=P();function fm(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||$c.isScalar(s)&&$c.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}qc.mapIncludes=fm});var Bc=w(Wc=>{"use strict";var Lc=Ae(),dm=Te(),Dc=Zt(),pm=_i(),Mc=As(),mm=Ns(),Fc="All mapping items must start at the same column";function hm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??dm.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let u of i.items){let{start:f,key:d,sep:m,value:g}=u,p=Dc.resolveProps(f,{indicator:"explicit-key-ind",next:d??m?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),h=!p.found;if(h){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(c,"BAD_INDENT",Fc)),!p.anchor&&!p.tag&&!m){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||pm.containsNewline(d))&&r(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",Fc);n.atKey=!0;let y=p.end,v=d?t(n,d,p,r):e(n,y,f,null,p,r);n.schema.compat&&Mc.flowIndentCheck(i.indent,d,r),n.atKey=!1,mm.mapIncludes(n,a.items,v)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let S=Dc.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:v.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){h&&(g?.type==="block-map"&&!S.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<S.found.offset-1024&&r(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let R=g?t(n,g,S,r):e(n,c,m,null,S,r);n.schema.compat&&Mc.flowIndentCheck(i.indent,g,r),c=R.range[2];let E=new Lc.Pair(v,R);n.options.keepSourceTokens&&(E.srcToken=u),a.items.push(E)}else{h&&r(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(v.comment?v.comment+=`
68
+ `+S.comment:v.comment=S.comment);let R=new Lc.Pair(v);n.options.keepSourceTokens&&(R.srcToken=u),a.items.push(R)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}Wc.resolveBlockMap=hm});var Uc=w(Kc=>{"use strict";var gm=Ie(),wm=Zt(),ym=As();function vm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??gm.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,l=null;for(let{start:u,value:f}of i.items){let d=wm.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let m=f?t(n,f,d,r):e(n,d.end,u,null,d,r);n.schema.compat&&ym.flowIndentCheck(i.indent,f,r),c=m.range[2],a.items.push(m)}return a.range=[i.offset,c,l??c],a}Kc.resolveBlockSeq=vm});var pt=w(Yc=>{"use strict";function bm(t,e,n,i){let r="";if(t){let s=!1,o="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{n&&!s&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";r?r+=o+u:r=u,o="";break}case"newline":r&&(o+=c),s=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}Yc.resolveEnd=bm});var Gc=w(Hc=>{"use strict";var km=P(),Sm=Ae(),Vc=Te(),Cm=Ie(),Em=pt(),Jc=Zt(),Rm=_i(),_m=Ns(),Ts="Block collections are not allowed within flow collections",Is=t=>t&&(t.type==="block-map"||t.type==="block-seq");function xm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?Vc.YAMLMap:Cm.YAMLSeq),l=new c(n.schema);l.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=i.offset+i.start.source.length;for(let h=0;h<i.items.length;++h){let y=i.items[h],{start:v,key:S,sep:R,value:E}=y,_=Jc.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:S??R?.[0],offset:f,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!_.found){if(!_.anchor&&!_.tag&&!R&&!E){h===0&&_.comma?r(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<i.items.length-1&&r(_.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),_.comment&&(l.comment?l.comment+=`
69
+ `+_.comment:l.comment=_.comment),f=_.end;continue}!o&&n.options.strict&&Rm.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)_.comma&&r(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(_.comma||r(_.start,"MISSING_CHAR",`Missing , between ${a} items`),_.comment){let N="";e:for(let k of v)switch(k.type){case"comma":case"space":break;case"comment":N=k.source.substring(1);break e;default:break e}if(N){let k=l.items[l.items.length-1];km.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
+ `+N:k.comment=N,_.comment=_.comment.substring(N.length+1)}}if(!o&&!R&&!_.found){let N=E?t(n,E,_,r):e(n,_.end,R,null,_,r);l.items.push(N),f=N.range[2],Is(E)&&r(N.range,"BLOCK_IN_FLOW",Ts)}else{n.atKey=!0;let N=_.end,k=S?t(n,S,_,r):e(n,N,v,null,_,r);Is(S)&&r(k.range,"BLOCK_IN_FLOW",Ts),n.atKey=!1;let q=Jc.resolveProps(R??[],{flow:a,indicator:"map-value-ind",next:E,offset:k.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(q.found){if(!o&&!_.found&&n.options.strict){if(R)for(let L of R){if(L===q.found)break;if(L.type==="newline"){r(L,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}_.start<q.found.offset-1024&&r(q.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]===":"?r(E,"MISSING_CHAR",`Missing space after : in ${a}`):r(q.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Re=E?t(n,E,q,r):q.found?e(n,q.end,R,null,q,r):null;Re?Is(E)&&r(Re.range,"BLOCK_IN_FLOW",Ts):q.comment&&(k.comment?k.comment+=`
71
+ `+q.comment:k.comment=q.comment);let it=new Sm.Pair(k,Re);if(n.options.keepSourceTokens&&(it.srcToken=y),o){let L=l;_m.mapIncludes(n,L.items,k)&&r(N,"DUPLICATE_KEY","Map keys must be unique"),L.items.push(it)}else{let L=new Vc.YAMLMap(n.schema);L.flow=!0,L.items.push(it);let Go=(Re??k).range;L.range=[k.range[0],Go[1],Go[2]],l.items.push(L)}f=Re?Re.range[2]:q.end}}let d=o?"}":"]",[m,...g]=i.end,p=f;if(m?.source===d)p=m.offset+m.source.length;else{let h=a[0].toUpperCase()+a.substring(1),y=u?`${h} must end with a ${d}`:`${h} in block collection must be sufficiently indented and end with a ${d}`;r(f,u?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let h=Em.resolveEnd(g,p,n.options.strict,r);h.comment&&(l.comment?l.comment+=`
72
+ `+h.comment:l.comment=h.comment),l.range=[i.offset,p,h.offset]}else l.range=[i.offset,p,p];return l}Hc.resolveFlowCollection=xm});var Qc=w(zc=>{"use strict";var Pm=P(),Om=$(),Am=Te(),Nm=Ie(),Tm=Bc(),Im=Uc(),jm=Gc();function js(t,e,n,i,r,s){let o=n.type==="block-map"?Tm.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?Im.resolveBlockSeq(t,e,n,i,s):jm.resolveFlowCollection(t,e,n,i,s),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function $m(t,e,n,i,r){let s=i.tag,o=s?e.directives.tagName(s.source,d=>r(s,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=i,g=d&&s?d.offset>s.offset?d:s:d??s;g&&(!m||m.offset<g.offset)&&r(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===Am.YAMLMap.tagName&&a==="map"||o===Nm.YAMLSeq.tagName&&a==="seq")return js(t,e,n,r,o);let c=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!c){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(s,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),js(t,e,n,r,o)}let l=js(t,e,n,r,o,c),u=c.resolve?.(l,d=>r(s,"TAG_RESOLVE_FAILED",d),e.options)??l,f=Pm.isNode(u)?u:new Om.Scalar(u);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}zc.composeCollection=$m});var qs=w(Xc=>{"use strict";var $s=$();function qm(t,e,n){let i=e.offset,r=Lm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?$s.Scalar.BLOCK_FOLDED:$s.Scalar.BLOCK_LITERAL,o=e.source?Dm(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let h=o[p][1];if(h===""||h==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
73
+ `.repeat(Math.max(1,o.length-1)):"",h=i+r.length;return e.source&&(h+=e.source.length),{value:p,type:s,comment:r.comment,range:[i,h,h]}}let c=e.indent+r.indent,l=e.offset+r.length,u=0;for(let p=0;p<a;++p){let[h,y]=o[p];if(y===""||y==="\r")r.indent===0&&h.length>c&&(c=h.length);else{h.length<c&&n(l+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=h.length),u=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=h.length+y.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let f="",d="",m=!1;for(let p=0;p<u;++p)f+=o[p][0].slice(c)+`
74
+ `;for(let p=u;p<a;++p){let[h,y]=o[p];l+=h.length+y.length+1;let v=y[y.length-1]==="\r";if(v&&(y=y.slice(0,-1)),y&&h.length<c){let R=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-y.length-(v?2:1),"BAD_INDENT",R),h=""}s===$s.Scalar.BLOCK_LITERAL?(f+=d+h.slice(c)+y,d=`
75
+ `):h.length>c||y[0]===" "?(d===" "?d=`
76
+ `:!m&&d===`
77
+ `&&(d=`
78
+
79
+ `),f+=d+h.slice(c)+y,d=`
80
+ `,m=!0):y===""?d===`
81
+ `?f+=`
82
+ `:d=`
83
+ `:(f+=d+y,d=" ",m=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)f+=`
84
+ `+o[p][0].slice(c);f[f.length-1]!==`
85
+ `&&(f+=`
86
+ `);break;default:f+=`
87
+ `}let g=i+r.length+e.source.length;return{value:f,type:s,comment:r.comment,range:[i,g,g]}}function Lm({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],s=r[0],o=0,a="",c=-1;for(let d=1;d<r.length;++d){let m=r[d];if(!a&&(m==="-"||m==="+"))a=m;else{let g=Number(m);!o&&g?o=g:c===-1&&(c=t+d)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,u="",f=r.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":l=!0;case"newline":f+=m.source.length;break;case"comment":n&&!l&&i(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,u=m.source.substring(1);break;case"error":i(m,"UNEXPECTED_TOKEN",m.message),f+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;i(m,"UNEXPECTED_TOKEN",g);let p=m.source;p&&typeof p=="string"&&(f+=p.length)}}}return{mode:s,indent:o,chomp:a,comment:u,length:f}}function Dm(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),s=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}Xc.resolveBlockScalar=qm});var Ds=w(el=>{"use strict";var Ls=$(),Mm=pt();function Fm(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(d,m,g)=>n(i+d,m,g);switch(r){case"scalar":a=Ls.Scalar.PLAIN,c=Wm(s,l);break;case"single-quoted-scalar":a=Ls.Scalar.QUOTE_SINGLE,c=Bm(s,l);break;case"double-quoted-scalar":a=Ls.Scalar.QUOTE_DOUBLE,c=Km(s,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+s.length,i+s.length]}}let u=i+s.length,f=Mm.resolveEnd(o,u,e,n);return{value:c,type:a,comment:f.comment,range:[i,u,f.offset]}}function Wm(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Zc(t)}function Bm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Zc(t.slice(1,-1)).replace(/''/g,"'")}function Zc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
+ `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(t);if(!i)return t;let r=i[1],s=" ",o=e.lastIndex;for(n.lastIndex=o;i=n.exec(t);)i[1]===""?s===`
90
+ `?r+=s:s=`
91
+ `:(r+=s+i[1],s=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(t),r+s+(i?.[1]??"")}function Km(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
+ `))if(r===`
93
+ `){let{fold:s,offset:o}=Um(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=Ym[s];if(o)n+=o;else if(s===`
94
+ `)for(s=t[i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="\r"&&t[i+1]===`
95
+ `)for(s=t[++i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;n+=Vm(t,i+1,a,e),i+=a}else{let a=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let s=i,o=t[i+1];for(;o===" "||o===" ";)o=t[++i+1];o!==`
96
+ `&&!(o==="\r"&&t[i+2]===`
97
+ `)&&(n+=i>s?t.slice(s,i+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Um(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
+ `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
+ `);)i===`
100
+ `&&(n+=`
101
+ `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Ym={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Vm(t,e,n,i){let r=t.substr(e,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}el.resolveFlowScalar=Fm});var il=w(nl=>{"use strict";var Qe=P(),tl=$(),Jm=qs(),Hm=Ds();function Gm(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?Jm.resolveBlockScalar(t,e,i):Hm.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,f=>i(n,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Qe.SCALAR]:c?l=zm(t.schema,r,c,n,i):e.type==="scalar"?l=Qm(t,r,e,i):l=t.schema[Qe.SCALAR];let u;try{let f=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);u=Qe.isScalar(f)?f:new tl.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);i(n??e,"TAG_RESOLVE_FAILED",d),u=new tl.Scalar(r)}return u.range=a,u.source=r,s&&(u.type=s),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function zm(t,e,n,i,r){if(n==="!")return t[Qe.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Qe.SCALAR])}function Qm({atKey:t,directives:e,schema:n},i,r,s){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||n[Qe.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[Qe.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",u,!0)}}return o}nl.composeScalar=Gm});var sl=w(rl=>{"use strict";function Xm(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}rl.emptyScalarPosition=Xm});var cl=w(Fs=>{"use strict";var Zm=It(),eh=P(),th=Qc(),ol=il(),nh=pt(),ih=sl(),rh={composeNode:al,composeEmptyNode:Ms};function al(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,u=!0;switch(e.type){case"alias":l=sh(t,e,i),(a||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=ol.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=th.composeCollection(rh,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);i(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=Ms(t,e.offset,void 0,null,n,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!eh.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"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function Ms(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let u={type:"scalar",offset:ih.emptyScalarPosition(e,n,i),indent:-1,source:""},f=ol.composeScalar(t,u,a,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=c),f}function sh({options:t},{offset:e,source:n,end:i},r){let s=new Zm.Alias(n.substring(1));s.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=nh.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Fs.composeEmptyNode=Ms;Fs.composeNode=al});var fl=w(ul=>{"use strict";var oh=Gt(),ll=cl(),ah=pt(),ch=Zt();function lh(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new oh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=ch.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?ll.composeNode(l,r,u,o):ll.composeEmptyNode(l,u.end,i,null,u,o);let f=c.contents.range[2],d=ah.resolveEnd(s,f,!1,o);return d.comment&&(c.comment=d.comment),c.range=[n,f,d.offset],c}ul.composeDoc=lh});var Bs=w(ml=>{"use strict";var uh=qn("process"),fh=xr(),dh=Gt(),en=Xt(),dl=P(),ph=fl(),mh=pt();function tn(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:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function pl(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let s=t[r];switch(s[0]){case"#":e+=(e===""?"":i?`
103
+
104
+ `:`
105
+ `)+(s.substring(1)||" "),n=!0,i=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}var Ws=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=tn(n);s?this.warnings.push(new en.YAMLWarning(o,i,r)):this.errors.push(new en.YAMLParseError(o,i,r))},this.directives=new fh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=pl(this.prelude);if(i){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
+ ${i}`:i;else if(r||e.directives.docStart||!s)e.commentBefore=i;else if(dl.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];dl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
107
+ ${a}`:i}else{let o=s.commentBefore;s.commentBefore=o?`${i}
108
+ ${o}`:i}}if(n){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:pl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(uh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=tn(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=ph.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new en.YAMLParseError(tn(e),"UNEXPECTED_TOKEN",n);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 en.YAMLParseError(tn(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=mh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new en.YAMLParseError(tn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-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),r=new dh.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};ml.Composer=Ws});var wl=w(xi=>{"use strict";var hh=qs(),gh=Ds(),wh=Xt(),hl=Dt();function yh(t,e=!0,n){if(t){let i=(r,s,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,s,o);else throw new wh.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return gh.resolveFlowScalar(t,e,i);case"block-scalar":return hh.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function vh(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=hl.stringifyString({type:o,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
110
+ `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
+ `),u=a.substring(0,l),f=a.substring(l+1)+`
112
+ `,d=[{type:"block-scalar-header",offset:s,indent:i,source:u}];return gl(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:s,indent:i,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:s,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:i,source:a,end:c};default:return{type:"scalar",offset:s,indent:i,source:a,end:c}}}function bh(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=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=hl.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":kh(t,c);break;case'"':Ks(t,c,"double-quoted-scalar");break;case"'":Ks(t,c,"single-quoted-scalar");break;default:Ks(t,c,"scalar")}}function kh(t,e){let n=e.indexOf(`
114
+ `),i=e.substring(0,n),r=e.substring(n+1)+`
115
+ `;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=i,t.source=r}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:i}];gl(a,"end"in t?t.end:void 0)||a.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:a,source:r})}}function gl(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Ks(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let s of i)s.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:i,source:e,end:r})}}}xi.createScalarToken=vh;xi.resolveAsScalar=yh;xi.setScalarValue=bh});var vl=w(yl=>{"use strict";var Sh=t=>"type"in t?Oi(t):Pi(t);function Oi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Oi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Pi(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Pi(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Pi(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Pi({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=Oi(e)),n)for(let s of n)r+=s.source;return i&&(r+=Oi(i)),r}yl.stringify=Sh});var Cl=w(Sl=>{"use strict";var Us=Symbol("break visit"),Ch=Symbol("skip children"),bl=Symbol("remove item");function Xe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),kl(Object.freeze([]),t,e)}Xe.BREAK=Us;Xe.SKIP=Ch;Xe.REMOVE=bl;Xe.itemAtPath=(t,e)=>{let n=t;for(let[i,r]of e){let s=n?.[i];if(s&&"items"in s)n=s.items[r];else return}return n};Xe.parentCollection=(t,e)=>{let n=Xe.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function kl(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let s=e[r];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=kl(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Us)return Us;a===bl&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}Sl.visit=Xe});var Ai=w(z=>{"use strict";var Ys=wl(),Eh=vl(),Rh=Cl(),Vs="\uFEFF",Js="",Hs="",Gs="",_h=t=>!!t&&"items"in t,xh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Ph(t){switch(t){case Vs:return"<BOM>";case Js:return"<DOC>";case Hs:return"<FLOW_END>";case Gs:return"<SCALAR>";default:return JSON.stringify(t)}}function Oh(t){switch(t){case Vs:return"byte-order-mark";case Js:return"doc-mode";case Hs:return"flow-error-end";case Gs:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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(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}z.createScalarToken=Ys.createScalarToken;z.resolveAsScalar=Ys.resolveAsScalar;z.setScalarValue=Ys.setScalarValue;z.stringify=Eh.stringify;z.visit=Rh.visit;z.BOM=Vs;z.DOCUMENT=Js;z.FLOW_END=Hs;z.SCALAR=Gs;z.isCollection=_h;z.isScalar=xh;z.prettyToken=Ph;z.tokenType=Oh});var Xs=w(Rl=>{"use strict";var nn=Ai();function ie(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var El=new Set("0123456789ABCDEFabcdef"),Ah=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ni=new Set(",[]{}"),Nh=new Set(` ,[]{}
121
+ \r `),zs=t=>!t||Nh.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,n=!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=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
122
+ `?!0:n==="\r"?this.buffer[e+1]===`
123
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+e];if(n==="\r"){let r=this.buffer[i+e+1];if(r===`
124
+ `||!r&&!this.atEnd)return e+i+1}return n===`
125
+ `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&ie(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]===nn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let s=e[i-1];if(s===" "||s===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield nn.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 n=this.peek(3);if((n==="---"||n==="...")&&ie(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ie(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ie(n)){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 n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);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(zs),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&ie(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield nn.FLOW_END,yield*this.parseLineStart();let s=0;for(;r[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),r[s]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-s),"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(zs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ie(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),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
127
+ `,this.pos);if(r!==-1){for(;r!==-1;){let s=this.continueScalar(r+1);if(s===-1)break;r=i.indexOf(`
128
+ `,s)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ie(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let s=this.pos;i=this.buffer[s];++s)switch(i){case" ":n+=1;break;case`
129
+ `:e=s,n=0;break;case"\r":{let o=this.buffer[s+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(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
131
+ `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
+ `;)i=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
133
+ `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield nn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let s=this.buffer[i+1];if(ie(s)||e&&Ni.has(s))break;n=i}else if(ie(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
134
+ `?(i+=1,r=`
135
+ `,s=this.buffer[i+1]):n=i),s==="#"||e&&Ni.has(s))break;if(r===`
136
+ `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&Ni.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield nn.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(n&&(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(zs),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(ie(i)||n&&Ni.has(i)){n?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,n=this.buffer[e];for(;!ie(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Ah.has(n))n=this.buffer[++e];else if(n==="%"&&El.has(this.buffer[e+1])&&El.has(this.buffer[e+2]))n=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 n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Rl.Lexer=Qs});var eo=w(_l=>{"use strict";var Zs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let s=n+i>>1;this.lineStarts[s]<e?n=s+1:i=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};_l.LineCounter=Zs});var no=w(Nl=>{"use strict";var Th=qn("process"),xl=Ai(),Ih=Xs();function je(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Pl(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 Al(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 Ti(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 mt(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 Ii(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function Ol(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Al(e.value)?e.value.end?Ii(e.value.end,e.sep):e.value.end=e.sep:Ii(e.start,e.sep),delete e.sep)}var to=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 Ih.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,n))yield*this.next(i);n||(yield*this.end())}*next(e){if(this.source=e,Th.env.LOG_TOKENS&&console.log("|",xl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=xl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Ol(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&Pl(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.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":{Pl(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 n=this.startBlockValue(e);n?this.stack.push(n):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 n=Ti(this.peek(2)),i=mt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}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 n=this.source.indexOf(`
139
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
140
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.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 n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ii(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(s.push(this.sourceToken),e.items.push({start:s,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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(je(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(Al(n.key)&&!je(n.sep,"newline")){let o=mt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(je(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=mt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?e.items.push({start:s,key:null,sep:[this.sourceToken]}):je(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{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);r||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!je(n.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:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.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 n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ii(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||je(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.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 n=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":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,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 r=Ti(i),s=mt(r);Ol(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
141
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
142
+ `,n)+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 n=Ti(e),i=mt(n);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 n=Ti(e),i=mt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!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())}}};Nl.Parser=to});var ql=w(sn=>{"use strict";var Tl=Bs(),jh=Gt(),rn=Xt(),$h=Fr(),qh=P(),Lh=eo(),Il=no();function jl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Lh.LineCounter||null,prettyErrors:e}}function Dh(t,e={}){let{lineCounter:n,prettyErrors:i}=jl(e),r=new Il.Parser(n?.addNewLine),s=new Tl.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(rn.prettifyError(t,n)),a.warnings.forEach(rn.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function $l(t,e={}){let{lineCounter:n,prettyErrors:i}=jl(e),r=new Il.Parser(n?.addNewLine),s=new Tl.Composer(e),o=null;for(let a of s.compose(r.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new rn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(rn.prettifyError(t,n)),o.warnings.forEach(rn.prettifyError(t,n))),o}function Mh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=$l(t,n);if(!r)return null;if(r.warnings.forEach(s=>$h.warn(r.options.logLevel,s)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function Fh(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=n??e??{};if(!r)return}return qh.isDocument(t)&&!i?t.toString(n):new jh.Document(t,i,n).toString(n)}sn.parse=Mh;sn.parseAllDocuments=Dh;sn.parseDocument=$l;sn.stringify=Fh});var ht=w(A=>{"use strict";var Wh=Bs(),Bh=Gt(),Kh=Ss(),io=Xt(),Uh=It(),$e=P(),Yh=Ae(),Vh=$(),Jh=Te(),Hh=Ie(),Gh=Ai(),zh=Xs(),Qh=eo(),Xh=no(),ji=ql(),Ll=Ot();A.Composer=Wh.Composer;A.Document=Bh.Document;A.Schema=Kh.Schema;A.YAMLError=io.YAMLError;A.YAMLParseError=io.YAMLParseError;A.YAMLWarning=io.YAMLWarning;A.Alias=Uh.Alias;A.isAlias=$e.isAlias;A.isCollection=$e.isCollection;A.isDocument=$e.isDocument;A.isMap=$e.isMap;A.isNode=$e.isNode;A.isPair=$e.isPair;A.isScalar=$e.isScalar;A.isSeq=$e.isSeq;A.Pair=Yh.Pair;A.Scalar=Vh.Scalar;A.YAMLMap=Jh.YAMLMap;A.YAMLSeq=Hh.YAMLSeq;A.CST=Gh;A.Lexer=zh.Lexer;A.LineCounter=Qh.LineCounter;A.Parser=Xh.Parser;A.parse=ji.parse;A.parseAllDocuments=ji.parseAllDocuments;A.parseDocument=ji.parseDocument;A.stringify=ji.stringify;A.visit=Ll.visit;A.visitAsync=Ll.visitAsync});function qe(t){return t!==0&&t!==0n&&t!=="0"}function $i(t,e){return qe(t.dev)&&qe(e.dev)&&qe(t.ino)&&qe(e.ino)}function ye(t,e){let n=qe(t.dev)&&qe(e.dev);if(n&&t.dev!==e.dev)return!1;let i=qe(t.ino)&&qe(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var qi=U(()=>{"use strict"});import{constants as Li,promises as Ze}from"fs";function ro(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Dl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function on(t){return{dev:t.dev,ino:t.ino,birthtime:ro(t)}}function Di(t,e){let n=on(t),i=on(e);return $i(n,i)?ye(n,i):ye(n,i)&&ro(t)===ro(e)&&Dl(t)===Dl(e)&&t.size===e.size}async function Mi(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,s=await Ze.lstat(t,{bigint:r});if(!s.isFile()||s.isSymbolicLink())throw new Le("not-regular-file",`${i} must be a regular file`);if(BigInt(s.size)>BigInt(e))throw new Le("too-large",`${i} exceeds ${e} bytes`);let o=await Ze.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:on(s)});let a=process.platform==="win32"?Li.O_RDONLY:Li.O_RDONLY|Li.O_NOFOLLOW|Li.O_NONBLOCK,c;try{c=await Ze.open(t,a)}catch(l){throw l.code==="ELOOP"?new Le("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:r}),Ze.lstat(t,{bigint:r}),Ze.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==o||!Di(s,l)||!Di(s,u))throw new Le("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:f,identity:on(l)}),await n.hooks?.afterOpen?.();let d=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let v=e+1-m,{bytesRead:S}=await c.read(g,0,Math.min(g.length,v),null);if(S===0)break;if(m+=S,m>e)throw new Le("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,h,y]=await Promise.all([c.stat({bigint:r}),Ze.lstat(t,{bigint:r}),Ze.realpath(t)]);if(!h.isFile()||h.isSymbolicLink()||y!==o||!Di(s,p)||!Di(s,h))throw new Le("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:y,identity:on(p)}),{bytes:Buffer.concat(d,m),stat:p,realPath:y}}finally{await c.close()}}var Le,so=U(()=>{"use strict";qi();Le=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import Ki from"path";function ug(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Ki.posix.isAbsolute(n)||Ki.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function Ui(t){let e=ug(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Xl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function De(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||Ki.posix.isAbsolute(i)||Ki.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(s=>s===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(s=>s===""||s==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function dn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Zl(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function eu(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>go)throw new Error(`${e} exceeds ${go} characters`);let n=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?n+=1:t[i]==="*"&&(n+=1,t[i+1]==="*"&&(i+=1));if(n>wo)throw new Error(`${e} contains more than ${wo} wildcard tokens`);return t}function Ql(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(i=>eu(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function ho(t,e,n){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${n} must be a positive integer`);return i}function fg(t){if(t===void 0)return{...ve,include:[...ve.include],exclude:[...ve.exclude]};let e=dn(t,"native.snapshot");return{include:Ql(e.include,"native.snapshot.include",ve.include),exclude:Ql(e.exclude,"native.snapshot.exclude",ve.exclude),max_files:ho(e.max_files,ve.max_files,"native.snapshot.max_files"),max_total_bytes:ho(e.max_total_bytes,ve.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:ho(e.max_duration_ms,ve.max_duration_ms,"native.snapshot.max_duration_ms")}}function dg(t){if(t===void 0)return;let e=dn(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=e.to_artifact_root,s=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(s!=="copying"&&s!=="ready"&&s!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let a=dn(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=a.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:n,fromArtifactRoot:Ui(i),toArtifactRoot:Ui(r),stage:s,...o?{cleanup:o}:{}}}function pg(t){let e=dn(t,"native");if(typeof e.artifact_root!="string")throw new Error("native.artifact_root must be a string");let n=e.clarification_mode??"sequential";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let i=e.archive_confirmation??"automatic";if(i!=="automatic"&&i!=="required")throw new Error("native.archive_confirmation must be automatic or required");let r=e.max_verify_failures??cg;if(!Number.isSafeInteger(r)||r<1)throw new Error("native.max_verify_failures must be a positive integer");let s=dg(e.pending_root_move);return{artifact_root:Ui(e.artifact_root),language:Zl(e.language,"en","native.language"),clarification_mode:n,archive_confirmation:i,max_verify_failures:r,snapshot:fg(e.snapshot),...s?{pending_root_move:s}:{}}}function mg(t){let e=dn(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="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 r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Xl(e.artifact_layout),language:Zl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function hg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function gg(t,e,n,i,r){let s=t.schema!==void 0;if(!(s||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!s)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 a=t.workflows??[t.default_workflow];if(!Array.isArray(a)||a.length===0||a.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(a)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:i,...e?{native:e}:{},...n?{classic:n}:{}}}function pn(t,e={}){let n=(0,yo.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let i=n.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 r=i,s=hg(r.ambient_resume),o=r.native===void 0?void 0:pg(r.native),a=r.classic===void 0?void 0:mg(r.classic),c=gg(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}var yo,Yi,go,wo,cg,lg,ve,Me=U(()=>{"use strict";yo=Pt(ht(),1),Yi=64*1024,go=1024,wo=64,cg=5,lg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],ve={include:["**/*"],exclude:[...lg],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{promises as Fe}from"fs";import re from"path";function tu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Vi(t,e){let n=re.relative(t,e);return n===""||!re.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${re.sep}`)}async function vo(t,e){let n=re.resolve(t),i=await Fe.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Fe.realpath(n)}async function bo(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=re.join(r,n[s]);let o;try{o=await Fe.lstat(r)}catch(u){if(tu(u))return{exists:!1,kind:"missing"};throw u}let a=re.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=s===n.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${a} 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 Fe.realpath(r);if(!Vi(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 j(t,e,n){let i=De(e,n.label),r=re.resolve(t),s=await vo(r,n.label),o=i.split("/"),a=re.resolve(r,...o);if(!Vi(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await bo(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function ko(t,e,n){let i=De(e,n.label),r=re.resolve(t),s=await vo(r,n.label),o=i.split("/"),a=r;for(let c of o){a=re.join(a,c);let l;try{l=await Fe.lstat(a)}catch(d){if(!tu(d))throw d;try{await Fe.mkdir(a)}catch(m){if(m.code!=="EEXIST")throw m}l=await Fe.lstat(a)}let u=re.relative(r,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${u}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${u} must be a real directory`);let f=await Fe.realpath(a);if(!Vi(s,f))throw new Error(`${n.label} resolves outside the project root`)}return await bo(r,s,o,{label:n.label,expected:"directory"}),a}async function Ji(t,e,n){return(await j(t,e,{...n,expected:"file"})).exists}async function Y(t,e,n,i){let r=await j(t,e,{label:i.label,expected:"file"});if(!r.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let s=await vo(r.projectRoot,i.label);return Mi(r.target,n,{...i,verify:async(o,a)=>{if(!Vi(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await bo(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var ue=U(()=>{"use strict";so();Me()});import{createHash as wg}from"crypto";function yg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function gt(t,e={}){return(await Hi(t,e)).document}async function vg(t){try{return(await Y(t,mn,Yi,{label:mn})).bytes}catch(e){if(yg(e))return null;throw e}}function bg(t){return t?{exists:!0,sha256:wg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Hi(t,e={}){let n=await vg(t);return{document:n?pn(n.toString("utf8"),e):null,identity:bg(n)}}var mn,wt=U(()=>{"use strict";Me();ue();mn=".comet/config.yaml"});import{randomUUID as kg}from"crypto";import{promises as M}from"fs";import B from"path";function yt(t,e){let n=B.relative(t,e);return n===""||!B.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${B.sep}`)}function zi(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Sg(t,e){return ye(t,zi(e))}function Gi(t,e){let n=zi(t),i=zi(e);return $i(n,i)?ye(n,i):ye(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Qi(t){let e=await M.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await M.realpath(t),...zi(e)}}async function We(t){for(let e of t){let n=await M.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Sg(e,n)||await M.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Cg(t,e){let n=B.resolve(t),i=B.resolve(e);if(!yt(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await Qi(n)],s=B.relative(n,i).split(B.sep).filter(Boolean),o=n;for(let a of s){await We(r),o=B.join(o,a);try{await M.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Qi(o);if(!yt(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await We(r),r}async function Eg(t,e){let n=B.resolve(t),i=B.resolve(e);if(!yt(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await Qi(n)],s=B.relative(n,i).split(B.sep).filter(Boolean),o=n;for(let a of s){o=B.join(o,a);try{let c=await Qi(o);if(!yt(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${o}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await We(r),r}async function nu(t){let e;try{e=await M.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function Rg(t,e,n){let i=B.dirname(t),r=await Cg(n.containedRoot,i),s=B.join(i,`.${B.basename(t)}.${kg()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await M.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([M.lstat(s),M.realpath(s)]);if(await We(r),!c.isFile()||c.isSymbolicLink()||!Gi(a,c)||!yt(r[0].realPath,l))throw new Error("Contained 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(),!Gi(a,await o.stat()))throw new Error("Contained atomic write temporary file changed while writing");await o.close(),o=void 0,await n.beforeCommit?.(),await We(r);let u=await M.lstat(s);if(!u.isFile()||u.isSymbolicLink()||!Gi(u,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await M.link(s,t),await M.unlink(s)):await M.rename(s,t),await nu(i)}catch(c){await o?.close();try{await We(r),await M.rm(s,{force:!0})}catch{}throw c}}async function fe(t,e,n){await Rg(t,e,n)}async function So(t,e){let n=B.dirname(t),i=await Eg(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await M.lstat(t),s=await M.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!yt(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await We(i);let[o,a]=await Promise.all([M.lstat(t),M.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Gi(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await M.unlink(t),await We(i),await nu(n),!0}var vt=U(()=>{"use strict";qi()});var uk,Co=U(()=>{"use strict";vt();wt();ue();uk=16*1024});var Eo=U(()=>{"use strict";vt();Me();wt();ue();Co()});var er=U(()=>{"use strict"});var hu=U(()=>{"use strict"});var Po=U(()=>{"use strict";er()});var gu=U(()=>{"use strict";er();Po()});var wu=U(()=>{"use strict";er();vt();hu();gu();Me();ue();wt();Eo();Co();Po()});import{TextDecoder as Jg}from"util";function yu(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Hg(t,e){try{return new Jg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function Oo(t,e,n,i,r={}){try{let s=await Y(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:Hg(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function vn(t,e,n,i,r={}){return(await Oo(t,e,n,i,r))?.text??null}async function tr(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await Oo(t,e,i,r),a=await j(t,e,{label:r,expected:"file"});await fe(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await Oo(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ye(yu(o.result.stat),yu(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function nr(t,e,n,i,r,s={}){let o=await vn(t,e,i,r);await tr(t,e,`${o??""}${n}`,i,r,s)}async function Ao(t,e,n,i={}){let r=await j(t,e,{label:n,expected:"file"});return r.exists?So(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var ir=U(()=>{"use strict";wu();qi()});var ku={};Ef(ku,{RUN_STATE_FILE:()=>sr,applyRunStateToDocument:()=>No,readRunState:()=>Sn,removeRunState:()=>To,runStateFromDocument:()=>rr,writeRunState:()=>or});import Gg from"path";function kn(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function bn(t,e){let n=kn(t,e);if(Gg.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function zg(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function rr(t){if(!t.run_id)return null;let e=kn(t,"run_id"),n=kn(t,"skill"),i=kn(t,"skill_version"),r=kn(t,"skill_hash"),s=bn(t,"pending_ref"),o=bn(t,"trajectory_ref"),a=bn(t,"context_ref"),c=bn(t,"artifacts_ref"),l=bn(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:i,skillHash:r,orchestration:t.orchestration,currentStep:vu(t,"current_step"),iteration:u,pending:vu(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:zg(t)}}function No(t,e){e?t.run_id=e.runId:delete t.run_id}function Qg(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function Xg(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return rr(e)}async function Sn(t,e={}){let n=await vn(t,sr,bu,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return Xg(i)}async function or(t,e,n={}){await tr(t,sr,JSON.stringify(Qg(e),null,2),bu,"Run state",n)}async function To(t,e={}){await Ao(t,sr,"Run state",e)}var vu,sr,bu,Cn=U(()=>{"use strict";ir();vu=(t,e)=>{let n=t[e];return n==null?null:String(n)};sr=".comet/run-state.json",bu=256*1024});var $n=Pt(ht(),1);import{spawnSync as vy}from"child_process";import{promises as by}from"fs";import O from"path";so();import{randomUUID as Zh}from"crypto";import{promises as an}from"fs";import Fl from"path";var oo="comet.selection.v2",eg=16*1024;function Fi(t){return Fl.join(t,".comet","current-change.json")}function tg(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Ml(t){return t===null||typeof t=="string"}function Wl(t){let e;try{e=JSON.parse(t)}catch(n){throw new Error(`current change selection contains invalid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(!tg(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Ml(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:oo,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==oo)throw new Error(`current change selection schema must be ${oo}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Ml(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function ao(t){let e;try{let i=Fi(t),{bytes:r}=await Mi(i,eg,{label:"current change selection"});e=r.toString("utf8")}catch(i){if(i.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${i instanceof Error?i.message:String(i)}`,{cause:i})}return{status:"selected",...Wl(e)}}async function Bl(t,e){let n=Wl(JSON.stringify(e));if(n.legacy)throw new Error("cannot write a legacy current change selection");let i=Fi(t),r=`${i}.${Zh()}.tmp`;await an.mkdir(Fl.dirname(i),{recursive:!0});try{await an.writeFile(r,`${JSON.stringify(n.selection,null,2)}
143
+ `,"utf8"),await an.rename(r,i)}catch(s){throw await an.rm(r,{force:!0}),s}}async function Kl(t){await an.rm(Fi(t),{force:!0})}var Ul=null;function Yl(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Vl(t,e){return(...n)=>{let i=Ul;if(i===null)return e(...n);let r=Yl(`async:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n).catch(a=>{throw i.entries.delete(r),a});return i.entries.set(r,{value:o}),o}}function co(t,e){return(...n)=>{let i=Ul;if(i===null)return e(...n);let r=Yl(`sync:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n);return i.entries.set(r,{value:o}),o}}var lo=Pt(ht(),1);import{execFileSync as Jl}from"child_process";import{randomUUID as ng}from"crypto";import{promises as cn}from"fs";import Hl from"path";function Wi(t){try{let e=Jl("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var ig=co("liveGitBranch",t=>Wi(t));function uo(t){try{return Jl("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var rg=co("isGitWorkTree",t=>uo(t)),sg=["current","branch","worktree"];function Bi(t){return sg.includes(t)}function fo(t){return Bi(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function ln(t,e){let n=Hl.join(t,".comet.yaml"),i=(0,lo.parseDocument)(await cn.readFile(n,"utf8"),{uniqueKeys:!1});if(i.errors.length>0)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);let r=i.toJS()??{},s=typeof r.isolation=="string"?r.isolation:null,o=typeof r.bound_branch=="string"&&r.bound_branch!==""?r.bound_branch:null,a=Bi(s),c=ig(e.cwd),l=a&&o===null&&c===null?rg(e.cwd):!0,u=fo({isolation:s,boundBranch:o,currentBranch:c,gitWorkTree:l});return u.status==="needs-heal"&&e.heal?(await po(t,u.branch),{status:"healed",branch:u.branch,bindingRequired:a,currentBranch:c}):{...u,bindingRequired:a,currentBranch:c}}async function po(t,e){let n=Hl.join(t,".comet.yaml"),i=(0,lo.parseDocument)(await cn.readFile(n,"utf8"),{uniqueKeys:!1});i.set("bound_branch",e);let r=`${n}.${ng()}.tmp`;try{await cn.writeFile(r,i.toString(),"utf8"),await cn.rename(r,n)}catch(s){throw await cn.rm(r,{force:!0}),s}}function Gl(t){return t??"detached HEAD"}function zl(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${Gl(n)}'.
144
+ Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function mo(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${Gl(n)}'`}function un(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}import{promises as Dg}from"fs";import bt from"path";import{promises as Ng}from"fs";import T from"path";import{promises as og}from"fs";async function fn(t){try{return await og.access(t),!0}catch(e){if(ag(e))return!1;throw e}}function ag(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}Me();wt();Eo();ue();var hn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Ro=class extends Error{constructor(n,i,r){let s=Q(r,n),o=Q(r,i);super(`Classic layout conflict: both ${s}/ and ${o}/ exist; run comet doctor and resolve the conflict before writing`);this.configuredRoot=n;this.alternateRoot=i;this.name="ClassicLayoutConflictError"}configuredRoot;alternateRoot;code="classic-layout-conflict"},su=".comet/config.yaml";function Tg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ou(t){await j(t,su,{label:su,expected:"file"})}function au(t,e){let n=T.resolve(t),i=e==="docs"?T.join(n,"docs"):n,r=T.join(i,"openspec"),s=T.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:T.join(r,"changes"),archiveDir:T.join(r,"changes","archive"),specsDir:T.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:T.join(s,"specs"),superpowersPlansDir:T.join(s,"plans"),superpowersReportsDir:T.join(s,"reports")}}async function Ig(t){await ou(t);let e=await gt(t,{allowPartialProject:!0});if(!e?.config)throw new hn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new hn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function jg(t,e){return au(t,e??await Ig(t))}async function $g(t,e){let n=await jg(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=au(t,i).openSpecRoot,[s,o]=await Promise.all([j(n.projectRoot,Q(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),j(n.projectRoot,Q(n.projectRoot,r),{label:"Alternate Classic OpenSpec root",expected:"directory"})]),a=s.exists,c=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:c,dualRoots:a&&c}}async function qg(t,e){let n=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,e,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let i of n){let r=Q(t.projectRoot,i);await j(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function de(t,e,n={}){let i=await $g(t,e);if(await qg(i.paths,i.alternateRoot),i.dualRoots&&!n.allowAlternateRoot)throw new Ro(i.paths.openSpecRoot,i.alternateRoot,i.paths.projectRoot);if(!i.configuredRootExists){let r=Q(i.paths.projectRoot,i.paths.openSpecRoot),s=Q(i.paths.projectRoot,i.alternateRoot);throw new hn(`Configured Classic OpenSpec root is missing: ${r} (alternate ${s} is ${i.alternateRootExists?"present":"missing"})`)}return i.paths}async function Xi(t,e,n={}){let i=T.join(T.resolve(t),".comet","classic-root-move.json");if(await fn(i))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await de(t,e,n);if(!await fn(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${Q(r.projectRoot,r.openSpecRoot)}`);return r}async function gn(t){let e=T.resolve(t),n=null;try{(await Ng.lstat(e)).isDirectory()||(e=T.dirname(e))}catch(i){if(!Tg(i))throw i}for(;;){T.basename(e)==="openspec"&&(n=T.dirname(e));let i=T.join(e,".comet","config.yaml"),r=!1;if(await fn(i))try{await ou(e);let o=(await gt(e))?.value;r=!!o&&typeof o=="object"&&!Array.isArray(o)&&(o.schema==="comet.project.v1"||o.default_workflow!==void 0||o.native!==void 0)}catch{}if(r||await fn(T.join(e,".git")))return e;let s=T.dirname(e);if(s===e)return n??T.resolve(t);e=s}}function Q(t,e){return T.relative(T.resolve(t),e).replaceAll("\\","/")}vt();Me();ue();import wn from"path";var Lg=2*1024*1024;function Zi(t,e,n){let i=wn.resolve(t),r=wn.isAbsolute(e)?wn.resolve(e):wn.resolve(i,e),s=wn.relative(i,r).replaceAll("\\","/");return{root:i,relative:De(s,n),target:r}}async function Be(t,e,n){let i=Zi(t,e,n.label);return j(i.root,i.relative,n)}async function _o(t,e,n){return(await Be(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function cu(t,e,n,i){return await _o(t,e,{label:n,expected:"file"})?(await lu(t,e,{label:n,hooks:i})).byteLength>0:!1}async function Ke(t,e,n){return(await lu(t,e,n)).toString("utf8")}async function lu(t,e,n){let i=Zi(t,e,n.label);return(await Y(i.root,i.relative,n.maxBytes??Lg,{label:n.label,hooks:n.hooks})).bytes}async function uu(t,e,n){let i=Zi(t,e,n);return ko(i.root,i.relative,{label:n})}async function fu(t,e,n,i){let r=Zi(t,e,i.label);await j(r.root,r.relative,{label:i.label,expected:"file"}),await fe(r.target,n,{containedRoot:r.root,beforeTemporaryOpen:i.beforeTemporaryOpen,beforeCommit:i.beforeCommit,exclusive:i.exclusive})}function xo(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
145
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function et(t){let e=xo(t);if(e)throw new Error(e)}function Mg(t,e){return{label:Q(t,e),directory:e}}async function yn(t,e,n){let i=Mg(t,e);if(!(await Be(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Be(t,bt.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Fg(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Wg(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await yn(t,bt.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Be(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await Dg.readdir(e,{withFileTypes:!0})){if(!Fg(o.name,n))continue;let a=await yn(t,bt.join(e,o.name),`Classic archived change ${o.name}`);a.exists&&a.stateExists&&s.push(a.change)}return s.sort((o,a)=>a.directory.localeCompare(o.directory))[0]??null}async function du(t,e=process.cwd()){et(t);let n=await de(e),i=await yn(n.projectRoot,bt.join(n.changesDir,t),`Classic active change ${t}`);return{...i.change,exists:i.exists,stateExists:i.stateExists}}async function pu(t,e=process.cwd()){et(t);let n=await Xi(e),i=bt.join(n.changesDir,t),r=await yn(n.projectRoot,i,`Classic active change ${t}`);return r.exists||await uu(n.projectRoot,i,`Classic active change ${t}`),r.change}async function mu(t,e=process.cwd()){et(t);let n=await de(e),i=await yn(n.projectRoot,bt.join(n.changesDir,t),`Classic active change ${t}`);if(i.exists)return i.change;let r=await Wg(n.projectRoot,n.archiveDir,t);return r||i.change}var lr=Pt(ht(),1);vt();ue();import cr from"path";Cn();var Su=["full","hotfix","tweak"],En=1,Zg=["open","design","build","verify","archive"],ew=["en","zh-CN"],tw=["off","beta"],nw=["subagent-driven-development","executing-plans","direct"],iw=["plan-ready"],rw=["confirmed"],sw=["tdd","direct"],ow=["off","standard","thorough"],aw=["current","branch","worktree"],cw=["light","full"],lw=["pending","pass","fail"],uw=["pending","handled"],fw=["pending","confirmed"],St=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],jo=["run_id"],dw=new Set([...St,...jo]),pw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Cu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function V(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function Io(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function mw(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function ar(t,e){let n=kt(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function hw(t,e){let n=kt(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function gw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==En)throw new Error(`Invalid Classic state: classic_migration must be ${En}`);return e}function ww(t){if(!St.some(n=>Cu(t,n)))return null;for(let n of pw)if(!Cu(t,n))return null;return{workflow:V(t,"workflow",Su,!1),language:V(t,"language",ew),phase:V(t,"phase",Zg,!1),contextCompression:V(t,"context_compression",tw),buildMode:V(t,"build_mode",nw),buildPause:V(t,"build_pause",iw),subagentDispatch:V(t,"subagent_dispatch",rw),tddMode:V(t,"tdd_mode",sw),reviewMode:V(t,"review_mode",ow),isolation:V(t,"isolation",aw),boundBranch:kt(t,"bound_branch"),verifyMode:V(t,"verify_mode",cw),autoTransition:Io(t,"auto_transition"),baseRef:kt(t,"base_ref"),designDoc:ar(t,"design_doc"),plan:ar(t,"plan"),verifyResult:V(t,"verify_result",lw,!1),verifyFailures:mw(t,"verify_failures"),verificationReport:ar(t,"verification_report"),branchStatus:V(t,"branch_status",uw),createdAt:kt(t,"created_at"),verifiedAt:kt(t,"verified_at"),archiveConfirmation:V(t,"archive_confirmation",fw),archived:Io(t,"archived",!1),directOverride:Io(t,"direct_override"),handoffContext:ar(t,"handoff_context"),handoffHash:hw(t,"handoff_hash"),classicProfile:V(t,"classic_profile",Su),classicMigration:gw(t)}}function Rn(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=rr(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:ww(t),run:n,unknownKeys:Object.keys(t).filter(i=>!dw.has(i))}}function Eu(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}Cn();var yw=2*1024*1024;function _n(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function Ru(t,e,n){t.get(e)!==n&&t.set(e,n)}function vw(t,e){if(e.classic)for(let[n,i]of Object.entries(Eu(e.classic)))Ru(t,n,i);else for(let n of St)t.delete(n);No(t.toJS(),e.run),e.run?Ru(t,"run_id",e.run.runId):t.delete("run_id")}function bw(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function kw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function _u(t){let e;try{e=(await Y(cr.dirname(t),cr.basename(t),yw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new lr.Document({})}let n=(0,lr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return _n(n),n}async function pe(t,e={}){let n=e.migrate!==!1,i=cr.join(t,".comet.yaml"),r=await _u(i),s=_n(r),o=kw(r);o&&(s=_n(r));let a=await Sn(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Cn(),ku));a=c(s),a&&n&&(await or(t,a),bw(r),o=!0)}return o&&n&&await fe(i,r.toString(),{containedRoot:t}),Rn(_n(r),a)}async function Ct(t,e,n={}){let i=cr.join(t,".comet.yaml"),r=await _u(i);vw(r,{...e,unknownKeys:e.unknownKeys??[]}),Rn(_n(r),e.run??null),await fe(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await or(t,e.run):await To(t)}var Sw=Vl("readCometCurrentSelection",t=>ao(t));async function xu(t,e){et(e);let n=await du(e,t);if(!n.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let i=await pe(n.directory,{migrate:!1});if(!i.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(i.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return n.directory}async function Pu(t,e){let n=await xu(t,e),i=await ln(n,{heal:!0,cwd:t});if(i.status==="drift")throw new Error(mo(e,i.boundBranch,i.currentBranch));if(i.status==="unbound-detached")throw new Error(un(e));let r={schema:"comet.selection.v2",workflow:"classic",change:e,branch:i.currentBranch};return await Bl(t,r),r}async function Ou(t){let e;try{e=await Sw(t)}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let n=e.selection,i;try{i=await xu(t,n.change)}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}let r=await ln(i,{heal:!1,cwd:t});return r.status==="drift"?{status:"stale",reason:mo(n.change,r.boundBranch,r.currentBranch)}:r.status==="unbound-detached"?{status:"stale",reason:un(n.change)}:r.status==="ok"?{status:"selected",selection:n}:n.branch!==null&&r.currentBranch!==n.branch?{status:"stale",reason:`current change '${n.change}' was selected on branch '${n.branch}', current branch is '${r.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:n}}async function Au(t){let e;try{e=await ao(t)}catch{return}e.status==="selected"&&e.selection.workflow==="classic"&&await Kl(t)}import{promises as Ew}from"fs";import be from"path";ue();Me();import xn from"path";function Cw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Nu(t,e,n,i){let r=De(n,"Classic handoff artifact pointer");if((await j(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await de(t),a=`${Q(t,o.changesDir)}/`,l=(o.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(v=>r.startsWith(v));if(!l)return null;let u=r.slice(l.length).split("/");if(u.length<4||u[1]!==".comet"||u.slice(2).some(v=>v.length===0))return null;let f=u[0];et(f);let d=u.slice(2),m=xn.resolve(e);if(xn.dirname(m)!==xn.resolve(o.archiveDir))return null;let g=xn.basename(m),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==f&&p?.[1]!==f)return null;await j(t,Q(t,m),{label:"Classic archived change directory",expected:"directory"});let h=xn.join(m,".comet",...d),y=Q(t,h);try{return await Y(t,y,i,{label:"Historical Classic archived handoff artifact"}),y}catch(v){if(Cw(v))return null;throw v}}ue();var Tu=2*1024*1024;function Pn(t,e){return be.relative(t,e).split(be.sep).join("/")}async function On(t,e,n){if(!n)return{code:e,satisfied:!1};let i=n.replaceAll("\\","/");try{let r=await Ji(t,i,{label:`${e} artifact`});return{code:e,satisfied:r,source:i,...r?{resolvedSource:i}:{}}}catch(r){return{code:e,satisfied:!1,source:i,detail:`unsafe artifact pointer outside the project or through a special path: ${r instanceof Error?r.message:String(r)}`}}}async function Rw(t,e,n){try{await de(t)}catch(r){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${r instanceof Error?r.message:String(r)}`}}let i=await On(t,"design.handoff",n);if(!n||i.satisfied||i.detail)return i;try{let r=await Nu(t,e,n,Tu);return r?{...i,satisfied:!0,resolvedSource:r,detail:`resolved historical legacy pointer from archived change: ${r}`}:i}catch(r){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${r instanceof Error?r.message:String(r)}`}}}async function ur(t,e,n){return On(t,e,Pn(t,n))}async function _w(t,e){let n=be.join(e,"specs"),i;try{let o=Pn(t,n);if(!(await j(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Ew.readdir(n)}catch(o){return o.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${o instanceof Error?o.message:String(o)}`}}let r=i.map(o=>be.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Ji(t,Pn(t,o),{label:"OpenSpec delta spec"})?o:null}catch{return null}}))).filter(o=>o!==null);return{code:"openspec.delta-spec",satisfied:s.length>0,source:s[0]?Pn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function xw(t,e){let n,i=Pn(t,e);try{n=(await Y(t,i,Tu,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(o){return o.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:i,detail:`unsafe tasks artifact: ${o instanceof Error?o.message:String(o)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],s=r.filter(o=>o[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&s===r.length,source:i,detail:`${s} of ${r.length} tasks complete`}}function An(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Et(t,e){let n=await gn(t),i=e.classic,r=be.join(t,"proposal.md"),s=be.join(t,"design.md"),o=be.join(t,"tasks.md"),a=e.run?be.resolve(t,e.run.checkpointRef):be.join(t,".comet","checkpoint.json"),c=await Promise.all([ur(n,"openspec.proposal",r),ur(n,"openspec.design",s),ur(n,"openspec.tasks",o),_w(n,t),On(n,"design.document",i?.designDoc??null),On(n,"build.plan",i?.plan??null),xw(n,o),On(n,"verification.report",i?.verificationReport??null),Rw(n,t,i?.handoffContext??null),ur(n,"run.checkpoint",a)]),l=c.find(u=>u.code==="design.handoff");return l&&!i?.handoffHash&&(l.satisfied=!1,l.detail="handoff hash is missing"),c.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),c}import{AsyncLocalStorage as Pw}from"async_hooks";import{promises as Iu}from"fs";import Nn from"path";var fr=new Pw;function Ow(t,e){let n=Nn.relative(t,e);return n===""||!Nn.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Nn.sep}`)}async function Aw(t){let e=Nn.resolve(t.invocationCwd??process.cwd()),n=Nn.resolve(t.projectRoot??await gn(e)),[i,r]=await Promise.all([Iu.realpath(e),Iu.realpath(n)]);if(!Ow(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function ju(t,e){let n=fr.getStore();if(n)return e(n);let i=await Aw(t);return fr.run(i,()=>e(i))}function I(){let t=fr.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function Tn(){let t=fr.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}function Nw(t){return t.classicProfile??t.workflow}function Tw(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function Iw(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function jw(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!An(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Tw(e))return"full.build.configure"}else if(!Iw(e))throw new Error(`${t} build configuration is incomplete`);return An(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function $w(t,e,n){return e.verifyResult!=="pass"||!An(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function qw(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Rt(t,e){let n=Nw(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return An(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return jw(n,t,e);case"verify":return $w(n,t,e);case"archive":return qw(n,t)}}import{promises as Zu}from"fs";import Z from"path";import{fileURLToPath as ef}from"url";ir();import dr from"path";var $u={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function qu(t,e){if(dr.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=dr.resolve(t),i=dr.resolve(n,e);if(i!==n&&!i.startsWith(n+dr.sep))throw new Error("Run path must stay inside the change directory")}async function tt(t,e,n,i={}){qu(t,e),await nr(t,e,`${JSON.stringify(n)}
146
+ `,$u.trajectory,"Run trajectory",i)}async function _t(t,e,n={}){qu(t,e);let i=await vn(t,e,$u.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,s)=>({line:r,number:s+1})).filter(({line:r})=>r.length>0).map(({line:r,number:s})=>{try{return JSON.parse(r)}catch(o){throw new Error(`Invalid Trajectory event at line ${s}`,{cause:o})}})}import{createHash as zu,randomUUID as CC}from"crypto";import{promises as xt}from"fs";import me from"path";var Mu=Pt(ht(),1);import{promises as $o}from"fs";import te from"path";var Lw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Dw=["deterministic","adaptive"],Mw=["function","mcp","script","agent"],Fw=["none","read","write","external"],Ww=["progress","step","completion"],Bw=["artifact_exists","state_equals"];function nt(t,e,n){return new Error(`${t}: ${e} ${n}`)}function X(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw nt(e,n,"must be an object")}function Ue(t,e,n){if(!Array.isArray(t))throw nt(e,n,"must be an array")}function J(t,e,n){if(typeof t!="string")throw nt(e,n,"must be a string")}function se(t,e,n,i){e in t&&J(t[e],n,`${i}.${e}`)}function Fu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw nt(n,`${i}.${e}`,"must be a boolean")}function Ye(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw nt(n,i,`must be one of ${e.join(", ")}`)}function pr(t,e,n){Ue(t,e,n),t.forEach((i,r)=>{J(i,e,`${n}[${r}]`)})}function Lu(t,e,n){X(t,e,n),J(t.name,e,`${n}.name`),J(t.description,e,`${n}.description`),Fu(t,"required",e,n)}function Kw(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),se(t,"source",e,n),se(t,"version",e,n)}function Uw(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),J(t.role,e,`${n}.role`),se(t,"instructions",e,n)}function Yw(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),Ye(t.kind,Mw,e,`${n}.kind`),J(t.source,e,`${n}.source`),Ye(t.sideEffect,Fw,e,`${n}.sideEffect`),Fu(t,"requiresConfirmation",e,n)}function Vw(t,e,n){X(t,e,n),Ye(t.type,Lw,e,`${n}.type`),se(t,"ref",e,n),se(t,"prompt",e,n),se(t,"question",e,n),"options"in t&&pr(t.options,e,`${n}.options`)}function Jw(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),Vw(t.action,e,`${n}.action`),se(t,"next",e,n),"completionEvals"in t&&pr(t.completionEvals,e,`${n}.completionEvals`)}function Hw(t,e){let n="goal";X(t,e,n),J(t.statement,e,`${n}.statement`),Ue(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{Lu(i,e,`${n}.inputs[${r}]`)}),Ue(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{Lu(i,e,`${n}.outputs[${r}]`)}),pr(t.success,e,`${n}.success`)}function Gw(t,e){let n="orchestration";X(t,e,n),Ye(t.mode,Dw,e,`${n}.mode`),se(t,"entry",e,n),"steps"in t&&(Ue(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{Jw(i,e,`${n}.steps[${r}]`)}))}function Wu(t,e){return X(t,e),Ye(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ye(t.kind,["Skill"],e,"kind"),X(t.metadata,e,"metadata"),J(t.metadata.name,e,"metadata.name"),J(t.metadata.version,e,"metadata.version"),J(t.metadata.description,e,"metadata.description"),Hw(t.goal,e),Gw(t.orchestration,e),Ue(t.skills,e,"skills"),t.skills.forEach((n,i)=>{Kw(n,e,`skills[${i}]`)}),Ue(t.agents,e,"agents"),t.agents.forEach((n,i)=>{Uw(n,e,`agents[${i}]`)}),Ue(t.tools,e,"tools"),t.tools.forEach((n,i)=>{Yw(n,e,`tools[${i}]`)}),t}function Bu(t,e){X(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&pr(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw nt(e,n,"must be a finite number");return t}function zw(t,e){return X(t,e),"runtime"in t&&Ku(t.runtime,e,"runtime"),t}function Ku(t,e,n){return Ue(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;X(i,e,s),J(i.id,e,`${s}.id`),Ye(i.scope,Ww,e,`${s}.scope`),Ye(i.type,Bw,e,`${s}.type`),se(i,"artifact",e,s),se(i,"field",e,s),se(i,"equals",e,s)}),t}async function qo(t){let e=await $o.readFile(t,"utf8");try{return(0,Mu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw nt(t,"document",i)}}async function Qw(t){try{return await qo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Du(t){try{return await $o.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Xw(t){let e=te.join(t,"checks.yaml"),n=te.join(t,"evals.yaml"),[i,r]=await Promise.all([Du(e),Du(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:zw(await qo(e),e)}:{document:null}}async function Uu(t){let e=te.resolve(t.root),n=te.resolve(t.controlRoot);t.requireSkillMarkdown&&await $o.access(te.join(e,"SKILL.md"));let i=te.join(n,"skill.yaml"),r=te.join(n,"guardrails.yaml"),s=Wu(await qo(i),i),o=await Qw(r),a=o===null?null:Bu(o,r),c=await Xw(n),l={allowedSkills:s.skills.map(u=>u.id),allowedAgents:s.agents.map(u=>u.id),allowedTools:s.tools.map(u=>u.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(u=>u.requiresConfirmation).map(u=>u.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function Yu(t){let e=te.resolve(t);return Uu({root:e,controlRoot:te.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Vu(t){let e=te.resolve(t);return Uu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function Ju(t,e,n=te.join(e,"package.json")){X(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=Wu(t.definition,n),s=Bu(t.guardrails,n),o=Ku(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:te.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import Hu from"path";function Zw(t,e,n,i){t.type==="invoke_skill"&&!e.definition.skills.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${i} ask_user action requires question`)}function Gu(t){let e=[],{definition:n,guardrails:i,evals:r}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),i.maxIterations<1&&e.push("maxIterations must be at least 1"),i.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let s=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||s.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let o=new Set;for(let a of s)o.has(a.id)&&e.push(`duplicate step id: ${a.id}`),o.add(a.id),Zw(a.action,t,e,a.id);(!n.orchestration.entry||!o.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of s){a.next&&!o.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])r.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let o of n.tools){if(o.kind!=="script")continue;let a=Hu.posix.normalize(o.source.replaceAll("\\","/"));(Hu.isAbsolute(o.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${o.id} must reference a relative path inside the Skill package`)}for(let o of i.allowedSkills)n.skills.some(a=>a.id===o)||e.push(`guardrails allow undeclared skill: ${o}`);for(let o of i.allowedAgents)n.agents.some(a=>a.id===o)||e.push(`guardrails allow undeclared agent: ${o}`);for(let o of i.allowedTools)n.tools.some(a=>a.id===o)||e.push(`guardrails allow undeclared tool: ${o}`);return e}function mr(t){return Array.isArray(t)?t.map(mr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,mr(n)])):t}function ey(t){return mr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function ty(t){return me.posix.normalize(t.replaceAll("\\","/"))}function Lo(t,e,n){let i=me.relative(t,e);if(!(i===""||!me.isAbsolute(i)&&!i.startsWith(`..${me.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Qu(t,e,n){let i=ty(e);if(me.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=me.resolve(t,...i.split("/"));Lo(t,r,n);let s;try{s=await xt.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(Lo(t,s,n),!(await xt.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await xt.readFile(s)}}async function ny(t){let e=await xt.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Qu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await Qu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function iy(t,e){let n=e.map(i=>({path:i.path,sha256:zu("sha256").update(i.content).digest("hex")}));return zu("sha256").update(JSON.stringify(mr({package:t,files:n}))).digest("hex")}async function ry(t){let e=ey(t),n=await ny(t);return{document:e,files:n,hash:iy(e,n)}}async function Xu(t){return(await ry(t)).hash}async function Do(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=me.resolve(t,".comet","skill-snapshots"),i=me.join(n,e);Lo(n,i,"Skill snapshot");try{let r=(await xt.readFile(me.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=me.join(i,"package.json"),o=JSON.parse(await xt.readFile(s,"utf8")),a=Ju(o,i,s),c=Gu(a);if(c.length>0)throw new Error(c.map(u=>` - ${u}`).join(`
147
+ `));let l=await Xu(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(r){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:r})}}async function sy(t){try{return(await Zu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function hr(t){try{return(await Zu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function oy(t){return await sy(t)?await hr(Z.join(t,"skill.yaml"))?!0:await hr(Z.join(t,"SKILL.md"))&&await hr(Z.join(t,"comet","skill.yaml")):!1}function ay(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function cy(){let t=Z.dirname(ef(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,Z.resolve(t,"..","runtime","classic"),Z.resolve(t,"..","..","comet","runtime","classic"),Z.resolve(t,"..","..","assets","skills","comet","runtime","classic"),Z.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,Z.resolve(t,"..","..","comet-classic"),Z.resolve(t,"..","..","assets","skills","comet-classic"),Z.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await oy(n))return n;return null}async function ly(t){return await hr(Z.join(t,"skill.yaml"))?Vu(t):Yu(t)}async function tf(t,e){let n=e??await pe(t,{migrate:!1}),i=Array.from(new Set(n.unknownKeys)).sort();if(i.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${i.join(", ")}`);if(!n.classic||!n.run)throw new Error("Classic runtime validation requires synchronized Classic and Run projections");if(n.classic.classicMigration!==En)throw new Error("Classic Run exists without a supported classic_migration marker");let r=await cy(),s=r?await ly(r):ay(Z.dirname(ef(import.meta.url)));if(n.run.skill!==s.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${s.definition.metadata.name}, got ${n.run.skill}`);let o=await Do(t,n.run.skillHash);if(o.definition.metadata.name!==n.run.skill)throw new Error(`Classic Run snapshot skill mismatch: expected ${n.run.skill}, got ${o.definition.metadata.name}`);let a=await Et(t,n),c=Rt(n.classic,a);if(n.run.currentStep!==c)throw new Error(`Classic Run step mismatch: expected ${c}, got ${n.run.currentStep}`);return{classic:n.classic,run:n.run,evidence:a,migrated:!1,snapshotDir:Z.join(t,".comet","skill-snapshots",n.run.skillHash)}}async function nf(t,e,n,i){let r=await pe(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await Et(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Rt(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await Ct(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await _t(t,a.trajectoryRef);return await tt(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:o,...i}}),a}ir();import uy from"path";var fy=uy.join(".comet","state-events.jsonl"),dy=8*1024*1024;async function Mo(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await nr(t,fy,`${JSON.stringify(n)}
148
+ `,dy,"Classic state event log"),n}var rf=["open-complete","design-complete","build-complete","verify-pass","verify-fail","archive-confirm","archive-reopen","archived","preset-escalate"],py={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}};function my(t){return t.toISOString().slice(0,10)}function x(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function sf(t,e,n={}){let i=py[e];if(t.phase!==i.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${i.from}'`);let r={...t},s=[],o=n.now??new Date;if(e==="open-complete")x(r,s,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")x(r,s,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";x(r,s,"phase","verify"),x(r,s,"verifyResult","pending"),x(r,s,"branchStatus","pending"),a||x(r,s,"verificationReport",null)}else if(e==="verify-pass")x(r,s,"verifyResult","pass"),x(r,s,"verifyFailures",0),x(r,s,"phase","archive"),x(r,s,"verifiedAt",my(o)),x(r,s,"archiveConfirmation","pending"),x(r,s,"branchStatus","pending");else if(e==="verify-fail")x(r,s,"verifyResult","fail"),x(r,s,"verifyFailures",r.verifyFailures+1),x(r,s,"phase","build"),x(r,s,"branchStatus","pending");else if(e==="preset-escalate"){if(r.workflow!=="hotfix"&&r.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${r.workflow}'`);x(r,s,"workflow","full"),x(r,s,"classicProfile","full"),x(r,s,"phase","design"),x(r,s,"designDoc",null),x(r,s,"buildPause",null),x(r,s,"buildMode",null),x(r,s,"subagentDispatch",null),x(r,s,"tddMode",null),x(r,s,"reviewMode",null),x(r,s,"isolation",null),x(r,s,"boundBranch",null),x(r,s,"verifyMode",null),x(r,s,"directOverride",null)}else if(e==="archive-confirm"){if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);x(r,s,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);x(r,s,"verifyResult","pending"),x(r,s,"verifyFailures",0),x(r,s,"phase","verify"),x(r,s,"verifiedAt",null),x(r,s,"archiveConfirmation",null),x(r,s,"branchStatus","pending")}else{if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);x(r,s,"archived",!0)}return{classic:r,effects:s,definition:i}}Cn();import gr from"path";function hy(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function gy(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=gr.resolve(t),i=gr.resolve(n,e);if(i!==n&&!i.startsWith(n+gr.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return gr.relative(n,i).replaceAll("\\","/")||"."}async function of(t,e,n,i){if(hy(i.scope),typeof i.command!="string"||i.command.trim().length===0)throw new Error("Command check command cannot be blank");if(!Number.isInteger(i.exitCode))throw new Error("Command check exitCode must be an integer");let s={sequence:(await _t(e,n.trajectoryRef)).reduce((o,a)=>Math.max(o,a.sequence),0)+1,timestamp:new Date().toISOString(),runId:n.runId,scope:i.scope,command:i.command,exitCode:i.exitCode,cwd:gy(t,i.cwd)};return await tt(e,n.trajectoryRef,{sequence:s.sequence,timestamp:s.timestamp,type:"command_check_recorded",runId:s.runId,data:{scope:s.scope,command:s.command,exitCode:s.exitCode,cwd:s.cwd}}),s}wt();import wy from"os";import wr from"path";function yy(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??wy.homedir(),i=[{file:wr.resolve(e,".comet","config.yaml"),source:".comet/config.yaml"},{file:wr.resolve(n,".comet","config.yaml"),source:"~/.comet/config.yaml"}];return i.filter((r,s)=>i.findIndex(o=>o.file===r.file)===s)}async function Fo(t,e={}){for(let n of yy(e)){let i=await gt(wr.dirname(wr.dirname(n.file)),{allowPartialProject:!0});if(!i)continue;let r=i.value.classic;if(!r||typeof r!="object"||Array.isArray(r))continue;let s=r[t];if(s!=null)return{value:String(s),source:n.source}}return null}var ky="\x1B[32m",Sy="\x1B[31m",Cy="\x1B[33m",Yo="\x1B[0m",In=["full","hotfix","tweak"],Vo=["open","design","build","verify","archive"],cf=["en","zh-CN"],Ey=rf,Bo=new Set([...jo,"archive_confirmation","verify_failures","classic_profile","classic_migration","bound_branch"]),Ry=new Set(St.filter(t=>!Bo.has(t))),_y={workflow:In,phase:Vo,context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["null","plan-ready"],subagent_dispatch:["null","confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:In,classic_migration:["1"]},xy=new Set(["design_doc","plan","verification_report","handoff_context"]),Py={archived:"archived",branchStatus:"branch_status",classicProfile:"classic_profile",designDoc:"design_doc",language:"language",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",archiveConfirmation:"archive_confirmation",verifyResult:"verify_result",verifyFailures:"verify_failures",workflow:"workflow"},jn=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},vr=class{stdout=[];stderr=[];result(e=0){return{exitCode:e,...this.stdout.length>0?{stdout:this.stdout.join(`
149
+ `)+`
150
+ `}:{},...this.stderr.length>0?{stderr:this.stderr.join(`
151
+ `)}:{}}}};function oe(t){return`${ky}${t}${Yo}`}function Ko(t){return`${Sy}${t}${Yo}`}function af(t){return`${Cy}${t}${Yo}`}function b(t){throw new jn(t)}function ae(t){let e=xo(t);e&&b(`ERROR: ${e}`)}function kr(t,e){e.includes(t)||b(`ERROR: Invalid value: '${t}'
152
+ Valid values: ${e.join(" ")}`)}function br(t,e){if(cf.includes(t))return t;b(`ERROR: Invalid language from ${e}: '${t}'
153
+ Valid values: en, zh-CN`)}function lf(t,e){!t||t==="null"||(/^(?:[A-Za-z]:|[\\/]|~)/u.test(t)&&b(`ERROR: ${e} must be a relative path within the repo: '${t}'`),t.split(/[\\/]/u).includes("..")&&b(`ERROR: ${e} cannot contain '..' (path traversal not allowed): '${t}'`))}async function F(t){let e=I();return _o(e,t,{label:`Classic project path ${O.relative(e,O.resolve(e,t)).replaceAll("\\","/")}`})}async function Ee(t){let e=I();return cu(e,t,`Classic project file ${O.relative(e,O.resolve(e,t)).replaceAll("\\","/")}`)}async function Oy(t){return mu(t,I())}async function Sr(t){let e,n=I();try{e=await Ke(n,t,{label:`Classic state ${O.relative(n,t).replaceAll("\\","/")}`})}catch(r){throw r.code==="ENOENT"&&b(`ERROR: .comet.yaml not found at ${O.relative(n,t).replaceAll("\\","/")}`),r}let i=(0,$n.parseDocument)(e,{uniqueKeys:!1});return i.errors.length>0&&b(`ERROR: Invalid .comet.yaml: ${i.errors[0].message}`),i}async function Jo(t,e){await fu(I(),t,e,{label:"Classic state write target"})}function Uo(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}function uf(t){return Py[t]??String(t)}function ff(t){return t===null?"null":Uo(t)}function H(t,e,n,i){let r=t[e];return typeof r=="string"&&n.includes(r)?r:i}function ke(t,e){let n=t[e];return n==null||n===""?null:typeof n=="string"?n:String(n)}function Wo(t,e){let n=t[e];return n==null||n===""?null:typeof n=="boolean"?n:n==="true"?!0:n==="false"?!1:null}function Ay(t,e,n=0){let i=t[e];return typeof i=="number"&&Number.isInteger(i)&&i>=0?i:n}function Ny(t){let e=H(t,"workflow",In,"full");return{workflow:e,language:H(t,"language",cf,null),phase:H(t,"phase",Vo,"open"),contextCompression:H(t,"context_compression",["off","beta"],null),buildMode:H(t,"build_mode",["subagent-driven-development","executing-plans","direct"],null),buildPause:H(t,"build_pause",["plan-ready"],null),subagentDispatch:H(t,"subagent_dispatch",["confirmed"],null),tddMode:H(t,"tdd_mode",["tdd","direct"],null),reviewMode:H(t,"review_mode",["off","standard","thorough"],null),isolation:H(t,"isolation",["current","branch","worktree"],null),boundBranch:ke(t,"bound_branch"),verifyMode:H(t,"verify_mode",["light","full"],null),autoTransition:Wo(t,"auto_transition"),baseRef:ke(t,"base_ref"),designDoc:ke(t,"design_doc"),plan:ke(t,"plan"),verifyResult:H(t,"verify_result",["pending","pass","fail"],"pending"),verifyFailures:Ay(t,"verify_failures"),verificationReport:ke(t,"verification_report"),branchStatus:H(t,"branch_status",["pending","handled"],null),createdAt:ke(t,"created_at"),verifiedAt:ke(t,"verified_at"),archiveConfirmation:H(t,"archive_confirmation",["pending","confirmed"],null),archived:Wo(t,"archived")??!1,directOverride:Wo(t,"direct_override"),handoffContext:ke(t,"handoff_context"),handoffHash:ke(t,"handoff_hash"),classicProfile:H(t,"classic_profile",In,e),classicMigration:typeof t.classic_migration=="number"?t.classic_migration:null}}async function Ho(t){return(await Fo(t,{cwd:I()}))?.value??null}async function df(){if(process.env.COMET_LANGUAGE)return br(process.env.COMET_LANGUAGE,"COMET_LANGUAGE");let t=await Fo("language",{cwd:I()});return t?br(t.value,t.source):"en"}async function Ty(){let t=process.env.COMET_CONTEXT_COMPRESSION??await Ho("context_compression")??"off";return["off","beta"].includes(t)||b(`ERROR: Invalid context_compression: '${t}'
154
+ Valid values: off, beta`),t}async function pf(){let t=process.env.COMET_AUTO_TRANSITION??await Ho("auto_transition")??"true";return["true","false"].includes(t)||b(`ERROR: Invalid auto_transition: '${t}'
155
+ Valid values: true, false`),t}async function Iy(){let t=process.env.COMET_REVIEW_MODE??await Ho("review_mode")??"standard";return["null","off","standard","thorough"].includes(t)||b(`ERROR: Invalid review_mode: '${t}'
156
+ Valid values: off, standard, thorough`),t==="null"?null:t}function mf(t){let e=vy("git",t,{encoding:"utf8"});return e.status===0?e.stdout.trim():null}async function he(t){let e=await Oy(t);return await Be(I(),O.join(e.directory,".comet"),{label:`Classic runtime directory for ${t}`,expected:"directory"}),{...e,file:O.join(e.directory,".comet.yaml")}}async function C(t,e){let{file:n}=await he(t),s=(await Sr(n)).toJS()[e];return e==="language"?s==null||s===""?df():br(Uo(s),".comet.yaml"):e==="auto_transition"&&(s==null||s==="")?pf():Uo(s)}function hf(t,e){let n=(0,$n.parseDocument)(`${t}: ${e}
157
+ `);return n.errors.length>0&&b(`ERROR: Invalid value: '${e}'`),n.get(t)}async function jy(t,e){if(t==="language"){br(e,"language");return}let n=_y[t];n&&kr(e,n),xy.has(t)&&(lf(e,t),e&&e!=="null"&&await Be(I(),e,{label:`${t} artifact pointer`,expected:"file"})),(t==="skill_hash"||t==="handoff_hash")&&!/^[a-f0-9]{64}$/u.test(e)&&b(`ERROR: ${t} must be a sha256 hex digest`),t==="iteration"&&!/^[0-9]+$/u.test(e)&&b("ERROR: iteration must be a non-negative integer")}async function gf(t,e,n,i,r={}){Bo.has(n)&&!r.machineOwned&&b(`ERROR: '${n}' is a machine-owned field and cannot be set directly`),!Ry.has(n)&&!Bo.has(n)&&b(`ERROR: Unknown field: '${n}'`),n==="phase"&&!r.internal&&process.env.COMET_FORCE_PHASE!=="1"&&b(`ERROR: Setting 'phase' directly is not allowed; it bypasses state machine evidence checks.
158
+ Use: comet-state.mjs transition <change-name> <event>
159
+ Repair-only escape hatch: COMET_FORCE_PHASE=1 comet-state.mjs set <change-name> phase <value>`),await jy(n,i);let{file:s,directory:o}=await he(e),a=await Sr(s),c=a.toJS()??{};if(a.set(n,hf(n,i)),n==="isolation")if(Bi(i)){let f=typeof c.isolation=="string"?c.isolation:null,d=c.bound_branch;if(!(typeof d=="string"&&d!=="")||f!==i){let g=Tn(),p=Wi(g),h=fo({isolation:i,boundBranch:null,currentBranch:p,gitWorkTree:p===null?uo(g):!0});h.status==="needs-heal"?a.set("bound_branch",h.branch):h.status==="unbound-detached"?b(`ERROR: cannot bind isolation=${i} while HEAD is detached; checkout a branch first`):a.set("bound_branch",null)}}else a.set("bound_branch",null);let l=await Sn(o),u=Rn(a.toJS(),l);if(u.run){u.classic||b("ERROR: migrated Run is missing its Classic projection");let f=await Et(o,u),d=Rt(u.classic,f),m=d!==u.run.currentStep,g={...u.run,currentStep:d,iteration:u.run.iteration+(m?1:0),status:d==="completed"?"completed":"running"};if(await Ct(o,{classic:u.classic,run:g,unknownKeys:u.unknownKeys}),m){let p=await _t(o,g.trajectoryRef);await tt(o,g.trajectoryRef,{sequence:p.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:g.runId,data:{kind:"classic-config",field:n,fromStep:u.run.currentStep,toStep:d}})}}else await Jo(s,a.toString());n==="phase"&&!r.internal&&t.stderr.push(af("WARNING: Setting 'phase' directly bypasses state machine constraints."),af(" Consider using: comet-state.mjs transition <change-name> <event>")),t.stderr.push(oe(`[SET] ${n}=${i}`))}async function $y(t,e,n){ae(e),kr(n,In);let i=await pu(e,I()),{label:r,directory:s}=i,o=O.join(s,".comet.yaml");await F(o)&&b(`ERROR: .comet.yaml already exists at ${r}/.comet.yaml`);let a=n!=="full",c=a?"off":await Iy(),l=new $n.Document({workflow:n,language:await df(),phase:"open",context_compression:await Ty(),build_mode:a?"direct":null,build_pause:null,subagent_dispatch:null,tdd_mode:a?"direct":null,review_mode:c,isolation:null,verify_mode:a?"light":null,auto_transition:await pf()==="true",base_ref:mf(["rev-parse","--verify","HEAD"]),design_doc:null,plan:null,verify_result:"pending",verify_failures:0,verification_report:null,branch_status:"pending",created_at:new Date().toISOString().slice(0,10),verified_at:null,archive_confirmation:null,archived:!1});await Jo(o,l.toString()),t.stdout.push(oe(`Initialized: ${r}/.comet.yaml (workflow=${n})`))}async function Se(t,e){let n=await C(t,"phase");n!==e&&b(`ERROR: Cannot transition '${t}': expected phase ${e}, got ${n}`)}async function qy(t){let e=await C(t,"workflow"),n=await C(t,"build_mode"),i=await C(t,"isolation"),r=await C(t,"direct_override"),s=await C(t,"subagent_dispatch"),o=await C(t,"tdd_mode"),a=await C(t,"review_mode");["current","branch","worktree"].includes(i)||b(`ERROR: Cannot transition '${t}': isolation must be current, branch, or worktree, got '${i||"null"}'`),["subagent-driven-development","executing-plans","direct"].includes(n)||b(`ERROR: Cannot transition '${t}': build_mode must be selected before leaving build, got '${n||"null"}'`),n==="direct"&&!["hotfix","tweak"].includes(e)&&r!=="true"&&b(`ERROR: Cannot transition '${t}': build_mode=direct is only allowed for hotfix/tweak unless direct_override=true`),n==="subagent-driven-development"&&s!=="confirmed"&&b(`ERROR: Cannot transition '${t}': subagent_dispatch must be confirmed before using build_mode=subagent-driven-development`),e==="full"&&(!o||o==="null")&&b(`ERROR: Cannot transition '${t}': tdd_mode must be selected before leaving build (full workflow)`),e==="full"&&!["off","standard","thorough"].includes(a)&&b(`ERROR: Cannot transition '${t}': review_mode must be selected before leaving build (full workflow); review_mode must be off, standard, or thorough, got '${a||"null"}'`)}async function Ly(t){let{directory:e}=await he(t),n=await C(t,"workflow");for(let i of["proposal.md","tasks.md"])await Ee(O.join(e,i))||b(`ERROR: Cannot transition '${t}': ${i} must exist and be non-empty before leaving open`);n==="full"&&!await Ee(O.join(e,"design.md"))&&b(`ERROR: Cannot transition '${t}': design.md must exist and be non-empty before leaving open`)}async function Dy(t){let e=await C(t,"design_doc");(!e||e==="null"||!await Ee(O.resolve(e)))&&b(`ERROR: Cannot transition '${t}': design_doc must point to an existing Design Doc before leaving design`)}async function My(t,e){let n=O.join(t,".comet.yaml"),i=await Sr(n);for(let r of e){let s=uf(r.field);i.set(s,hf(s,ff(r.to)))}await Jo(n,i.toString())}async function Fy(t,e,n){let{directory:i}=await he(e),r=await pe(i),s=r.classic,o=!1;if(!s){r.run&&b("ERROR: Classic state projection is missing");let c=await Sr(O.join(i,".comet.yaml"));s=Ny(c.toJS()),o=!0}let a=sf(s,n);r.run?await nf(i,a.classic,r.run,{event:n,source:"comet-state"}):o?await My(i,a.effects):await Ct(i,{classic:a.classic,run:null,unknownKeys:r.unknownKeys}),await Mo(i,{change:e,event:n,source:"comet-state",from:s,to:a.classic,effects:a.effects});for(let c of a.effects)t.stderr.push(oe(`[SET] ${uf(c.field)}=${ff(c.to)}`));t.stderr.push(oe(`[TRANSITION] ${n}`))}async function Wy(t,e,n){if(ae(e),kr(n,Ey),n==="open-complete")await Se(e,"open"),await Ly(e);else if(n==="design-complete")await Se(e,"design"),await Dy(e);else if(n==="build-complete")await Se(e,"build"),await qy(e);else if(n==="verify-pass"){await Se(e,"verify");let i=await C(e,"verification_report");(!i||!await F(O.resolve(i)))&&b(`ERROR: Cannot transition '${e}': verification_report must point to an existing report file`)}else if(n==="verify-fail")await Se(e,"verify");else if(n==="archive-confirm")await Se(e,"archive"),await C(e,"verify_result")!=="pass"&&b(`ERROR: Cannot transition '${e}': verify_result must be pass before archiving`),await C(e,"archived")==="true"&&b(`ERROR: Cannot transition '${e}': already archived`);else if(n==="preset-escalate"){await Se(e,"build");let i=await C(e,"workflow");["hotfix","tweak"].includes(i)||b(`ERROR: Cannot transition '${e}': preset-escalate only applies to hotfix/tweak, got workflow='${i}'`)}else n==="archive-reopen"?(await Se(e,"archive"),await C(e,"archived")==="true"&&b(`ERROR: Cannot transition '${e}': already archived`)):(await Se(e,"archive"),await C(e,"verify_result")!=="pass"&&b(`ERROR: Cannot transition '${e}': verify_result must be pass before archiving`),await C(e,"archive_confirmation")!=="confirmed"&&b(`ERROR: Cannot transition '${e}': archive_confirmation must be confirmed before archiving`));await Fy(t,e,n)}async function By(t,e){ae(e);let{file:n,label:i}=await he(e);await F(n)||b(`ERROR: .comet.yaml not found at ${i}/.comet.yaml`);let r=await C(e,"phase"),s=await C(e,"workflow"),o=await C(e,"auto_transition");if(await C(e,"archived")==="true"){t.stdout.push("NEXT: done");return}let a=r==="open"?"comet-open":r==="design"?"comet-design":r==="verify"?"comet-verify":r==="archive"?"comet-archive":r==="build"?s==="hotfix"?"comet-hotfix":s==="tweak"?"comet-tweak":"comet-build":null;a||b(`ERROR: Cannot resolve next step for '${e}': unknown phase '${r||"null"}'`),t.stdout.push(`NEXT: ${o==="false"?"manual":"auto"}`,`SKILL: ${a}`),o==="false"&&t.stdout.push(`HINT: phase is '${r}'; run /${a} manually to continue`)}async function Ky(t,e,n){lf(e,"task file"),n||b("ERROR: Task text cannot be empty");let i=O.resolve(I(),e);await F(i)||b(`ERROR: Task file not found: ${e}`);let s=(await Ke(I(),i,{label:"Classic task-checkoff file"})).split(/\r?\n/u).filter(a=>[`- [ ] ${n}`,`- [x] ${n}`,`- [X] ${n}`].includes(a)),o=s.filter(a=>/^- \[[xX]\] /u.test(a));s.length!==1&&b(`ERROR: task text must appear exactly once in ${e} (found ${s.length}): ${n}`),o.length!==1&&b(`ERROR: task is not checked in ${e}: ${n}`),t.stdout.push("TASK_CHECKOFF: PASS",`FILE: ${e}`,`TASK: ${n}`)}async function Uy(t,e,n){ae(e),kr(n,Vo);let{file:i,directory:r,label:s}=await he(e);t.stdout.push(`=== Entry Check: comet-${n} ===`),await F(i)||b(`ERROR: .comet.yaml not found at ${s}/.comet.yaml`);let o=!1,a=f=>t.stdout.push(` ${oe("[PASS]")} ${f}`),c=f=>{t.stdout.push(` ${Ko("[FAIL]")} ${f}`),o=!0},l=async(f,d)=>{let m=await C(e,f);(m===d?a:c)(`${f}=${m} (expected: ${d})`)};if(a(".comet.yaml exists"),await l("phase",n),n==="design"){await l("workflow","full");let f=await C(e,"design_doc");(!f||f==="null"?a:c)(f?`design_doc=${f} (expected: empty/null)`:"design_doc is empty/null");for(let d of["proposal.md","design.md","tasks.md"])(await Ee(O.join(r,d))?a:c)(`${d} ${await Ee(O.join(r,d))?"non-empty":"missing or empty"}`)}else if(n==="build"){let f=await C(e,"workflow"),d=await C(e,"design_doc");f==="full"?(d&&d!=="null"&&await F(O.resolve(d))?a:c)(`design_doc=${d} (expected: non-null and file exists)`):a(`workflow=${f} (design_doc not required)`);for(let m of["proposal.md","tasks.md"])(await Ee(O.join(r,m))?a:c)(`${m} ${await Ee(O.join(r,m))?"non-empty":"missing or empty"}`)}else if(n==="verify"){let f=await C(e,"verify_result");(["","null","pending"].includes(f)?a:c)(`verify_result=${f} (expected: pending or null)`)}else if(n==="archive"){await l("verify_result","pass");let f=await C(e,"archived");(f!=="true"?a:c)(`archived=${f} (expected: not true)`)}let u=await ln(r,{heal:!0,cwd:Tn()});if(u.bindingRequired)switch(u.status){case"drift":c(zl(e,u.boundBranch,u.currentBranch));break;case"unbound-detached":c(un(e));break;case"healed":a(`bound_branch lazily set to ${u.branch}`);break;case"needs-heal":case"ok":case"not-applicable":a("bound_branch matches current branch");break;default:{let f=u;throw new Error(`unhandled branch binding status: ${JSON.stringify(f)}`)}}if(t.stdout.push(""),o)throw t.stderr.push(Ko("BLOCKED — fix failing checks before proceeding")),new jn("",1);t.stderr.push(oe("ALL CHECKS PASSED — ready to proceed"))}async function K(t,e,n){return!e||e==="null"?` - ${t}: PENDING`:n&&!await F(O.resolve(n))?` - ${t}: BROKEN (path ${e} does not exist)`:` - ${t}: DONE (${e})`}async function Yy(t,e){t.stdout.push(" Artifacts:");let n=0;for(let i of["proposal.md","design.md","tasks.md"]){let r=await Ee(O.join(e,i));r&&(n+=1),t.stdout.push(` - ${i}: ${r?"DONE":"PENDING"}`)}t.stdout.push("",n===3?"Recovery action: All artifacts complete. Run /comet-open user confirmation, then guard to transition.":n===0?"Recovery action: No artifacts created yet. Start from /comet-open Step 1 (explore and clarify).":"Recovery action: Some artifacts incomplete. Resume /comet-open from the first missing artifact.")}async function Vy(t,e,n){t.stdout.push(" Artifacts:");for(let o of["proposal.md","design.md","tasks.md"])t.stdout.push(` - ${o}: ${await Ee(O.join(n,o))?"DONE":"MISSING (unexpected in design phase)"}`);let i=await C(e,"handoff_context"),r=await C(e,"handoff_hash"),s=await C(e,"design_doc");t.stdout.push(""," Design progress:",await K("handoff_context",i,i),await K("handoff_hash",r),await K("design_doc",s,s),""),s&&s!=="null"&&await F(O.resolve(s))?t.stdout.push("Recovery action: Design Doc already created and linked. Run guard to transition to build."):i&&i!=="null"&&await F(O.resolve(i))?t.stdout.push("Recovery action: Handoff generated but Design Doc not yet created. Resume from brainstorming confirmation (Step 1c)."):t.stdout.push("Recovery action: No handoff generated yet. Start from Step 1a (generate handoff package).")}async function Jy(t,e,n,i){let r=await C(e,"isolation"),s=await C(e,"build_mode"),o=await C(e,"build_pause"),a=await C(e,"subagent_dispatch"),c=await C(e,"tdd_mode"),l=await C(e,"review_mode"),u=await C(e,"plan"),f=[" Build decisions:",await K("isolation",r),await K("build_mode",s),await K("build_pause",o),await K("tdd_mode",c),await K("review_mode",l)];(s==="subagent-driven-development"||a&&a!=="null")&&f.push(await K("subagent_dispatch",a)),t.stdout.push(...f,""," Plan:",await K("plan",u,u),"");let d=O.join(n,"tasks.md");if(!await F(d)){t.stdout.push(" Tasks: tasks.md MISSING","","Recovery action: tasks.md missing. Verify change directory integrity.");return}let m=(await Ke(I(),d,{label:"Classic change tasks"})).split(/\r?\n/u),g=m.filter(E=>/^\s*- \[[ xX]\] /u.test(E)).length,p=m.filter(E=>/^\s*- \[[xX]\] /u.test(E)).length,h=g-p,y=0,v=0;if(u&&u!=="null"&&await F(u)){let E=(await Ke(I(),u,{label:"Classic build plan"})).split(/\r?\n/u);y=E.filter(_=>/^\s*- \[[ xX]\] /u.test(_)).length,v=E.filter(_=>/^\s*- \[[xX]\] /u.test(_)).length}let S=y-v;t.stdout.push(` Tasks: ${p}/${g} done, ${h} pending`),y>0&&t.stdout.push(` Plan tasks: ${v}/${y} done, ${S} pending`),t.stdout.push("");let R=Hy(i,r,s,o,a,c,l,u,h,S);t.stdout.push(R)}function Ve(t){return!t||t==="null"}function Hy(t,e,n,i,r,s,o,a,c,l){let u=a&&a!=="null",f=t==="full"&&(Ve(s)||Ve(o));return i==="plan-ready"&&u&&(Ve(e)||Ve(n)||f)?t==="full"?"Recovery action: Plan-ready pause detected. Ask the user whether to continue, then choose isolation, build mode, TDD mode, and review mode without regenerating the plan.":"Recovery action: Plan-ready pause detected. Ask the user whether to continue, then choose isolation and build mode without regenerating the plan.":i==="plan-ready"&&!u?"Recovery action: Plan-ready pause is recorded, but the plan file is missing. Restore the plan file or rerun writing-plans before choosing execution.":i==="plan-ready"?n==="subagent-driven-development"&&(c>0||l>0)?r==="confirmed"?"Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then inspect the first unchecked task (OpenSpec or plan additions) against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Plan-ready pause is stale and selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":c>0||l>0?"Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then continue from the first unchecked task.":"Recovery action: Plan-ready pause is stale and all tasks are done. Clear build_pause to null, then run guard to transition to verify.":Ve(e)?"Recovery action: Isolation not selected. Use the current platform's user confirmation mechanism to ask user for branch/worktree choice.":Ve(n)?"Recovery action: Build mode not selected. Use the current platform's user confirmation mechanism to ask user for execution method.":t==="full"&&Ve(s)?"Recovery action: TDD mode not selected. Use the current platform's user confirmation mechanism to ask user for tdd or direct.":t==="full"&&Ve(o)?"Recovery action: Review mode not selected. Use the current platform's user confirmation mechanism to ask user for off, standard, or thorough.":c>0?n==="subagent-driven-development"?r==="confirmed"?"Recovery action: Read tasks.md and the Superpowers plan (which may include additions beyond OpenSpec), then inspect the first unchecked task against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":"Recovery action: Read tasks.md and continue from first unchecked task.":l>0?n==="subagent-driven-development"?r==="confirmed"?"Recovery action: Read the Superpowers plan, then inspect the first unchecked Superpowers plan task against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":"Recovery action: Read the Superpowers plan and continue from the first unchecked plan task.":"Recovery action: All tasks done. Run guard to transition to verify."}async function Gy(t,e){let n=await C(e,"verify_result"),i=await C(e,"verify_failures"),r=await C(e,"verify_mode"),s=await C(e,"verification_report"),o=await C(e,"branch_status");t.stdout.push(" Verification:",await K("verify_result",n),` - verify_failures: ${i||"0"}`,await K("verify_mode",r),await K("verification_report",s,s),o==="handled"?" - branch_status: LEGACY (handled before archive; archive still owns final closure)":" - branch_status: DEFERRED (handled after the archive commit)","",n==="pass"?"Recovery action: Verification complete. Continue to archive; branch handling happens after archive changes are committed.":n==="fail"?"Recovery action: Verification failed and rolled back to build. Resume from /comet-build.":"Recovery action: Verification not yet started or in progress. Run scale assessment then verify.")}async function zy(t,e){let n=await C(e,"archive_confirmation");t.stdout.push(" Archive:",await K("verify_result",await C(e,"verify_result")),await K("archive_confirmation",n),await K("archived",await C(e,"archived")),"",n==="confirmed"?"Recovery action: Archive is confirmed. Run /comet-archive to complete archiving.":"Recovery action: Ask for final archive confirmation in /comet-archive before running the archive command.")}async function Qy(t,e){ae(e);let{file:n,directory:i,label:r}=await he(e);await F(n)||b(`ERROR: .comet.yaml not found at ${r}/.comet.yaml`);let s=await C(e,"phase"),o=await C(e,"workflow");t.stdout.push(`=== Recovery Context: ${e} ===`,`Phase: ${s}`,`Workflow: ${o}`,"","State fields:"),s==="open"?await Yy(t,i):s==="design"?await Vy(t,e,i):s==="build"?await Jy(t,e,i,o):s==="verify"?await Gy(t,e):s==="archive"?await zy(t,e):b(`ERROR: Unknown phase: ${s}`),t.stdout.push("","=== End Recovery Context ===")}async function Xy(t,e){ae(e);let{file:n,directory:i,label:r}=await he(e);await F(n)||b(`ERROR: .comet.yaml not found at ${r}/.comet.yaml`);let s=O.join(i,"tasks.md"),o=await F(s)?(await Ke(I(),s,{label:"Classic scale task file"})).split(/\r?\n/u).filter(g=>/^- \[/u.test(g)).length:0,a=O.join(i,"specs"),c=0;if(await F(a))for(let g of await by.readdir(a))await F(O.join(a,g,"spec.md"))&&(c+=1);let l=await C(e,"plan"),u="";l&&l!=="null"&&await F(l)&&(u=(await Ke(I(),l,{label:"Classic scale plan"})).match(/^base-ref:\s*(.+)$/mu)?.[1].trim()??""),u||(u=await C(e,"base_ref"));let f=mf(["diff","--name-only",...u&&u!=="null"?[`${u}...HEAD`]:["HEAD"]]),d=f?f.split(/\r?\n/u).filter(Boolean).length:0,m=o>3||c>1||d>8?"full":"light";await gf(new vr,e,"verify_mode",m),t.stderr.push(`=== Scale Assessment: ${e} ===`,` Tasks: ${o} (threshold: 3)`,` Delta specs: ${c} capabilities (threshold: 1)`,` Changed files: ${d} (threshold: 8)`,` → Result: ${m}`,oe(`[SCALE] verify_mode=${m}`))}function Zy(t){let e,n,i;for(let r=0;r<t.length;r+=2){let s=t[r];["--command","--exit-code","--cwd"].includes(s)||b(`ERROR: Unknown option: ${s}`);let o=t[r+1];o===void 0&&b(`ERROR: Missing value for option: ${s}`),s==="--command"?e=o:s==="--exit-code"?n=o:i=o}return e===void 0&&b("ERROR: Missing option: --command"),n===void 0&&b("ERROR: Missing option: --exit-code"),/^-?\d+$/u.test(n)||b("ERROR: --exit-code must be an integer"),{command:e,exitCode:Number(n),...i===void 0?{}:{cwd:i}}}async function ev(t,e,n,i){ae(e),n!=="build"&&n!=="verify"&&b(`ERROR: Invalid command check scope: '${n}'`);let r=Zy(i),{directory:s,file:o}=await he(e),a=I(),c=(await de(a)).changesDir;(O.dirname(s)!==c||!await F(o))&&b(`ERROR: command checks require an active change: ${e}`);try{let l=await pe(s,{migrate:!1});if(!l.classic||!l.run)throw new Error("command checks require an existing synchronized Classic Run");let{run:u}=await tf(s,l),f=await of(a,s,u,{scope:n,...r,cwd:r.cwd??(O.relative(a,Tn()).replaceAll("\\","/")||".")});t.stderr.push(oe(`[RECORDED] ${f.scope} exit=${f.exitCode} cwd=${f.cwd} command=${f.command}`))}catch(l){b(`ERROR: ${l.message}`)}}function Ce(t,e,n){t.length<e&&b(n)}function yr(t,e,n){t.length!==e&&b(n)}var tv=new Set(["init","set","transition","check","scale","record-check","rebind","select","clear-selection"]);async function nv(t){if(!(!t||!tv.has(t)))try{await Xi(I())}catch(e){b(`ERROR: ${e instanceof Error?e.message:String(e)}`)}}async function iv(t,e){ae(e);try{let n=await Pu(I(),e),i=await C(e,"bound_branch"),r=i&&i!=="null"?i:null;t.stderr.push(oe(`[SELECTED] current change: ${n.change}${r?` (branch: ${r})`:""}`))}catch(n){b(`ERROR: ${n instanceof Error?n.message:String(n)}`)}}async function rv(t,e){ae(e);let{directory:n}=await he(e),i=await C(e,"bound_branch");(!i||i==="null")&&b(`ERROR: '${e}' is not yet bound; use 'comet state set ${e} isolation <current|branch|worktree>' to establish the first binding`);let r=Wi(Tn());r===null&&b("ERROR: cannot rebind while HEAD is detached; checkout a branch first");let s=await pe(n);s.classic||b("ERROR: Classic state projection is missing"),await po(n,r);let o={...s.classic,boundBranch:r};await Mo(n,{change:e,event:"rebind",source:"comet-state",from:s.classic,to:o,effects:[{field:"boundBranch",from:i,to:r}]}),t.stderr.push(oe(`[REBIND] bound_branch: ${i} → ${r}`))}async function sv(t){let e=await Ou(I());if(e.status==="selected"){t.stdout.push(e.selection.change);return}e.status==="missing"&&b(`ERROR: no current change selected
160
+ Use: comet-state.mjs select <change-name>`),b(`ERROR: current change selection is stale: ${e.reason}
161
+ Use: comet-state.mjs select <change-name>`)}async function ov(t){await Au(I()),t.stderr.push(oe("[CLEARED] current change selection"))}var wf=async(t,e)=>ju(e,async()=>{let n=new vr;try{let[i,...r]=t;return await nv(i),i==="init"?(Ce(r,2,"Usage: comet-state.mjs init <change-name> <workflow>"),await $y(n,r[0],r[1])):i==="get"?(Ce(r,2,"Usage: comet-state.mjs get <change-name> <field>"),ae(r[0]),n.stdout.push(await C(r[0],r[1]))):i==="set"?(Ce(r,3,"Usage: comet-state.mjs set <change-name> <field> <value>"),ae(r[0]),await gf(n,r[0],r[1],r[2])):i==="transition"?(Ce(r,2,"Usage: comet-state.mjs transition <change-name> <event>"),await Wy(n,r[0],r[1])):i==="check"?(Ce(r,2,"Usage: comet-state.mjs check <change-name> <phase> [--recover]"),r[2]==="--recover"?await Qy(n,r[0]):await Uy(n,r[0],r[1])):i==="scale"?(Ce(r,1,"Usage: comet-state.mjs scale <change-name>"),await Xy(n,r[0])):i==="record-check"?(Ce(r,2,"Usage: comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]"),await ev(n,r[0],r[1],r.slice(2))):i==="task-checkoff"?(Ce(r,2,"Usage: comet-state.mjs task-checkoff <file> <task-text>"),await Ky(n,r[0],r[1])):i==="rebind"?(yr(r,1,"Usage: comet-state.mjs rebind <change-name>"),await rv(n,r[0])):i==="select"?(yr(r,1,"Usage: comet-state.mjs select <change-name>"),await iv(n,r[0])):i==="current"?(yr(r,0,"Usage: comet-state.mjs current"),await sv(n)):i==="clear-selection"?(yr(r,0,"Usage: comet-state.mjs clear-selection"),await ov(n)):i==="next"?(Ce(r,1,"Usage: comet-state.mjs next <change-name>"),await By(n,r[0])):b(`Unknown subcommand: ${i??""}`),n.result()}catch(i){if(!(i instanceof jn))throw i;if(i.message)for(let r of i.message.split(`
162
+ `))n.stderr.push(Ko(r));return n.result(i.exitCode)}});function av(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
163
+ `}}async function yf(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),s;try{s=await e(r,{json:i})}catch(a){s={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let o=i?av(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
164
+ `)?"":`
165
+ `)),o.exitCode}process.exitCode=await yf("state",wf);