@rpamis/comet 0.4.0-beta.14 → 0.4.0-beta.15

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 (317) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +13 -1
  3. package/assets/manifest.json +1 -1
  4. package/assets/skills/comet/SKILL.md +6 -5
  5. package/assets/skills/comet/reference/subagent-dispatch.md +2 -4
  6. package/assets/skills/comet/rules/comet-phase-guard.en.md +4 -3
  7. package/assets/skills/comet/rules/comet-phase-guard.md +4 -3
  8. package/assets/skills/comet/rules/comet-workflow-guard.en.md +1 -1
  9. package/assets/skills/comet/rules/comet-workflow-guard.md +1 -1
  10. package/assets/skills/comet/scripts/comet-archive.mjs +85 -85
  11. package/assets/skills/comet/scripts/comet-guard.mjs +111 -111
  12. package/assets/skills/comet/scripts/comet-handoff.mjs +85 -85
  13. package/assets/skills/comet/scripts/comet-hook-guard.mjs +91 -89
  14. package/assets/skills/comet/scripts/comet-hook-router.mjs +124 -116
  15. package/assets/skills/comet/scripts/comet-resume-probe.mjs +77 -77
  16. package/assets/skills/comet/scripts/comet-runtime.mjs +188 -185
  17. package/assets/skills/comet/scripts/comet-state.mjs +108 -107
  18. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +95 -95
  19. package/assets/skills/comet-any/SKILL.md +1 -1
  20. package/assets/skills/comet-any/reference/authoring-subagents.md +3 -11
  21. package/assets/skills/comet-any/reference/subagents/pause-points-author.md +1 -4
  22. package/assets/skills/comet-any/reference/subagents/reference-author.md +1 -4
  23. package/assets/skills/comet-any/reference/subagents/script-author.md +1 -4
  24. package/assets/skills/comet-any/reference/subagents/skill-core-author.md +1 -4
  25. package/assets/skills/comet-any/reference/subagents/skill-reviewer.md +1 -4
  26. package/assets/skills/comet-any/reference/subagents/workflow-entry-author.md +1 -4
  27. package/assets/skills/comet-build/SKILL.md +2 -2
  28. package/assets/skills/comet-native/SKILL.md +85 -11
  29. package/assets/skills/comet-native/reference/artifacts.md +3 -1
  30. package/assets/skills/comet-native/reference/commands.md +15 -6
  31. package/assets/skills/comet-native/reference/recovery.md +12 -1
  32. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +124 -118
  33. package/assets/skills/comet-native/scripts/comet-native-check.mjs +116 -110
  34. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +110 -110
  35. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +121 -121
  36. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +83 -83
  37. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +88 -82
  38. package/assets/skills/comet-native/scripts/comet-native-init.mjs +85 -85
  39. package/assets/skills/comet-native/scripts/comet-native-new.mjs +114 -114
  40. package/assets/skills/comet-native/scripts/comet-native-next.mjs +122 -122
  41. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +124 -116
  42. package/assets/skills/comet-native/scripts/comet-native-root.mjs +110 -110
  43. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +154 -152
  44. package/assets/skills/comet-native/scripts/comet-native-select.mjs +110 -110
  45. package/assets/skills/comet-native/scripts/comet-native-show.mjs +80 -80
  46. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +112 -112
  47. package/assets/skills/comet-native/scripts/comet-native-status.mjs +107 -107
  48. package/assets/skills-zh/comet/SKILL.md +3 -3
  49. package/assets/skills-zh/comet/reference/subagent-dispatch.md +2 -4
  50. package/assets/skills-zh/comet-any/SKILL.md +1 -1
  51. package/assets/skills-zh/comet-any/reference/authoring-subagents.md +3 -14
  52. package/assets/skills-zh/comet-any/reference/subagents/pause-points-author.md +1 -4
  53. package/assets/skills-zh/comet-any/reference/subagents/reference-author.md +1 -4
  54. package/assets/skills-zh/comet-any/reference/subagents/script-author.md +1 -4
  55. package/assets/skills-zh/comet-any/reference/subagents/skill-core-author.md +1 -4
  56. package/assets/skills-zh/comet-any/reference/subagents/skill-reviewer.md +1 -4
  57. package/assets/skills-zh/comet-any/reference/subagents/workflow-entry-author.md +1 -4
  58. package/assets/skills-zh/comet-build/SKILL.md +2 -2
  59. package/assets/skills-zh/comet-native/SKILL.md +86 -12
  60. package/assets/skills-zh/comet-native/reference/artifacts.md +3 -1
  61. package/assets/skills-zh/comet-native/reference/commands.md +17 -8
  62. package/assets/skills-zh/comet-native/reference/recovery.md +14 -3
  63. package/bin/fast-runtime-router.js +1 -0
  64. package/dist/app/cli/index.js +1 -0
  65. package/dist/app/cli/index.js.map +1 -1
  66. package/dist/app/commands/doctor.d.ts.map +1 -1
  67. package/dist/app/commands/doctor.js +138 -37
  68. package/dist/app/commands/doctor.js.map +1 -1
  69. package/dist/app/commands/init.d.ts.map +1 -1
  70. package/dist/app/commands/init.js +43 -12
  71. package/dist/app/commands/init.js.map +1 -1
  72. package/dist/app/commands/update.d.ts.map +1 -1
  73. package/dist/app/commands/update.js +42 -9
  74. package/dist/app/commands/update.js.map +1 -1
  75. package/dist/app/commands/workflow.d.ts +1 -0
  76. package/dist/app/commands/workflow.d.ts.map +1 -1
  77. package/dist/app/commands/workflow.js +9 -2
  78. package/dist/app/commands/workflow.js.map +1 -1
  79. package/dist/domains/comet-classic/classic-hook-guard.d.ts +5 -1
  80. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  81. package/dist/domains/comet-classic/classic-hook-guard.js +104 -20
  82. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  83. package/dist/domains/comet-classic/classic-plan-readiness.d.ts +12 -0
  84. package/dist/domains/comet-classic/classic-plan-readiness.d.ts.map +1 -0
  85. package/dist/domains/comet-classic/classic-plan-readiness.js +26 -0
  86. package/dist/domains/comet-classic/classic-plan-readiness.js.map +1 -0
  87. package/dist/domains/comet-classic/classic-project-config.d.ts +1 -0
  88. package/dist/domains/comet-classic/classic-project-config.d.ts.map +1 -1
  89. package/dist/domains/comet-classic/classic-project-config.js +13 -7
  90. package/dist/domains/comet-classic/classic-project-config.js.map +1 -1
  91. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  92. package/dist/domains/comet-classic/classic-state-command.js +58 -7
  93. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  94. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  95. package/dist/domains/comet-entry/hook-adapter.js +15 -2
  96. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  97. package/dist/domains/comet-entry/hook-project-root.d.ts +3 -0
  98. package/dist/domains/comet-entry/hook-project-root.d.ts.map +1 -0
  99. package/dist/domains/comet-entry/hook-project-root.js +62 -0
  100. package/dist/domains/comet-entry/hook-project-root.js.map +1 -0
  101. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -1
  102. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  103. package/dist/domains/comet-entry/hook-router-entry.js +6 -4
  104. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  105. package/dist/domains/comet-entry/hook-router.d.ts +2 -0
  106. package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
  107. package/dist/domains/comet-entry/hook-router.js +45 -9
  108. package/dist/domains/comet-entry/hook-router.js.map +1 -1
  109. package/dist/domains/comet-entry/hook-types.d.ts +1 -0
  110. package/dist/domains/comet-entry/hook-types.d.ts.map +1 -1
  111. package/dist/domains/comet-entry/project-activation.d.ts +12 -0
  112. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -0
  113. package/dist/domains/comet-entry/project-activation.js +109 -0
  114. package/dist/domains/comet-entry/project-activation.js.map +1 -0
  115. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  116. package/dist/domains/comet-entry/resume-probe.js +47 -26
  117. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  118. package/dist/domains/comet-entry/types.d.ts +1 -1
  119. package/dist/domains/comet-entry/types.d.ts.map +1 -1
  120. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-archive-command.js +43 -1
  122. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  123. package/dist/domains/comet-native/native-archive-inspection.d.ts.map +1 -1
  124. package/dist/domains/comet-native/native-archive-inspection.js +11 -0
  125. package/dist/domains/comet-native/native-archive-inspection.js.map +1 -1
  126. package/dist/domains/comet-native/native-archive-preflight.d.ts +10 -0
  127. package/dist/domains/comet-native/native-archive-preflight.d.ts.map +1 -1
  128. package/dist/domains/comet-native/native-archive-preflight.js +44 -0
  129. package/dist/domains/comet-native/native-archive-preflight.js.map +1 -1
  130. package/dist/domains/comet-native/native-change.d.ts +18 -1
  131. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  132. package/dist/domains/comet-native/native-change.js +72 -3
  133. package/dist/domains/comet-native/native-change.js.map +1 -1
  134. package/dist/domains/comet-native/native-check.d.ts.map +1 -1
  135. package/dist/domains/comet-native/native-check.js +13 -1
  136. package/dist/domains/comet-native/native-check.js.map +1 -1
  137. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  138. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  139. package/dist/domains/comet-native/native-cli-shared.js +24 -3
  140. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  141. package/dist/domains/comet-native/native-conflict-inspection.d.ts +3 -1
  142. package/dist/domains/comet-native/native-conflict-inspection.d.ts.map +1 -1
  143. package/dist/domains/comet-native/native-conflict-inspection.js +20 -10
  144. package/dist/domains/comet-native/native-conflict-inspection.js.map +1 -1
  145. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  146. package/dist/domains/comet-native/native-continuation.js +16 -0
  147. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  148. package/dist/domains/comet-native/native-diagnostics.d.ts +2 -0
  149. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  150. package/dist/domains/comet-native/native-diagnostics.js +43 -32
  151. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  152. package/dist/domains/comet-native/native-evidence-storage.d.ts +6 -0
  153. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  154. package/dist/domains/comet-native/native-evidence-storage.js +24 -0
  155. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  156. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  157. package/dist/domains/comet-native/native-findings.js +36 -0
  158. package/dist/domains/comet-native/native-findings.js.map +1 -1
  159. package/dist/domains/comet-native/native-hook-guard.js +2 -2
  160. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  161. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  162. package/dist/domains/comet-native/native-new-command.js +22 -7
  163. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  164. package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -1
  165. package/dist/domains/comet-native/native-receipt-command.js +14 -1
  166. package/dist/domains/comet-native/native-receipt-command.js.map +1 -1
  167. package/dist/domains/comet-native/native-receipt-errors.d.ts +23 -0
  168. package/dist/domains/comet-native/native-receipt-errors.d.ts.map +1 -0
  169. package/dist/domains/comet-native/native-receipt-errors.js +9 -0
  170. package/dist/domains/comet-native/native-receipt-errors.js.map +1 -0
  171. package/dist/domains/comet-native/native-receipt-refresh.d.ts +3 -0
  172. package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -1
  173. package/dist/domains/comet-native/native-receipt-refresh.js +13 -2
  174. package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -1
  175. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-root-move.js +54 -1
  177. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  178. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  179. package/dist/domains/comet-native/native-snapshot.js +71 -14
  180. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  181. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  182. package/dist/domains/comet-native/native-transitions.js +74 -42
  183. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  184. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +37 -4
  185. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  186. package/dist/domains/comet-native/native-verification-receipt-runtime.js +192 -4
  187. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  188. package/dist/domains/comet-native/native-verification-runtime.d.ts +27 -1
  189. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  190. package/dist/domains/comet-native/native-verification-runtime.js +29 -6
  191. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  192. package/dist/domains/comet-native/native-workspace.d.ts +39 -3
  193. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  194. package/dist/domains/comet-native/native-workspace.js +200 -8
  195. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  196. package/dist/domains/dashboard/collector.d.ts +26 -1
  197. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  198. package/dist/domains/dashboard/collector.js +381 -1
  199. package/dist/domains/dashboard/collector.js.map +1 -1
  200. package/dist/domains/dashboard/native-adapter.d.ts +15 -0
  201. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  202. package/dist/domains/dashboard/native-adapter.js +1 -1
  203. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  204. package/dist/domains/dashboard/native-collector.d.ts +26 -1
  205. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  206. package/dist/domains/dashboard/native-collector.js +284 -5
  207. package/dist/domains/dashboard/native-collector.js.map +1 -1
  208. package/dist/domains/dashboard/server.d.ts.map +1 -1
  209. package/dist/domains/dashboard/server.js +92 -3
  210. package/dist/domains/dashboard/server.js.map +1 -1
  211. package/dist/domains/dashboard/types.d.ts +41 -1
  212. package/dist/domains/dashboard/types.d.ts.map +1 -1
  213. package/dist/domains/dashboard/verify-parser.d.ts +1 -0
  214. package/dist/domains/dashboard/verify-parser.d.ts.map +1 -1
  215. package/dist/domains/dashboard/verify-parser.js +8 -4
  216. package/dist/domains/dashboard/verify-parser.js.map +1 -1
  217. package/dist/domains/dashboard/web/assets/{arc-mNt_SS1l.js → arc-ClrSujVb.js} +1 -1
  218. package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-Bc5akVD6.js → architectureDiagram-3BPJPVTR-B4A_t84A.js} +1 -1
  219. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-C43zhVBe.js → blockDiagram-GPEHLZMM-D72u2953.js} +1 -1
  220. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-dToETarK.js → c4Diagram-AAUBKEIU-Ca5zba3N.js} +1 -1
  221. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +1 -0
  222. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-C0oO137R.js → chunk-2J33WTMH-CCVPBm0J.js} +1 -1
  223. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-CGms1fgI.js → chunk-4BX2VUAB-JYluRsP-.js} +1 -1
  224. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-Bugl8v6f.js → chunk-55IACEB6-DfYm7pN7.js} +1 -1
  225. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-8ATNMlBG.js → chunk-727SXJPM-CwghIMO9.js} +1 -1
  226. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-BNYjSSqU.js → chunk-AQP2D5EJ-BA_zgMXZ.js} +1 -1
  227. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-_nJAqSbe.js → chunk-FMBD7UC4-BAJLB5V6.js} +1 -1
  228. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-lyxYm5NX.js → chunk-ND2GUHAM-Bj6HWRwi.js} +1 -1
  229. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-PUMVeWpd.js → chunk-QZHKN3VN-B1kXfg5N.js} +1 -1
  230. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +1 -0
  231. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +1 -0
  232. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-DzMqjexn.js → cose-bilkent-S5V4N54A-BBrkuiAU.js} +1 -1
  233. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-B67ET0eq.js → cynefin-VYW2F7L2-DlFhgQHt.js} +1 -1
  234. package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-CQPMvRLK.js → dagre-BM42HDAG-B0Bk5oiP.js} +1 -1
  235. package/dist/domains/dashboard/web/assets/{demo-BuVau32v.js → demo-DZYPLZpF.js} +2 -2
  236. package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-BRpLrFHM.js → diagram-2AECGRRQ-tvTUiBA2.js} +1 -1
  237. package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-CPGWuGrE.js → diagram-5GNKFQAL-BZfcK29q.js} +1 -1
  238. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-D2wpX2iO.js → diagram-KO2AKTUF-BQahyP-C.js} +1 -1
  239. package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-D54mAbDu.js → diagram-LMA3HP47-D5bJnW2C.js} +1 -1
  240. package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-ZGQDpSs_.js → diagram-OG6HWLK6-DTwWdzWJ.js} +1 -1
  241. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-C3qDo7sd.js → erDiagram-TEJ5UH35-BbvrdCp9.js} +1 -1
  242. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-B7hStPd9.js → flowDiagram-I6XJVG4X-DgbR7Tcc.js} +1 -1
  243. package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-IqcLFbTK.js → ganttDiagram-6RSMTGT7-wWMOA7F4.js} +1 -1
  244. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-YrMZpzUu.js → gitGraphDiagram-PVQCEYII-DCxvMAUJ.js} +1 -1
  245. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +1 -0
  246. package/dist/domains/dashboard/web/assets/{index-icxk8_BP.js → index-Blit0P5Z.js} +1 -1
  247. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +257 -0
  248. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-CcIgGK_7.js → infoDiagram-5YYISTIA-9qXEkzDe.js} +1 -1
  249. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-1x3rNjGP.js → ishikawaDiagram-YF4QCWOH-Dkf5othW.js} +1 -1
  250. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-B2XiqMNP.js → journeyDiagram-JHISSGLW-C2_IkO4s.js} +1 -1
  251. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-x46cGuo3.js → kanban-definition-UN3LZRKU-BxWgu4DL.js} +1 -1
  252. package/dist/domains/dashboard/web/assets/{linear-DFLqGZWl.js → linear-Dkr6p-Ro.js} +1 -1
  253. package/dist/domains/dashboard/web/assets/{mermaid.core-g3J6BACc.js → mermaid.core-DZUcsoG4.js} +4 -4
  254. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CTdeKmcX.js → mindmap-definition-RKZ34NQL-C9xyxGfa.js} +1 -1
  255. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-C_obwjIf.js → pieDiagram-4H26LBE5-Dn67tdOF.js} +1 -1
  256. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-B6Gnfz9M.js → quadrantDiagram-W4KKPZXB-Cy6iOcxc.js} +1 -1
  257. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-nX4PObnB.js → requirementDiagram-4Y6WPE33-B_gZONhx.js} +1 -1
  258. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-QjDwwHgl.js → sankeyDiagram-5OEKKPKP-C3u-4dOk.js} +1 -1
  259. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-BEEe0j6B.js → sequenceDiagram-3UESZ5HK-Xd3ByTVF.js} +1 -1
  260. package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CXfAaBgM.js → stateDiagram-AJRCARHV-CJGHL7Up.js} +1 -1
  261. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +1 -0
  262. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-BOzX2EnD.js → timeline-definition-PNZ67QCA-DvONX2YQ.js} +1 -1
  263. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-C40vhXRq.js → vennDiagram-CIIHVFJN-B-L4qWy4.js} +1 -1
  264. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-B1rm89JH.js → wardleyDiagram-YWT4CUSO-cf39WX2o.js} +1 -1
  265. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-BlMr59qK.js → xychartDiagram-2RQKCTM6-Dk1vcm3u.js} +1 -1
  266. package/dist/domains/dashboard/web/index.html +16 -16
  267. package/dist/domains/skill/hook-lifecycle.d.ts +9 -0
  268. package/dist/domains/skill/hook-lifecycle.d.ts.map +1 -0
  269. package/dist/domains/skill/hook-lifecycle.js +48 -0
  270. package/dist/domains/skill/hook-lifecycle.js.map +1 -0
  271. package/dist/domains/skill/platform-inspect.d.ts +2 -0
  272. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  273. package/dist/domains/skill/platform-inspect.js +170 -32
  274. package/dist/domains/skill/platform-inspect.js.map +1 -1
  275. package/dist/domains/skill/platform-install.d.ts +21 -1
  276. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  277. package/dist/domains/skill/platform-install.js +142 -31
  278. package/dist/domains/skill/platform-install.js.map +1 -1
  279. package/dist/domains/skill/project-hook-projection.d.ts +14 -0
  280. package/dist/domains/skill/project-hook-projection.d.ts.map +1 -0
  281. package/dist/domains/skill/project-hook-projection.js +41 -0
  282. package/dist/domains/skill/project-hook-projection.js.map +1 -0
  283. package/dist/domains/skill/project-instructions.d.ts +3 -0
  284. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  285. package/dist/domains/skill/project-instructions.js +8 -0
  286. package/dist/domains/skill/project-instructions.js.map +1 -1
  287. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  288. package/dist/domains/skill/uninstall.js +50 -11
  289. package/dist/domains/skill/uninstall.js.map +1 -1
  290. package/dist/domains/workflow-contract/global-config.d.ts +10 -0
  291. package/dist/domains/workflow-contract/global-config.d.ts.map +1 -0
  292. package/dist/domains/workflow-contract/global-config.js +117 -0
  293. package/dist/domains/workflow-contract/global-config.js.map +1 -0
  294. package/dist/domains/workflow-contract/hook-target-scope.d.ts +6 -0
  295. package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -0
  296. package/dist/domains/workflow-contract/hook-target-scope.js +51 -0
  297. package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -0
  298. package/dist/domains/workflow-contract/index.d.ts +1 -0
  299. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  300. package/dist/domains/workflow-contract/index.js +1 -0
  301. package/dist/domains/workflow-contract/index.js.map +1 -1
  302. package/dist/domains/workflow-contract/types.d.ts +3 -0
  303. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  304. package/dist/platform/paths/git-worktree.d.ts +4 -1
  305. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  306. package/dist/platform/paths/git-worktree.js +34 -1
  307. package/dist/platform/paths/git-worktree.js.map +1 -1
  308. package/eval/local/tests/scaffold/test_utils.py +74 -0
  309. package/eval/pyproject.toml +4 -4
  310. package/eval/scaffold/shell/docker.sh +5 -0
  311. package/package.json +1 -1
  312. package/dist/domains/dashboard/web/assets/channel-b2wWDG4F.js +0 -1
  313. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-B9SWZywo.js +0 -1
  314. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-B9SWZywo.js +0 -1
  315. package/dist/domains/dashboard/web/assets/index-DhtBssCt.js +0 -257
  316. package/dist/domains/dashboard/web/assets/index-pr3axVDI.css +0 -1
  317. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-CD3nS4cC.js +0 -1
@@ -1,75 +1,75 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Fu=Object.create;var sr=Object.defineProperty;var Mu=Object.getOwnPropertyDescriptor;var Wu=Object.getOwnPropertyNames;var Bu=Object.getPrototypeOf,Ku=Object.prototype.hasOwnProperty;var bn=(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 K=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Yu=(t,e)=>{for(var n in e)sr(t,n,{get:e[n],enumerable:!0})},Uu=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Wu(e))!Ku.call(t,r)&&r!==n&&sr(t,r,{get:()=>e[r],enumerable:!(i=Mu(e,r))||i.enumerable});return t};var vt=(t,e,n)=>(n=t!=null?Fu(Bu(t)):{},Uu(e||!t||!t.__esModule?sr(n,"default",{value:t,enumerable:!0}):n,t));var _=v(F=>{"use strict";var or=Symbol.for("yaml.alias"),_o=Symbol.for("yaml.document"),kn=Symbol.for("yaml.map"),Po=Symbol.for("yaml.pair"),ar=Symbol.for("yaml.scalar"),Sn=Symbol.for("yaml.seq"),he=Symbol.for("yaml.node.type"),zu=t=>!!t&&typeof t=="object"&&t[he]===or,Gu=t=>!!t&&typeof t=="object"&&t[he]===_o,Qu=t=>!!t&&typeof t=="object"&&t[he]===kn,Xu=t=>!!t&&typeof t=="object"&&t[he]===Po,Ro=t=>!!t&&typeof t=="object"&&t[he]===ar,Zu=t=>!!t&&typeof t=="object"&&t[he]===Sn;function Oo(t){if(t&&typeof t=="object")switch(t[he]){case kn:case Sn:return!0}return!1}function ef(t){if(t&&typeof t=="object")switch(t[he]){case or:case kn:case ar:case Sn:return!0}return!1}var tf=t=>(Ro(t)||Oo(t))&&!!t.anchor;F.ALIAS=or;F.DOC=_o;F.MAP=kn;F.NODE_TYPE=he;F.PAIR=Po;F.SCALAR=ar;F.SEQ=Sn;F.hasAnchor=tf;F.isAlias=zu;F.isCollection=Oo;F.isDocument=Gu;F.isMap=Qu;F.isNode=ef;F.isPair=Xu;F.isScalar=Ro;F.isSeq=Zu});var kt=v(cr=>{"use strict";var L=_(),J=Symbol("break visit"),Ao=Symbol("skip children"),ce=Symbol("remove node");function Cn(t,e){let n=No(e);L.isDocument(t)?et(null,t.contents,n,Object.freeze([t]))===ce&&(t.contents=null):et(null,t,n,Object.freeze([]))}Cn.BREAK=J;Cn.SKIP=Ao;Cn.REMOVE=ce;function et(t,e,n,i){let r=To(t,e,n,i);if(L.isNode(r)||L.isPair(r))return jo(t,i,r),et(t,r,n,i);if(typeof r!="symbol"){if(L.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=et(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===J)return J;o===ce&&(e.items.splice(s,1),s-=1)}}}else if(L.isPair(e)){i=Object.freeze(i.concat(e));let s=et("key",e.key,n,i);if(s===J)return J;s===ce&&(e.key=null);let o=et("value",e.value,n,i);if(o===J)return J;o===ce&&(e.value=null)}}return r}async function En(t,e){let n=No(e);L.isDocument(t)?await tt(null,t.contents,n,Object.freeze([t]))===ce&&(t.contents=null):await tt(null,t,n,Object.freeze([]))}En.BREAK=J;En.SKIP=Ao;En.REMOVE=ce;async function tt(t,e,n,i){let r=await To(t,e,n,i);if(L.isNode(r)||L.isPair(r))return jo(t,i,r),tt(t,r,n,i);if(typeof r!="symbol"){if(L.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await tt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===J)return J;o===ce&&(e.items.splice(s,1),s-=1)}}}else if(L.isPair(e)){i=Object.freeze(i.concat(e));let s=await tt("key",e.key,n,i);if(s===J)return J;s===ce&&(e.key=null);let o=await tt("value",e.value,n,i);if(o===J)return J;o===ce&&(e.value=null)}}return r}function No(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 To(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(L.isMap(e))return n.Map?.(t,e,i);if(L.isSeq(e))return n.Seq?.(t,e,i);if(L.isPair(e))return n.Pair?.(t,e,i);if(L.isScalar(e))return n.Scalar?.(t,e,i);if(L.isAlias(e))return n.Alias?.(t,e,i)}function jo(t,e,n){let i=e[e.length-1];if(L.isCollection(i))i.items[t]=n;else if(L.isPair(i))t==="key"?i.key=n:i.value=n;else if(L.isDocument(i))i.contents=n;else{let r=L.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}cr.visit=Cn;cr.visitAsync=En});var lr=v(qo=>{"use strict";var Io=_(),nf=kt(),rf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sf=t=>t.replace(/[!,[\]{}]/g,e=>rf[e]),St=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+sf(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&&Io.isNode(e.contents)){let s={};nf.visit(e.contents,(o,a)=>{Io.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
- `)}};St.defaultYaml={explicit:!1,version:"1.2"};St.defaultTags={"!!":"tag:yaml.org,2002:"};qo.Directives=St});var xn=v(Ct=>{"use strict";var $o=_(),of=kt();function af(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 Lo(t){let e=new Set;return of.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Do(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function cf(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=Lo(t));let o=Do(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&($o.isScalar(o.node)||$o.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}}Ct.anchorIsValid=af;Ct.anchorNames=Lo;Ct.createNodeAnchors=cf;Ct.findNewAnchor=Do});var ur=v(Fo=>{"use strict";function Et(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=Et(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=Et(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=Et(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=Et(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}Fo.applyReviver=Et});var Ce=v(Wo=>{"use strict";var lf=_();function Mo(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Mo(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!lf.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}Wo.toJS=Mo});var _n=v(Ko=>{"use strict";var uf=ur(),Bo=_(),ff=Ce(),fr=class{constructor(e){Object.defineProperty(this,Bo.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(!Bo.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=ff.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?uf.applyReviver(s,{"":a},"",a):a}};Ko.NodeBase=fr});var xt=v(Yo=>{"use strict";var df=xn(),pf=kt(),nt=_(),mf=_n(),hf=Ce(),dr=class extends mf.NodeBase{constructor(e){super(nt.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=[],pf.visit(e,{Node:(s,o)=>{(nt.isAlias(o)||nt.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||(hf.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=Pn(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(df.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 Pn(t,e,n){if(nt.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(nt.isCollection(e)){let i=0;for(let r of e.items){let s=Pn(t,r,n);s>i&&(i=s)}return i}else if(nt.isPair(e)){let i=Pn(t,e.key,n),r=Pn(t,e.value,n);return Math.max(i,r)}return 1}Yo.Alias=dr});var I=v(pr=>{"use strict";var gf=_(),wf=_n(),yf=Ce(),vf=t=>!t||typeof t!="function"&&typeof t!="object",Ee=class extends wf.NodeBase{constructor(e){super(gf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:yf.toJS(this.value,e,n)}toString(){return String(this.value)}};Ee.BLOCK_FOLDED="BLOCK_FOLDED";Ee.BLOCK_LITERAL="BLOCK_LITERAL";Ee.PLAIN="PLAIN";Ee.QUOTE_DOUBLE="QUOTE_DOUBLE";Ee.QUOTE_SINGLE="QUOTE_SINGLE";pr.Scalar=Ee;pr.isScalarValue=vf});var _t=v(Jo=>{"use strict";var bf=xt(),Ye=_(),Uo=I(),kf="tag:yaml.org,2002:";function Sf(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 Cf(t,e,n){if(Ye.isDocument(t)&&(t=t.contents),Ye.isNode(t))return t;if(Ye.isPair(t)){let u=n.schema[Ye.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(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 bf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=kf+e.slice(2));let l=Sf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Uo.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Ye.MAP]:Symbol.iterator in Object(t)?o[Ye.SEQ]:o[Ye.MAP]}s&&(s(l),delete n.onTagObj);let f=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new Uo.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Jo.createNode=Cf});var On=v(Rn=>{"use strict";var Ef=_t(),le=_(),xf=_n();function mr(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 Ef.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 Vo=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,hr=class extends xf.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(Vo(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,mr(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,mr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Rn.Collection=hr;Rn.collectionFromPath=mr;Rn.isEmptyPath=Vo});var Pt=v(An=>{"use strict";var _f=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function gr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pf=(t,e,n)=>t.endsWith(`
4
+ var Wu=Object.create;var sr=Object.defineProperty;var Bu=Object.getOwnPropertyDescriptor;var Ku=Object.getOwnPropertyNames;var Yu=Object.getPrototypeOf,Uu=Object.prototype.hasOwnProperty;var kn=(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 K=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Ju=(t,e)=>{for(var n in e)sr(t,n,{get:e[n],enumerable:!0})},Vu=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ku(e))!Uu.call(t,r)&&r!==n&&sr(t,r,{get:()=>e[r],enumerable:!(i=Bu(e,r))||i.enumerable});return t};var nt=(t,e,n)=>(n=t!=null?Wu(Yu(t)):{},Vu(e||!t||!t.__esModule?sr(n,"default",{value:t,enumerable:!0}):n,t));var _=v(M=>{"use strict";var or=Symbol.for("yaml.alias"),Po=Symbol.for("yaml.document"),Sn=Symbol.for("yaml.map"),Ro=Symbol.for("yaml.pair"),ar=Symbol.for("yaml.scalar"),Cn=Symbol.for("yaml.seq"),he=Symbol.for("yaml.node.type"),Qu=t=>!!t&&typeof t=="object"&&t[he]===or,Xu=t=>!!t&&typeof t=="object"&&t[he]===Po,Zu=t=>!!t&&typeof t=="object"&&t[he]===Sn,ef=t=>!!t&&typeof t=="object"&&t[he]===Ro,Oo=t=>!!t&&typeof t=="object"&&t[he]===ar,tf=t=>!!t&&typeof t=="object"&&t[he]===Cn;function Ao(t){if(t&&typeof t=="object")switch(t[he]){case Sn:case Cn:return!0}return!1}function nf(t){if(t&&typeof t=="object")switch(t[he]){case or:case Sn:case ar:case Cn:return!0}return!1}var rf=t=>(Oo(t)||Ao(t))&&!!t.anchor;M.ALIAS=or;M.DOC=Po;M.MAP=Sn;M.NODE_TYPE=he;M.PAIR=Ro;M.SCALAR=ar;M.SEQ=Cn;M.hasAnchor=rf;M.isAlias=Qu;M.isCollection=Ao;M.isDocument=Xu;M.isMap=Zu;M.isNode=nf;M.isPair=ef;M.isScalar=Oo;M.isSeq=tf});var St=v(cr=>{"use strict";var L=_(),J=Symbol("break visit"),No=Symbol("skip children"),le=Symbol("remove node");function En(t,e){let n=To(e);L.isDocument(t)?it(null,t.contents,n,Object.freeze([t]))===le&&(t.contents=null):it(null,t,n,Object.freeze([]))}En.BREAK=J;En.SKIP=No;En.REMOVE=le;function it(t,e,n,i){let r=jo(t,e,n,i);if(L.isNode(r)||L.isPair(r))return Io(t,i,r),it(t,r,n,i);if(typeof r!="symbol"){if(L.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=it(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===J)return J;o===le&&(e.items.splice(s,1),s-=1)}}}else if(L.isPair(e)){i=Object.freeze(i.concat(e));let s=it("key",e.key,n,i);if(s===J)return J;s===le&&(e.key=null);let o=it("value",e.value,n,i);if(o===J)return J;o===le&&(e.value=null)}}return r}async function xn(t,e){let n=To(e);L.isDocument(t)?await rt(null,t.contents,n,Object.freeze([t]))===le&&(t.contents=null):await rt(null,t,n,Object.freeze([]))}xn.BREAK=J;xn.SKIP=No;xn.REMOVE=le;async function rt(t,e,n,i){let r=await jo(t,e,n,i);if(L.isNode(r)||L.isPair(r))return Io(t,i,r),rt(t,r,n,i);if(typeof r!="symbol"){if(L.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await rt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===J)return J;o===le&&(e.items.splice(s,1),s-=1)}}}else if(L.isPair(e)){i=Object.freeze(i.concat(e));let s=await rt("key",e.key,n,i);if(s===J)return J;s===le&&(e.key=null);let o=await rt("value",e.value,n,i);if(o===J)return J;o===le&&(e.value=null)}}return r}function To(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 jo(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(L.isMap(e))return n.Map?.(t,e,i);if(L.isSeq(e))return n.Seq?.(t,e,i);if(L.isPair(e))return n.Pair?.(t,e,i);if(L.isScalar(e))return n.Scalar?.(t,e,i);if(L.isAlias(e))return n.Alias?.(t,e,i)}function Io(t,e,n){let i=e[e.length-1];if(L.isCollection(i))i.items[t]=n;else if(L.isPair(i))t==="key"?i.key=n:i.value=n;else if(L.isDocument(i))i.contents=n;else{let r=L.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}cr.visit=En;cr.visitAsync=xn});var lr=v($o=>{"use strict";var qo=_(),sf=St(),of={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},af=t=>t.replace(/[!,[\]{}]/g,e=>of[e]),Ct=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+af(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&&qo.isNode(e.contents)){let s={};sf.visit(e.contents,(o,a)=>{qo.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
+ `)}};Ct.defaultYaml={explicit:!1,version:"1.2"};Ct.defaultTags={"!!":"tag:yaml.org,2002:"};$o.Directives=Ct});var _n=v(Et=>{"use strict";var Lo=_(),cf=St();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 Do(t){let e=new Set;return cf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Fo(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function uf(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=Do(t));let o=Fo(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(Lo.isScalar(o.node)||Lo.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}}Et.anchorIsValid=lf;Et.anchorNames=Do;Et.createNodeAnchors=uf;Et.findNewAnchor=Fo});var ur=v(Mo=>{"use strict";function xt(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=xt(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=xt(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=xt(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=xt(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}Mo.applyReviver=xt});var Ee=v(Bo=>{"use strict";var ff=_();function Wo(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Wo(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!ff.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}Bo.toJS=Wo});var Pn=v(Yo=>{"use strict";var df=ur(),Ko=_(),pf=Ee(),fr=class{constructor(e){Object.defineProperty(this,Ko.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(!Ko.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=pf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?df.applyReviver(s,{"":a},"",a):a}};Yo.NodeBase=fr});var _t=v(Uo=>{"use strict";var mf=_n(),hf=St(),st=_(),gf=Pn(),wf=Ee(),dr=class extends gf.NodeBase{constructor(e){super(st.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=[],hf.visit(e,{Node:(s,o)=>{(st.isAlias(o)||st.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||(wf.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=Rn(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(mf.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 Rn(t,e,n){if(st.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(st.isCollection(e)){let i=0;for(let r of e.items){let s=Rn(t,r,n);s>i&&(i=s)}return i}else if(st.isPair(e)){let i=Rn(t,e.key,n),r=Rn(t,e.value,n);return Math.max(i,r)}return 1}Uo.Alias=dr});var I=v(pr=>{"use strict";var yf=_(),vf=Pn(),bf=Ee(),kf=t=>!t||typeof t!="function"&&typeof t!="object",xe=class extends vf.NodeBase{constructor(e){super(yf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:bf.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";pr.Scalar=xe;pr.isScalarValue=kf});var Pt=v(Vo=>{"use strict";var Sf=_t(),Ye=_(),Jo=I(),Cf="tag:yaml.org,2002:";function Ef(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 xf(t,e,n){if(Ye.isDocument(t)&&(t=t.contents),Ye.isNode(t))return t;if(Ye.isPair(t)){let u=n.schema[Ye.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(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 Sf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Cf+e.slice(2));let l=Ef(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Jo.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Ye.MAP]:Symbol.iterator in Object(t)?o[Ye.SEQ]:o[Ye.MAP]}s&&(s(l),delete n.onTagObj);let f=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new Jo.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Vo.createNode=xf});var An=v(On=>{"use strict";var _f=Pt(),ue=_(),Pf=Pn();function mr(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 _f.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 Ho=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,hr=class extends Pf.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=>ue.isNode(i)||ue.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Ho(e))this.add(n);else{let[i,...r]=e,s=this.get(i,!0);if(ue.isCollection(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,mr(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(ue.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&&ue.isScalar(s)?s.value:s:ue.isCollection(s)?s.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!ue.isPair(n))return!1;let i=n.value;return i==null||e&&ue.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 ue.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(ue.isCollection(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,mr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};On.Collection=hr;On.collectionFromPath=mr;On.isEmptyPath=Ho});var Rt=v(Nn=>{"use strict";var Rf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function gr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Of=(t,e,n)=>t.endsWith(`
6
6
  `)?gr(n,e):n.includes(`
7
7
  `)?`
8
- `+gr(n,e):(t.endsWith(" ")?"":" ")+n;An.indentComment=gr;An.lineComment=Pf;An.stringifyComment=_f});var zo=v(Rt=>{"use strict";var Rf="flow",wr="block",Nn="quoted";function Of(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=[],f={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,s)?l.push(0):u=r-i);let d,h,g=!1,p=-1,m=-1,w=-1;n===wr&&(p=Ho(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(n===Nn&&S==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(S===`
9
- `)n===wr&&(p=Ho(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
8
+ `+gr(n,e):(t.endsWith(" ")?"":" ")+n;Nn.indentComment=gr;Nn.lineComment=Of;Nn.stringifyComment=Rf});var zo=v(Ot=>{"use strict";var Af="flow",wr="block",Tn="quoted";function Nf(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=[],f={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,s)?l.push(0):u=r-i);let d,h,g=!1,p=-1,m=-1,w=-1;n===wr&&(p=Go(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(n===Tn&&S==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(S===`
9
+ `)n===wr&&(p=Go(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
10
10
  `&&h!==" "){let k=t[p+1];k&&k!==" "&&k!==`
11
- `&&k!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===Nn){for(;h===" "||h===" ";)h=S,S=t[p+=1],g=!0;let k=p>w+1?p-2:m-1;if(f[k])return t;l.push(k),f[k]=!0,u=k+c,d=void 0}else g=!0}h=S}if(g&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let k=l[S],C=l[S+1]||t.length;k===0?y=`
12
- ${e}${t.slice(0,C)}`:(n===Nn&&f[k]&&(y+=`${t[k]}\\`),y+=`
13
- ${e}${t.slice(k+1,C)}`)}return y}function Ho(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}Rt.FOLD_BLOCK=wr;Rt.FOLD_FLOW=Rf;Rt.FOLD_QUOTED=Nn;Rt.foldFlowLines=Of});var At=v(Go=>{"use strict";var ie=I(),xe=zo(),jn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),In=t=>/^(%|---|\.\.\.)/m.test(t);function Af(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 Ot(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(In(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 f=n.substr(c+2,4);switch(f){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:f.substr(0,2)==="00"?o+="\\x"+f.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)+`
11
+ `&&k!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===Tn){for(;h===" "||h===" ";)h=S,S=t[p+=1],g=!0;let k=p>w+1?p-2:m-1;if(f[k])return t;l.push(k),f[k]=!0,u=k+c,d=void 0}else g=!0}h=S}if(g&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let k=l[S],C=l[S+1]||t.length;k===0?y=`
12
+ ${e}${t.slice(0,C)}`:(n===Tn&&f[k]&&(y+=`${t[k]}\\`),y+=`
13
+ ${e}${t.slice(k+1,C)}`)}return y}function Go(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}Ot.FOLD_BLOCK=wr;Ot.FOLD_FLOW=Af;Ot.FOLD_QUOTED=Tn;Ot.foldFlowLines=Nf});var Nt=v(Qo=>{"use strict";var re=I(),_e=zo(),In=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),qn=t=>/^(%|---|\.\.\.)/m.test(t);function Tf(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 At(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(qn(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 f=n.substr(c+2,4);switch(f){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:f.substr(0,2)==="00"?o+="\\x"+f.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
16
 
17
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:xe.foldFlowLines(o,s,xe.FOLD_QUOTED,jn(e,!1))}function yr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return Ot(t,e);let n=e.indent||(In(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?i:xe.foldFlowLines(i,n,xe.FOLD_FLOW,jn(e,!1))}function it(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=Ot;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=yr:s&&!r?i=Ot:i=n?yr:Ot}return i(t,e)}var vr;try{vr=new RegExp(`(^|(?<!
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:_e.foldFlowLines(o,s,_e.FOLD_QUOTED,In(e,!1))}function yr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return At(t,e);let n=e.indent||(qn(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?i:_e.foldFlowLines(i,n,_e.FOLD_FLOW,In(e,!1))}function ot(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=At;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=yr:s&&!r?i=At:i=n?yr:At}return i(t,e)}var vr;try{vr=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{vr=/\n+(?!\n|$)/g}function Tn({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 it(n,i);let l=i.indent||(i.forceBlockIndent||In(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===ie.Scalar.BLOCK_FOLDED?!1:e===ie.Scalar.BLOCK_LITERAL?!0:!Af(n,c,l.length);if(!n)return f?`|
23
+ |$)`,"g")}catch{vr=/\n+(?!\n|$)/g}function jn({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 ot(n,i);let l=i.indent||(i.forceBlockIndent||qn(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===re.Scalar.BLOCK_FOLDED?!1:e===re.Scalar.BLOCK_LITERAL?!0:!Tf(n,c,l.length);if(!n)return f?`|
24
24
  `:`>
25
25
  `;let u,d;for(d=n.length;d>0;--d){let C=n[d-1];if(C!==`
26
26
  `&&C!==" "&&C!==" ")break}let h=n.substring(d),g=h.indexOf(`
27
27
  `);g===-1?u="-":n===h||g!==h.length-1?(u="+",s&&s()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
28
28
  `&&(h=h.slice(0,-1)),h=h.replace(vr,`$&${l}`));let p=!1,m,w=-1;for(m=0;m<n.length;++m){let C=n[m];if(C===" ")p=!0;else if(C===`
29
29
  `)w=m;else break}let y=n.substring(0,w<m?w+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let k=(p?l?"2":"1":"")+u;if(t&&(k+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!f){let C=n.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,R=jn(i,!0);o!=="folded"&&e!==ie.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{E=!0});let b=xe.foldFlowLines(`${y}${C}${h}`,l,xe.FOLD_BLOCK,R);if(!E)return`>${k}
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,R=In(i,!0);o!=="folded"&&e!==re.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{E=!0});let b=_e.foldFlowLines(`${y}${C}${h}`,l,_e.FOLD_BLOCK,R);if(!E)return`>${k}
31
31
  ${l}${b}`}return n=n.replace(/\n+/g,`$&${l}`),`|${k}
32
- ${l}${y}${n}${h}`}function Nf(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&s.includes(`
33
- `)||f&&/[[\]{},]/.test(s))return it(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(`
34
- `)?it(s,e):Tn(t,e,n,i);if(!a&&!f&&r!==ie.Scalar.PLAIN&&s.includes(`
35
- `))return Tn(t,e,n,i);if(In(s)){if(c==="")return e.forceBlockIndent=!0,Tn(t,e,n,i);if(a&&c===l)return it(s,e)}let u=s.replace(/\n+/g,`$&
36
- ${c}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return it(s,e)}return a?u:xe.foldFlowLines(u,c,xe.FOLD_FLOW,jn(e,!1))}function Tf(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!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ie.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return r||s?it(o.value,e):Tn(o,e,n,i);case ie.Scalar.QUOTE_DOUBLE:return Ot(o.value,e);case ie.Scalar.QUOTE_SINGLE:return yr(o.value,e);case ie.Scalar.PLAIN:return Nf(o,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=r&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Go.stringifyString=Tf});var Nt=v(br=>{"use strict";var jf=xn(),_e=_(),If=Pt(),qf=At();function $f(t,e){let n=Object.assign({blockQuote:!0,commentString:If.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 Lf(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(_e.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 Df(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(_e.isScalar(t)||_e.isCollection(t))&&t.anchor;s&&jf.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 Ff(t,e,n,i){if(_e.isPair(t))return t.toString(e,n,i);if(_e.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=_e.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Lf(e.doc.schema.tags,s));let o=Df(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):_e.isScalar(s)?qf.stringifyString(s,e,n,i):s.toString(e,n,i);return o?_e.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
- ${e.indent}${a}`:a}br.createStringifyContext=$f;br.stringify=Ff});var ea=v(Zo=>{"use strict";var ge=_(),Qo=I(),Xo=Nt(),Tt=Pt();function Mf({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=ge.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===Qo.Scalar.BLOCK_FOLDED||t.type===Qo.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!s),indent:a+c});let g=!1,p=!1,m=Xo.stringify(t,n,()=>g=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||e==null)return g&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(s&&!u||e==null&&h)return m=`? ${m}`,d&&!g?m+=Tt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;g&&(d=null),h?(d&&(m+=Tt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
- ${a}:`):(m=`${m}:`,d&&(m+=Tt.lineComment(m,n.indent,l(d))));let w,y,S;ge.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(w=!1,y=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!d&&ge.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let k=!1,C=Xo.stringify(e,n,()=>k=!0,()=>p=!0),E=" ";if(d||w||y){if(E=w?`
32
+ ${l}${y}${n}${h}`}function jf(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&s.includes(`
33
+ `)||f&&/[[\]{},]/.test(s))return ot(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(`
34
+ `)?ot(s,e):jn(t,e,n,i);if(!a&&!f&&r!==re.Scalar.PLAIN&&s.includes(`
35
+ `))return jn(t,e,n,i);if(qn(s)){if(c==="")return e.forceBlockIndent=!0,jn(t,e,n,i);if(a&&c===l)return ot(s,e)}let u=s.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return ot(s,e)}return a?u:_e.foldFlowLines(u,c,_e.FOLD_FLOW,In(e,!1))}function If(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!==re.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=re.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case re.Scalar.BLOCK_FOLDED:case re.Scalar.BLOCK_LITERAL:return r||s?ot(o.value,e):jn(o,e,n,i);case re.Scalar.QUOTE_DOUBLE:return At(o.value,e);case re.Scalar.QUOTE_SINGLE:return yr(o.value,e);case re.Scalar.PLAIN:return jf(o,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=r&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Qo.stringifyString=If});var Tt=v(br=>{"use strict";var qf=_n(),Pe=_(),$f=Rt(),Lf=Nt();function Df(t,e){let n=Object.assign({blockQuote:!0,commentString:$f.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 Ff(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(Pe.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 Mf(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(Pe.isScalar(t)||Pe.isCollection(t))&&t.anchor;s&&qf.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 Wf(t,e,n,i){if(Pe.isPair(t))return t.toString(e,n,i);if(Pe.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=Pe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Ff(e.doc.schema.tags,s));let o=Mf(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):Pe.isScalar(s)?Lf.stringifyString(s,e,n,i):s.toString(e,n,i);return o?Pe.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
+ ${e.indent}${a}`:a}br.createStringifyContext=Df;br.stringify=Wf});var ta=v(ea=>{"use strict";var ge=_(),Xo=I(),Zo=Tt(),jt=Rt();function Bf({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=ge.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===Xo.Scalar.BLOCK_FOLDED||t.type===Xo.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!s),indent:a+c});let g=!1,p=!1,m=Zo.stringify(t,n,()=>g=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||e==null)return g&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(s&&!u||e==null&&h)return m=`? ${m}`,d&&!g?m+=jt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;g&&(d=null),h?(d&&(m+=jt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
+ ${a}:`):(m=`${m}:`,d&&(m+=jt.lineComment(m,n.indent,l(d))));let w,y,S;ge.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(w=!1,y=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!d&&ge.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let k=!1,C=Zo.stringify(e,n,()=>k=!0,()=>p=!0),E=" ";if(d||w||y){if(E=w?`
39
39
  `:"",y){let R=l(y);E+=`
40
- ${Tt.indentComment(R,n.indent)}`}C===""&&!n.inFlow?E===`
40
+ ${jt.indentComment(R,n.indent)}`}C===""&&!n.inFlow?E===`
41
41
  `&&S&&(E=`
42
42
 
43
43
  `):E+=`
44
44
  ${n.indent}`}else if(!h&&ge.isCollection(e)){let R=C[0],b=C.indexOf(`
45
- `),P=b!==-1,te=n.inFlow??e.flow??e.items.length===0;if(P||!te){let G=!1;if(P&&(R==="&"||R==="!")){let A=C.indexOf(" ");R==="&"&&A!==-1&&A<b&&C[A+1]==="!"&&(A=C.indexOf(" ",A+1)),(A===-1||b<A)&&(G=!0)}G||(E=`
45
+ `),P=b!==-1,ne=n.inFlow??e.flow??e.items.length===0;if(P||!ne){let z=!1;if(P&&(R==="&"||R==="!")){let A=C.indexOf(" ");R==="&"&&A!==-1&&A<b&&C[A+1]==="!"&&(A=C.indexOf(" ",A+1)),(A===-1||b<A)&&(z=!0)}z||(E=`
46
46
  ${n.indent}`)}}else(C===""||C[0]===`
47
- `)&&(E="");return m+=E+C,n.inFlow?k&&i&&i():S&&!k?m+=Tt.lineComment(m,n.indent,l(S)):p&&r&&r(),m}Zo.stringifyPair=Mf});var Sr=v(kr=>{"use strict";var ta=bn("process");function Wf(t,...e){t==="debug"&&console.log(...e)}function Bf(t,e){(t==="debug"||t==="warn")&&(typeof ta.emitWarning=="function"?ta.emitWarning(e):console.warn(e))}kr.debug=Wf;kr.warn=Bf});var Fn=v(Dn=>{"use strict";var Ln=_(),na=I(),qn="<<",$n={identify:t=>t===qn||typeof t=="symbol"&&t.description===qn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new na.Scalar(Symbol(qn)),{addToJSMap:ia}),stringify:()=>qn},Kf=(t,e)=>($n.identify(e)||Ln.isScalar(e)&&(!e.type||e.type===na.Scalar.PLAIN)&&$n.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===$n.tag&&n.default);function ia(t,e,n){let i=ra(t,n);if(Ln.isSeq(i))for(let r of i.items)Cr(t,e,r);else if(Array.isArray(i))for(let r of i)Cr(t,e,r);else Cr(t,e,i)}function Cr(t,e,n){let i=ra(t,n);if(!Ln.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 ra(t,e){return t&&Ln.isAlias(e)?e.resolve(t.doc,t):e}Dn.addMergeToJSMap=ia;Dn.isMergeKey=Kf;Dn.merge=$n});var xr=v(aa=>{"use strict";var Yf=Sr(),sa=Fn(),Uf=Nt(),oa=_(),Er=Ce();function Jf(t,e,{key:n,value:i}){if(oa.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(sa.isMergeKey(t,n))sa.addMergeToJSMap(t,e,i);else{let r=Er.toJS(n,"",t);if(e instanceof Map)e.set(r,Er.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=Vf(n,r,t),o=Er.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 Vf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(oa.isNode(t)&&n?.doc){let i=Uf.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)+'..."'),Yf.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)}aa.addPairToJSMap=Jf});var Pe=v(_r=>{"use strict";var ca=_t(),Hf=ea(),zf=xr(),Mn=_();function Gf(t,e,n){let i=ca.createNode(t,void 0,n),r=ca.createNode(e,void 0,n);return new Wn(i,r)}var Wn=class t{constructor(e,n=null){Object.defineProperty(this,Mn.NODE_TYPE,{value:Mn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Mn.isNode(n)&&(n=n.clone(e)),Mn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return zf.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?Hf.stringifyPair(this,e,n,i):JSON.stringify(this)}};_r.Pair=Wn;_r.createPair=Gf});var Pr=v(ua=>{"use strict";var Ue=_(),la=Nt(),Bn=Pt();function Qf(t,e,n){return(e.inFlow??t.flow?Zf:Xf)(t,e,n)}function Xf({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:s,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(Ue.isNode(p))!u&&p.spaceBefore&&d.push(""),Kn(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Ue.isPair(p)){let y=Ue.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),Kn(n,d,y.commentBefore,u))}u=!1;let w=la.stringify(p,f,()=>m=null,()=>u=!0);m&&(w+=Bn.lineComment(w,s,l(m))),u&&m&&(u=!1),d.push(i+w)}let h;if(d.length===0)h=r.start+r.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
47
+ `)&&(E="");return m+=E+C,n.inFlow?k&&i&&i():S&&!k?m+=jt.lineComment(m,n.indent,l(S)):p&&r&&r(),m}ea.stringifyPair=Bf});var Sr=v(kr=>{"use strict";var na=kn("process");function Kf(t,...e){t==="debug"&&console.log(...e)}function Yf(t,e){(t==="debug"||t==="warn")&&(typeof na.emitWarning=="function"?na.emitWarning(e):console.warn(e))}kr.debug=Kf;kr.warn=Yf});var Mn=v(Fn=>{"use strict";var Dn=_(),ia=I(),$n="<<",Ln={identify:t=>t===$n||typeof t=="symbol"&&t.description===$n,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ia.Scalar(Symbol($n)),{addToJSMap:ra}),stringify:()=>$n},Uf=(t,e)=>(Ln.identify(e)||Dn.isScalar(e)&&(!e.type||e.type===ia.Scalar.PLAIN)&&Ln.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Ln.tag&&n.default);function ra(t,e,n){let i=sa(t,n);if(Dn.isSeq(i))for(let r of i.items)Cr(t,e,r);else if(Array.isArray(i))for(let r of i)Cr(t,e,r);else Cr(t,e,i)}function Cr(t,e,n){let i=sa(t,n);if(!Dn.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 sa(t,e){return t&&Dn.isAlias(e)?e.resolve(t.doc,t):e}Fn.addMergeToJSMap=ra;Fn.isMergeKey=Uf;Fn.merge=Ln});var xr=v(ca=>{"use strict";var Jf=Sr(),oa=Mn(),Vf=Tt(),aa=_(),Er=Ee();function Hf(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=Er.toJS(n,"",t);if(e instanceof Map)e.set(r,Er.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=Gf(n,r,t),o=Er.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 Gf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(aa.isNode(t)&&n?.doc){let i=Vf.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)+'..."'),Jf.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)}ca.addPairToJSMap=Hf});var Re=v(_r=>{"use strict";var la=Pt(),zf=ta(),Qf=xr(),Wn=_();function Xf(t,e,n){let i=la.createNode(t,void 0,n),r=la.createNode(e,void 0,n);return new Bn(i,r)}var Bn=class t{constructor(e,n=null){Object.defineProperty(this,Wn.NODE_TYPE,{value:Wn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Wn.isNode(n)&&(n=n.clone(e)),Wn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return Qf.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?zf.stringifyPair(this,e,n,i):JSON.stringify(this)}};_r.Pair=Bn;_r.createPair=Xf});var Pr=v(fa=>{"use strict";var Ue=_(),ua=Tt(),Kn=Rt();function Zf(t,e,n){return(e.inFlow??t.flow?td:ed)(t,e,n)}function ed({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:s,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(Ue.isNode(p))!u&&p.spaceBefore&&d.push(""),Yn(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Ue.isPair(p)){let y=Ue.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),Yn(n,d,y.commentBefore,u))}u=!1;let w=ua.stringify(p,f,()=>m=null,()=>u=!0);m&&(w+=Kn.lineComment(w,s,l(m))),u&&m&&(u=!1),d.push(i+w)}let h;if(d.length===0)h=r.start+r.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
48
48
  ${c}${p}`:`
49
49
  `}}return t?(h+=`
50
- `+Bn.indentComment(l(t),c),a&&a()):u&&o&&o(),h}function Zf({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,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],m=null;if(Ue.isNode(p))p.spaceBefore&&u.push(""),Kn(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ue.isPair(p)){let y=Ue.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),Kn(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=Ue.isNode(p.value)?p.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=la.stringify(p,c,()=>m=null);l||(l=u.length>f||w.includes(`
51
- `)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(w.length+2)>e.options.lineWidth)),l&&(w+=",")),m&&(w+=Bn.lineComment(w,i,a(m))),u.push(w),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let g=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
50
+ `+Kn.indentComment(l(t),c),a&&a()):u&&o&&o(),h}function td({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,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],m=null;if(Ue.isNode(p))p.spaceBefore&&u.push(""),Yn(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ue.isPair(p)){let y=Ue.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),Yn(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=Ue.isNode(p.value)?p.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=ua.stringify(p,c,()=>m=null);l||(l=u.length>f||w.includes(`
51
+ `)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(w.length+2)>e.options.lineWidth)),l&&(w+=",")),m&&(w+=Kn.lineComment(w,i,a(m))),u.push(w),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let g=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
52
52
  ${s}${r}${p}`:`
53
53
  `;return`${g}
54
- ${r}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function Kn({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=Bn.indentComment(e(i),t);n.push(s.trimStart())}}ua.stringifyCollection=Qf});var Oe=v(Or=>{"use strict";var ed=Pr(),td=xr(),nd=On(),Re=_(),Yn=Pe(),id=I();function jt(t,e){let n=Re.isScalar(e)?e.value:e;for(let i of t)if(Re.isPair(i)&&(i.key===e||i.key===n||Re.isScalar(i.key)&&i.key.value===n))return i}var Rr=class extends nd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Re.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(Yn.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;Re.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new Yn.Pair(e,e?.value):i=new Yn.Pair(e.key,e.value);let r=jt(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Re.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=jt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=jt(this.items,e)?.value;return(!n&&Re.isScalar(r)?r.value:r)??void 0}has(e){return!!jt(this.items,e)}set(e,n){this.add(new Yn.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)td.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Re.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})),ed.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Or.YAMLMap=Rr;Or.findPair=jt});var rt=v(da=>{"use strict";var rd=_(),fa=Oe(),sd={collection:"map",default:!0,nodeClass:fa.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return rd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>fa.YAMLMap.from(t,e,n)};da.map=sd});var Ae=v(pa=>{"use strict";var od=_t(),ad=Pr(),cd=On(),Jn=_(),ld=I(),ud=Ce(),Ar=class extends cd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Jn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Un(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=Un(e);if(typeof i!="number")return;let r=this.items[i];return!n&&Jn.isScalar(r)?r.value:r}has(e){let n=Un(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=Un(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];Jn.isScalar(r)&&ld.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(ud.toJS(s,String(r++),n));return i}toString(e,n,i){return e?ad.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(od.createNode(a,void 0,i))}}return s}};function Un(t){let e=Jn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}pa.YAMLSeq=Ar});var st=v(ha=>{"use strict";var fd=_(),ma=Ae(),dd={collection:"seq",default:!0,nodeClass:ma.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return fd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>ma.YAMLSeq.from(t,e,n)};ha.seq=dd});var It=v(ga=>{"use strict";var pd=At(),md={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),pd.stringifyString(t,e,n,i)}};ga.string=md});var Vn=v(va=>{"use strict";var wa=I(),ya={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"&&ya.test.test(t)?t:e.options.nullStr};va.nullTag=ya});var Nr=v(ka=>{"use strict";var hd=I(),ba={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new hd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ba.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};ka.boolTag=ba});var ot=v(Sa=>{"use strict";function gd({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}Sa.stringifyNumber=gd});var jr=v(Hn=>{"use strict";var wd=I(),Tr=ot(),yd={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:Tr.stringifyNumber},vd={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():Tr.stringifyNumber(t)}},bd={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 wd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Tr.stringifyNumber};Hn.float=bd;Hn.floatExp=vd;Hn.floatNaN=yd});var qr=v(Gn=>{"use strict";var Ca=ot(),zn=t=>typeof t=="bigint"||Number.isInteger(t),Ir=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function Ea(t,e,n){let{value:i}=t;return zn(i)&&i>=0?n+i.toString(e):Ca.stringifyNumber(t)}var kd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Ir(t,2,8,n),stringify:t=>Ea(t,8,"0o")},Sd={identify:zn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Ir(t,0,10,n),stringify:Ca.stringifyNumber},Cd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Ir(t,2,16,n),stringify:t=>Ea(t,16,"0x")};Gn.int=Sd;Gn.intHex=Cd;Gn.intOct=kd});var _a=v(xa=>{"use strict";var Ed=rt(),xd=Vn(),_d=st(),Pd=It(),Rd=Nr(),$r=jr(),Lr=qr(),Od=[Ed.map,_d.seq,Pd.string,xd.nullTag,Rd.boolTag,Lr.intOct,Lr.int,Lr.intHex,$r.floatNaN,$r.floatExp,$r.float];xa.schema=Od});var Oa=v(Ra=>{"use strict";var Ad=I(),Nd=rt(),Td=st();function Pa(t){return typeof t=="bigint"||Number.isInteger(t)}var Qn=({value:t})=>JSON.stringify(t),jd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Qn},{identify:t=>t==null,createNode:()=>new Ad.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Qn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Qn},{identify:Pa,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})=>Pa(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:Qn}],Id={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},qd=[Nd.map,Td.seq].concat(jd,Id);Ra.schema=qd});var Fr=v(Aa=>{"use strict";var qt=bn("buffer"),Dr=I(),$d=At(),Ld={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof qt.Buffer=="function")return qt.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 qt.Buffer=="function")a=o instanceof qt.Buffer?o.toString("base64"):qt.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=Dr.Scalar.BLOCK_LITERAL),e!==Dr.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=a.substr(d,c);a=f.join(e===Dr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return $d.stringifyString({comment:t,type:e,value:a},i,r,s)}};Aa.binary=Ld});var ei=v(Zn=>{"use strict";var Xn=_(),Mr=Pe(),Dd=I(),Fd=Ae();function Na(t,e){if(Xn.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!Xn.isPair(i)){if(Xn.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new Mr.Pair(new Dd.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
54
+ ${r}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function Yn({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=Kn.indentComment(e(i),t);n.push(s.trimStart())}}fa.stringifyCollection=Zf});var Ae=v(Or=>{"use strict";var nd=Pr(),id=xr(),rd=An(),Oe=_(),Un=Re(),sd=I();function It(t,e){let n=Oe.isScalar(e)?e.value:e;for(let i of t)if(Oe.isPair(i)&&(i.key===e||i.key===n||Oe.isScalar(i.key)&&i.key.value===n))return i}var Rr=class extends rd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Oe.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(Un.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;Oe.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new Un.Pair(e,e?.value):i=new Un.Pair(e.key,e.value);let r=It(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Oe.isScalar(r.value)&&sd.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=It(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=It(this.items,e)?.value;return(!n&&Oe.isScalar(r)?r.value:r)??void 0}has(e){return!!It(this.items,e)}set(e,n){this.add(new Un.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)id.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Oe.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})),nd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Or.YAMLMap=Rr;Or.findPair=It});var at=v(pa=>{"use strict";var od=_(),da=Ae(),ad={collection:"map",default:!0,nodeClass:da.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return od.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>da.YAMLMap.from(t,e,n)};pa.map=ad});var Ne=v(ma=>{"use strict";var cd=Pt(),ld=Pr(),ud=An(),Vn=_(),fd=I(),dd=Ee(),Ar=class extends ud.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Vn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Jn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=Jn(e);if(typeof i!="number")return;let r=this.items[i];return!n&&Vn.isScalar(r)?r.value:r}has(e){let n=Jn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=Jn(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];Vn.isScalar(r)&&fd.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(dd.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(cd.createNode(a,void 0,i))}}return s}};function Jn(t){let e=Vn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ma.YAMLSeq=Ar});var ct=v(ga=>{"use strict";var pd=_(),ha=Ne(),md={collection:"seq",default:!0,nodeClass:ha.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return pd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>ha.YAMLSeq.from(t,e,n)};ga.seq=md});var qt=v(wa=>{"use strict";var hd=Nt(),gd={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),hd.stringifyString(t,e,n,i)}};wa.string=gd});var Hn=v(ba=>{"use strict";var ya=I(),va={identify:t=>t==null,createNode:()=>new ya.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ya.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&va.test.test(t)?t:e.options.nullStr};ba.nullTag=va});var Nr=v(Sa=>{"use strict";var wd=I(),ka={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new wd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ka.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Sa.boolTag=ka});var lt=v(Ca=>{"use strict";function yd({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}Ca.stringifyNumber=yd});var jr=v(Gn=>{"use strict";var vd=I(),Tr=lt(),bd={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:Tr.stringifyNumber},kd={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():Tr.stringifyNumber(t)}},Sd={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 vd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Tr.stringifyNumber};Gn.float=Sd;Gn.floatExp=kd;Gn.floatNaN=bd});var qr=v(Qn=>{"use strict";var Ea=lt(),zn=t=>typeof t=="bigint"||Number.isInteger(t),Ir=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function xa(t,e,n){let{value:i}=t;return zn(i)&&i>=0?n+i.toString(e):Ea.stringifyNumber(t)}var Cd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Ir(t,2,8,n),stringify:t=>xa(t,8,"0o")},Ed={identify:zn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Ir(t,0,10,n),stringify:Ea.stringifyNumber},xd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Ir(t,2,16,n),stringify:t=>xa(t,16,"0x")};Qn.int=Ed;Qn.intHex=xd;Qn.intOct=Cd});var Pa=v(_a=>{"use strict";var _d=at(),Pd=Hn(),Rd=ct(),Od=qt(),Ad=Nr(),$r=jr(),Lr=qr(),Nd=[_d.map,Rd.seq,Od.string,Pd.nullTag,Ad.boolTag,Lr.intOct,Lr.int,Lr.intHex,$r.floatNaN,$r.floatExp,$r.float];_a.schema=Nd});var Aa=v(Oa=>{"use strict";var Td=I(),jd=at(),Id=ct();function Ra(t){return typeof t=="bigint"||Number.isInteger(t)}var Xn=({value:t})=>JSON.stringify(t),qd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xn},{identify:t=>t==null,createNode:()=>new Td.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Xn},{identify:Ra,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})=>Ra(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:Xn}],$d={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ld=[jd.map,Id.seq].concat(qd,$d);Oa.schema=Ld});var Fr=v(Na=>{"use strict";var $t=kn("buffer"),Dr=I(),Dd=Nt(),Fd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof $t.Buffer=="function")return $t.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 $t.Buffer=="function")a=o instanceof $t.Buffer?o.toString("base64"):$t.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=Dr.Scalar.BLOCK_LITERAL),e!==Dr.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=a.substr(d,c);a=f.join(e===Dr.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Dd.stringifyString({comment:t,type:e,value:a},i,r,s)}};Na.binary=Fd});var ti=v(ei=>{"use strict";var Zn=_(),Mr=Re(),Md=I(),Wd=Ne();function Ta(t,e){if(Zn.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!Zn.isPair(i)){if(Zn.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new Mr.Pair(new Md.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
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]=Xn.isPair(i)?i:new Mr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Ta(t,e,n){let{replacer:i}=n,r=new Fd.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(Mr.createPair(a,c,n))}return r}var Md={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Na,createNode:Ta};Zn.createPairs=Ta;Zn.pairs=Md;Zn.resolvePairs=Na});var Kr=v(Br=>{"use strict";var ja=_(),Wr=Ce(),$t=Oe(),Wd=Ae(),Ia=ei(),Je=class t extends Wd.YAMLSeq{constructor(){super(),this.add=$t.YAMLMap.prototype.add.bind(this),this.delete=$t.YAMLMap.prototype.delete.bind(this),this.get=$t.YAMLMap.prototype.get.bind(this),this.has=$t.YAMLMap.prototype.has.bind(this),this.set=$t.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(ja.isPair(r)?(s=Wr.toJS(r.key,"",n),o=Wr.toJS(r.value,s,n)):s=Wr.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=Ia.createPairs(e,n,i),s=new this;return s.items=r.items,s}};Je.tag="tag:yaml.org,2002:omap";var Bd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Je,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ia.resolvePairs(t,e),i=[];for(let{key:r}of n.items)ja.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Je,n)},createNode:(t,e,n)=>Je.from(t,e,n)};Br.YAMLOMap=Je;Br.omap=Bd});var Fa=v(Yr=>{"use strict";var qa=I();function $a({value:t,source:e},n){return e&&(t?La:Da).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var La={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 qa.Scalar(!0),stringify:$a},Da={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 qa.Scalar(!1),stringify:$a};Yr.falseTag=Da;Yr.trueTag=La});var Ma=v(ti=>{"use strict";var Kd=I(),Ur=ot(),Yd={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:Ur.stringifyNumber},Ud={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():Ur.stringifyNumber(t)}},Jd={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 Kd.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:Ur.stringifyNumber};ti.float=Jd;ti.floatExp=Ud;ti.floatNaN=Yd});var Ba=v(Dt=>{"use strict";var Wa=ot(),Lt=t=>typeof t=="bigint"||Number.isInteger(t);function ni(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 Jr(t,e,n){let{value:i}=t;if(Lt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return Wa.stringifyNumber(t)}var Vd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>ni(t,2,2,n),stringify:t=>Jr(t,2,"0b")},Hd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>ni(t,1,8,n),stringify:t=>Jr(t,8,"0")},zd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>ni(t,0,10,n),stringify:Wa.stringifyNumber},Gd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>ni(t,2,16,n),stringify:t=>Jr(t,16,"0x")};Dt.int=zd;Dt.intBin=Vd;Dt.intHex=Gd;Dt.intOct=Hd});var Hr=v(Vr=>{"use strict";var si=_(),ii=Pe(),ri=Oe(),Ve=class t extends ri.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;si.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new ii.Pair(e.key,null):n=new ii.Pair(e,null),ri.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=ri.findPair(this.items,e);return!n&&si.isPair(i)?si.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=ri.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new ii.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(ii.createPair(o,null,i));return s}};Ve.tag="tag:yaml.org,2002:set";var Qd={collection:"map",identify:t=>t instanceof Set,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Ve.from(t,e,n),resolve(t,e){if(si.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ve,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Vr.YAMLSet=Ve;Vr.set=Qd});var Gr=v(oi=>{"use strict";var Xd=ot();function zr(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 Ka(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Xd.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 Zd={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})=>zr(t,n),stringify:Ka},ep={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=>zr(t,!1),stringify:Ka},Ya={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(Ya.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),f=e[8];if(f&&f!=="Z"){let u=zr(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};oi.floatTime=ep;oi.intTime=Zd;oi.timestamp=Ya});var Va=v(Ja=>{"use strict";var tp=rt(),np=Vn(),ip=st(),rp=It(),sp=Fr(),Ua=Fa(),Qr=Ma(),ai=Ba(),op=Fn(),ap=Kr(),cp=ei(),lp=Hr(),Xr=Gr(),up=[tp.map,ip.seq,rp.string,np.nullTag,Ua.trueTag,Ua.falseTag,ai.intBin,ai.intOct,ai.int,ai.intHex,Qr.floatNaN,Qr.floatExp,Qr.float,sp.binary,op.merge,ap.omap,cp.pairs,lp.set,Xr.intTime,Xr.floatTime,Xr.timestamp];Ja.schema=up});var ic=v(ts=>{"use strict";var Qa=rt(),fp=Vn(),Xa=st(),dp=It(),pp=Nr(),Zr=jr(),es=qr(),mp=_a(),hp=Oa(),Za=Fr(),Ft=Fn(),ec=Kr(),tc=ei(),Ha=Va(),nc=Hr(),ci=Gr(),za=new Map([["core",mp.schema],["failsafe",[Qa.map,Xa.seq,dp.string]],["json",hp.schema],["yaml11",Ha.schema],["yaml-1.1",Ha.schema]]),Ga={binary:Za.binary,bool:pp.boolTag,float:Zr.float,floatExp:Zr.floatExp,floatNaN:Zr.floatNaN,floatTime:ci.floatTime,int:es.int,intHex:es.intHex,intOct:es.intOct,intTime:ci.intTime,map:Qa.map,merge:Ft.merge,null:fp.nullTag,omap:ec.omap,pairs:tc.pairs,seq:Xa.seq,set:nc.set,timestamp:ci.timestamp},gp={"tag:yaml.org,2002:binary":Za.binary,"tag:yaml.org,2002:merge":Ft.merge,"tag:yaml.org,2002:omap":ec.omap,"tag:yaml.org,2002:pairs":tc.pairs,"tag:yaml.org,2002:set":nc.set,"tag:yaml.org,2002:timestamp":ci.timestamp};function wp(t,e,n){let i=za.get(e);if(i&&!t)return n&&!i.includes(Ft.merge)?i.concat(Ft.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(za.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(Ft.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?Ga[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(Ga).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}ts.coreKnownTags=gp;ts.getTags=wp});var rs=v(rc=>{"use strict";var ns=_(),yp=rt(),vp=st(),bp=It(),li=ic(),kp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,is=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?li.getTags(e,"compat"):e?li.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?li.coreKnownTags:{},this.tags=li.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ns.MAP,{value:yp.map}),Object.defineProperty(this,ns.SCALAR,{value:bp.string}),Object.defineProperty(this,ns.SEQ,{value:vp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?kp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};rc.Schema=is});var oc=v(sc=>{"use strict";var Sp=_(),ss=Nt(),Mt=Pt();function Cp(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=ss.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Mt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(Sp.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=s(t.contents.commentBefore);n.push(Mt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=ss.stringify(t.contents,r,()=>a=null,c);a&&(l+=Mt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(ss.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
- `)?(n.push("..."),n.push(Mt.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(Mt.indentComment(s(c),"")))}return n.join(`
57
+ ${s.comment}`:i.comment}i=r}t.items[n]=Zn.isPair(i)?i:new Mr.Pair(i)}}else e("Expected a sequence for this tag");return t}function ja(t,e,n){let{replacer:i}=n,r=new Wd.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(Mr.createPair(a,c,n))}return r}var Bd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ta,createNode:ja};ei.createPairs=ja;ei.pairs=Bd;ei.resolvePairs=Ta});var Kr=v(Br=>{"use strict";var Ia=_(),Wr=Ee(),Lt=Ae(),Kd=Ne(),qa=ti(),Je=class t extends Kd.YAMLSeq{constructor(){super(),this.add=Lt.YAMLMap.prototype.add.bind(this),this.delete=Lt.YAMLMap.prototype.delete.bind(this),this.get=Lt.YAMLMap.prototype.get.bind(this),this.has=Lt.YAMLMap.prototype.has.bind(this),this.set=Lt.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(Ia.isPair(r)?(s=Wr.toJS(r.key,"",n),o=Wr.toJS(r.value,s,n)):s=Wr.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=qa.createPairs(e,n,i),s=new this;return s.items=r.items,s}};Je.tag="tag:yaml.org,2002:omap";var Yd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Je,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=qa.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Ia.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Je,n)},createNode:(t,e,n)=>Je.from(t,e,n)};Br.YAMLOMap=Je;Br.omap=Yd});var Ma=v(Yr=>{"use strict";var $a=I();function La({value:t,source:e},n){return e&&(t?Da:Fa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Da={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 $a.Scalar(!0),stringify:La},Fa={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 $a.Scalar(!1),stringify:La};Yr.falseTag=Fa;Yr.trueTag=Da});var Wa=v(ni=>{"use strict";var Ud=I(),Ur=lt(),Jd={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:Ur.stringifyNumber},Vd={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():Ur.stringifyNumber(t)}},Hd={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 Ud.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:Ur.stringifyNumber};ni.float=Hd;ni.floatExp=Vd;ni.floatNaN=Jd});var Ka=v(Ft=>{"use strict";var Ba=lt(),Dt=t=>typeof t=="bigint"||Number.isInteger(t);function ii(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 Jr(t,e,n){let{value:i}=t;if(Dt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return Ba.stringifyNumber(t)}var Gd={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>ii(t,2,2,n),stringify:t=>Jr(t,2,"0b")},zd={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>ii(t,1,8,n),stringify:t=>Jr(t,8,"0")},Qd={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>ii(t,0,10,n),stringify:Ba.stringifyNumber},Xd={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>ii(t,2,16,n),stringify:t=>Jr(t,16,"0x")};Ft.int=Qd;Ft.intBin=Gd;Ft.intHex=Xd;Ft.intOct=zd});var Hr=v(Vr=>{"use strict";var oi=_(),ri=Re(),si=Ae(),Ve=class t extends si.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;oi.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new ri.Pair(e.key,null):n=new ri.Pair(e,null),si.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=si.findPair(this.items,e);return!n&&oi.isPair(i)?oi.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=si.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new ri.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(ri.createPair(o,null,i));return s}};Ve.tag="tag:yaml.org,2002:set";var Zd={collection:"map",identify:t=>t instanceof Set,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Ve.from(t,e,n),resolve(t,e){if(oi.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ve,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Vr.YAMLSet=Ve;Vr.set=Zd});var zr=v(ai=>{"use strict";var ep=lt();function Gr(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 Ya(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return ep.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 tp={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})=>Gr(t,n),stringify:Ya},np={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=>Gr(t,!1),stringify:Ya},Ua={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(Ua.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),f=e[8];if(f&&f!=="Z"){let u=Gr(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ai.floatTime=np;ai.intTime=tp;ai.timestamp=Ua});var Ha=v(Va=>{"use strict";var ip=at(),rp=Hn(),sp=ct(),op=qt(),ap=Fr(),Ja=Ma(),Qr=Wa(),ci=Ka(),cp=Mn(),lp=Kr(),up=ti(),fp=Hr(),Xr=zr(),dp=[ip.map,sp.seq,op.string,rp.nullTag,Ja.trueTag,Ja.falseTag,ci.intBin,ci.intOct,ci.int,ci.intHex,Qr.floatNaN,Qr.floatExp,Qr.float,ap.binary,cp.merge,lp.omap,up.pairs,fp.set,Xr.intTime,Xr.floatTime,Xr.timestamp];Va.schema=dp});var rc=v(ts=>{"use strict";var Xa=at(),pp=Hn(),Za=ct(),mp=qt(),hp=Nr(),Zr=jr(),es=qr(),gp=Pa(),wp=Aa(),ec=Fr(),Mt=Mn(),tc=Kr(),nc=ti(),Ga=Ha(),ic=Hr(),li=zr(),za=new Map([["core",gp.schema],["failsafe",[Xa.map,Za.seq,mp.string]],["json",wp.schema],["yaml11",Ga.schema],["yaml-1.1",Ga.schema]]),Qa={binary:ec.binary,bool:hp.boolTag,float:Zr.float,floatExp:Zr.floatExp,floatNaN:Zr.floatNaN,floatTime:li.floatTime,int:es.int,intHex:es.intHex,intOct:es.intOct,intTime:li.intTime,map:Xa.map,merge:Mt.merge,null:pp.nullTag,omap:tc.omap,pairs:nc.pairs,seq:Za.seq,set:ic.set,timestamp:li.timestamp},yp={"tag:yaml.org,2002:binary":ec.binary,"tag:yaml.org,2002:merge":Mt.merge,"tag:yaml.org,2002:omap":tc.omap,"tag:yaml.org,2002:pairs":nc.pairs,"tag:yaml.org,2002:set":ic.set,"tag:yaml.org,2002:timestamp":li.timestamp};function vp(t,e,n){let i=za.get(e);if(i&&!t)return n&&!i.includes(Mt.merge)?i.concat(Mt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(za.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(Mt.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?Qa[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(Qa).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}ts.coreKnownTags=yp;ts.getTags=vp});var rs=v(sc=>{"use strict";var ns=_(),bp=at(),kp=ct(),Sp=qt(),ui=rc(),Cp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,is=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ui.getTags(e,"compat"):e?ui.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?ui.coreKnownTags:{},this.tags=ui.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ns.MAP,{value:bp.map}),Object.defineProperty(this,ns.SCALAR,{value:Sp.string}),Object.defineProperty(this,ns.SEQ,{value:kp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Cp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};sc.Schema=is});var ac=v(oc=>{"use strict";var Ep=_(),ss=Tt(),Wt=Rt();function xp(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=ss.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Wt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(Ep.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=s(t.contents.commentBefore);n.push(Wt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=ss.stringify(t.contents,r,()=>a=null,c);a&&(l+=Wt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(ss.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
+ `)?(n.push("..."),n.push(Wt.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(Wt.indentComment(s(c),"")))}return n.join(`
59
59
  `)+`
60
- `}sc.stringifyDocument=Cp});var Wt=v(ac=>{"use strict";var Ep=xt(),at=On(),X=_(),xp=Pe(),_p=Ce(),Pp=rs(),Rp=oc(),os=xn(),Op=ur(),Ap=_t(),as=lr(),cs=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,X.NODE_TYPE,{value:X.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 as.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,{[X.NODE_TYPE]:{value:X.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=X.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ct(this.contents)&&this.contents.add(e)}addIn(e,n){ct(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=os.anchorNames(this);e.anchor=!n||i.has(n)?os.findNewAnchor(n||"a",i):n}return new Ep.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 m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=n.filter(m).map(String);w.length>0&&(n=n.concat(w)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=os.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=Ap.createNode(e,f,g);return a&&X.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 xp.Pair(r,s)}delete(e){return ct(this.contents)?this.contents.delete(e):!1}deleteIn(e){return at.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ct(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return X.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return at.isEmptyPath(e)?!n&&X.isScalar(this.contents)?this.contents.value:this.contents:X.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return X.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return at.isEmptyPath(e)?this.contents!==void 0:X.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=at.collectionFromPath(this.schema,[e],n):ct(this.contents)&&this.contents.set(e,n)}setIn(e,n){at.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=at.collectionFromPath(this.schema,Array.from(e),n):ct(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 as.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 as.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 Pp.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=_p.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:f}of a.anchors.values())s(f,l);return typeof o=="function"?Op.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 Rp.stringifyDocument(this,e)}};function ct(t){if(X.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}ac.Document=cs});var Yt=v(Kt=>{"use strict";var Bt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},ls=class extends Bt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},us=class extends Bt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},Np=(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)+`…
60
+ `}oc.stringifyDocument=xp});var Bt=v(cc=>{"use strict";var _p=_t(),ut=An(),X=_(),Pp=Re(),Rp=Ee(),Op=rs(),Ap=ac(),os=_n(),Np=ur(),Tp=Pt(),as=lr(),cs=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,X.NODE_TYPE,{value:X.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 as.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,{[X.NODE_TYPE]:{value:X.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=X.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ft(this.contents)&&this.contents.add(e)}addIn(e,n){ft(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=os.anchorNames(this);e.anchor=!n||i.has(n)?os.findNewAnchor(n||"a",i):n}return new _p.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 m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=n.filter(m).map(String);w.length>0&&(n=n.concat(w)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=os.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=Tp.createNode(e,f,g);return a&&X.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 Pp.Pair(r,s)}delete(e){return ft(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ut.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ft(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return X.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return ut.isEmptyPath(e)?!n&&X.isScalar(this.contents)?this.contents.value:this.contents:X.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return X.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ut.isEmptyPath(e)?this.contents!==void 0:X.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=ut.collectionFromPath(this.schema,[e],n):ft(this.contents)&&this.contents.set(e,n)}setIn(e,n){ut.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=ut.collectionFromPath(this.schema,Array.from(e),n):ft(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 as.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 as.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 Op.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=Rp.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:f}of a.anchors.values())s(f,l);return typeof o=="function"?Np.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 Ap.stringifyDocument(this,e)}};function ft(t){if(X.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}cc.Document=cs});var Ut=v(Yt=>{"use strict";var Kt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},ls=class extends Kt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},us=class extends Kt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},jp=(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
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
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};Kt.YAMLError=Bt;Kt.YAMLParseError=ls;Kt.YAMLWarning=us;Kt.prettifyError=Np});var Ut=v(cc=>{"use strict";function Tp(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,g=!1,p=null,m=null,w=null,y=null,S=null,k=null,C=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&s(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),f=!0;break;case"comment":{f||s(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let P=b.source.substring(1)||" ";u?u+=d+P:u=P,d="",l=!1;break}case"newline":l?u?u+=b.source:(!k||n!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,h=!0,(m||w)&&(y=b),f=!0;break;case"anchor":m&&s(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&s(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,C??(C=b.offset),l=!1,f=!1,g=!0;break;case"tag":{w&&s(b,"MULTIPLE_TAGS","A node can have at most one tag"),w=b,C??(C=b.offset),l=!1,f=!1,g=!0;break}case n:(m||w)&&s(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),k&&s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),k=b,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&s(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=b,l=!1,f=!1;break}default:s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,f=!1}let E=t[t.length-1],R=E?E.offset+E.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:k,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:w,newlineAfterProp:y,end:R,start:C??R}}cc.resolveProps=Tp});var ui=v(lc=>{"use strict";function fs(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(fs(e.key)||fs(e.value))return!0}return!1;default:return!0}}lc.containsNewline=fs});var ds=v(uc=>{"use strict";var jp=ui();function Ip(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&jp.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}uc.flowIndentCheck=Ip});var ps=v(dc=>{"use strict";var fc=_();function qp(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||fc.isScalar(s)&&fc.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}dc.mapIncludes=qp});var yc=v(wc=>{"use strict";var pc=Pe(),$p=Oe(),mc=Ut(),Lp=ui(),hc=ds(),Dp=ps(),gc="All mapping items must start at the same column";function Fp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??$p.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let f of i.items){let{start:u,key:d,sep:h,value:g}=f,p=mc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){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",gc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Lp.containsNewline(d))&&r(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",gc);n.atKey=!0;let w=p.end,y=d?t(n,d,p,r):e(n,w,u,null,p,r);n.schema.compat&&hc.flowIndentCheck(i.indent,d,r),n.atKey=!1,Dp.mapIncludes(n,a.items,y)&&r(w,"DUPLICATE_KEY","Map keys must be unique");let S=mc.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){m&&(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(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=g?t(n,g,S,r):e(n,c,h,null,S,r);n.schema.compat&&hc.flowIndentCheck(i.indent,g,r),c=k.range[2];let C=new pc.Pair(y,k);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
- `+S.comment:y.comment=S.comment);let k=new pc.Pair(y);n.options.keepSourceTokens&&(k.srcToken=f),a.items.push(k)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}wc.resolveBlockMap=Fp});var bc=v(vc=>{"use strict";var Mp=Ae(),Wp=Ut(),Bp=ds();function Kp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Mp.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:f,value:u}of i.items){let d=Wp.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.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 h=u?t(n,u,d,r):e(n,d.end,f,null,d,r);n.schema.compat&&Bp.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}vc.resolveBlockSeq=Kp});var lt=v(kc=>{"use strict";function Yp(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 f=c.substring(1)||" ";r?r+=o+f:r=f,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}}kc.resolveEnd=Yp});var xc=v(Ec=>{"use strict";var Up=_(),Jp=Pe(),Sc=Oe(),Vp=Ae(),Hp=lt(),Cc=Ut(),zp=ui(),Gp=ps(),ms="Block collections are not allowed within flow collections",hs=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Qp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?Sc.YAMLMap:Vp.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let w=i.items[m],{start:y,key:S,sep:k,value:C}=w,E=Cc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??k?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!C){m===0&&E.comma?r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
- `+E.comment:l.comment=E.comment),u=E.end;continue}!o&&n.options.strict&&zp.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||r(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let R="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":R=b.source.substring(1);break e;default:break e}if(R){let b=l.items[l.items.length-1];Up.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
- `+R:b.comment=R,E.comment=E.comment.substring(R.length+1)}}if(!o&&!k&&!E.found){let R=C?t(n,C,E,r):e(n,E.end,k,null,E,r);l.items.push(R),u=R.range[2],hs(C)&&r(R.range,"BLOCK_IN_FLOW",ms)}else{n.atKey=!0;let R=E.end,b=S?t(n,S,E,r):e(n,R,y,null,E,r);hs(S)&&r(b.range,"BLOCK_IN_FLOW",ms),n.atKey=!1;let P=Cc.resolveProps(k??[],{flow:a,indicator:"map-value-ind",next:C,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(P.found){if(!o&&!E.found&&n.options.strict){if(k)for(let A of k){if(A===P.found)break;if(A.type==="newline"){r(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<P.found.offset-1024&&r(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?r(C,"MISSING_CHAR",`Missing space after : in ${a}`):r(P.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let te=C?t(n,C,P,r):P.found?e(n,P.end,k,null,P,r):null;te?hs(C)&&r(te.range,"BLOCK_IN_FLOW",ms):P.comment&&(b.comment?b.comment+=`
71
- `+P.comment:b.comment=P.comment);let G=new Jp.Pair(b,te);if(n.options.keepSourceTokens&&(G.srcToken=w),o){let A=l;Gp.mapIncludes(n,A.items,b)&&r(R,"DUPLICATE_KEY","Map keys must be unique"),A.items.push(G)}else{let A=new Sc.YAMLMap(n.schema);A.flow=!0,A.items.push(G);let ne=(te??b).range;A.range=[b.range[0],ne[1],ne[2]],l.items.push(A)}u=te?te.range[2]:P.end}}let d=o?"}":"]",[h,...g]=i.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let m=Hp.resolveEnd(g,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}Ec.resolveFlowCollection=Qp});var Pc=v(_c=>{"use strict";var Xp=_(),Zp=I(),em=Oe(),tm=Ae(),nm=yc(),im=bc(),rm=xc();function gs(t,e,n,i,r,s){let o=n.type==="block-map"?nm.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?im.resolveBlockSeq(t,e,n,i,s):rm.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 sm(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:h}=i,g=d&&s?d.offset>s.offset?d:s:d??s;g&&(!h||h.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===em.YAMLMap.tagName&&a==="map"||o===tm.YAMLSeq.tagName&&a==="seq")return gs(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),gs(t,e,n,r,o)}let l=gs(t,e,n,r,o,c),f=c.resolve?.(l,d=>r(s,"TAG_RESOLVE_FAILED",d),e.options)??l,u=Xp.isNode(f)?f:new Zp.Scalar(f);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}_c.composeCollection=sm});var ys=v(Rc=>{"use strict";var ws=I();function om(t,e,n){let i=e.offset,r=am(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?ws.Scalar.BLOCK_FOLDED:ws.Scalar.BLOCK_LITERAL,o=e.source?cm(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
65
+ `}};Yt.YAMLError=Kt;Yt.YAMLParseError=ls;Yt.YAMLWarning=us;Yt.prettifyError=jp});var Jt=v(lc=>{"use strict";function Ip(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,g=!1,p=null,m=null,w=null,y=null,S=null,k=null,C=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&s(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),f=!0;break;case"comment":{f||s(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let P=b.source.substring(1)||" ";u?u+=d+P:u=P,d="",l=!1;break}case"newline":l?u?u+=b.source:(!k||n!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,h=!0,(m||w)&&(y=b),f=!0;break;case"anchor":m&&s(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&s(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,C??(C=b.offset),l=!1,f=!1,g=!0;break;case"tag":{w&&s(b,"MULTIPLE_TAGS","A node can have at most one tag"),w=b,C??(C=b.offset),l=!1,f=!1,g=!0;break}case n:(m||w)&&s(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),k&&s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),k=b,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&s(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=b,l=!1,f=!1;break}default:s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,f=!1}let E=t[t.length-1],R=E?E.offset+E.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:k,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:w,newlineAfterProp:y,end:R,start:C??R}}lc.resolveProps=Ip});var fi=v(uc=>{"use strict";function fs(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(fs(e.key)||fs(e.value))return!0}return!1;default:return!0}}uc.containsNewline=fs});var ds=v(fc=>{"use strict";var qp=fi();function $p(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&qp.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}fc.flowIndentCheck=$p});var ps=v(pc=>{"use strict";var dc=_();function Lp(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||dc.isScalar(s)&&dc.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}pc.mapIncludes=Lp});var vc=v(yc=>{"use strict";var mc=Re(),Dp=Ae(),hc=Jt(),Fp=fi(),gc=ds(),Mp=ps(),wc="All mapping items must start at the same column";function Wp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Dp.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let f of i.items){let{start:u,key:d,sep:h,value:g}=f,p=hc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){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",wc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Fp.containsNewline(d))&&r(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",wc);n.atKey=!0;let w=p.end,y=d?t(n,d,p,r):e(n,w,u,null,p,r);n.schema.compat&&gc.flowIndentCheck(i.indent,d,r),n.atKey=!1,Mp.mapIncludes(n,a.items,y)&&r(w,"DUPLICATE_KEY","Map keys must be unique");let S=hc.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){m&&(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(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=g?t(n,g,S,r):e(n,c,h,null,S,r);n.schema.compat&&gc.flowIndentCheck(i.indent,g,r),c=k.range[2];let C=new mc.Pair(y,k);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
+ `+S.comment:y.comment=S.comment);let k=new mc.Pair(y);n.options.keepSourceTokens&&(k.srcToken=f),a.items.push(k)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}yc.resolveBlockMap=Wp});var kc=v(bc=>{"use strict";var Bp=Ne(),Kp=Jt(),Yp=ds();function Up({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Bp.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:f,value:u}of i.items){let d=Kp.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.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 h=u?t(n,u,d,r):e(n,d.end,f,null,d,r);n.schema.compat&&Yp.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}bc.resolveBlockSeq=Up});var dt=v(Sc=>{"use strict";function Jp(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 f=c.substring(1)||" ";r?r+=o+f:r=f,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}}Sc.resolveEnd=Jp});var _c=v(xc=>{"use strict";var Vp=_(),Hp=Re(),Cc=Ae(),Gp=Ne(),zp=dt(),Ec=Jt(),Qp=fi(),Xp=ps(),ms="Block collections are not allowed within flow collections",hs=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Zp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?Cc.YAMLMap:Gp.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let w=i.items[m],{start:y,key:S,sep:k,value:C}=w,E=Ec.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??k?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!C){m===0&&E.comma?r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),u=E.end;continue}!o&&n.options.strict&&Qp.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||r(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let R="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":R=b.source.substring(1);break e;default:break e}if(R){let b=l.items[l.items.length-1];Vp.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
+ `+R:b.comment=R,E.comment=E.comment.substring(R.length+1)}}if(!o&&!k&&!E.found){let R=C?t(n,C,E,r):e(n,E.end,k,null,E,r);l.items.push(R),u=R.range[2],hs(C)&&r(R.range,"BLOCK_IN_FLOW",ms)}else{n.atKey=!0;let R=E.end,b=S?t(n,S,E,r):e(n,R,y,null,E,r);hs(S)&&r(b.range,"BLOCK_IN_FLOW",ms),n.atKey=!1;let P=Ec.resolveProps(k??[],{flow:a,indicator:"map-value-ind",next:C,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(P.found){if(!o&&!E.found&&n.options.strict){if(k)for(let A of k){if(A===P.found)break;if(A.type==="newline"){r(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<P.found.offset-1024&&r(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?r(C,"MISSING_CHAR",`Missing space after : in ${a}`):r(P.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ne=C?t(n,C,P,r):P.found?e(n,P.end,k,null,P,r):null;ne?hs(C)&&r(ne.range,"BLOCK_IN_FLOW",ms):P.comment&&(b.comment?b.comment+=`
71
+ `+P.comment:b.comment=P.comment);let z=new Hp.Pair(b,ne);if(n.options.keepSourceTokens&&(z.srcToken=w),o){let A=l;Xp.mapIncludes(n,A.items,b)&&r(R,"DUPLICATE_KEY","Map keys must be unique"),A.items.push(z)}else{let A=new Cc.YAMLMap(n.schema);A.flow=!0,A.items.push(z);let ie=(ne??b).range;A.range=[b.range[0],ie[1],ie[2]],l.items.push(A)}u=ne?ne.range[2]:P.end}}let d=o?"}":"]",[h,...g]=i.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let m=zp.resolveEnd(g,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}xc.resolveFlowCollection=Zp});var Rc=v(Pc=>{"use strict";var em=_(),tm=I(),nm=Ae(),im=Ne(),rm=vc(),sm=kc(),om=_c();function gs(t,e,n,i,r,s){let o=n.type==="block-map"?rm.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?sm.resolveBlockSeq(t,e,n,i,s):om.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 am(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:h}=i,g=d&&s?d.offset>s.offset?d:s:d??s;g&&(!h||h.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===nm.YAMLMap.tagName&&a==="map"||o===im.YAMLSeq.tagName&&a==="seq")return gs(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),gs(t,e,n,r,o)}let l=gs(t,e,n,r,o,c),f=c.resolve?.(l,d=>r(s,"TAG_RESOLVE_FAILED",d),e.options)??l,u=em.isNode(f)?f:new tm.Scalar(f);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Pc.composeCollection=am});var ys=v(Oc=>{"use strict";var ws=I();function cm(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===">"?ws.Scalar.BLOCK_FOLDED:ws.Scalar.BLOCK_LITERAL,o=e.source?um(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
73
73
  `.repeat(Math.max(1,o.length-1)):"",m=i+r.length;return e.source&&(m+=e.source.length),{value:p,type:s,comment:r.comment,range:[i,m,m]}}let c=e.indent+r.indent,l=e.offset+r.length,f=0;for(let p=0;p<a;++p){let[m,w]=o[p];if(w===""||w==="\r")r.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&n(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=m.length),f=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(c)+`
74
74
  `;for(let p=f;p<a;++p){let[m,w]=o[p];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}s===ws.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+w,d=`
75
75
  `):m.length>c||w[0]===" "?(d===" "?d=`
@@ -84,83 +84,83 @@ ${l}
84
84
  `+o[p][0].slice(c);u[u.length-1]!==`
85
85
  `&&(u+=`
86
86
  `);break;default:u+=`
87
- `}let g=i+r.length+e.source.length;return{value:u,type:s,comment:r.comment,range:[i,g,g]}}function am({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 h=r[d];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!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,f="",u=r.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:s,indent:o,chomp:a,comment:f,length:u}}function cm(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}Rc.resolveBlockScalar=om});var bs=v(Ac=>{"use strict";var vs=I(),lm=lt();function um(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(d,h,g)=>n(i+d,h,g);switch(r){case"scalar":a=vs.Scalar.PLAIN,c=fm(s,l);break;case"single-quoted-scalar":a=vs.Scalar.QUOTE_SINGLE,c=dm(s,l);break;case"double-quoted-scalar":a=vs.Scalar.QUOTE_DOUBLE,c=pm(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 f=i+s.length,u=lm.resolveEnd(o,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function fm(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}`),Oc(t)}function dm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Oc(t.slice(1,-1)).replace(/''/g,"'")}function Oc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let g=i+r.length+e.source.length;return{value:u,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 h=r[d];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!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,f="",u=r.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:s,indent:o,chomp:a,comment:f,length:u}}function um(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}Oc.resolveBlockScalar=cm});var bs=v(Nc=>{"use strict";var vs=I(),fm=dt();function dm(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(d,h,g)=>n(i+d,h,g);switch(r){case"scalar":a=vs.Scalar.PLAIN,c=pm(s,l);break;case"single-quoted-scalar":a=vs.Scalar.QUOTE_SINGLE,c=mm(s,l);break;case"double-quoted-scalar":a=vs.Scalar.QUOTE_DOUBLE,c=hm(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 f=i+s.length,u=fm.resolveEnd(o,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function pm(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}`),Ac(t)}function mm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Ac(t.slice(1,-1)).replace(/''/g,"'")}function Ac(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
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
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 pm(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
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 hm(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
92
  `))if(r===`
93
- `){let{fold:s,offset:o}=mm(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=hm[s];if(o)n+=o;else if(s===`
93
+ `){let{fold:s,offset:o}=gm(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=wm[s];if(o)n+=o;else if(s===`
94
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+=gm(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!==`
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+=ym(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
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 mm(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
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 gm(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
98
  `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
99
  `);)i===`
100
100
  `&&(n+=`
101
- `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var hm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function gm(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}}Ac.resolveFlowScalar=um});var jc=v(Tc=>{"use strict";var He=_(),Nc=I(),wm=ys(),ym=bs();function vm(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?wm.resolveBlockScalar(t,e,i):ym.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[He.SCALAR]:c?l=bm(t.schema,r,c,n,i):e.type==="scalar"?l=km(t,r,e,i):l=t.schema[He.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=He.isScalar(u)?u:new Nc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Nc.Scalar(r)}return f.range=a,f.source=r,s&&(f.type=s),c&&(f.tag=c),l.format&&(f.format=l.format),o&&(f.comment=o),f}function bm(t,e,n,i,r){if(n==="!")return t[He.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[He.SCALAR])}function km({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[He.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[He.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",f,!0)}}return o}Tc.composeScalar=vm});var qc=v(Ic=>{"use strict";function Sm(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}Ic.emptyScalarPosition=Sm});var Dc=v(Ss=>{"use strict";var Cm=xt(),Em=_(),xm=Pc(),$c=jc(),_m=lt(),Pm=qc(),Rm={composeNode:Lc,composeEmptyNode:ks};function Lc(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=Om(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=$c.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=xm.composeCollection(Rm,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=ks(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&&(!Em.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&&f&&(l.srcToken=e),l}function ks(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let f={type:"scalar",offset:Pm.emptyScalarPosition(e,n,i),indent:-1,source:""},u=$c.composeScalar(t,f,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),s&&(u.comment=s,u.range[2]=c),u}function Om({options:t},{offset:e,source:n,end:i},r){let s=new Cm.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=_m.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Ss.composeEmptyNode=ks;Ss.composeNode=Lc});var Wc=v(Mc=>{"use strict";var Am=Wt(),Fc=Dc(),Nm=lt(),Tm=Ut();function jm(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new Am.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Tm.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Fc.composeNode(l,r,f,o):Fc.composeEmptyNode(l,f.end,i,null,f,o);let u=c.contents.range[2],d=Nm.resolveEnd(s,u,!1,o);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Mc.composeDoc=jm});var Es=v(Yc=>{"use strict";var Im=bn("process"),qm=lr(),$m=Wt(),Jt=Yt(),Bc=_(),Lm=Wc(),Dm=lt();function Vt(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 Kc(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?`
101
+ `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var wm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ym(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}}Nc.resolveFlowScalar=dm});var Ic=v(jc=>{"use strict";var He=_(),Tc=I(),vm=ys(),bm=bs();function km(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?vm.resolveBlockScalar(t,e,i):bm.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[He.SCALAR]:c?l=Sm(t.schema,r,c,n,i):e.type==="scalar"?l=Cm(t,r,e,i):l=t.schema[He.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=He.isScalar(u)?u:new Tc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Tc.Scalar(r)}return f.range=a,f.source=r,s&&(f.type=s),c&&(f.tag=c),l.format&&(f.format=l.format),o&&(f.comment=o),f}function Sm(t,e,n,i,r){if(n==="!")return t[He.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[He.SCALAR])}function Cm({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[He.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[He.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",f,!0)}}return o}jc.composeScalar=km});var $c=v(qc=>{"use strict";function Em(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}qc.emptyScalarPosition=Em});var Fc=v(Ss=>{"use strict";var xm=_t(),_m=_(),Pm=Rc(),Lc=Ic(),Rm=dt(),Om=$c(),Am={composeNode:Dc,composeEmptyNode:ks};function Dc(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=Nm(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=Lc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Pm.composeCollection(Am,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=ks(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&&(!_m.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&&f&&(l.srcToken=e),l}function ks(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let f={type:"scalar",offset:Om.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Lc.composeScalar(t,f,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),s&&(u.comment=s,u.range[2]=c),u}function Nm({options:t},{offset:e,source:n,end:i},r){let s=new xm.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=Rm.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Ss.composeEmptyNode=ks;Ss.composeNode=Dc});var Bc=v(Wc=>{"use strict";var Tm=Bt(),Mc=Fc(),jm=dt(),Im=Jt();function qm(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new Tm.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Im.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Mc.composeNode(l,r,f,o):Mc.composeEmptyNode(l,f.end,i,null,f,o);let u=c.contents.range[2],d=jm.resolveEnd(s,u,!1,o);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Wc.composeDoc=qm});var Es=v(Uc=>{"use strict";var $m=kn("process"),Lm=lr(),Dm=Bt(),Vt=Ut(),Kc=_(),Fm=Bc(),Mm=dt();function Ht(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 Yc(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
103
 
104
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 Cs=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=Vt(n);s?this.warnings.push(new Jt.YAMLWarning(o,i,r)):this.errors.push(new Jt.YAMLParseError(o,i,r))},this.directives=new qm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=Kc(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(Bc.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];Bc.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
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 Cs=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=Ht(n);s?this.warnings.push(new Vt.YAMLWarning(o,i,r)):this.errors.push(new Vt.YAMLParseError(o,i,r))},this.directives=new Lm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=Yc(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(Kc.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];Kc.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
107
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:Kc(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(Im.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=Vt(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Lm.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 Jt.YAMLParseError(Vt(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 Jt.YAMLParseError(Vt(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=Dm.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 Jt.YAMLParseError(Vt(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 $m.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}}};Yc.Composer=Cs});var Vc=v(fi=>{"use strict";var Fm=ys(),Mm=bs(),Wm=Yt(),Uc=At();function Bm(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 Wm.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Mm.resolveFlowScalar(t,e,i);case"block-scalar":return Fm.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Km(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=Uc.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:`
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:Yc(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($m.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=Ht(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Fm.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 Vt.YAMLParseError(Ht(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 Vt.YAMLParseError(Ht(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=Mm.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 Vt.YAMLParseError(Ht(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 Dm.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}}};Uc.Composer=Cs});var Hc=v(di=>{"use strict";var Wm=ys(),Bm=bs(),Km=Ut(),Jc=Nt();function Ym(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 Km.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Bm.resolveFlowScalar(t,e,i);case"block-scalar":return Wm.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Um(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=Jc.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
110
  `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
111
  `),f=a.substring(0,l),u=a.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:s,indent:i,source:f}];return Jc(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
- `}),{type:"block-scalar",offset:s,indent:i,props:d,source:u}}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 Ym(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=Uc.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">":Um(t,c);break;case'"':xs(t,c,"double-quoted-scalar");break;case"'":xs(t,c,"single-quoted-scalar");break;default:xs(t,c,"scalar")}}function Um(t,e){let n=e.indexOf(`
112
+ `,d=[{type:"block-scalar-header",offset:s,indent:i,source:f}];return Vc(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:s,indent:i,props:d,source:u}}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 Jm(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=Jc.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">":Vm(t,c);break;case'"':xs(t,c,"double-quoted-scalar");break;case"'":xs(t,c,"single-quoted-scalar");break;default:xs(t,c,"scalar")}}function Vm(t,e){let n=e.indexOf(`
114
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}];Jc(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 Jc(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 xs(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})}}}fi.createScalarToken=Km;fi.resolveAsScalar=Bm;fi.setScalarValue=Ym});var zc=v(Hc=>{"use strict";var Jm=t=>"type"in t?pi(t):di(t);function pi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=pi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=di(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=di(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=di(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 di({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=pi(e)),n)for(let s of n)r+=s.source;return i&&(r+=pi(i)),r}Hc.stringify=Jm});var Zc=v(Xc=>{"use strict";var _s=Symbol("break visit"),Vm=Symbol("skip children"),Gc=Symbol("remove item");function ze(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Qc(Object.freeze([]),t,e)}ze.BREAK=_s;ze.SKIP=Vm;ze.REMOVE=Gc;ze.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};ze.parentCollection=(t,e)=>{let n=ze.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 Qc(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=Qc(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===_s)return _s;a===Gc&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}Xc.visit=ze});var mi=v(V=>{"use strict";var Ps=Vc(),Hm=zc(),zm=Zc(),Rs="\uFEFF",Os="",As="",Ns="",Gm=t=>!!t&&"items"in t,Qm=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Xm(t){switch(t){case Rs:return"<BOM>";case Os:return"<DOC>";case As:return"<FLOW_END>";case Ns:return"<SCALAR>";default:return JSON.stringify(t)}}function Zm(t){switch(t){case Rs:return"byte-order-mark";case Os:return"doc-mode";case As:return"flow-error-end";case Ns:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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}];Vc(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 Vc(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 xs(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})}}}di.createScalarToken=Um;di.resolveAsScalar=Ym;di.setScalarValue=Jm});var zc=v(Gc=>{"use strict";var Hm=t=>"type"in t?mi(t):pi(t);function mi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=mi(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+=mi(e)),n)for(let s of n)r+=s.source;return i&&(r+=mi(i)),r}Gc.stringify=Hm});var el=v(Zc=>{"use strict";var _s=Symbol("break visit"),Gm=Symbol("skip children"),Qc=Symbol("remove item");function Ge(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Xc(Object.freeze([]),t,e)}Ge.BREAK=_s;Ge.SKIP=Gm;Ge.REMOVE=Qc;Ge.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};Ge.parentCollection=(t,e)=>{let n=Ge.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 Xc(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=Xc(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===_s)return _s;a===Qc&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}Zc.visit=Ge});var hi=v(V=>{"use strict";var Ps=Hc(),zm=zc(),Qm=el(),Rs="\uFEFF",Os="",As="",Ns="",Xm=t=>!!t&&"items"in t,Zm=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function eh(t){switch(t){case Rs:return"<BOM>";case Os:return"<DOC>";case As:return"<FLOW_END>";case Ns:return"<SCALAR>";default:return JSON.stringify(t)}}function th(t){switch(t){case Rs:return"byte-order-mark";case Os:return"doc-mode";case As:return"flow-error-end";case Ns:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(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}V.createScalarToken=Ps.createScalarToken;V.resolveAsScalar=Ps.resolveAsScalar;V.setScalarValue=Ps.setScalarValue;V.stringify=Hm.stringify;V.visit=zm.visit;V.BOM=Rs;V.DOCUMENT=Os;V.FLOW_END=As;V.SCALAR=Ns;V.isCollection=Gm;V.isScalar=Qm;V.prettyToken=Xm;V.tokenType=Zm});var Is=v(tl=>{"use strict";var Ht=mi();function re(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var el=new Set("0123456789ABCDEFabcdef"),eh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),hi=new Set(",[]{}"),th=new Set(` ,[]{}
121
- \r `),Ts=t=>!t||th.has(t),js=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===`
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}V.createScalarToken=Ps.createScalarToken;V.resolveAsScalar=Ps.resolveAsScalar;V.setScalarValue=Ps.setScalarValue;V.stringify=zm.stringify;V.visit=Qm.visit;V.BOM=Rs;V.DOCUMENT=Os;V.FLOW_END=As;V.SCALAR=Ns;V.isCollection=Xm;V.isScalar=Zm;V.prettyToken=eh;V.tokenType=th});var Is=v(nl=>{"use strict";var Gt=hi();function se(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var tl=new Set("0123456789ABCDEFabcdef"),nh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),gi=new Set(",[]{}"),ih=new Set(` ,[]{}
121
+ \r `),Ts=t=>!t||ih.has(t),js=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
122
  `?!0:n==="\r"?this.buffer[e+1]===`
123
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
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==="...")&&re(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]===Ht.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 Ht.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==="...")&&re(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&&!re(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===":")&&re(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(Ts),"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("..."))&&re(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Ht.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(Ts),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||re(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(`
125
+ `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&se(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]===Gt.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 Gt.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==="...")&&se(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&&!se(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===":")&&se(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(Ts),"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("..."))&&se(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Gt.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(Ts),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||se(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
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=>re(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`
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=>se(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
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
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
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
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 Ht.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(re(s)||e&&hi.has(s))break;n=i}else if(re(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
133
+ `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield Gt.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(se(s)||e&&gi.has(s))break;n=i}else if(se(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
134
134
  `?(i+=1,r=`
135
- `,s=this.buffer[i+1]):n=i),s==="#"||e&&hi.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&&hi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Ht.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(Ts),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(re(i)||n&&hi.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(;!re(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(eh.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===`
135
+ `,s=this.buffer[i+1]):n=i),s==="#"||e&&gi.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&&gi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Gt.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(Ts),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(se(i)||n&&gi.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(;!se(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(nh.has(n))n=this.buffer[++e];else if(n==="%"&&tl.has(this.buffer[e+1])&&tl.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
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)}};tl.Lexer=js});var $s=v(nl=>{"use strict";var qs=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}}}};nl.LineCounter=qs});var Ds=v(al=>{"use strict";var nh=bn("process"),il=mi(),ih=Is();function Ne(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function rl(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 ol(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 gi(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 ut(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 wi(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 sl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ne(e.start,"explicit-key-ind")&&!Ne(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ol(e.value)?e.value.end?wi(e.value.end,e.sep):e.value.end=e.sep:wi(e.start,e.sep),delete e.sep)}var Ls=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,nh.env.LOG_TOKENS&&console.log("|",il.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=il.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"&&sl(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&&rl(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":{rl(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=gi(this.peek(2)),i=ut(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(`
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)}};nl.Lexer=js});var $s=v(il=>{"use strict";var qs=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}}}};il.LineCounter=qs});var Ds=v(cl=>{"use strict";var rh=kn("process"),rl=hi(),sh=Is();function Te(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function sl(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 wi(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 pt(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 yi(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&&!Te(e.start,"explicit-key-ind")&&!Te(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,al(e.value)?e.value.end?yi(e.value.end,e.sep):e.value.end=e.sep:yi(e.start,e.sep),delete e.sep)}var Ls=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 sh.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,rh.env.LOG_TOKENS&&console.log("|",rl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=rl.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&&sl(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":{sl(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=wi(this.peek(2)),i=pt(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
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)){wi(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(Ne(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(ol(n.key)&&!Ne(n.sep,"newline")){let o=ut(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(Ne(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=ut(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]}):Ne(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&&!Ne(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)){wi(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||Ne(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=gi(i),s=ut(r);sl(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(`
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)){yi(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(Te(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)&&!Te(n.sep,"newline")){let o=pt(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(Te(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=pt(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]}):Te(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&&!Te(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)){yi(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||Te(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=wi(i),s=pt(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
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=gi(e),i=ut(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=gi(e),i=ut(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())}}};al.Parser=Ls});var dl=v(Gt=>{"use strict";var cl=Es(),rh=Wt(),zt=Yt(),sh=Sr(),oh=_(),ah=$s(),ll=Ds();function ul(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new ah.LineCounter||null,prettyErrors:e}}function ch(t,e={}){let{lineCounter:n,prettyErrors:i}=ul(e),r=new ll.Parser(n?.addNewLine),s=new cl.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(zt.prettifyError(t,n)),a.warnings.forEach(zt.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function fl(t,e={}){let{lineCounter:n,prettyErrors:i}=ul(e),r=new ll.Parser(n?.addNewLine),s=new cl.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 zt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(zt.prettifyError(t,n)),o.warnings.forEach(zt.prettifyError(t,n))),o}function lh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=fl(t,n);if(!r)return null;if(r.warnings.forEach(s=>sh.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 uh(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 oh.isDocument(t)&&!i?t.toString(n):new rh.Document(t,i,n).toString(n)}Gt.parse=lh;Gt.parseAllDocuments=ch;Gt.parseDocument=fl;Gt.stringify=uh});var ft=v(O=>{"use strict";var fh=Es(),dh=Wt(),ph=rs(),Fs=Yt(),mh=xt(),Te=_(),hh=Pe(),gh=I(),wh=Oe(),yh=Ae(),vh=mi(),bh=Is(),kh=$s(),Sh=Ds(),yi=dl(),pl=kt();O.Composer=fh.Composer;O.Document=dh.Document;O.Schema=ph.Schema;O.YAMLError=Fs.YAMLError;O.YAMLParseError=Fs.YAMLParseError;O.YAMLWarning=Fs.YAMLWarning;O.Alias=mh.Alias;O.isAlias=Te.isAlias;O.isCollection=Te.isCollection;O.isDocument=Te.isDocument;O.isMap=Te.isMap;O.isNode=Te.isNode;O.isPair=Te.isPair;O.isScalar=Te.isScalar;O.isSeq=Te.isSeq;O.Pair=hh.Pair;O.Scalar=gh.Scalar;O.YAMLMap=wh.YAMLMap;O.YAMLSeq=yh.YAMLSeq;O.CST=vh;O.Lexer=bh.Lexer;O.LineCounter=kh.LineCounter;O.Parser=Sh.Parser;O.parse=yi.parse;O.parseAllDocuments=yi.parseAllDocuments;O.parseDocument=yi.parseDocument;O.stringify=yi.stringify;O.visit=pl.visit;O.visitAsync=pl.visitAsync});import vi from"path";function xh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||vi.posix.isAbsolute(n)||vi.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 bi(t){let e=xh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function hl(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 je(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||vi.posix.isAbsolute(i)||vi.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 Qt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function gl(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 wl(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>Ws)throw new Error(`${e} exceeds ${Ws} 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>Bs)throw new Error(`${e} contains more than ${Bs} wildcard tokens`);return t}function ml(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=>wl(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function Ms(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 _h(t){if(t===void 0)return{...we,include:[...we.include],exclude:[...we.exclude]};let e=Qt(t,"native.snapshot");return{include:ml(e.include,"native.snapshot.include",we.include),exclude:ml(e.exclude,"native.snapshot.exclude",we.exclude),max_files:Ms(e.max_files,we.max_files,"native.snapshot.max_files"),max_total_bytes:Ms(e.max_total_bytes,we.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Ms(e.max_duration_ms,we.max_duration_ms,"native.snapshot.max_duration_ms")}}function Ph(t){if(t===void 0)return;let e=Qt(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=Qt(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,f=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 f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:bi(i),toArtifactRoot:bi(r),stage:s,...o?{cleanup:o}:{}}}function Rh(t,e={}){let n=Qt(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let s=n.archive_confirmation??"automatic";if(s!=="automatic"&&s!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=n.max_verify_failures??Ch;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Ph(n.pending_root_move);return{artifact_root:bi(i),language:gl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:s,max_verify_failures:o,snapshot:_h(n.snapshot),...a?{pending_root_move:a}:{}}}function Oh(t){let e=Qt(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:hl(e.artifact_layout),language:gl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function Ah(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Nh(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 Xt(t,e={}){let n=(0,Ks.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=Ah(r.ambient_resume),o=r.native===void 0?void 0:Rh(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),a=r.classic===void 0?void 0:Oh(r.classic),c=Nh(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}var Ks,ki,Ws,Bs,Ch,Eh,we,Ie=K(()=>{"use strict";Ks=vt(ft(),1),ki=64*1024,Ws=1024,Bs=64,Ch=5,Eh=[".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/**"],we={include:["**/*"],exclude:[...Eh],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function qe(t){return t!==0&&t!==0n&&t!=="0"}function Si(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 Ci=K(()=>{"use strict"});import{constants as Ei,promises as Ge}from"fs";function Ys(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function yl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Zt(t){return{dev:t.dev,ino:t.ino,birthtime:Ys(t)}}function xi(t,e){let n=Zt(t),i=Zt(e);return Si(n,i)?ye(n,i):ye(n,i)&&Ys(t)===Ys(e)&&yl(t)===yl(e)&&t.size===e.size}async function _i(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 Ge.lstat(t,{bigint:r});if(!s.isFile()||s.isSymbolicLink())throw new $e("not-regular-file",`${i} must be a regular file`);if(BigInt(s.size)>BigInt(e))throw new $e("too-large",`${i} exceeds ${e} bytes`);let o=await Ge.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:Zt(s)});let a=process.platform==="win32"?Ei.O_RDONLY:Ei.O_RDONLY|Ei.O_NOFOLLOW|Ei.O_NONBLOCK,c;try{c=await Ge.open(t,a)}catch(l){throw l.code==="ELOOP"?new $e("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:r}),Ge.lstat(t,{bigint:r}),Ge.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==o||!xi(s,l)||!xi(s,f))throw new $e("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:Zt(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(h+=S,h>e)throw new $e("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat({bigint:r}),Ge.lstat(t,{bigint:r}),Ge.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!xi(s,p)||!xi(s,m))throw new $e("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:Zt(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:w}}finally{await c.close()}}var $e,Us=K(()=>{"use strict";Ci();$e=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Le}from"fs";import se from"path";function vl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Pi(t,e){let n=se.relative(t,e);return n===""||!se.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${se.sep}`)}async function Js(t,e){let n=se.resolve(t),i=await Le.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Le.realpath(n)}async function Vs(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=se.join(r,n[s]);let o;try{o=await Le.lstat(r)}catch(f){if(vl(f))return{exists:!1,kind:"missing"};throw f}let a=se.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 Le.realpath(r);if(!Pi(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 T(t,e,n){let i=je(e,n.label),r=se.resolve(t),s=await Js(r,n.label),o=i.split("/"),a=se.resolve(r,...o);if(!Pi(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Vs(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Hs(t,e,n){let i=je(e,n.label),r=se.resolve(t),s=await Js(r,n.label),o=i.split("/"),a=r;for(let c of o){a=se.join(a,c);let l;try{l=await Le.lstat(a)}catch(d){if(!vl(d))throw d;try{await Le.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await Le.lstat(a)}let f=se.relative(r,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${f} must be a real directory`);let u=await Le.realpath(a);if(!Pi(s,u))throw new Error(`${n.label} resolves outside the project root`)}return await Vs(r,s,o,{label:n.label,expected:"directory"}),a}async function Ri(t,e,n){return(await T(t,e,{...n,expected:"file"})).exists}async function M(t,e,n,i){let r=await T(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 Js(r.projectRoot,i.label);return _i(r.target,n,{...i,verify:async(o,a)=>{if(!Pi(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Vs(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var oe=K(()=>{"use strict";Us();Ie()});import{createHash as Th}from"crypto";function jh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Oi(t,e={}){return(await Ai(t,e)).document}async function Ih(t){try{return(await M(t,en,ki,{label:en})).bytes}catch(e){if(jh(e))return null;throw e}}function qh(t){return t?{exists:!0,sha256:Th("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ai(t,e={}){let n=await Ih(t);return{document:n?Xt(n.toString("utf8"),e):null,identity:qh(n)}}var en,tn=K(()=>{"use strict";Ie();oe();en=".comet/config.yaml"});import{randomUUID as $h}from"crypto";import{constants as Lh,promises as q}from"fs";import W from"path";async function zs(t,e){try{return await q.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await q.copyFile(t,e,Lh.COPYFILE_EXCL),{linked:!1}}function dt(t,e){let n=W.relative(t,e);return n===""||!W.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${W.sep}`)}function Ti(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Dh(t,e){return ye(t,Ti(e))}function Ni(t,e){let n=Ti(t),i=Ti(e);return Si(n,i)?ye(n,i):ye(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function ji(t){let e=await q.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 q.realpath(t),...Ti(e)}}async function De(t){for(let e of t){let n=await q.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Dh(e,n)||await q.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Fh(t,e){let n=W.resolve(t),i=W.resolve(e);if(!dt(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await ji(n)],s=W.relative(n,i).split(W.sep).filter(Boolean),o=n;for(let a of s){await De(r),o=W.join(o,a);try{await q.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await ji(o);if(!dt(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await De(r),r}async function Mh(t,e){let n=W.resolve(t),i=W.resolve(e);if(!dt(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await ji(n)],s=W.relative(n,i).split(W.sep).filter(Boolean),o=n;for(let a of s){o=W.join(o,a);try{let c=await ji(o);if(!dt(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 De(r),r}async function bl(t){let e;try{e=await q.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 Wh(t,e,n){let i=W.dirname(t),r=await Fh(n.containedRoot,i),s=W.join(i,`.${W.basename(t)}.${$h()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await q.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([q.lstat(s),q.realpath(s)]);if(await De(r),!c.isFile()||c.isSymbolicLink()||!Ni(a,c)||!dt(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(),!Ni(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 De(r);let f=await q.lstat(s);if(!f.isFile()||f.isSymbolicLink()||!Ni(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await zs(s,t),await q.unlink(s)):await q.rename(s,t),await bl(i)}catch(c){await o?.close();try{await De(r),await q.rm(s,{force:!0})}catch{}throw c}}async function ue(t,e,n){await Wh(t,e,n)}async function Gs(t,e){let n=W.dirname(t),i=await Mh(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await q.lstat(t),s=await q.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!dt(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await De(i);let[o,a]=await Promise.all([q.lstat(t),q.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Ni(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await q.unlink(t),await De(i),await bl(n),!0}var pt=K(()=>{"use strict";Ci()});var Xv,Qs=K(()=>{"use strict";pt();tn();oe();Xv=16*1024});var Xs=K(()=>{"use strict";pt();Ie();tn();oe();Qs()});var Fi=K(()=>{"use strict"});var jl=K(()=>{"use strict"});var io=K(()=>{"use strict";Fi()});var Il=K(()=>{"use strict";Fi();io()});var ql=K(()=>{"use strict";Fi();pt();jl();Il();Ie();oe();tn();Xs();Qs();io()});import{TextDecoder as Eg}from"util";function $l(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function xg(t,e){try{return new Eg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function ro(t,e,n,i,r={}){try{let s=await M(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:xg(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function Me(t,e,n,i,r={}){return(await ro(t,e,n,i,r))?.text??null}async function We(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await ro(t,e,i,r),a=await T(t,e,{label:r,expected:"file"});await ue(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await ro(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($l(o.result.stat),$l(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Mi(t,e,n,i,r,s={}){let o=await Me(t,e,i,r);await We(t,e,`${o??""}${n}`,i,r,s)}async function Wi(t,e,n,i={}){let r=await T(t,e,{label:n,expected:"file"});return r.exists?Gs(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Bi=K(()=>{"use strict";ql();Ci()});var Fl={};Yu(Fl,{RUN_STATE_FILE:()=>Yi,applyRunStateToDocument:()=>so,readRunState:()=>oo,removeRunState:()=>ao,runStateFromDocument:()=>Ki,writeRunState:()=>Ui});import _g from"path";function hn(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 mn(t,e){let n=hn(t,e);if(_g.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 Pg(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 Ki(t){if(!t.run_id)return null;let e=hn(t,"run_id"),n=hn(t,"skill"),i=hn(t,"skill_version"),r=hn(t,"skill_hash"),s=mn(t,"pending_ref"),o=mn(t,"trajectory_ref"),a=mn(t,"context_ref"),c=mn(t,"artifacts_ref"),l=mn(t,"checkpoint_ref"),f=Number(t.iteration);if(!Number.isInteger(f)||f<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:Ll(t,"current_step"),iteration:f,pending:Ll(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Pg(t)}}function so(t,e){e?t.run_id=e.runId:delete t.run_id}function Rg(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 Og(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 Ki(e)}async function oo(t,e={}){let n=await Me(t,Yi,Dl,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return Og(i)}async function Ui(t,e,n={}){await We(t,Yi,JSON.stringify(Rg(e),null,2),Dl,"Run state",n)}async function ao(t,e={}){await Wi(t,Yi,"Run state",e)}var Ll,Yi,Dl,Ji=K(()=>{"use strict";Bi();Ll=(t,e)=>{let n=t[e];return n==null?null:String(n)};Yi=".comet/run-state.json",Dl=256*1024});import{createHash as Vw}from"crypto";import{promises as Hw}from"fs";import me from"path";import{spawnSync as tg}from"child_process";function Ju(t){return t.length>0&&/^[A-Za-z0-9@+=:,./\\_-]+$/.test(t)?t:`"${t.replace(/"/g,'""')}"`}function xo(t){return t.map(e=>Ju(e))}import{promises as Vh}from"fs";import N from"path";import{promises as Vu}from"fs";async function bt(t){try{return await Vu.access(t),!0}catch(e){if(Hu(e))return!1;throw e}}function Hu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}Ie();tn();Xs();oe();var nn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Zs=class extends Error{constructor(n,i,r){let s=j(r,n),o=j(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"},Cl=".comet/config.yaml";function Hh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function El(t){await T(t,Cl,{label:Cl,expected:"file"})}function xl(t,e){let n=N.resolve(t),i=e==="docs"?N.join(n,"docs"):n,r=N.join(i,"openspec"),s=N.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:N.join(r,"changes"),archiveDir:N.join(r,"changes","archive"),specsDir:N.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:N.join(s,"specs"),superpowersPlansDir:N.join(s,"plans"),superpowersReportsDir:N.join(s,"reports")}}async function zh(t){await El(t);let e=await Oi(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new nn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new nn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Gh(t,e){return xl(t,e??await zh(t))}async function Qh(t,e){let n=await Gh(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=xl(t,i).openSpecRoot,[s,o]=await Promise.all([T(n.projectRoot,j(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),T(n.projectRoot,j(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 Xh(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=j(t.projectRoot,i);await T(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function fe(t,e,n={}){let i=await Qh(t,e);if(await Xh(i.paths,i.alternateRoot),i.dualRoots&&!n.allowAlternateRoot)throw new Zs(i.paths.openSpecRoot,i.alternateRoot,i.paths.projectRoot);if(!i.configuredRootExists){let r=j(i.paths.projectRoot,i.paths.openSpecRoot),s=j(i.paths.projectRoot,i.alternateRoot);throw new nn(`Configured Classic OpenSpec root is missing: ${r} (alternate ${s} is ${i.alternateRootExists?"present":"missing"})`)}return i.paths}async function rn(t,e,n={}){let i=N.join(N.resolve(t),".comet","classic-root-move.json");if(await bt(i))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await fe(t,e,n);if(!await bt(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${j(r.projectRoot,r.openSpecRoot)}`);return r}async function ve(t){let e=N.resolve(t),n=null;try{(await Vh.lstat(e)).isDirectory()||(e=N.dirname(e))}catch(i){if(!Hh(i))throw i}for(;;){N.basename(e)==="openspec"&&(n=N.dirname(e));let i=N.join(e,".comet","config.yaml"),r=!1;if(await bt(i))try{await El(e);let o=(await Oi(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 bt(N.join(e,".git")))return e;let s=N.dirname(e);if(s===e)return n??N.resolve(t);e=s}}function j(t,e){return N.relative(N.resolve(t),e).replaceAll("\\","/")}var _l=vt(ft(),1);oe();import Zh from"path";var eg=1024*1024;async function Pl(t,e){let n=e??await fe(t),i=Zh.join(n.openSpecRoot,"config.yaml"),r=j(n.projectRoot,i),s;try{s=(await M(n.projectRoot,r,eg,{label:"Classic OpenSpec project config",bigint:!0})).bytes.toString("utf8")}catch(l){throw l.code==="ENOENT"?new Error(`Classic OpenSpec root is unhealthy: ${r} is missing; rerun OpenSpec initialization for the configured Classic layout`,{cause:l}):new Error(`Classic OpenSpec root is unhealthy: ${l instanceof Error?l.message:String(l)}`,{cause:l})}let o=(0,_l.parseDocument)(s,{uniqueKeys:!0});if(o.errors.length>0)throw new Error(`Classic OpenSpec root is unhealthy: ${r} is invalid YAML (${o.errors[0].message})`);let a=o.toJS();if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Classic OpenSpec root is unhealthy: ${r} must contain a mapping`);let c=a.schema;if(typeof c!="string"||c.trim()==="")throw new Error(`Classic OpenSpec root is unhealthy: ${r} must declare a non-empty schema`);return{layout:n,configPath:r,schema:c}}function ng(t){return t[0]==="--"?t.slice(1):[...t]}async function Rl(t,e=process.cwd()){let n=ng(t);if(n.length===0)return{exitCode:64,stderr:"Usage: comet classic openspec -- <openspec-args...>"};let i=await ve(e),r=await rn(i);await Pl(i,r);let s=process.env.COMET_OPENSPEC||"openspec",o=process.platform==="win32",a=tg(s,o?xo(n):n,{cwd:r.openSpecBase,encoding:"utf8",shell:o,windowsHide:!0});if(a.error){let c=a.error.code;return{exitCode:c==="ENOENT"?127:70,stdout:a.stdout||void 0,stderr:a.stderr||(c==="ENOENT"?`OpenSpec CLI not found: ${s}`:a.error.message)}}return{exitCode:a.status??1,stdout:a.stdout||void 0,stderr:a.stderr||void 0}}import{promises as sg}from"fs";import cn from"path";pt();Ie();oe();import sn from"path";var ig=2*1024*1024;function Ii(t,e,n){let i=sn.resolve(t),r=sn.isAbsolute(e)?sn.resolve(e):sn.resolve(i,e),s=sn.relative(i,r).replaceAll("\\","/");return{root:i,relative:je(s,n),target:r}}async function Fe(t,e,n){let i=Ii(t,e,n.label);return T(i.root,i.relative,n)}async function on(t,e,n){return(await Fe(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function an(t,e,n){return(await rg(t,e,n)).toString("utf8")}async function rg(t,e,n){let i=Ii(t,e,n.label);return(await M(i.root,i.relative,n.maxBytes??ig,{label:n.label,hooks:n.hooks})).bytes}async function eo(t,e,n){let i=Ii(t,e,n);return Hs(i.root,i.relative,{label:n})}async function Ol(t,e,n,i){let r=Ii(t,e,i.label);await T(r.root,r.relative,{label:i.label,expected:"file"}),await ue(r.target,n,{containedRoot:r.root,beforeTemporaryOpen:i.beforeTemporaryOpen,beforeCommit:i.beforeCommit,exclusive:i.exclusive})}function to(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}'
143
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function ln(t){let e=to(t);if(e)throw new Error(e)}function og(t,e){return{label:j(t,e),directory:e}}async function qi(t,e,n){let i=og(t,e);if(!(await Fe(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Fe(t,cn.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Al(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function ag(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await qi(t,cn.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Fe(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await sg.readdir(e,{withFileTypes:!0})){if(!Al(o.name,n))continue;let a=await qi(t,cn.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 no(t,e=process.cwd()){ln(t);let n=await fe(e),i=await qi(n.projectRoot,cn.join(n.changesDir,t),`Classic active change ${t}`);return{...i.change,exists:i.exists,stateExists:i.stateExists}}async function $i(t,e=process.cwd(),n={}){ln(t);let i=await fe(e);if(n.preferredArchiveName!==void 0){let r=n.preferredArchiveName;if(r!==t&&!Al(r,t))throw new Error(`Classic preferred archive name '${r}' does not belong to change '${t}'`);let s=await qi(i.projectRoot,cn.join(i.archiveDir,r),`Classic preferred archived change ${r}`);return s.exists&&s.stateExists?s.change:null}return ag(i.projectRoot,i.archiveDir,t,n)}import{promises as vu}from"fs";import Q from"path";import{fileURLToPath as bu}from"url";import{promises as lg}from"fs";import be from"path";oe();Ie();import un from"path";function cg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Nl(t,e,n,i){let r=je(n,"Classic handoff artifact pointer");if((await T(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await fe(t),a=`${j(t,o.changesDir)}/`,l=(o.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>r.startsWith(y));if(!l)return null;let f=r.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];ln(u);let d=f.slice(2),h=un.resolve(e);if(un.dirname(h)!==un.resolve(o.archiveDir))return null;let g=un.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await T(t,j(t,h),{label:"Classic archived change directory",expected:"directory"});let m=un.join(h,".comet",...d),w=j(t,m);try{return await M(t,w,i,{label:"Historical Classic archived handoff artifact"}),w}catch(y){if(cg(y))return null;throw y}}oe();var Tl=2*1024*1024;function fn(t,e){return be.relative(t,e).split(be.sep).join("/")}async function dn(t,e,n){if(!n)return{code:e,satisfied:!1};let i=n.replaceAll("\\","/");try{let r=await Ri(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 ug(t,e,n){try{await fe(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 dn(t,"design.handoff",n);if(!n||i.satisfied||i.detail)return i;try{let r=await Nl(t,e,n,Tl);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 Li(t,e,n){return dn(t,e,fn(t,n))}async function fg(t,e){let n=be.join(e,"specs"),i;try{let o=fn(t,n);if(!(await T(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await lg.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 Ri(t,fn(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]?fn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function dg(t,e){let n,i=fn(t,e);try{n=(await M(t,i,Tl,{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 pn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function mt(t,e){let n=await ve(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([Li(n,"openspec.proposal",r),Li(n,"openspec.design",s),Li(n,"openspec.tasks",o),fg(n,t),dn(n,"design.document",i?.designDoc??null),dn(n,"build.plan",i?.plan??null),dg(n,o),dn(n,"verification.report",i?.verificationReport??null),ug(n,t,i?.handoffContext??null),Li(n,"run.checkpoint",a)]),l=c.find(f=>f.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{createHash as Sw,randomUUID as Cw}from"crypto";import{promises as go}from"fs";import Se from"path";function pg(t){return t.classicProfile??t.workflow}function mg(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 hg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function gg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!pn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!mg(e))return"full.build.configure"}else if(!hg(e))throw new Error(`${t} build configuration is incomplete`);return pn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function wg(t,e,n){return e.verifyResult!=="pass"||!pn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function yg(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 Di(t,e){let n=pg(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 pn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return gg(n,t,e);case"verify":return wg(n,t,e);case"archive":return yg(n,t)}}var Gi=vt(ft(),1);pt();oe();import zi from"path";Ji();var Ml=["full","hotfix","tweak"],Qe=1,Ag=["open","design","build","verify","archive"],Ng=["en","zh-CN"],Tg=["off","beta"],jg=["subagent-driven-development","executing-plans","direct"],Ig=["plan-ready"],qg=["confirmed"],$g=["tdd","direct"],Lg=["off","standard","thorough"],Dg=["current","branch","worktree"],Fg=["light","full"],Mg=["pending","pass","fail"],Wg=["pending","handled"],Bg=["pending","confirmed"],Hi=["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"],Kg=["run_id"],Yg=new Set([...Hi,...Kg]),Ug=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Wl(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ht(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 Y(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 co(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 Jg(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 Vi(t,e){let n=ht(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 Vg(t,e){let n=ht(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 Hg(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==Qe)throw new Error(`Invalid Classic state: classic_migration must be ${Qe}`);return e}function zg(t){if(!Hi.some(n=>Wl(t,n)))return null;for(let n of Ug)if(!Wl(t,n))return null;return{workflow:Y(t,"workflow",Ml,!1),language:Y(t,"language",Ng),phase:Y(t,"phase",Ag,!1),contextCompression:Y(t,"context_compression",Tg),buildMode:Y(t,"build_mode",jg),buildPause:Y(t,"build_pause",Ig),subagentDispatch:Y(t,"subagent_dispatch",qg),tddMode:Y(t,"tdd_mode",$g),reviewMode:Y(t,"review_mode",Lg),isolation:Y(t,"isolation",Dg),boundBranch:ht(t,"bound_branch"),verifyMode:Y(t,"verify_mode",Fg),autoTransition:co(t,"auto_transition"),baseRef:ht(t,"base_ref"),designDoc:Vi(t,"design_doc"),plan:Vi(t,"plan"),verifyResult:Y(t,"verify_result",Mg,!1),verifyFailures:Jg(t,"verify_failures"),verificationReport:Vi(t,"verification_report"),branchStatus:Y(t,"branch_status",Wg),createdAt:ht(t,"created_at"),verifiedAt:ht(t,"verified_at"),archiveConfirmation:Y(t,"archive_confirmation",Bg),archived:co(t,"archived",!1),directOverride:co(t,"direct_override"),handoffContext:Vi(t,"handoff_context"),handoffHash:Vg(t,"handoff_hash"),classicProfile:Y(t,"classic_profile",Ml),classicMigration:Hg(t)}}function lo(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Ki(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:zg(t),run:n,unknownKeys:Object.keys(t).filter(i=>!Yg.has(i))}}function Bl(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}}Ji();var Gg=2*1024*1024;function gn(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 Kl(t,e,n){t.get(e)!==n&&t.set(e,n)}function Qg(t,e){if(e.classic)for(let[n,i]of Object.entries(Bl(e.classic)))Kl(t,n,i);else for(let n of Hi)t.delete(n);so(t.toJS(),e.run),e.run?Kl(t,"run_id",e.run.runId):t.delete("run_id")}function Xg(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 Zg(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function Yl(t){let e;try{e=(await M(zi.dirname(t),zi.basename(t),Gg,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new Gi.Document({})}let n=(0,Gi.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return gn(n),n}async function de(t,e={}){let n=e.migrate!==!1,i=zi.join(t,".comet.yaml"),r=await Yl(i),s=gn(r),o=Zg(r);o&&(s=gn(r));let a=await oo(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Ji(),Fl));a=c(s),a&&n&&(await Ui(t,a),Xg(r),o=!0)}return o&&n&&await ue(i,r.toString(),{containedRoot:t}),lo(gn(r),a)}async function Xe(t,e,n={}){let i=zi.join(t,".comet.yaml"),r=await Yl(i);Qg(r,{...e,unknownKeys:e.unknownKeys??[]}),lo(gn(r),e.run??null),await ue(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await Ui(t,e.run):await ao(t)}function Ul(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}Bi();import Qi from"path";var ke={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pe(t,e){if(Qi.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Qi.resolve(t),i=Qi.resolve(n,e);if(i!==n&&!i.startsWith(n+Qi.sep))throw new Error("Run path must stay inside the change directory")}async function gt(t,e,n,i={}){pe(t,e),await Mi(t,e,`${JSON.stringify(n)}
144
- `,ke.trajectory,"Run trajectory",i)}async function wn(t,e,n={}){pe(t,e);let i=await Me(t,e,ke.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})}})}async function uo(t,e,n={}){pe(t,e);let i=await Me(t,e,ke.artifacts,"Run artifacts",n);return i===null?{}:JSON.parse(i)}async function Xi(t,e,n,i={}){pe(t,e),await We(t,e,JSON.stringify(n,null,2)+`
145
- `,ke.artifacts,"Run artifacts",i)}async function Jl(t,e,n,i={}){pe(t,e),await We(t,e,n,ke.context,"Run context",i)}async function Vl(t,e,n={}){return pe(t,e),Me(t,e,ke.context,"Run context",n)}async function Hl(t,e,n,i={}){pe(t,e),await We(t,e,JSON.stringify(n,null,2)+`
146
- `,ke.pendingAction,"Run pending action",i)}async function zl(t,e,n={}){pe(t,e);let i=await Me(t,e,ke.pendingAction,"Run pending action",n);return i===null?null:JSON.parse(i)}async function Gl(t,e,n={}){pe(t,e),await Wi(t,e,"Run pending action",n)}async function Zi(t,e,n,i={}){pe(t,e),await We(t,e,JSON.stringify(n,null,2)+`
147
- `,ke.checkpoint,"Run checkpoint",i)}import{createHash as uu,randomUUID as ww}from"crypto";import{promises as D}from"fs";import $ from"path";var Zl=vt(ft(),1);import{promises as fo}from"fs";import Z from"path";var ew=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],tw=["deterministic","adaptive"],nw=["function","mcp","script","agent"],iw=["none","read","write","external"],rw=["progress","step","completion"],sw=["artifact_exists","state_equals"];function Ze(t,e,n){return new Error(`${t}: ${e} ${n}`)}function H(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw Ze(e,n,"must be an object")}function Be(t,e,n){if(!Array.isArray(t))throw Ze(e,n,"must be an array")}function U(t,e,n){if(typeof t!="string")throw Ze(e,n,"must be a string")}function ae(t,e,n,i){e in t&&U(t[e],n,`${i}.${e}`)}function eu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw Ze(n,`${i}.${e}`,"must be a boolean")}function Ke(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw Ze(n,i,`must be one of ${e.join(", ")}`)}function er(t,e,n){Be(t,e,n),t.forEach((i,r)=>{U(i,e,`${n}[${r}]`)})}function Ql(t,e,n){H(t,e,n),U(t.name,e,`${n}.name`),U(t.description,e,`${n}.description`),eu(t,"required",e,n)}function ow(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),ae(t,"source",e,n),ae(t,"version",e,n)}function aw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),U(t.role,e,`${n}.role`),ae(t,"instructions",e,n)}function cw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),Ke(t.kind,nw,e,`${n}.kind`),U(t.source,e,`${n}.source`),Ke(t.sideEffect,iw,e,`${n}.sideEffect`),eu(t,"requiresConfirmation",e,n)}function lw(t,e,n){H(t,e,n),Ke(t.type,ew,e,`${n}.type`),ae(t,"ref",e,n),ae(t,"prompt",e,n),ae(t,"question",e,n),"options"in t&&er(t.options,e,`${n}.options`)}function uw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),lw(t.action,e,`${n}.action`),ae(t,"next",e,n),"completionEvals"in t&&er(t.completionEvals,e,`${n}.completionEvals`)}function fw(t,e){let n="goal";H(t,e,n),U(t.statement,e,`${n}.statement`),Be(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{Ql(i,e,`${n}.inputs[${r}]`)}),Be(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{Ql(i,e,`${n}.outputs[${r}]`)}),er(t.success,e,`${n}.success`)}function dw(t,e){let n="orchestration";H(t,e,n),Ke(t.mode,tw,e,`${n}.mode`),ae(t,"entry",e,n),"steps"in t&&(Be(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{uw(i,e,`${n}.steps[${r}]`)}))}function tu(t,e){return H(t,e),Ke(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ke(t.kind,["Skill"],e,"kind"),H(t.metadata,e,"metadata"),U(t.metadata.name,e,"metadata.name"),U(t.metadata.version,e,"metadata.version"),U(t.metadata.description,e,"metadata.description"),fw(t.goal,e),dw(t.orchestration,e),Be(t.skills,e,"skills"),t.skills.forEach((n,i)=>{ow(n,e,`skills[${i}]`)}),Be(t.agents,e,"agents"),t.agents.forEach((n,i)=>{aw(n,e,`agents[${i}]`)}),Be(t.tools,e,"tools"),t.tools.forEach((n,i)=>{cw(n,e,`tools[${i}]`)}),t}function nu(t,e){H(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&er(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw Ze(e,n,"must be a finite number");return t}function pw(t,e){return H(t,e),"runtime"in t&&iu(t.runtime,e,"runtime"),t}function iu(t,e,n){return Be(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;H(i,e,s),U(i.id,e,`${s}.id`),Ke(i.scope,rw,e,`${s}.scope`),Ke(i.type,sw,e,`${s}.type`),ae(i,"artifact",e,s),ae(i,"field",e,s),ae(i,"equals",e,s)}),t}async function po(t){let e=await fo.readFile(t,"utf8");try{return(0,Zl.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw Ze(t,"document",i)}}async function mw(t){try{return await po(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Xl(t){try{return await fo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function hw(t){let e=Z.join(t,"checks.yaml"),n=Z.join(t,"evals.yaml"),[i,r]=await Promise.all([Xl(e),Xl(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:pw(await po(e),e)}:{document:null}}async function ru(t){let e=Z.resolve(t.root),n=Z.resolve(t.controlRoot);t.requireSkillMarkdown&&await fo.access(Z.join(e,"SKILL.md"));let i=Z.join(n,"skill.yaml"),r=Z.join(n,"guardrails.yaml"),s=tu(await po(i),i),o=await mw(r),a=o===null?null:nu(o,r),c=await hw(n),l={allowedSkills:s.skills.map(f=>f.id),allowedAgents:s.agents.map(f=>f.id),allowedTools:s.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function su(t){let e=Z.resolve(t);return ru({root:e,controlRoot:Z.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function ou(t){let e=Z.resolve(t);return ru({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function au(t,e,n=Z.join(e,"package.json")){H(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=tu(t.definition,n),s=nu(t.guardrails,n),o=iu(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:Z.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import cu from"path";function gw(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 lu(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),gw(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=cu.posix.normalize(o.source.replaceAll("\\","/"));(cu.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 tr(t){return Array.isArray(t)?t.map(tr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,tr(n)])):t}function yw(t){return tr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function vw(t){return $.posix.normalize(t.replaceAll("\\","/"))}function wt(t,e,n){let i=$.relative(t,e);if(!(i===""||!$.isAbsolute(i)&&!i.startsWith(`..${$.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function fu(t,e,n){let i=vw(e);if($.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=$.resolve(t,...i.split("/"));wt(t,r,n);let s;try{s=await D.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(wt(t,s,n),!(await D.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await D.readFile(s)}}async function bw(t){let e=await D.realpath(t.root),n=t.packageKind==="runtime"?[]:[await fu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await fu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function kw(t,e){let n=e.map(i=>({path:i.path,sha256:uu("sha256").update(i.content).digest("hex")}));return uu("sha256").update(JSON.stringify(tr({package:t,files:n}))).digest("hex")}function mu(t){return JSON.stringify(t,null,2)+`
148
- `}async function hu(t){let e=yw(t),n=await bw(t);return{document:e,files:n,hash:kw(e,n)}}async function nr(t){return(await hu(t)).hash}async function du(t){try{return await D.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function pu(t,e){try{if((await D.readFile($.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await D.readFile($.join(t,"package.json"),"utf8")!==mu(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await D.readFile($.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function mo(t,e){let n=await hu(t),i=$.resolve(e,".comet","skill-snapshots"),r=$.join(i,n.hash);if(await D.mkdir(i,{recursive:!0}),await du(r))return await pu(r,n),{hash:n.hash,snapshotDir:r};let s=$.join(i,`.tmp-${ww()}`);wt(i,s,"Temporary snapshot"),wt(i,r,"Published snapshot");try{await D.mkdir(s);for(let o of n.files){let a=$.join(s,...o.path.split("/"));wt(s,a,`Snapshot file ${o.path}`),await D.mkdir($.dirname(a),{recursive:!0}),await D.writeFile(a,o.content)}await D.writeFile($.join(s,"package.json"),mu(n.document)),await D.writeFile($.join(s,"sha256"),n.hash+`
149
- `),await D.rename(s,r)}catch(o){if(await du(r)){try{await pu(r,n)}finally{await D.rm(s,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await D.rm(s,{recursive:!0,force:!0}),o}return{hash:n.hash,snapshotDir:r}}async function ho(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=$.resolve(t,".comet","skill-snapshots"),i=$.join(n,e);wt(n,i,"Skill snapshot");try{let r=(await D.readFile($.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=$.join(i,"package.json"),o=JSON.parse(await D.readFile(s,"utf8")),a=au(o,i,s),c=lu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
- `));let l=await nr(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 gu(t){try{return await go.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function wu(t){return Sw("sha256").update(t).digest("hex")}function Ew(t){return wu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function xw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function _w(t,e){let n=await ve(t),i=Object.fromEntries(e.filter(o=>o.satisfied&&o.source).map(o=>[xw(o.code),o.source])),r=Se.join(t,"subagent-progress.md");await gu(r)&&(i.subagent_progress=Se.relative(n,r).split(Se.sep).join("/"));let s=e.find(o=>o.code==="design.handoff"&&o.satisfied);return s?.source&&(i.handoff_context=s.source),i}function Pw(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:Qe,profile:e,source:"pre-migration"}}]}async function Rw(t){await Promise.all(t.map(e=>go.rm(e,{recursive:!0,force:!0})))}async function yu(t,e){let n=await de(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==Qe)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await nr(e.skillPackage)!==n.run.skillHash)return await ho(t,n.run.skillHash),{classic:i,run:n.run,evidence:await mt(t,n),migrated:!1,snapshotDir:Se.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await mo(e.skillPackage,t);return{classic:i,run:n.run,evidence:await mt(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let s=await mt(t,n),o=Di(i,s);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===o))throw new Error(`Classic Skill package does not define resolved step: ${o}`);let a=await nr(e.skillPackage),c=Se.join(t,".comet","skill-snapshots",a),l=await gu(c),f=[];try{let u=await mo(e.skillPackage,t),d=Ul(e.skillPackage,e.runId?.()??Cw(),u.hash);d.currentStep=o,o==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:Qe},g=await _w(t,s),p=await ve(t),m=s.find(k=>k.code==="design.handoff"&&k.satisfied),w=null;m?.source&&(w=await an(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await Jl(t,d.contextRef,w),f.push(Se.resolve(t,d.contextRef))),await Xi(t,d.artifactsRef,g),f.push(Se.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),S={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:wu(w),artifactsHash:Ew(g),createdAt:y};await Zi(t,d.checkpointRef,S),f.push(Se.resolve(t,d.checkpointRef)),f.push(Se.resolve(t,d.trajectoryRef));for(let k of Pw(d,r,y))await gt(t,d.trajectoryRef,k);return await Xe(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:s,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await Rw(f),l||await go.rm(c,{recursive:!0,force:!0}),u}}async function Ow(t){try{return(await vu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ir(t){try{return(await vu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Aw(t){return await Ow(t)?await ir(Q.join(t,"skill.yaml"))?!0:await ir(Q.join(t,"SKILL.md"))&&await ir(Q.join(t,"comet","skill.yaml")):!1}function Nw(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 Tw(){let t=Q.dirname(bu(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,Q.resolve(t,"..","runtime","classic"),Q.resolve(t,"..","..","comet","runtime","classic"),Q.resolve(t,"..","..","assets","skills","comet","runtime","classic"),Q.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,Q.resolve(t,"..","..","comet-classic"),Q.resolve(t,"..","..","assets","skills","comet-classic"),Q.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await Aw(n))return n;return null}async function jw(t){return await ir(Q.join(t,"skill.yaml"))?ou(t):su(t)}async function ku(t){let e=await Tw();return yu(t,{skillPackage:e?await jw(e):Nw(Q.dirname(bu(import.meta.url)))})}async function Su(t,e,n,i){let r=await de(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await mt(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Di(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await Xe(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await wn(t,a.trajectoryRef);return await gt(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}Bi();import Iw from"path";var qw=Iw.join(".comet","state-events.jsonl"),$w=8*1024*1024;async function Cu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Mi(t,qw,`${JSON.stringify(n)}
151
- `,$w,"Classic state event log"),n}var Lw={"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 Dw(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 Eu(t,e,n={}){let i=Lw[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",Dw(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}}Us();import{promises as Fw}from"fs";import Mw from"path";var wo="comet.selection.v2",Ww=16*1024;function yo(t){return Mw.join(t,".comet","current-change.json")}function Bw(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function xu(t){return t===null||typeof t=="string"}function Kw(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(!Bw(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&&!xu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:wo,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==wo)throw new Error(`current change selection schema must be ${wo}`);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(!xu(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 vo(t){let e;try{let i=yo(t),{bytes:r}=await _i(i,Ww,{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",...Kw(e)}}async function _u(t){await Fw.rm(yo(t),{force:!0})}async function Pu(t,e,n){let i=await vo(t);return i.status!=="selected"||i.selection.workflow!==e||i.selection.change!==n?!1:(await _u(t),!0)}var Ru=null;function Ou(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Au(t,e){return(...n)=>{let i=Ru;if(i===null)return e(...n);let r=Ou(`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 bo(t,e){return(...n)=>{let i=Ru;if(i===null)return e(...n);let r=Ou(`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}}import{execFileSync as Nu}from"child_process";var Yw=vt(ft(),1);function Uw(t){try{let e=Nu("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 zS=bo("liveGitBranch",t=>Uw(t));function Jw(t){try{return Nu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var GS=bo("isGitWorkTree",t=>Jw(t));var aC=Au("readCometCurrentSelection",t=>vo(t));async function Tu(t,e){return Pu(t,"classic",e)}var zw="\x1B[32m",Gw="\x1B[31m",Qw="\x1B[33m",So="\x1B[0m";function ee(t){return`${zw}${t}${So}`}function z(t){return`${Gw}${t}${So}`}function yn(t){return`${Qw}${t}${So}`}var B=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},ko=class{stderr=[];openSpecStdout=[];openSpecStderr=[];stepsOk=0;stepsTotal=0;captureOpenSpec(e){e.stdout&&this.openSpecStdout.push(e.stdout),e.stderr&&this.openSpecStderr.push(e.stderr)}toResult(e=0){let n=this.stderr.length>0?this.stderr.join(`
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=wi(e),i=pt(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=wi(e),i=pt(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())}}};cl.Parser=Ls});var pl=v(Qt=>{"use strict";var ll=Es(),oh=Bt(),zt=Ut(),ah=Sr(),ch=_(),lh=$s(),ul=Ds();function fl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new lh.LineCounter||null,prettyErrors:e}}function uh(t,e={}){let{lineCounter:n,prettyErrors:i}=fl(e),r=new ul.Parser(n?.addNewLine),s=new ll.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(zt.prettifyError(t,n)),a.warnings.forEach(zt.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function dl(t,e={}){let{lineCounter:n,prettyErrors:i}=fl(e),r=new ul.Parser(n?.addNewLine),s=new ll.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 zt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(zt.prettifyError(t,n)),o.warnings.forEach(zt.prettifyError(t,n))),o}function fh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=dl(t,n);if(!r)return null;if(r.warnings.forEach(s=>ah.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 dh(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 ch.isDocument(t)&&!i?t.toString(n):new oh.Document(t,i,n).toString(n)}Qt.parse=fh;Qt.parseAllDocuments=uh;Qt.parseDocument=dl;Qt.stringify=dh});var ze=v(O=>{"use strict";var ph=Es(),mh=Bt(),hh=rs(),Fs=Ut(),gh=_t(),je=_(),wh=Re(),yh=I(),vh=Ae(),bh=Ne(),kh=hi(),Sh=Is(),Ch=$s(),Eh=Ds(),vi=pl(),ml=St();O.Composer=ph.Composer;O.Document=mh.Document;O.Schema=hh.Schema;O.YAMLError=Fs.YAMLError;O.YAMLParseError=Fs.YAMLParseError;O.YAMLWarning=Fs.YAMLWarning;O.Alias=gh.Alias;O.isAlias=je.isAlias;O.isCollection=je.isCollection;O.isDocument=je.isDocument;O.isMap=je.isMap;O.isNode=je.isNode;O.isPair=je.isPair;O.isScalar=je.isScalar;O.isSeq=je.isSeq;O.Pair=wh.Pair;O.Scalar=yh.Scalar;O.YAMLMap=vh.YAMLMap;O.YAMLSeq=bh.YAMLSeq;O.CST=kh;O.Lexer=Sh.Lexer;O.LineCounter=Ch.LineCounter;O.Parser=Eh.Parser;O.parse=vi.parse;O.parseAllDocuments=vi.parseAllDocuments;O.parseDocument=vi.parseDocument;O.stringify=vi.stringify;O.visit=ml.visit;O.visitAsync=ml.visitAsync});import bi from"path";function Ph(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||bi.posix.isAbsolute(n)||bi.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 ki(t){let e=Ph(t,"native.artifact_root");return e.length===0?".":e.join("/")}function gl(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 Ie(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||bi.posix.isAbsolute(i)||bi.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 Xt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function wl(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 yl(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>Ws)throw new Error(`${e} exceeds ${Ws} 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>Bs)throw new Error(`${e} contains more than ${Bs} wildcard tokens`);return t}function hl(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=>yl(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function Ms(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 Rh(t){if(t===void 0)return{...we,include:[...we.include],exclude:[...we.exclude]};let e=Xt(t,"native.snapshot");return{include:hl(e.include,"native.snapshot.include",we.include),exclude:hl(e.exclude,"native.snapshot.exclude",we.exclude),max_files:Ms(e.max_files,we.max_files,"native.snapshot.max_files"),max_total_bytes:Ms(e.max_total_bytes,we.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Ms(e.max_duration_ms,we.max_duration_ms,"native.snapshot.max_duration_ms")}}function Oh(t){if(t===void 0)return;let e=Xt(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=Xt(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,f=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 f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:ki(i),toArtifactRoot:ki(r),stage:s,...o?{cleanup:o}:{}}}function Ah(t,e={}){let n=Xt(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let s=n.archive_confirmation??"automatic";if(s!=="automatic"&&s!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=n.max_verify_failures??xh;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Oh(n.pending_root_move);return{artifact_root:ki(i),language:wl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:s,max_verify_failures:o,snapshot:Rh(n.snapshot),...a?{pending_root_move:a}:{}}}function Nh(t){let e=Xt(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:gl(e.artifact_layout),language:wl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function Th(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function jh(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 mt(t,e={}){let n=(0,Ks.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=Th(r.ambient_resume),o=r.native===void 0?void 0:Ah(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),a=r.classic===void 0?void 0:Nh(r.classic),c=jh(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}var Ks,Zt,Ws,Bs,xh,_h,we,ye=K(()=>{"use strict";Ks=nt(ze(),1),Zt=64*1024,Ws=1024,Bs=64,xh=5,_h=[".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/**"],we={include:["**/*"],exclude:[..._h],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function qe(t){return t!==0&&t!==0n&&t!=="0"}function Si(t,e){return qe(t.dev)&&qe(e.dev)&&qe(t.ino)&&qe(e.ino)}function ve(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 Ci=K(()=>{"use strict"});import{constants as Ei,promises as Qe}from"fs";function Ys(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function vl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function en(t){return{dev:t.dev,ino:t.ino,birthtime:Ys(t)}}function xi(t,e){let n=en(t),i=en(e);return Si(n,i)?ve(n,i):ve(n,i)&&Ys(t)===Ys(e)&&vl(t)===vl(e)&&t.size===e.size}async function _i(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 Qe.lstat(t,{bigint:r});if(!s.isFile()||s.isSymbolicLink())throw new $e("not-regular-file",`${i} must be a regular file`);if(BigInt(s.size)>BigInt(e))throw new $e("too-large",`${i} exceeds ${e} bytes`);let o=await Qe.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:en(s)});let a=process.platform==="win32"?Ei.O_RDONLY:Ei.O_RDONLY|Ei.O_NOFOLLOW|Ei.O_NONBLOCK,c;try{c=await Qe.open(t,a)}catch(l){throw l.code==="ELOOP"?new $e("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:r}),Qe.lstat(t,{bigint:r}),Qe.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==o||!xi(s,l)||!xi(s,f))throw new $e("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:en(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(h+=S,h>e)throw new $e("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat({bigint:r}),Qe.lstat(t,{bigint:r}),Qe.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!xi(s,p)||!xi(s,m))throw new $e("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:en(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:w}}finally{await c.close()}}var $e,Us=K(()=>{"use strict";Ci();$e=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Le}from"fs";import oe from"path";function bl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Pi(t,e){let n=oe.relative(t,e);return n===""||!oe.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${oe.sep}`)}async function Js(t,e){let n=oe.resolve(t),i=await Le.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Le.realpath(n)}async function Vs(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=oe.join(r,n[s]);let o;try{o=await Le.lstat(r)}catch(f){if(bl(f))return{exists:!1,kind:"missing"};throw f}let a=oe.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 Le.realpath(r);if(!Pi(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 T(t,e,n){let i=Ie(e,n.label),r=oe.resolve(t),s=await Js(r,n.label),o=i.split("/"),a=oe.resolve(r,...o);if(!Pi(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Vs(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Hs(t,e,n){let i=Ie(e,n.label),r=oe.resolve(t),s=await Js(r,n.label),o=i.split("/"),a=r;for(let c of o){a=oe.join(a,c);let l;try{l=await Le.lstat(a)}catch(d){if(!bl(d))throw d;try{await Le.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await Le.lstat(a)}let f=oe.relative(r,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${f} must be a real directory`);let u=await Le.realpath(a);if(!Pi(s,u))throw new Error(`${n.label} resolves outside the project root`)}return await Vs(r,s,o,{label:n.label,expected:"directory"}),a}async function Ri(t,e,n){return(await T(t,e,{...n,expected:"file"})).exists}async function F(t,e,n,i){let r=await T(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 Js(r.projectRoot,i.label);return _i(r.target,n,{...i,verify:async(o,a)=>{if(!Pi(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Vs(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var Z=K(()=>{"use strict";Us();ye()});import{createHash as Ih}from"crypto";function qh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Oi(t,e={}){return(await Ai(t,e)).document}async function $h(t){try{return(await F(t,tn,Zt,{label:tn})).bytes}catch(e){if(qh(e))return null;throw e}}function Lh(t){return t?{exists:!0,sha256:Ih("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ai(t,e={}){let n=await $h(t);return{document:n?mt(n.toString("utf8"),e):null,identity:Lh(n)}}var tn,nn=K(()=>{"use strict";ye();Z();tn=".comet/config.yaml"});import{randomUUID as Dh}from"crypto";import{constants as Fh,promises as q}from"fs";import W from"path";async function Gs(t,e){try{return await q.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await q.copyFile(t,e,Fh.COPYFILE_EXCL),{linked:!1}}function ht(t,e){let n=W.relative(t,e);return n===""||!W.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${W.sep}`)}function Ti(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Mh(t,e){return ve(t,Ti(e))}function Ni(t,e){let n=Ti(t),i=Ti(e);return Si(n,i)?ve(n,i):ve(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function ji(t){let e=await q.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 q.realpath(t),...Ti(e)}}async function De(t){for(let e of t){let n=await q.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Mh(e,n)||await q.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Wh(t,e){let n=W.resolve(t),i=W.resolve(e);if(!ht(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await ji(n)],s=W.relative(n,i).split(W.sep).filter(Boolean),o=n;for(let a of s){await De(r),o=W.join(o,a);try{await q.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await ji(o);if(!ht(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await De(r),r}async function Bh(t,e){let n=W.resolve(t),i=W.resolve(e);if(!ht(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await ji(n)],s=W.relative(n,i).split(W.sep).filter(Boolean),o=n;for(let a of s){o=W.join(o,a);try{let c=await ji(o);if(!ht(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 De(r),r}async function kl(t){let e;try{e=await q.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 Kh(t,e,n){let i=W.dirname(t),r=await Wh(n.containedRoot,i),s=W.join(i,`.${W.basename(t)}.${Dh()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await q.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([q.lstat(s),q.realpath(s)]);if(await De(r),!c.isFile()||c.isSymbolicLink()||!Ni(a,c)||!ht(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(),!Ni(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 De(r);let f=await q.lstat(s);if(!f.isFile()||f.isSymbolicLink()||!Ni(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await Gs(s,t),await q.unlink(s)):await q.rename(s,t),await kl(i)}catch(c){await o?.close();try{await De(r),await q.rm(s,{force:!0})}catch{}throw c}}async function ae(t,e,n){await Kh(t,e,n)}async function zs(t,e){let n=W.dirname(t),i=await Bh(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await q.lstat(t),s=await q.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!ht(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await De(i);let[o,a]=await Promise.all([q.lstat(t),q.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Ni(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await q.unlink(t),await De(i),await kl(n),!0}var Xe=K(()=>{"use strict";Ci()});var tb,Qs=K(()=>{"use strict";Xe();nn();Z();tb=16*1024});var Zs=K(()=>{"use strict";Xe();ye();nn();Z();Qs()});var Fi=K(()=>{"use strict"});var Il=K(()=>{"use strict"});var ro=K(()=>{"use strict";Fi()});var ql=K(()=>{"use strict";Fi();ro()});var _g,$l=K(()=>{"use strict";_g=nt(ze(),1);Xe();ye();Z()});var Ll=K(()=>{"use strict";Fi();Xe();Il();ql();ye();$l();Z();nn();Zs();Qs();ro()});import{TextDecoder as Pg}from"util";function Dl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Rg(t,e){try{return new Pg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function so(t,e,n,i,r={}){try{let s=await F(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:Rg(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function Me(t,e,n,i,r={}){return(await so(t,e,n,i,r))?.text??null}async function We(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await so(t,e,i,r),a=await T(t,e,{label:r,expected:"file"});await ae(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await so(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ve(Dl(o.result.stat),Dl(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Mi(t,e,n,i,r,s={}){let o=await Me(t,e,i,r);await We(t,e,`${o??""}${n}`,i,r,s)}async function Wi(t,e,n,i={}){let r=await T(t,e,{label:n,expected:"file"});return r.exists?zs(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Bi=K(()=>{"use strict";Ll();Ci()});var Wl={};Ju(Wl,{RUN_STATE_FILE:()=>Yi,applyRunStateToDocument:()=>oo,readRunState:()=>ao,removeRunState:()=>co,runStateFromDocument:()=>Ki,writeRunState:()=>Ui});import Og from"path";function gn(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 hn(t,e){let n=gn(t,e);if(Og.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 Ag(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 Ki(t){if(!t.run_id)return null;let e=gn(t,"run_id"),n=gn(t,"skill"),i=gn(t,"skill_version"),r=gn(t,"skill_hash"),s=hn(t,"pending_ref"),o=hn(t,"trajectory_ref"),a=hn(t,"context_ref"),c=hn(t,"artifacts_ref"),l=hn(t,"checkpoint_ref"),f=Number(t.iteration);if(!Number.isInteger(f)||f<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:Fl(t,"current_step"),iteration:f,pending:Fl(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Ag(t)}}function oo(t,e){e?t.run_id=e.runId:delete t.run_id}function Ng(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 Tg(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 Ki(e)}async function ao(t,e={}){let n=await Me(t,Yi,Ml,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return Tg(i)}async function Ui(t,e,n={}){await We(t,Yi,JSON.stringify(Ng(e),null,2),Ml,"Run state",n)}async function co(t,e={}){await Wi(t,Yi,"Run state",e)}var Fl,Yi,Ml,Ji=K(()=>{"use strict";Bi();Fl=(t,e)=>{let n=t[e];return n==null?null:String(n)};Yi=".comet/run-state.json",Ml=256*1024});import{createHash as zw}from"crypto";import{promises as Qw}from"fs";import me from"path";import{spawnSync as ng}from"child_process";function Hu(t){return t.length>0&&/^[A-Za-z0-9@+=:,./\\_-]+$/.test(t)?t:`"${t.replace(/"/g,'""')}"`}function _o(t){return t.map(e=>Hu(e))}import{promises as Hh}from"fs";import N from"path";import{promises as Gu}from"fs";async function kt(t){try{return await Gu.access(t),!0}catch(e){if(zu(e))return!1;throw e}}function zu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ye();nn();Zs();Z();var rn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},eo=class extends Error{constructor(n,i,r){let s=j(r,n),o=j(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"},El=".comet/config.yaml";function Gh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function xl(t){await T(t,El,{label:El,expected:"file"})}function _l(t,e){let n=N.resolve(t),i=e==="docs"?N.join(n,"docs"):n,r=N.join(i,"openspec"),s=N.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:N.join(r,"changes"),archiveDir:N.join(r,"changes","archive"),specsDir:N.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:N.join(s,"specs"),superpowersPlansDir:N.join(s,"plans"),superpowersReportsDir:N.join(s,"reports")}}async function zh(t){await xl(t);let e=await Oi(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new rn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new rn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Qh(t,e){return _l(t,e??await zh(t))}async function Xh(t,e){let n=await Qh(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=_l(t,i).openSpecRoot,[s,o]=await Promise.all([T(n.projectRoot,j(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),T(n.projectRoot,j(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 Zh(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=j(t.projectRoot,i);await T(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function fe(t,e,n={}){let i=await Xh(t,e);if(await Zh(i.paths,i.alternateRoot),i.dualRoots&&!n.allowAlternateRoot)throw new eo(i.paths.openSpecRoot,i.alternateRoot,i.paths.projectRoot);if(!i.configuredRootExists){let r=j(i.paths.projectRoot,i.paths.openSpecRoot),s=j(i.paths.projectRoot,i.alternateRoot);throw new rn(`Configured Classic OpenSpec root is missing: ${r} (alternate ${s} is ${i.alternateRootExists?"present":"missing"})`)}return i.paths}async function sn(t,e,n={}){let i=N.join(N.resolve(t),".comet","classic-root-move.json");if(await kt(i))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await fe(t,e,n);if(!await kt(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${j(r.projectRoot,r.openSpecRoot)}`);return r}async function be(t){let e=N.resolve(t),n=null;try{(await Hh.lstat(e)).isDirectory()||(e=N.dirname(e))}catch(i){if(!Gh(i))throw i}for(;;){N.basename(e)==="openspec"&&(n=N.dirname(e));let i=N.join(e,".comet","config.yaml"),r=!1;if(await kt(i))try{await xl(e);let o=(await Oi(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 kt(N.join(e,".git")))return e;let s=N.dirname(e);if(s===e)return n??N.resolve(t);e=s}}function j(t,e){return N.relative(N.resolve(t),e).replaceAll("\\","/")}var Pl=nt(ze(),1);Z();import eg from"path";var tg=1024*1024;async function Rl(t,e){let n=e??await fe(t),i=eg.join(n.openSpecRoot,"config.yaml"),r=j(n.projectRoot,i),s;try{s=(await F(n.projectRoot,r,tg,{label:"Classic OpenSpec project config",bigint:!0})).bytes.toString("utf8")}catch(l){throw l.code==="ENOENT"?new Error(`Classic OpenSpec root is unhealthy: ${r} is missing; rerun OpenSpec initialization for the configured Classic layout`,{cause:l}):new Error(`Classic OpenSpec root is unhealthy: ${l instanceof Error?l.message:String(l)}`,{cause:l})}let o=(0,Pl.parseDocument)(s,{uniqueKeys:!0});if(o.errors.length>0)throw new Error(`Classic OpenSpec root is unhealthy: ${r} is invalid YAML (${o.errors[0].message})`);let a=o.toJS();if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Classic OpenSpec root is unhealthy: ${r} must contain a mapping`);let c=a.schema;if(typeof c!="string"||c.trim()==="")throw new Error(`Classic OpenSpec root is unhealthy: ${r} must declare a non-empty schema`);return{layout:n,configPath:r,schema:c}}function ig(t){return t[0]==="--"?t.slice(1):[...t]}async function Ol(t,e=process.cwd()){let n=ig(t);if(n.length===0)return{exitCode:64,stderr:"Usage: comet classic openspec -- <openspec-args...>"};let i=await be(e),r=await sn(i);await Rl(i,r);let s=process.env.COMET_OPENSPEC||"openspec",o=process.platform==="win32",a=ng(s,o?_o(n):n,{cwd:r.openSpecBase,encoding:"utf8",shell:o,windowsHide:!0});if(a.error){let c=a.error.code;return{exitCode:c==="ENOENT"?127:70,stdout:a.stdout||void 0,stderr:a.stderr||(c==="ENOENT"?`OpenSpec CLI not found: ${s}`:a.error.message)}}return{exitCode:a.status??1,stdout:a.stdout||void 0,stderr:a.stderr||void 0}}import{promises as og}from"fs";import ln from"path";Xe();ye();Z();import on from"path";var rg=2*1024*1024;function Ii(t,e,n){let i=on.resolve(t),r=on.isAbsolute(e)?on.resolve(e):on.resolve(i,e),s=on.relative(i,r).replaceAll("\\","/");return{root:i,relative:Ie(s,n),target:r}}async function Fe(t,e,n){let i=Ii(t,e,n.label);return T(i.root,i.relative,n)}async function an(t,e,n){return(await Fe(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function cn(t,e,n){return(await sg(t,e,n)).toString("utf8")}async function sg(t,e,n){let i=Ii(t,e,n.label);return(await F(i.root,i.relative,n.maxBytes??rg,{label:n.label,hooks:n.hooks})).bytes}async function to(t,e,n){let i=Ii(t,e,n);return Hs(i.root,i.relative,{label:n})}async function Al(t,e,n,i){let r=Ii(t,e,i.label);await T(r.root,r.relative,{label:i.label,expected:"file"}),await ae(r.target,n,{containedRoot:r.root,beforeTemporaryOpen:i.beforeTemporaryOpen,beforeCommit:i.beforeCommit,exclusive:i.exclusive})}function no(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}'
143
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function un(t){let e=no(t);if(e)throw new Error(e)}function ag(t,e){return{label:j(t,e),directory:e}}async function qi(t,e,n){let i=ag(t,e);if(!(await Fe(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Fe(t,ln.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Nl(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function cg(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await qi(t,ln.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Fe(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await og.readdir(e,{withFileTypes:!0})){if(!Nl(o.name,n))continue;let a=await qi(t,ln.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 io(t,e=process.cwd()){un(t);let n=await fe(e),i=await qi(n.projectRoot,ln.join(n.changesDir,t),`Classic active change ${t}`);return{...i.change,exists:i.exists,stateExists:i.stateExists}}async function $i(t,e=process.cwd(),n={}){un(t);let i=await fe(e);if(n.preferredArchiveName!==void 0){let r=n.preferredArchiveName;if(r!==t&&!Nl(r,t))throw new Error(`Classic preferred archive name '${r}' does not belong to change '${t}'`);let s=await qi(i.projectRoot,ln.join(i.archiveDir,r),`Classic preferred archived change ${r}`);return s.exists&&s.stateExists?s.change:null}return cg(i.projectRoot,i.archiveDir,t,n)}import{promises as ku}from"fs";import Q from"path";import{fileURLToPath as Su}from"url";import{promises as ug}from"fs";import ke from"path";Z();ye();import fn from"path";function lg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Tl(t,e,n,i){let r=Ie(n,"Classic handoff artifact pointer");if((await T(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await fe(t),a=`${j(t,o.changesDir)}/`,l=(o.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>r.startsWith(y));if(!l)return null;let f=r.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];un(u);let d=f.slice(2),h=fn.resolve(e);if(fn.dirname(h)!==fn.resolve(o.archiveDir))return null;let g=fn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await T(t,j(t,h),{label:"Classic archived change directory",expected:"directory"});let m=fn.join(h,".comet",...d),w=j(t,m);try{return await F(t,w,i,{label:"Historical Classic archived handoff artifact"}),w}catch(y){if(lg(y))return null;throw y}}Z();var jl=2*1024*1024;function dn(t,e){return ke.relative(t,e).split(ke.sep).join("/")}async function pn(t,e,n){if(!n)return{code:e,satisfied:!1};let i=n.replaceAll("\\","/");try{let r=await Ri(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 fg(t,e,n){try{await fe(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 pn(t,"design.handoff",n);if(!n||i.satisfied||i.detail)return i;try{let r=await Tl(t,e,n,jl);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 Li(t,e,n){return pn(t,e,dn(t,n))}async function dg(t,e){let n=ke.join(e,"specs"),i;try{let o=dn(t,n);if(!(await T(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await ug.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=>ke.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Ri(t,dn(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]?dn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function pg(t,e){let n,i=dn(t,e);try{n=(await F(t,i,jl,{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 mn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function gt(t,e){let n=await be(t),i=e.classic,r=ke.join(t,"proposal.md"),s=ke.join(t,"design.md"),o=ke.join(t,"tasks.md"),a=e.run?ke.resolve(t,e.run.checkpointRef):ke.join(t,".comet","checkpoint.json"),c=await Promise.all([Li(n,"openspec.proposal",r),Li(n,"openspec.design",s),Li(n,"openspec.tasks",o),dg(n,t),pn(n,"design.document",i?.designDoc??null),pn(n,"build.plan",i?.plan??null),pg(n,o),pn(n,"verification.report",i?.verificationReport??null),fg(n,t,i?.handoffContext??null),Li(n,"run.checkpoint",a)]),l=c.find(f=>f.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{createHash as xw,randomUUID as _w}from"crypto";import{promises as wo}from"fs";import Ce from"path";function mg(t){return t.classicProfile??t.workflow}function hg(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 gg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function wg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!mn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!hg(e))return"full.build.configure"}else if(!gg(e))throw new Error(`${t} build configuration is incomplete`);return mn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function yg(t,e,n){return e.verifyResult!=="pass"||!mn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function vg(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 Di(t,e){let n=mg(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 mn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return wg(n,t,e);case"verify":return yg(n,t,e);case"archive":return vg(n,t)}}var zi=nt(ze(),1);Xe();Z();import Gi from"path";Ji();var Bl=["full","hotfix","tweak"],Ze=1,jg=["open","design","build","verify","archive"],Ig=["en","zh-CN"],qg=["off","beta"],$g=["subagent-driven-development","executing-plans","direct"],Lg=["plan-ready"],Dg=["confirmed"],Fg=["tdd","direct"],Mg=["off","standard","thorough"],Wg=["current","branch","worktree"],Bg=["light","full"],Kg=["pending","pass","fail"],Yg=["pending","handled"],Ug=["pending","confirmed"],Hi=["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"],Jg=["run_id"],Vg=new Set([...Hi,...Jg]),Hg=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Kl(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function wt(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 Y(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 lo(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 Gg(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 Vi(t,e){let n=wt(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 zg(t,e){let n=wt(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 Qg(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==Ze)throw new Error(`Invalid Classic state: classic_migration must be ${Ze}`);return e}function Xg(t){if(!Hi.some(n=>Kl(t,n)))return null;for(let n of Hg)if(!Kl(t,n))return null;return{workflow:Y(t,"workflow",Bl,!1),language:Y(t,"language",Ig),phase:Y(t,"phase",jg,!1),contextCompression:Y(t,"context_compression",qg),buildMode:Y(t,"build_mode",$g),buildPause:Y(t,"build_pause",Lg),subagentDispatch:Y(t,"subagent_dispatch",Dg),tddMode:Y(t,"tdd_mode",Fg),reviewMode:Y(t,"review_mode",Mg),isolation:Y(t,"isolation",Wg),boundBranch:wt(t,"bound_branch"),verifyMode:Y(t,"verify_mode",Bg),autoTransition:lo(t,"auto_transition"),baseRef:wt(t,"base_ref"),designDoc:Vi(t,"design_doc"),plan:Vi(t,"plan"),verifyResult:Y(t,"verify_result",Kg,!1),verifyFailures:Gg(t,"verify_failures"),verificationReport:Vi(t,"verification_report"),branchStatus:Y(t,"branch_status",Yg),createdAt:wt(t,"created_at"),verifiedAt:wt(t,"verified_at"),archiveConfirmation:Y(t,"archive_confirmation",Ug),archived:lo(t,"archived",!1),directOverride:lo(t,"direct_override"),handoffContext:Vi(t,"handoff_context"),handoffHash:zg(t,"handoff_hash"),classicProfile:Y(t,"classic_profile",Bl),classicMigration:Qg(t)}}function uo(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Ki(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:Xg(t),run:n,unknownKeys:Object.keys(t).filter(i=>!Vg.has(i))}}function Yl(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}}Ji();var Zg=2*1024*1024;function wn(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 Ul(t,e,n){t.get(e)!==n&&t.set(e,n)}function ew(t,e){if(e.classic)for(let[n,i]of Object.entries(Yl(e.classic)))Ul(t,n,i);else for(let n of Hi)t.delete(n);oo(t.toJS(),e.run),e.run?Ul(t,"run_id",e.run.runId):t.delete("run_id")}function tw(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 nw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function Jl(t){let e;try{e=(await F(Gi.dirname(t),Gi.basename(t),Zg,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new zi.Document({})}let n=(0,zi.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return wn(n),n}async function de(t,e={}){let n=e.migrate!==!1,i=Gi.join(t,".comet.yaml"),r=await Jl(i),s=wn(r),o=nw(r);o&&(s=wn(r));let a=await ao(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Ji(),Wl));a=c(s),a&&n&&(await Ui(t,a),tw(r),o=!0)}return o&&n&&await ae(i,r.toString(),{containedRoot:t}),uo(wn(r),a)}async function et(t,e,n={}){let i=Gi.join(t,".comet.yaml"),r=await Jl(i);ew(r,{...e,unknownKeys:e.unknownKeys??[]}),uo(wn(r),e.run??null),await ae(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await Ui(t,e.run):await co(t)}function Vl(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}Bi();import Qi from"path";var Se={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pe(t,e){if(Qi.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Qi.resolve(t),i=Qi.resolve(n,e);if(i!==n&&!i.startsWith(n+Qi.sep))throw new Error("Run path must stay inside the change directory")}async function yt(t,e,n,i={}){pe(t,e),await Mi(t,e,`${JSON.stringify(n)}
144
+ `,Se.trajectory,"Run trajectory",i)}async function yn(t,e,n={}){pe(t,e);let i=await Me(t,e,Se.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})}})}async function fo(t,e,n={}){pe(t,e);let i=await Me(t,e,Se.artifacts,"Run artifacts",n);return i===null?{}:JSON.parse(i)}async function Xi(t,e,n,i={}){pe(t,e),await We(t,e,JSON.stringify(n,null,2)+`
145
+ `,Se.artifacts,"Run artifacts",i)}async function Hl(t,e,n,i={}){pe(t,e),await We(t,e,n,Se.context,"Run context",i)}async function Gl(t,e,n={}){return pe(t,e),Me(t,e,Se.context,"Run context",n)}async function zl(t,e,n,i={}){pe(t,e),await We(t,e,JSON.stringify(n,null,2)+`
146
+ `,Se.pendingAction,"Run pending action",i)}async function Ql(t,e,n={}){pe(t,e);let i=await Me(t,e,Se.pendingAction,"Run pending action",n);return i===null?null:JSON.parse(i)}async function Xl(t,e,n={}){pe(t,e),await Wi(t,e,"Run pending action",n)}async function Zi(t,e,n,i={}){pe(t,e),await We(t,e,JSON.stringify(n,null,2)+`
147
+ `,Se.checkpoint,"Run checkpoint",i)}import{createHash as du,randomUUID as bw}from"crypto";import{promises as D}from"fs";import $ from"path";var tu=nt(ze(),1);import{promises as po}from"fs";import ee from"path";var iw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],rw=["deterministic","adaptive"],sw=["function","mcp","script","agent"],ow=["none","read","write","external"],aw=["progress","step","completion"],cw=["artifact_exists","state_equals"];function tt(t,e,n){return new Error(`${t}: ${e} ${n}`)}function H(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw tt(e,n,"must be an object")}function Be(t,e,n){if(!Array.isArray(t))throw tt(e,n,"must be an array")}function U(t,e,n){if(typeof t!="string")throw tt(e,n,"must be a string")}function ce(t,e,n,i){e in t&&U(t[e],n,`${i}.${e}`)}function nu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw tt(n,`${i}.${e}`,"must be a boolean")}function Ke(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw tt(n,i,`must be one of ${e.join(", ")}`)}function er(t,e,n){Be(t,e,n),t.forEach((i,r)=>{U(i,e,`${n}[${r}]`)})}function Zl(t,e,n){H(t,e,n),U(t.name,e,`${n}.name`),U(t.description,e,`${n}.description`),nu(t,"required",e,n)}function lw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),ce(t,"source",e,n),ce(t,"version",e,n)}function uw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),U(t.role,e,`${n}.role`),ce(t,"instructions",e,n)}function fw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),Ke(t.kind,sw,e,`${n}.kind`),U(t.source,e,`${n}.source`),Ke(t.sideEffect,ow,e,`${n}.sideEffect`),nu(t,"requiresConfirmation",e,n)}function dw(t,e,n){H(t,e,n),Ke(t.type,iw,e,`${n}.type`),ce(t,"ref",e,n),ce(t,"prompt",e,n),ce(t,"question",e,n),"options"in t&&er(t.options,e,`${n}.options`)}function pw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),dw(t.action,e,`${n}.action`),ce(t,"next",e,n),"completionEvals"in t&&er(t.completionEvals,e,`${n}.completionEvals`)}function mw(t,e){let n="goal";H(t,e,n),U(t.statement,e,`${n}.statement`),Be(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{Zl(i,e,`${n}.inputs[${r}]`)}),Be(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{Zl(i,e,`${n}.outputs[${r}]`)}),er(t.success,e,`${n}.success`)}function hw(t,e){let n="orchestration";H(t,e,n),Ke(t.mode,rw,e,`${n}.mode`),ce(t,"entry",e,n),"steps"in t&&(Be(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{pw(i,e,`${n}.steps[${r}]`)}))}function iu(t,e){return H(t,e),Ke(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ke(t.kind,["Skill"],e,"kind"),H(t.metadata,e,"metadata"),U(t.metadata.name,e,"metadata.name"),U(t.metadata.version,e,"metadata.version"),U(t.metadata.description,e,"metadata.description"),mw(t.goal,e),hw(t.orchestration,e),Be(t.skills,e,"skills"),t.skills.forEach((n,i)=>{lw(n,e,`skills[${i}]`)}),Be(t.agents,e,"agents"),t.agents.forEach((n,i)=>{uw(n,e,`agents[${i}]`)}),Be(t.tools,e,"tools"),t.tools.forEach((n,i)=>{fw(n,e,`tools[${i}]`)}),t}function ru(t,e){H(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&er(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw tt(e,n,"must be a finite number");return t}function gw(t,e){return H(t,e),"runtime"in t&&su(t.runtime,e,"runtime"),t}function su(t,e,n){return Be(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;H(i,e,s),U(i.id,e,`${s}.id`),Ke(i.scope,aw,e,`${s}.scope`),Ke(i.type,cw,e,`${s}.type`),ce(i,"artifact",e,s),ce(i,"field",e,s),ce(i,"equals",e,s)}),t}async function mo(t){let e=await po.readFile(t,"utf8");try{return(0,tu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw tt(t,"document",i)}}async function ww(t){try{return await mo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function eu(t){try{return await po.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function yw(t){let e=ee.join(t,"checks.yaml"),n=ee.join(t,"evals.yaml"),[i,r]=await Promise.all([eu(e),eu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:gw(await mo(e),e)}:{document:null}}async function ou(t){let e=ee.resolve(t.root),n=ee.resolve(t.controlRoot);t.requireSkillMarkdown&&await po.access(ee.join(e,"SKILL.md"));let i=ee.join(n,"skill.yaml"),r=ee.join(n,"guardrails.yaml"),s=iu(await mo(i),i),o=await ww(r),a=o===null?null:ru(o,r),c=await yw(n),l={allowedSkills:s.skills.map(f=>f.id),allowedAgents:s.agents.map(f=>f.id),allowedTools:s.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function au(t){let e=ee.resolve(t);return ou({root:e,controlRoot:ee.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function cu(t){let e=ee.resolve(t);return ou({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function lu(t,e,n=ee.join(e,"package.json")){H(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=iu(t.definition,n),s=ru(t.guardrails,n),o=su(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:ee.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import uu from"path";function vw(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 fu(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),vw(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=uu.posix.normalize(o.source.replaceAll("\\","/"));(uu.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 tr(t){return Array.isArray(t)?t.map(tr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,tr(n)])):t}function kw(t){return tr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Sw(t){return $.posix.normalize(t.replaceAll("\\","/"))}function vt(t,e,n){let i=$.relative(t,e);if(!(i===""||!$.isAbsolute(i)&&!i.startsWith(`..${$.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function pu(t,e,n){let i=Sw(e);if($.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=$.resolve(t,...i.split("/"));vt(t,r,n);let s;try{s=await D.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(vt(t,s,n),!(await D.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await D.readFile(s)}}async function Cw(t){let e=await D.realpath(t.root),n=t.packageKind==="runtime"?[]:[await pu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await pu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function Ew(t,e){let n=e.map(i=>({path:i.path,sha256:du("sha256").update(i.content).digest("hex")}));return du("sha256").update(JSON.stringify(tr({package:t,files:n}))).digest("hex")}function gu(t){return JSON.stringify(t,null,2)+`
148
+ `}async function wu(t){let e=kw(t),n=await Cw(t);return{document:e,files:n,hash:Ew(e,n)}}async function nr(t){return(await wu(t)).hash}async function mu(t){try{return await D.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function hu(t,e){try{if((await D.readFile($.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await D.readFile($.join(t,"package.json"),"utf8")!==gu(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await D.readFile($.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function ho(t,e){let n=await wu(t),i=$.resolve(e,".comet","skill-snapshots"),r=$.join(i,n.hash);if(await D.mkdir(i,{recursive:!0}),await mu(r))return await hu(r,n),{hash:n.hash,snapshotDir:r};let s=$.join(i,`.tmp-${bw()}`);vt(i,s,"Temporary snapshot"),vt(i,r,"Published snapshot");try{await D.mkdir(s);for(let o of n.files){let a=$.join(s,...o.path.split("/"));vt(s,a,`Snapshot file ${o.path}`),await D.mkdir($.dirname(a),{recursive:!0}),await D.writeFile(a,o.content)}await D.writeFile($.join(s,"package.json"),gu(n.document)),await D.writeFile($.join(s,"sha256"),n.hash+`
149
+ `),await D.rename(s,r)}catch(o){if(await mu(r)){try{await hu(r,n)}finally{await D.rm(s,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await D.rm(s,{recursive:!0,force:!0}),o}return{hash:n.hash,snapshotDir:r}}async function go(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=$.resolve(t,".comet","skill-snapshots"),i=$.join(n,e);vt(n,i,"Skill snapshot");try{let r=(await D.readFile($.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=$.join(i,"package.json"),o=JSON.parse(await D.readFile(s,"utf8")),a=lu(o,i,s),c=fu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
+ `));let l=await nr(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 yu(t){try{return await wo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function vu(t){return xw("sha256").update(t).digest("hex")}function Pw(t){return vu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Rw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Ow(t,e){let n=await be(t),i=Object.fromEntries(e.filter(o=>o.satisfied&&o.source).map(o=>[Rw(o.code),o.source])),r=Ce.join(t,"subagent-progress.md");await yu(r)&&(i.subagent_progress=Ce.relative(n,r).split(Ce.sep).join("/"));let s=e.find(o=>o.code==="design.handoff"&&o.satisfied);return s?.source&&(i.handoff_context=s.source),i}function Aw(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:Ze,profile:e,source:"pre-migration"}}]}async function Nw(t){await Promise.all(t.map(e=>wo.rm(e,{recursive:!0,force:!0})))}async function bu(t,e){let n=await de(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==Ze)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await nr(e.skillPackage)!==n.run.skillHash)return await go(t,n.run.skillHash),{classic:i,run:n.run,evidence:await gt(t,n),migrated:!1,snapshotDir:Ce.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await ho(e.skillPackage,t);return{classic:i,run:n.run,evidence:await gt(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let s=await gt(t,n),o=Di(i,s);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===o))throw new Error(`Classic Skill package does not define resolved step: ${o}`);let a=await nr(e.skillPackage),c=Ce.join(t,".comet","skill-snapshots",a),l=await yu(c),f=[];try{let u=await ho(e.skillPackage,t),d=Vl(e.skillPackage,e.runId?.()??_w(),u.hash);d.currentStep=o,o==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:Ze},g=await Ow(t,s),p=await be(t),m=s.find(k=>k.code==="design.handoff"&&k.satisfied),w=null;m?.source&&(w=await cn(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await Hl(t,d.contextRef,w),f.push(Ce.resolve(t,d.contextRef))),await Xi(t,d.artifactsRef,g),f.push(Ce.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),S={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:vu(w),artifactsHash:Pw(g),createdAt:y};await Zi(t,d.checkpointRef,S),f.push(Ce.resolve(t,d.checkpointRef)),f.push(Ce.resolve(t,d.trajectoryRef));for(let k of Aw(d,r,y))await yt(t,d.trajectoryRef,k);return await et(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:s,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await Nw(f),l||await wo.rm(c,{recursive:!0,force:!0}),u}}async function Tw(t){try{return(await ku.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ir(t){try{return(await ku.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function jw(t){return await Tw(t)?await ir(Q.join(t,"skill.yaml"))?!0:await ir(Q.join(t,"SKILL.md"))&&await ir(Q.join(t,"comet","skill.yaml")):!1}function Iw(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 qw(){let t=Q.dirname(Su(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,Q.resolve(t,"..","runtime","classic"),Q.resolve(t,"..","..","comet","runtime","classic"),Q.resolve(t,"..","..","assets","skills","comet","runtime","classic"),Q.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,Q.resolve(t,"..","..","comet-classic"),Q.resolve(t,"..","..","assets","skills","comet-classic"),Q.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await jw(n))return n;return null}async function $w(t){return await ir(Q.join(t,"skill.yaml"))?cu(t):au(t)}async function Cu(t){let e=await qw();return bu(t,{skillPackage:e?await $w(e):Iw(Q.dirname(Su(import.meta.url)))})}async function Eu(t,e,n,i){let r=await de(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await gt(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Di(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await et(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await yn(t,a.trajectoryRef);return await yt(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}Bi();import Lw from"path";var Dw=Lw.join(".comet","state-events.jsonl"),Fw=8*1024*1024;async function xu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Mi(t,Dw,`${JSON.stringify(n)}
151
+ `,Fw,"Classic state event log"),n}var Mw={"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 Ww(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 _u(t,e,n={}){let i=Mw[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",Ww(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}}Us();import{promises as Bw}from"fs";import Kw from"path";var yo="comet.selection.v2",Yw=16*1024;function vo(t){return Kw.join(t,".comet","current-change.json")}function Uw(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Pu(t){return t===null||typeof t=="string"}function Jw(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(!Uw(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&&!Pu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:yo,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==yo)throw new Error(`current change selection schema must be ${yo}`);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(!Pu(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 bo(t){let e;try{let i=vo(t),{bytes:r}=await _i(i,Yw,{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",...Jw(e)}}async function Ru(t){await Bw.rm(vo(t),{force:!0})}async function Ou(t,e,n){let i=await bo(t);return i.status!=="selected"||i.selection.workflow!==e||i.selection.change!==n?!1:(await Ru(t),!0)}var Au=null;function Nu(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Tu(t,e){return(...n)=>{let i=Au;if(i===null)return e(...n);let r=Nu(`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 ko(t,e){return(...n)=>{let i=Au;if(i===null)return e(...n);let r=Nu(`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}}import{execFileSync as ju}from"child_process";var Vw=nt(ze(),1);function Hw(t){try{let e=ju("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 cC=ko("liveGitBranch",t=>Hw(t));function Gw(t){try{return ju("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var lC=ko("isGitWorkTree",t=>Gw(t));var bC=Tu("readCometCurrentSelection",t=>bo(t));async function Iu(t,e){return Ou(t,"classic",e)}var Xw="\x1B[32m",Zw="\x1B[31m",ey="\x1B[33m",Co="\x1B[0m";function te(t){return`${Xw}${t}${Co}`}function G(t){return`${Zw}${t}${Co}`}function vn(t){return`${ey}${t}${Co}`}var B=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},So=class{stderr=[];openSpecStdout=[];openSpecStderr=[];stepsOk=0;stepsTotal=0;captureOpenSpec(e){e.stdout&&this.openSpecStdout.push(e.stdout),e.stderr&&this.openSpecStderr.push(e.stderr)}toResult(e=0){let n=this.stderr.length>0?this.stderr.join(`
152
152
  `)+`
153
153
  `:"",i=this.openSpecStderr.join(""),r=i&&n&&!i.endsWith(`
154
154
  `)?`
155
- `:"";return{exitCode:e,...this.openSpecStdout.length>0?{stdout:this.openSpecStdout.join("")}:{},...i||n?{stderr:`${i}${r}${n}`}:{}}}};function Xw(t){let e=to(t);if(e)throw new B(z(`FATAL: ${e}`))}function Iu(t){return Vw("sha256").update(t).digest("hex")}function Zw(t){return Iu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function ey(t,e){let n=me.relative(t,e);return n!==""&&!me.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${me.sep}`)}function vn(t,e,n,i){if(!i)return i;let r=me.resolve(t,i);return ey(e,r)?j(t,me.join(n,me.relative(e,r))):i}function ty(t,e,n,i){let r={...i};for(let s of["handoff_context","handoff_markdown"]){let o=r[s];o&&(r[s]=vn(t,e,n,o)??o)}return r}async function ny(t,e){let n=await de(e);if(!n.classic||!n.run||!n.classic.archived)throw new B(z(" [FAIL] Final archived state is incomplete"));let i=[["design_doc",n.classic.designDoc],["plan",n.classic.plan],["verification_report",n.classic.verificationReport],["handoff_context",n.classic.handoffContext]],r=await uo(e,n.run.artifactsRef),s=[["artifacts.handoff_context",r.handoff_context],["artifacts.handoff_markdown",r.handoff_markdown]];for(let[o,a]of[...i,...s])if(a&&!await on(t,me.resolve(t,a),{label:`Classic archived ${o}`,expected:"file"}))throw new B(z(` [FAIL] Final archived ${o} does not exist: ${a}`))}function ju(t){return`${t.replace(/\n+$/u,"")}
156
- `}function iy(t,e,n){let i=t.replace(/\r\n/gu,`
155
+ `:"";return{exitCode:e,...this.openSpecStdout.length>0?{stdout:this.openSpecStdout.join("")}:{},...i||n?{stderr:`${i}${r}${n}`}:{}}}};function ty(t){let e=no(t);if(e)throw new B(G(`FATAL: ${e}`))}function $u(t){return zw("sha256").update(t).digest("hex")}function ny(t){return $u(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function iy(t,e){let n=me.relative(t,e);return n!==""&&!me.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${me.sep}`)}function bn(t,e,n,i){if(!i)return i;let r=me.resolve(t,i);return iy(e,r)?j(t,me.join(n,me.relative(e,r))):i}function ry(t,e,n,i){let r={...i};for(let s of["handoff_context","handoff_markdown"]){let o=r[s];o&&(r[s]=bn(t,e,n,o)??o)}return r}async function sy(t,e){let n=await de(e);if(!n.classic||!n.run||!n.classic.archived)throw new B(G(" [FAIL] Final archived state is incomplete"));let i=[["design_doc",n.classic.designDoc],["plan",n.classic.plan],["verification_report",n.classic.verificationReport],["handoff_context",n.classic.handoffContext]],r=await fo(e,n.run.artifactsRef),s=[["artifacts.handoff_context",r.handoff_context],["artifacts.handoff_markdown",r.handoff_markdown]];for(let[o,a]of[...i,...s])if(a&&!await an(t,me.resolve(t,a),{label:`Classic archived ${o}`,expected:"file"}))throw new B(G(` [FAIL] Final archived ${o} does not exist: ${a}`))}function qu(t){return`${t.replace(/\n+$/u,"")}
156
+ `}function oy(t,e,n){let i=t.replace(/\r\n/gu,`
157
157
  `),r=i.split(`
158
- `),s=r[0]==="---"?r.indexOf("---",1):-1,o=n.match(/^([^:\n]+):/u)?.[1]?.trim();if(s!==-1){let c=r.slice(1,s).filter(l=>{let f=l.match(/^([^:\n]+):/u)?.[1]?.trim();return f===void 0?!0:f!=="archived-with"&&f!==o});return c.push(`archived-with: ${e}`),n&&c.push(n),ju(["---",...c,"---",...r.slice(s+1)].join(`
159
- `))}let a=["---",`archived-with: ${e}`];return n&&a.push(n),o!=="status"&&a.push("status: final"),a.push("---"),ju([...a,i].join(`
160
- `))}async function ry(t,e,n){let i=await wn(t,e.trajectoryRef);i.some(r=>r.type==="recovery_reconciled"&&r.data.kind==="classic-archive"&&r.data.actionId===n)||await gt(t,e.trajectoryRef,{sequence:i.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-archive",actionId:n}})}async function rr(t,e,n,i,r,s){if(!await on(e,n,{label:"Classic archive annotation target",expected:"file"}))return;if(s){t.stderr.push(yn(` [DRY-RUN] Would annotate: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1;return}let o=await an(e,n,{label:"Classic archive annotation target"}),a=iy(o,i,r);await Ol(e,n,a,{label:"Classic archive annotation target"}),t.stderr.push(ee(` [OK] Annotated: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1}async function sy(t,e){if(!(await Fe(t,e,{label:"Classic main specs directory",expected:"directory"})).exists)return;let i=!1,r=await Hw.readdir(e,{withFileTypes:!0});for(let s of r){if(!s.isDirectory()&&!s.isSymbolicLink())continue;let o=`${e}/${s.name}/spec.md`,a=await(async()=>await on(t,o,{label:`Classic main spec ${s.name}`,expected:"file"})?an(t,o,{label:`Classic main spec ${s.name}`}):null)();if(a===null)continue;let c=a.split(/\r?\n/u).map((l,f)=>({line:l,number:f+1})).filter(l=>/^## (ADDED|MODIFIED|REMOVED|RENAMED) Requirements$/u.test(l.line));if(c.length>0){i=!0,process.stderr.write(z(`FATAL: delta-only section heading leaked into main spec: ${o}`)+`
158
+ `),s=r[0]==="---"?r.indexOf("---",1):-1,o=n.match(/^([^:\n]+):/u)?.[1]?.trim();if(s!==-1){let c=r.slice(1,s).filter(l=>{let f=l.match(/^([^:\n]+):/u)?.[1]?.trim();return f===void 0?!0:f!=="archived-with"&&f!==o});return c.push(`archived-with: ${e}`),n&&c.push(n),qu(["---",...c,"---",...r.slice(s+1)].join(`
159
+ `))}let a=["---",`archived-with: ${e}`];return n&&a.push(n),o!=="status"&&a.push("status: final"),a.push("---"),qu([...a,i].join(`
160
+ `))}async function ay(t,e,n){let i=await yn(t,e.trajectoryRef);i.some(r=>r.type==="recovery_reconciled"&&r.data.kind==="classic-archive"&&r.data.actionId===n)||await yt(t,e.trajectoryRef,{sequence:i.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-archive",actionId:n}})}async function rr(t,e,n,i,r,s){if(!await an(e,n,{label:"Classic archive annotation target",expected:"file"}))return;if(s){t.stderr.push(vn(` [DRY-RUN] Would annotate: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1;return}let o=await cn(e,n,{label:"Classic archive annotation target"}),a=oy(o,i,r);await Al(e,n,a,{label:"Classic archive annotation target"}),t.stderr.push(te(` [OK] Annotated: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1}async function cy(t,e){if(!(await Fe(t,e,{label:"Classic main specs directory",expected:"directory"})).exists)return;let i=!1,r=await Qw.readdir(e,{withFileTypes:!0});for(let s of r){if(!s.isDirectory()&&!s.isSymbolicLink())continue;let o=`${e}/${s.name}/spec.md`,a=await(async()=>await an(t,o,{label:`Classic main spec ${s.name}`,expected:"file"})?cn(t,o,{label:`Classic main spec ${s.name}`}):null)();if(a===null)continue;let c=a.split(/\r?\n/u).map((l,f)=>({line:l,number:f+1})).filter(l=>/^## (ADDED|MODIFIED|REMOVED|RENAMED) Requirements$/u.test(l.line));if(c.length>0){i=!0,process.stderr.write(G(`FATAL: delta-only section heading leaked into main spec: ${o}`)+`
161
161
  `);for(let l of c)process.stderr.write(`${l.number}:${l.line}
162
- `)}}if(i)throw new B("")}var qu=async t=>{let e=new ko,n=t[0],i=t[1]==="--dry-run";try{Xw(n);let r=await ve(process.cwd()),s=await rn(r),o=await no(n,s.projectRoot),a=o.directory,c=j(s.projectRoot,a),f=`${new Date().toISOString().slice(0,10)}-${n}`,u=me.join(s.archiveDir,f);e.stderr.push(`=== Comet Archive: ${n} ===`);let d=o.stateExists,h=d?null:await $i(n,s.projectRoot),g=d?a:h?.directory;if(!g||!await on(s.projectRoot,`${g}/.comet.yaml`,{label:`Classic change ${n} state`,expected:"file"}))throw new B(z(`FATAL: .comet.yaml not found in ${c}/`));h&&(u=h.directory,f=me.basename(h.directory));let p=await de(g);if(!p.classic)throw new B(z("FATAL: archive requires Classic state"));let m=p.classic,w=m.designDoc,y=m.plan;if(m.phase!=="archive")throw new B(z(`FATAL: phase is '${m.phase}', expected 'archive'`));if(m.verifyResult!=="pass")throw new B(z(`FATAL: verify_result is '${m.verifyResult}', expected 'pass'. Run comet-verify first.`));e.stderr.push(ee(" [OK] Entry state verified")),e.stepsOk+=1,e.stepsTotal+=1;let S=await Fe(s.projectRoot,u,{label:`Classic archive target ${f}`,expected:"directory"});if(d&&S.exists)throw new B(z(`FATAL: archive target already exists: ${u}`));if(e.stderr.push(ee(" [OK] Archive target available")),e.stepsOk+=1,e.stepsTotal+=1,i)e.stderr.push(yn(` [DRY-RUN] Would run OpenSpec archive: ${n}`)),e.stepsOk+=1,e.stepsTotal+=1;else if(!m.archived||p.run?.pending){await eo(s.projectRoot,`${g}/.comet`,"Classic change runtime directory");let k=await ku(g),C=`classic-archive:${n}`,E=await zl(g,k.run.pendingRef),R=!!h||E?.id===C&&E.type==="checkpoint"&&E.ref===n;if(k.run.pending&&k.run.pending!==C)throw new B(z(`FATAL: another action is pending: ${k.run.pending}`));if(!R&&!m.archived&&m.archiveConfirmation!=="confirmed")throw new B(z(`FATAL: archive_confirmation is '${m.archiveConfirmation??"null"}', expected 'confirmed'. Run final archive confirmation first.`));if(!R){let yt={id:C,stepId:k.run.currentStep,type:"checkpoint",ref:n};await Hl(g,k.run.pendingRef,yt),await Xe(g,{classic:k.classic,run:{...k.run,pending:C,status:"waiting"},unknownKeys:(await de(g)).unknownKeys})}if(!h){let yt=await Rl(["archive",n,"--yes"],s.projectRoot);if(e.captureOpenSpec(yt),yt.exitCode!==0)throw new B("",yt.exitCode)}let b=await $i(n,s.projectRoot,{preferredArchiveName:f});if(!b&&!h&&(b=await $i(n,s.projectRoot,{skipExactCompatibility:!0})),!b)return e.stderr.push(z(" [FAIL] OpenSpec archive output not found")),e.stepsTotal+=1,e.stderr.push(""),e.stderr.push(ee(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(1);u=b.directory,f=me.basename(b.directory),e.stderr.push(ee(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,await sy(s.projectRoot,s.specsDir),e.stderr.push(ee(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,w&&await rr(e,s.projectRoot,w,f,"status: final",!1),y&&await rr(e,s.projectRoot,y,f,"",!1);let P=await de(u);if(!P.classic||!P.run)throw new B(z(" [FAIL] archived state projection is incomplete"));let te={...ty(s.projectRoot,a,u,await uo(u,P.run.artifactsRef)),archive_directory:j(s.projectRoot,u)};await Xi(u,P.run.artifactsRef,te);let G=Eu(R&&P.classic.archiveConfirmation!=="confirmed"?{...P.classic,archiveConfirmation:"confirmed"}:P.classic,"archived"),A={...G.classic,designDoc:vn(s.projectRoot,a,u,G.classic.designDoc),plan:vn(s.projectRoot,a,u,G.classic.plan),verificationReport:vn(s.projectRoot,a,u,G.classic.verificationReport),handoffContext:vn(s.projectRoot,a,u,G.classic.handoffContext)},ne=P.run;(P.run.currentStep!=="completed"||P.run.status!=="completed")&&(ne=await Su(u,A,P.run,{actionId:C,archiveDirectory:j(s.projectRoot,u),event:"archived",source:"comet-archive"})),R&&await ry(u,ne,C);let Lu=await wn(u,ne.trajectoryRef),Co=await Vl(u,ne.contextRef),Du={runId:ne.runId,stateVersion:ne.iteration,trajectoryOffset:Lu.length,contextHash:Co===null?null:Iu(Co),artifactsHash:Zw(te),createdAt:new Date().toISOString()};await Zi(u,ne.checkpointRef,Du);let Eo={...ne,pending:null,status:"completed"};await Xe(u,{classic:A,run:Eo,unknownKeys:P.unknownKeys}),await Cu(u,{change:f,event:"archived",source:"comet-archive",from:P.classic,to:A,effects:G.effects}),await Gl(u,Eo.pendingRef),e.stderr.push(ee(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}else{if(!p.run)throw new B(z("FATAL: archived Classic state is missing its Run projection"));e.stderr.push(ee(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ee(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ee(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}return i?(w&&await rr(e,s.projectRoot,w,f,"status: final",!0),y&&await rr(e,s.projectRoot,y,f,"",!0),e.stderr.push(yn(` [DRY-RUN] Would set archived: true in ${u}/.comet.yaml`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(yn(" [DRY-RUN] Would verify final archive integrity")),e.stepsOk+=1,e.stepsTotal+=1):(await ny(s.projectRoot,u),e.stderr.push(ee(" [OK] Final archive integrity verified")),e.stepsOk+=1,e.stepsTotal+=1),i||await Tu(s.projectRoot,n),e.stderr.push(""),e.stderr.push(i?yn(`Dry run complete. ${e.stepsOk}/${e.stepsTotal} steps would succeed.`):ee(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(e.stepsOk<e.stepsTotal?1:0)}catch(r){if(r instanceof B){if(r.message)for(let s of r.message.split(`
163
- `))e.stderr.push(s);return e.toResult(r.exitCode)}throw r}};function oy(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}})+`
164
- `}}async function $u(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?oy(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
162
+ `)}}if(i)throw new B("")}var Lu=async t=>{let e=new So,n=t[0],i=t[1]==="--dry-run";try{ty(n);let r=await be(process.cwd()),s=await sn(r),o=await io(n,s.projectRoot),a=o.directory,c=j(s.projectRoot,a),f=`${new Date().toISOString().slice(0,10)}-${n}`,u=me.join(s.archiveDir,f);e.stderr.push(`=== Comet Archive: ${n} ===`);let d=o.stateExists,h=d?null:await $i(n,s.projectRoot),g=d?a:h?.directory;if(!g||!await an(s.projectRoot,`${g}/.comet.yaml`,{label:`Classic change ${n} state`,expected:"file"}))throw new B(G(`FATAL: .comet.yaml not found in ${c}/`));h&&(u=h.directory,f=me.basename(h.directory));let p=await de(g);if(!p.classic)throw new B(G("FATAL: archive requires Classic state"));let m=p.classic,w=m.designDoc,y=m.plan;if(m.phase!=="archive")throw new B(G(`FATAL: phase is '${m.phase}', expected 'archive'`));if(m.verifyResult!=="pass")throw new B(G(`FATAL: verify_result is '${m.verifyResult}', expected 'pass'. Run comet-verify first.`));e.stderr.push(te(" [OK] Entry state verified")),e.stepsOk+=1,e.stepsTotal+=1;let S=await Fe(s.projectRoot,u,{label:`Classic archive target ${f}`,expected:"directory"});if(d&&S.exists)throw new B(G(`FATAL: archive target already exists: ${u}`));if(e.stderr.push(te(" [OK] Archive target available")),e.stepsOk+=1,e.stepsTotal+=1,i)e.stderr.push(vn(` [DRY-RUN] Would run OpenSpec archive: ${n}`)),e.stepsOk+=1,e.stepsTotal+=1;else if(!m.archived||p.run?.pending){await to(s.projectRoot,`${g}/.comet`,"Classic change runtime directory");let k=await Cu(g),C=`classic-archive:${n}`,E=await Ql(g,k.run.pendingRef),R=!!h||E?.id===C&&E.type==="checkpoint"&&E.ref===n;if(k.run.pending&&k.run.pending!==C)throw new B(G(`FATAL: another action is pending: ${k.run.pending}`));if(!R&&!m.archived&&m.archiveConfirmation!=="confirmed")throw new B(G(`FATAL: archive_confirmation is '${m.archiveConfirmation??"null"}', expected 'confirmed'. Run final archive confirmation first.`));if(!R){let bt={id:C,stepId:k.run.currentStep,type:"checkpoint",ref:n};await zl(g,k.run.pendingRef,bt),await et(g,{classic:k.classic,run:{...k.run,pending:C,status:"waiting"},unknownKeys:(await de(g)).unknownKeys})}if(!h){let bt=await Ol(["archive",n,"--yes"],s.projectRoot);if(e.captureOpenSpec(bt),bt.exitCode!==0)throw new B("",bt.exitCode)}let b=await $i(n,s.projectRoot,{preferredArchiveName:f});if(!b&&!h&&(b=await $i(n,s.projectRoot,{skipExactCompatibility:!0})),!b)return e.stderr.push(G(" [FAIL] OpenSpec archive output not found")),e.stepsTotal+=1,e.stderr.push(""),e.stderr.push(te(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(1);u=b.directory,f=me.basename(b.directory),e.stderr.push(te(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,await cy(s.projectRoot,s.specsDir),e.stderr.push(te(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,w&&await rr(e,s.projectRoot,w,f,"status: final",!1),y&&await rr(e,s.projectRoot,y,f,"",!1);let P=await de(u);if(!P.classic||!P.run)throw new B(G(" [FAIL] archived state projection is incomplete"));let ne={...ry(s.projectRoot,a,u,await fo(u,P.run.artifactsRef)),archive_directory:j(s.projectRoot,u)};await Xi(u,P.run.artifactsRef,ne);let z=_u(R&&P.classic.archiveConfirmation!=="confirmed"?{...P.classic,archiveConfirmation:"confirmed"}:P.classic,"archived"),A={...z.classic,designDoc:bn(s.projectRoot,a,u,z.classic.designDoc),plan:bn(s.projectRoot,a,u,z.classic.plan),verificationReport:bn(s.projectRoot,a,u,z.classic.verificationReport),handoffContext:bn(s.projectRoot,a,u,z.classic.handoffContext)},ie=P.run;(P.run.currentStep!=="completed"||P.run.status!=="completed")&&(ie=await Eu(u,A,P.run,{actionId:C,archiveDirectory:j(s.projectRoot,u),event:"archived",source:"comet-archive"})),R&&await ay(u,ie,C);let Fu=await yn(u,ie.trajectoryRef),Eo=await Gl(u,ie.contextRef),Mu={runId:ie.runId,stateVersion:ie.iteration,trajectoryOffset:Fu.length,contextHash:Eo===null?null:$u(Eo),artifactsHash:ny(ne),createdAt:new Date().toISOString()};await Zi(u,ie.checkpointRef,Mu);let xo={...ie,pending:null,status:"completed"};await et(u,{classic:A,run:xo,unknownKeys:P.unknownKeys}),await xu(u,{change:f,event:"archived",source:"comet-archive",from:P.classic,to:A,effects:z.effects}),await Xl(u,xo.pendingRef),e.stderr.push(te(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}else{if(!p.run)throw new B(G("FATAL: archived Classic state is missing its Run projection"));e.stderr.push(te(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(te(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(te(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}return i?(w&&await rr(e,s.projectRoot,w,f,"status: final",!0),y&&await rr(e,s.projectRoot,y,f,"",!0),e.stderr.push(vn(` [DRY-RUN] Would set archived: true in ${u}/.comet.yaml`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(vn(" [DRY-RUN] Would verify final archive integrity")),e.stepsOk+=1,e.stepsTotal+=1):(await sy(s.projectRoot,u),e.stderr.push(te(" [OK] Final archive integrity verified")),e.stepsOk+=1,e.stepsTotal+=1),i||await Iu(s.projectRoot,n),e.stderr.push(""),e.stderr.push(i?vn(`Dry run complete. ${e.stepsOk}/${e.stepsTotal} steps would succeed.`):te(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(e.stepsOk<e.stepsTotal?1:0)}catch(r){if(r instanceof B){if(r.message)for(let s of r.message.split(`
163
+ `))e.stderr.push(s);return e.toResult(r.exitCode)}throw r}};function ly(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}})+`
164
+ `}}async function Du(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?ly(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
165
165
  `)?"":`
166
- `)),o.exitCode}process.exitCode=await $u("archive",qu);
166
+ `)),o.exitCode}process.exitCode=await Du("archive",Lu);