@rpamis/comet 0.4.2 → 0.4.4

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 (391) hide show
  1. package/LICENSE +21 -21
  2. package/assets/manifest.json +1 -1
  3. package/assets/skills/comet/scripts/comet-archive.mjs +109 -96
  4. package/assets/skills/comet/scripts/comet-check.mjs +117 -104
  5. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +59 -59
  6. package/assets/skills/comet/scripts/comet-guard.mjs +173 -160
  7. package/assets/skills/comet/scripts/comet-handoff.mjs +110 -97
  8. package/assets/skills/comet/scripts/comet-hook-guard.mjs +110 -97
  9. package/assets/skills/comet/scripts/comet-hook-router.mjs +269 -159
  10. package/assets/skills/comet/scripts/comet-intent.mjs +31 -31
  11. package/assets/skills/comet/scripts/comet-resume-probe.mjs +104 -91
  12. package/assets/skills/comet/scripts/comet-runtime.mjs +272 -259
  13. package/assets/skills/comet/scripts/comet-state.mjs +204 -191
  14. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +25 -25
  15. package/assets/skills/comet-archive/SKILL.md +4 -4
  16. package/assets/skills/comet-build/SKILL.md +4 -6
  17. package/assets/skills/comet-classic/SKILL.md +3 -1
  18. package/assets/skills/comet-classic/reference/scripts.md +17 -1
  19. package/assets/skills/comet-design/SKILL.md +0 -2
  20. package/assets/skills/comet-hotfix/SKILL.md +2 -3
  21. package/assets/skills/comet-native/SKILL.md +11 -8
  22. package/assets/skills/comet-native/reference/artifacts.md +7 -7
  23. package/assets/skills/comet-native/reference/clarification.md +4 -4
  24. package/assets/skills/comet-native/reference/commands.md +25 -13
  25. package/assets/skills/comet-native/reference/recovery.md +3 -3
  26. package/assets/skills/comet-native/reference/workspace.md +10 -4
  27. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +230 -149
  28. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +239 -161
  29. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +232 -122
  30. package/assets/skills/comet-native/scripts/comet-native-init.mjs +184 -107
  31. package/assets/skills/comet-native/scripts/comet-native-new.mjs +219 -142
  32. package/assets/skills/comet-native/scripts/comet-native-next.mjs +239 -161
  33. package/assets/skills/comet-native/scripts/comet-native-root.mjs +205 -128
  34. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +276 -195
  35. package/assets/skills/comet-native/scripts/comet-native-select.mjs +204 -127
  36. package/assets/skills/comet-native/scripts/comet-native-show.mjs +202 -125
  37. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +203 -125
  38. package/assets/skills/comet-native/scripts/comet-native-status.mjs +200 -123
  39. package/assets/skills/comet-open/SKILL.md +0 -2
  40. package/assets/skills/comet-tweak/SKILL.md +2 -1
  41. package/assets/skills/comet-verify/SKILL.md +0 -2
  42. package/assets/skills-zh/comet-archive/SKILL.md +4 -4
  43. package/assets/skills-zh/comet-build/SKILL.md +4 -6
  44. package/assets/skills-zh/comet-classic/SKILL.md +3 -1
  45. package/assets/skills-zh/comet-classic/reference/scripts.md +11 -1
  46. package/assets/skills-zh/comet-design/SKILL.md +0 -2
  47. package/assets/skills-zh/comet-hotfix/SKILL.md +2 -3
  48. package/assets/skills-zh/comet-native/SKILL.md +11 -8
  49. package/assets/skills-zh/comet-native/reference/artifacts.md +7 -7
  50. package/assets/skills-zh/comet-native/reference/clarification.md +4 -4
  51. package/assets/skills-zh/comet-native/reference/commands.md +26 -10
  52. package/assets/skills-zh/comet-native/reference/recovery.md +3 -3
  53. package/assets/skills-zh/comet-native/reference/workspace.md +10 -4
  54. package/assets/skills-zh/comet-open/SKILL.md +0 -2
  55. package/assets/skills-zh/comet-tweak/SKILL.md +2 -1
  56. package/assets/skills-zh/comet-verify/SKILL.md +0 -2
  57. package/bin/comet-daemon-router.js +57 -13
  58. package/bin/fast-runtime-router.js +1 -1
  59. package/dist/app/commands/daemon-server.d.ts.map +1 -1
  60. package/dist/app/commands/daemon-server.js +14 -2
  61. package/dist/app/commands/daemon-server.js.map +1 -1
  62. package/dist/app/commands/project-knowledge.d.ts.map +1 -1
  63. package/dist/app/commands/project-knowledge.js +0 -1
  64. package/dist/app/commands/project-knowledge.js.map +1 -1
  65. package/dist/domains/comet-classic/classic-archive-entry.d.ts +1 -1
  66. package/dist/domains/comet-classic/classic-archive-entry.d.ts.map +1 -1
  67. package/dist/domains/comet-classic/classic-archive-entry.js +5 -2
  68. package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
  69. package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
  70. package/dist/domains/comet-classic/classic-branch-binding.js +5 -4
  71. package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
  72. package/dist/domains/comet-classic/classic-check-entry.d.ts +1 -1
  73. package/dist/domains/comet-classic/classic-check-entry.d.ts.map +1 -1
  74. package/dist/domains/comet-classic/classic-check-entry.js +5 -2
  75. package/dist/domains/comet-classic/classic-check-entry.js.map +1 -1
  76. package/dist/domains/comet-classic/classic-check-snapshot.d.ts +2 -0
  77. package/dist/domains/comet-classic/classic-check-snapshot.d.ts.map +1 -1
  78. package/dist/domains/comet-classic/classic-check-snapshot.js +90 -27
  79. package/dist/domains/comet-classic/classic-check-snapshot.js.map +1 -1
  80. package/dist/domains/comet-classic/classic-guard-entry.d.ts +1 -1
  81. package/dist/domains/comet-classic/classic-guard-entry.d.ts.map +1 -1
  82. package/dist/domains/comet-classic/classic-guard-entry.js +5 -2
  83. package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
  84. package/dist/domains/comet-classic/classic-handoff-entry.d.ts +1 -1
  85. package/dist/domains/comet-classic/classic-handoff-entry.d.ts.map +1 -1
  86. package/dist/domains/comet-classic/classic-handoff-entry.js +5 -2
  87. package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
  88. package/dist/domains/comet-classic/classic-resume-probe.d.ts.map +1 -1
  89. package/dist/domains/comet-classic/classic-resume-probe.js +3 -2
  90. package/dist/domains/comet-classic/classic-resume-probe.js.map +1 -1
  91. package/dist/domains/comet-classic/classic-script-entry.d.ts +3 -1
  92. package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
  93. package/dist/domains/comet-classic/classic-script-entry.js +34 -3
  94. package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
  95. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  96. package/dist/domains/comet-classic/classic-state-command.js +3 -2
  97. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  98. package/dist/domains/comet-classic/classic-state-entry.d.ts +1 -1
  99. package/dist/domains/comet-classic/classic-state-entry.d.ts.map +1 -1
  100. package/dist/domains/comet-classic/classic-state-entry.js +5 -2
  101. package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
  102. package/dist/domains/comet-classic/classic-store.d.ts.map +1 -1
  103. package/dist/domains/comet-classic/classic-store.js +67 -1
  104. package/dist/domains/comet-classic/classic-store.js.map +1 -1
  105. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  106. package/dist/domains/comet-entry/resume-probe.js +3 -2
  107. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  108. package/dist/domains/comet-native/native-acceptance.d.ts +5 -1
  109. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  110. package/dist/domains/comet-native/native-acceptance.js +13 -2
  111. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  112. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  113. package/dist/domains/comet-native/native-archive-command.js +167 -37
  114. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  115. package/dist/domains/comet-native/native-artifact-language.d.ts +3 -1
  116. package/dist/domains/comet-native/native-artifact-language.d.ts.map +1 -1
  117. package/dist/domains/comet-native/native-artifact-language.js +4 -11
  118. package/dist/domains/comet-native/native-artifact-language.js.map +1 -1
  119. package/dist/domains/comet-native/native-artifacts.d.ts +8 -1
  120. package/dist/domains/comet-native/native-artifacts.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-artifacts.js +14 -2
  122. package/dist/domains/comet-native/native-artifacts.js.map +1 -1
  123. package/dist/domains/comet-native/native-builder-acceptance-review.d.ts +16 -0
  124. package/dist/domains/comet-native/native-builder-acceptance-review.d.ts.map +1 -0
  125. package/dist/domains/comet-native/native-builder-acceptance-review.js +65 -0
  126. package/dist/domains/comet-native/native-builder-acceptance-review.js.map +1 -0
  127. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
  128. package/dist/domains/comet-native/native-cli-help.js +8 -4
  129. package/dist/domains/comet-native/native-cli-help.js.map +1 -1
  130. package/dist/domains/comet-native/native-cli-shared.d.ts +4 -2
  131. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  132. package/dist/domains/comet-native/native-cli-shared.js +37 -9
  133. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  134. package/dist/domains/comet-native/native-cli.d.ts +4 -1
  135. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  136. package/dist/domains/comet-native/native-cli.js +9 -5
  137. package/dist/domains/comet-native/native-cli.js.map +1 -1
  138. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  139. package/dist/domains/comet-native/native-doctor-command.js +144 -3
  140. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  141. package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -1
  142. package/dist/domains/comet-native/native-git-provenance.js +3 -2
  143. package/dist/domains/comet-native/native-git-provenance.js.map +1 -1
  144. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  145. package/dist/domains/comet-native/native-hook-guard.js +56 -26
  146. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  147. package/dist/domains/comet-native/native-local-execution.d.ts +1 -0
  148. package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -1
  149. package/dist/domains/comet-native/native-local-execution.js +7 -0
  150. package/dist/domains/comet-native/native-local-execution.js.map +1 -1
  151. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  152. package/dist/domains/comet-native/native-lock.js +12 -0
  153. package/dist/domains/comet-native/native-lock.js.map +1 -1
  154. package/dist/domains/comet-native/native-loop-runtime.d.ts +2 -0
  155. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -1
  156. package/dist/domains/comet-native/native-loop-runtime.js +6 -0
  157. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -1
  158. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  159. package/dist/domains/comet-native/native-next-command.js +57 -28
  160. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  161. package/dist/domains/comet-native/native-output-language.d.ts.map +1 -1
  162. package/dist/domains/comet-native/native-output-language.js +7 -0
  163. package/dist/domains/comet-native/native-output-language.js.map +1 -1
  164. package/dist/domains/comet-native/native-portable-acceptance.d.ts +2 -0
  165. package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -1
  166. package/dist/domains/comet-native/native-portable-acceptance.js +11 -1
  167. package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -1
  168. package/dist/domains/comet-native/native-portable-archive.d.ts +1 -0
  169. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -1
  170. package/dist/domains/comet-native/native-portable-archive.js +3 -0
  171. package/dist/domains/comet-native/native-portable-archive.js.map +1 -1
  172. package/dist/domains/comet-native/native-portable-checks.d.ts +15 -4
  173. package/dist/domains/comet-native/native-portable-checks.d.ts.map +1 -1
  174. package/dist/domains/comet-native/native-portable-checks.js +167 -66
  175. package/dist/domains/comet-native/native-portable-checks.js.map +1 -1
  176. package/dist/domains/comet-native/native-portable-continuation.d.ts +2 -1
  177. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
  178. package/dist/domains/comet-native/native-portable-continuation.js +121 -39
  179. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
  180. package/dist/domains/comet-native/native-portable-requirements.d.ts +1 -0
  181. package/dist/domains/comet-native/native-portable-requirements.d.ts.map +1 -1
  182. package/dist/domains/comet-native/native-portable-requirements.js +61 -18
  183. package/dist/domains/comet-native/native-portable-requirements.js.map +1 -1
  184. package/dist/domains/comet-native/native-portable-shape-coordination.d.ts.map +1 -1
  185. package/dist/domains/comet-native/native-portable-shape-coordination.js +18 -5
  186. package/dist/domains/comet-native/native-portable-shape-coordination.js.map +1 -1
  187. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
  188. package/dist/domains/comet-native/native-portable-state.js +10 -3
  189. package/dist/domains/comet-native/native-portable-state.js.map +1 -1
  190. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -1
  191. package/dist/domains/comet-native/native-portable-status.js +10 -4
  192. package/dist/domains/comet-native/native-portable-status.js.map +1 -1
  193. package/dist/domains/comet-native/native-portable-types.d.ts +2 -1
  194. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
  195. package/dist/domains/comet-native/native-portable-types.js.map +1 -1
  196. package/dist/domains/comet-native/native-portable-verification.d.ts +3 -0
  197. package/dist/domains/comet-native/native-portable-verification.d.ts.map +1 -1
  198. package/dist/domains/comet-native/native-portable-verification.js +28 -35
  199. package/dist/domains/comet-native/native-portable-verification.js.map +1 -1
  200. package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts +2 -0
  201. package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts.map +1 -1
  202. package/dist/domains/comet-native/native-portable-verifier-coordination.js +9 -0
  203. package/dist/domains/comet-native/native-portable-verifier-coordination.js.map +1 -1
  204. package/dist/domains/comet-native/native-runner-input-artifacts.d.ts +9 -0
  205. package/dist/domains/comet-native/native-runner-input-artifacts.d.ts.map +1 -0
  206. package/dist/domains/comet-native/native-runner-input-artifacts.js +102 -0
  207. package/dist/domains/comet-native/native-runner-input-artifacts.js.map +1 -0
  208. package/dist/domains/comet-native/native-runner-input.d.ts +90 -64
  209. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -1
  210. package/dist/domains/comet-native/native-runner-input.js +107 -22
  211. package/dist/domains/comet-native/native-runner-input.js.map +1 -1
  212. package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -1
  213. package/dist/domains/comet-native/native-script-entry.js +9 -3
  214. package/dist/domains/comet-native/native-script-entry.js.map +1 -1
  215. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  216. package/dist/domains/comet-native/native-snapshot.js +7 -2
  217. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  218. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  219. package/dist/domains/comet-native/native-verification-receipt-runtime.js +5 -4
  220. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  221. package/dist/domains/comet-native/native-workspace-finish.d.ts +26 -0
  222. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -1
  223. package/dist/domains/comet-native/native-workspace-finish.js +520 -15
  224. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -1
  225. package/dist/domains/dashboard/web/assets/{abnfDiagram-VCTEODGH-qlcciI25.js → abnfDiagram-VCTEODGH-CFEU4PQU.js} +1 -1
  226. package/dist/domains/dashboard/web/assets/{arc-KVm4k9kp.js → arc-BeYYJor9.js} +1 -1
  227. package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-YphM8Wtg.js +1 -0
  228. package/dist/domains/dashboard/web/assets/{architectureDiagram-5GKGNRK7-C366RdBK.js → architectureDiagram-5GKGNRK7-CqTy4fyH.js} +1 -1
  229. package/dist/domains/dashboard/web/assets/{blockDiagram-I7D4REHJ-DAuTc2OO.js → blockDiagram-I7D4REHJ-SR_5S4SA.js} +1 -1
  230. package/dist/domains/dashboard/web/assets/{c4Diagram-7LVT6UL2-CFB0RZmL.js → c4Diagram-7LVT6UL2-DzphG2XS.js} +1 -1
  231. package/dist/domains/dashboard/web/assets/channel-BkwcGbYR.js +1 -0
  232. package/dist/domains/dashboard/web/assets/{chunk-4HAMMTFA-DTV6lyGQ.js → chunk-4HAMMTFA-BpthUtIs.js} +1 -1
  233. package/dist/domains/dashboard/web/assets/{chunk-75Z2AOVW-DgJm4cEX.js → chunk-75Z2AOVW-CxAdhPhG.js} +1 -1
  234. package/dist/domains/dashboard/web/assets/{chunk-DU6HZSFF-NAtcgGZr.js → chunk-DU6HZSFF-5peVNfxp.js} +1 -1
  235. package/dist/domains/dashboard/web/assets/{chunk-F27PBJKO-BcFXHZMJ.js → chunk-F27PBJKO-CwG4xi2V.js} +1 -1
  236. package/dist/domains/dashboard/web/assets/{chunk-GMAD6QVW-wNemar9b.js → chunk-GMAD6QVW-BuFFY783.js} +1 -1
  237. package/dist/domains/dashboard/web/assets/{chunk-GVQU2GXP-BiVCDO9d.js → chunk-GVQU2GXP-OyUFmjE-.js} +1 -1
  238. package/dist/domains/dashboard/web/assets/{chunk-IMKFNOWR-D9GDj4b6.js → chunk-IMKFNOWR-DmTme45C.js} +1 -1
  239. package/dist/domains/dashboard/web/assets/{chunk-L3NEJ4N5-DkPl5vac.js → chunk-L3NEJ4N5-D6BHbKty.js} +1 -1
  240. package/dist/domains/dashboard/web/assets/{chunk-OSK3NFVY-RbbxGqtJ.js → chunk-OSK3NFVY-CCz1v1Nv.js} +1 -1
  241. package/dist/domains/dashboard/web/assets/{chunk-P2QGCYS3-B9_X57eT.js → chunk-P2QGCYS3-C1_7kDYS.js} +1 -1
  242. package/dist/domains/dashboard/web/assets/{chunk-POPQ4Y6H-DE4bOH0D.js → chunk-POPQ4Y6H-buFKlAdG.js} +1 -1
  243. package/dist/domains/dashboard/web/assets/{chunk-PWAF6VOD-Bo-W1iA1.js → chunk-PWAF6VOD-B_K6Jrsv.js} +1 -1
  244. package/dist/domains/dashboard/web/assets/{chunk-SHT3W25Y-BhLxs4rZ.js → chunk-SHT3W25Y-CRRLsXmS.js} +1 -1
  245. package/dist/domains/dashboard/web/assets/{chunk-SVP7TREG-BCXfn8uF.js → chunk-SVP7TREG-Q5zCQTul.js} +1 -1
  246. package/dist/domains/dashboard/web/assets/{chunk-TICWLB2K-DqSBgE5L.js → chunk-TICWLB2K-Zc5XaO5Z.js} +1 -1
  247. package/dist/domains/dashboard/web/assets/{chunk-XXDRQBXY-Dbkt1xEZ.js → chunk-XXDRQBXY-BAIB2h_r.js} +1 -1
  248. package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-DzpQhyL3.js +1 -0
  249. package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-DzpQhyL3.js +1 -0
  250. package/dist/domains/dashboard/web/assets/{cose-bilkent-JH36ORCC-DrwNpMyX.js → cose-bilkent-JH36ORCC-C7jkFYhm.js} +1 -1
  251. package/dist/domains/dashboard/web/assets/{cynefin-OW5HDTMX-BbDlivxs.js → cynefin-OW5HDTMX-4yS-l7kx.js} +1 -1
  252. package/dist/domains/dashboard/web/assets/{cynefinDiagram-5FMLGOSQ-DmLmRN42.js → cynefinDiagram-5FMLGOSQ-DAkfQ8jW.js} +1 -1
  253. package/dist/domains/dashboard/web/assets/{dagre-GXQ25YYZ-Cgm5DNgI.js → dagre-GXQ25YYZ-D3b16ruz.js} +1 -1
  254. package/dist/domains/dashboard/web/assets/{diagram-S7CK7UJ4-Bnht1X2m.js → diagram-S7CK7UJ4-BXZHtdNz.js} +1 -1
  255. package/dist/domains/dashboard/web/assets/{diagram-UQ7AKVKN-LELTI4PR.js → diagram-UQ7AKVKN-B4nIzofw.js} +1 -1
  256. package/dist/domains/dashboard/web/assets/{diagram-VSXAHHWV-Do0fZuNG.js → diagram-VSXAHHWV-B6d7KNj1.js} +1 -1
  257. package/dist/domains/dashboard/web/assets/{diagram-VX7I27RA-B0rZTUwt.js → diagram-VX7I27RA-CHr0Rg8a.js} +1 -1
  258. package/dist/domains/dashboard/web/assets/{diagram-Z3DM3KII-wn8xCc_j.js → diagram-Z3DM3KII-BO2IxR9N.js} +1 -1
  259. package/dist/domains/dashboard/web/assets/{dist-CYwDKy2m.js → dist-0wyW4qbm.js} +1 -1
  260. package/dist/domains/dashboard/web/assets/{ebnfDiagram-PWID7BFC-CMDOpP2T.js → ebnfDiagram-PWID7BFC-CHRK8Hyg.js} +1 -1
  261. package/dist/domains/dashboard/web/assets/{erDiagram-RLTQ6QDP-C2d43bdq.js → erDiagram-RLTQ6QDP-_HFHzZlc.js} +1 -1
  262. package/dist/domains/dashboard/web/assets/{es-BzaOcXwu.js → es-kjndkyYX.js} +1 -1
  263. package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-CG-cVTEg.js +1 -0
  264. package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-C3RaJz-z.js +1 -0
  265. package/dist/domains/dashboard/web/assets/{ganttDiagram-EL5Y4UJY-hTH7TzhY.js → ganttDiagram-EL5Y4UJY-CxhSw1PI.js} +1 -1
  266. package/dist/domains/dashboard/web/assets/{gitGraph-4MIJSDKK-C3CCywb-.js → gitGraph-4MIJSDKK-Cbw-3Dnk.js} +1 -1
  267. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-WWUBYQGX-DW6jDckj.js → gitGraphDiagram-WWUBYQGX-Cx93hwtL.js} +1 -1
  268. package/dist/domains/dashboard/web/assets/{index-CTZPz_mx.js → index-CQb8j5OE.js} +3 -3
  269. package/dist/domains/dashboard/web/assets/{index-CWNqBYyI.css → index-Gaxnq6Jd.css} +1 -1
  270. package/dist/domains/dashboard/web/assets/{info-A6RAGUB7-Bg3eKis8.js → info-A6RAGUB7--d4EMiIK.js} +1 -1
  271. package/dist/domains/dashboard/web/assets/{infoDiagram-27XIBGKW-7zk6ytVJ.js → infoDiagram-27XIBGKW-DMkRRNGB.js} +1 -1
  272. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-5VMMS53U-CGDCTmCQ.js → ishikawaDiagram-5VMMS53U-CjKh_jHT.js} +1 -1
  273. package/dist/domains/dashboard/web/assets/{journeyDiagram-3NMN7TZE-C8_L_e8a.js → journeyDiagram-3NMN7TZE-CG735M_M.js} +1 -1
  274. package/dist/domains/dashboard/web/assets/{kanban-definition-UXKFOSKX-D5x6qTgM.js → kanban-definition-UXKFOSKX-CgXFmhFM.js} +1 -1
  275. package/dist/domains/dashboard/web/assets/{line-DC93oja4.js → line-Bhf8l3gG.js} +1 -1
  276. package/dist/domains/dashboard/web/assets/{linear-81TNubkB.js → linear-YWT9mnmu.js} +1 -1
  277. package/dist/domains/dashboard/web/assets/{mermaid-parser.core-D60d8uy9.js → mermaid-parser.core-COzQ1kq0.js} +3 -3
  278. package/dist/domains/dashboard/web/assets/{mermaid.core-l4Wgjz2Q.js → mermaid.core-Cc1lMpx-.js} +4 -4
  279. package/dist/domains/dashboard/web/assets/{mindmap-definition-YA3MSWOX-Dfqu1201.js → mindmap-definition-YA3MSWOX-B_VOgUSO.js} +1 -1
  280. package/dist/domains/dashboard/web/assets/{packet-AYTQ26CC-CsFZBhTs.js → packet-AYTQ26CC-CXbJLNC9.js} +1 -1
  281. package/dist/domains/dashboard/web/assets/{pegDiagram-XKGWAZYB-myFMaA7n.js → pegDiagram-XKGWAZYB-BuS0hioo.js} +1 -1
  282. package/dist/domains/dashboard/web/assets/{pie-WAS4IAKB-FMuCTNSk.js → pie-WAS4IAKB-BEaGwdWZ.js} +1 -1
  283. package/dist/domains/dashboard/web/assets/{pieDiagram-E7YTZNPT-CSR4B4Z1.js → pieDiagram-E7YTZNPT-DDzYv-_9.js} +1 -1
  284. package/dist/domains/dashboard/web/assets/purify.es-Bvo9QlJ8.js +3 -0
  285. package/dist/domains/dashboard/web/assets/{quadrantDiagram-AXDQQJYC-BiE4kEeP.js → quadrantDiagram-AXDQQJYC-DExT--Ut.js} +1 -1
  286. package/dist/domains/dashboard/web/assets/{radar-RG4KPBEZ-BZ-n7JtG.js → radar-RG4KPBEZ-C1JtzGr8.js} +1 -1
  287. package/dist/domains/dashboard/web/assets/{railroad-74A4TZTK-CWVtRfHu.js → railroad-74A4TZTK-CMpkXATR.js} +1 -1
  288. package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-BM35gYWg.js +1 -0
  289. package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-CN60GGp0.js +1 -0
  290. package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-DRUSW4g7.js +1 -0
  291. package/dist/domains/dashboard/web/assets/{railroadDiagram-O6MQD6OU-CBj7v1de.js → railroadDiagram-O6MQD6OU-BCE65sLR.js} +1 -1
  292. package/dist/domains/dashboard/web/assets/{requirementDiagram-BXWQKSXE-DSDgb54n.js → requirementDiagram-BXWQKSXE-CmyX3vGG.js} +1 -1
  293. package/dist/domains/dashboard/web/assets/{sankeyDiagram-P5KCCOFB-1-oXLUAP.js → sankeyDiagram-P5KCCOFB-BFKrX2dv.js} +1 -1
  294. package/dist/domains/dashboard/web/assets/{sequenceDiagram-WJ2MYXX4-DAF4nGs_.js → sequenceDiagram-WJ2MYXX4-DqodS9W-.js} +1 -1
  295. package/dist/domains/dashboard/web/assets/{src-CTWLVUqE.js → src-BVUP3QzK.js} +1 -1
  296. package/dist/domains/dashboard/web/assets/{stateDiagram-D77RDMKH-DzENBaJT.js → stateDiagram-D77RDMKH-nHai_EZh.js} +1 -1
  297. package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-BL6vE1m9.js +1 -0
  298. package/dist/domains/dashboard/web/assets/{swimlanes-42K2YHIH-CnxFUZJc.js → swimlanes-42K2YHIH-BODBARYN.js} +1 -1
  299. package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-XHK_nuTj.js +8 -0
  300. package/dist/domains/dashboard/web/assets/{timeline-definition-24CTP7MA-KtvPzpZM.js → timeline-definition-24CTP7MA-RVnG8rgK.js} +1 -1
  301. package/dist/domains/dashboard/web/assets/{treeView-Q6P3EWNA-Bdu3P9iY.js → treeView-Q6P3EWNA-B6lrg3KQ.js} +1 -1
  302. package/dist/domains/dashboard/web/assets/{treemap-WGGIJYW6-DFnn23JR.js → treemap-WGGIJYW6-CJfMKVf4.js} +1 -1
  303. package/dist/domains/dashboard/web/assets/{vennDiagram-4TSXK5OY-BjpviP26.js → vennDiagram-4TSXK5OY-CZMWJiN7.js} +1 -1
  304. package/dist/domains/dashboard/web/assets/{wardley-WFR3VGLG-CEo4a-j4.js → wardley-WFR3VGLG-BoUsbNlx.js} +1 -1
  305. package/dist/domains/dashboard/web/assets/{wardleyDiagram-VM6X3IG4-Bf54n6im.js → wardleyDiagram-VM6X3IG4-BwBCykVb.js} +1 -1
  306. package/dist/domains/dashboard/web/assets/{xychartDiagram-S5SC5T6Z-CU-hI0Cm.js → xychartDiagram-S5SC5T6Z-vutnbx57.js} +1 -1
  307. package/dist/domains/dashboard/web/index.html +2 -2
  308. package/dist/domains/project-knowledge/corpus.d.ts +5 -0
  309. package/dist/domains/project-knowledge/corpus.d.ts.map +1 -1
  310. package/dist/domains/project-knowledge/corpus.js +34 -9
  311. package/dist/domains/project-knowledge/corpus.js.map +1 -1
  312. package/dist/domains/project-knowledge/index-store.d.ts +5 -2
  313. package/dist/domains/project-knowledge/index-store.d.ts.map +1 -1
  314. package/dist/domains/project-knowledge/index-store.js +95 -52
  315. package/dist/domains/project-knowledge/index-store.js.map +1 -1
  316. package/dist/domains/project-knowledge/local-provider.d.ts.map +1 -1
  317. package/dist/domains/project-knowledge/local-provider.js +14 -3
  318. package/dist/domains/project-knowledge/local-provider.js.map +1 -1
  319. package/dist/domains/project-knowledge/local-store.d.ts +2 -2
  320. package/dist/domains/project-knowledge/local-store.d.ts.map +1 -1
  321. package/dist/domains/project-knowledge/local-store.js +2 -2
  322. package/dist/domains/project-knowledge/local-store.js.map +1 -1
  323. package/dist/domains/project-knowledge/plugin.d.ts.map +1 -1
  324. package/dist/domains/project-knowledge/plugin.js +5 -4
  325. package/dist/domains/project-knowledge/plugin.js.map +1 -1
  326. package/dist/domains/project-knowledge/provider-factory.d.ts.map +1 -1
  327. package/dist/domains/project-knowledge/provider-factory.js +7 -5
  328. package/dist/domains/project-knowledge/provider-factory.js.map +1 -1
  329. package/dist/domains/project-knowledge/types.d.ts +1 -0
  330. package/dist/domains/project-knowledge/types.d.ts.map +1 -1
  331. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  332. package/dist/domains/skill/platform-install.js +31 -3
  333. package/dist/domains/skill/platform-install.js.map +1 -1
  334. package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -1
  335. package/dist/domains/workflow-contract/hook-target-scope.js +2 -1
  336. package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -1
  337. package/dist/platform/paths/git-worktree-cache.d.ts +3 -0
  338. package/dist/platform/paths/git-worktree-cache.d.ts.map +1 -0
  339. package/dist/platform/paths/git-worktree-cache.js +109 -0
  340. package/dist/platform/paths/git-worktree-cache.js.map +1 -0
  341. package/dist/platform/paths/git-worktree.d.ts +6 -0
  342. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  343. package/dist/platform/paths/git-worktree.js +191 -30
  344. package/dist/platform/paths/git-worktree.js.map +1 -1
  345. package/dist/platform/process/comet-daemon.d.ts +3 -0
  346. package/dist/platform/process/comet-daemon.d.ts.map +1 -1
  347. package/dist/platform/process/comet-daemon.js +9 -6
  348. package/dist/platform/process/comet-daemon.js.map +1 -1
  349. package/dist/platform/process/external-command.d.ts +3 -0
  350. package/dist/platform/process/external-command.d.ts.map +1 -1
  351. package/dist/platform/process/external-command.js +69 -2
  352. package/dist/platform/process/external-command.js.map +1 -1
  353. package/dist/platform/process/git.d.ts.map +1 -1
  354. package/dist/platform/process/git.js +3 -4
  355. package/dist/platform/process/git.js.map +1 -1
  356. package/dist/platform/process/hook-adapter.d.ts +2 -0
  357. package/dist/platform/process/hook-adapter.d.ts.map +1 -1
  358. package/dist/platform/process/hook-adapter.js +32 -3
  359. package/dist/platform/process/hook-adapter.js.map +1 -1
  360. package/dist/platform/process/hook-read-cache.d.ts +2 -0
  361. package/dist/platform/process/hook-read-cache.d.ts.map +1 -1
  362. package/dist/platform/process/hook-read-cache.js +25 -13
  363. package/dist/platform/process/hook-read-cache.js.map +1 -1
  364. package/dist/platform/process/process-identity.d.ts.map +1 -1
  365. package/dist/platform/process/process-identity.js +18 -51
  366. package/dist/platform/process/process-identity.js.map +1 -1
  367. package/dist/platform/process/runtime-metrics.d.ts +10 -1
  368. package/dist/platform/process/runtime-metrics.d.ts.map +1 -1
  369. package/dist/platform/process/runtime-metrics.js +37 -2
  370. package/dist/platform/process/runtime-metrics.js.map +1 -1
  371. package/dist/platform/process/windows-process-broker.d.ts +13 -0
  372. package/dist/platform/process/windows-process-broker.d.ts.map +1 -0
  373. package/dist/platform/process/windows-process-broker.js +150 -0
  374. package/dist/platform/process/windows-process-broker.js.map +1 -0
  375. package/dist/platform/process/windows-process-identity.d.ts +6 -0
  376. package/dist/platform/process/windows-process-identity.d.ts.map +1 -0
  377. package/dist/platform/process/windows-process-identity.js +190 -0
  378. package/dist/platform/process/windows-process-identity.js.map +1 -0
  379. package/package.json +1 -1
  380. package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-QeljAKq2.js +0 -1
  381. package/dist/domains/dashboard/web/assets/channel-_AqwP0KA.js +0 -1
  382. package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-CRo4aB_7.js +0 -1
  383. package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-CRo4aB_7.js +0 -1
  384. package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-KYANo3DQ.js +0 -1
  385. package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-CSROlLuj.js +0 -1
  386. package/dist/domains/dashboard/web/assets/purify.es-ChwZkWde.js +0 -3
  387. package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CkHwwI2i.js +0 -1
  388. package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-8xzEHL6v.js +0 -1
  389. package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-nSHBw0tH.js +0 -1
  390. package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-CNw52Fkn.js +0 -1
  391. package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-6TRvbqqI.js +0 -8
@@ -1,157 +1,170 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Su=Object.create;var Ar=Object.defineProperty;var _u=Object.getOwnPropertyDescriptor;var Eu=Object.getOwnPropertyNames;var xu=Object.getPrototypeOf,Pu=Object.prototype.hasOwnProperty;var rn=(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 O=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Ru=(t,e)=>{for(var n in e)Ar(t,n,{get:e[n],enumerable:!0})},Nu=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Eu(e))!Pu.call(t,i)&&i!==n&&Ar(t,i,{get:()=>e[i],enumerable:!(r=_u(e,i))||r.enumerable});return t};var on=(t,e,n)=>(n=t!=null?Su(xu(t)):{},Nu(e||!t||!t.__esModule?Ar(n,"default",{value:t,enumerable:!0}):n,t));var E=w(L=>{"use strict";var jr=Symbol.for("yaml.alias"),ts=Symbol.for("yaml.document"),sn=Symbol.for("yaml.map"),ns=Symbol.for("yaml.pair"),Lr=Symbol.for("yaml.scalar"),an=Symbol.for("yaml.seq"),oe=Symbol.for("yaml.node.type"),Au=t=>!!t&&typeof t=="object"&&t[oe]===jr,Iu=t=>!!t&&typeof t=="object"&&t[oe]===ts,Tu=t=>!!t&&typeof t=="object"&&t[oe]===sn,ju=t=>!!t&&typeof t=="object"&&t[oe]===ns,rs=t=>!!t&&typeof t=="object"&&t[oe]===Lr,Lu=t=>!!t&&typeof t=="object"&&t[oe]===an;function is(t){if(t&&typeof t=="object")switch(t[oe]){case sn:case an:return!0}return!1}function qu(t){if(t&&typeof t=="object")switch(t[oe]){case jr:case sn:case Lr:case an:return!0}return!1}var $u=t=>(rs(t)||is(t))&&!!t.anchor;L.ALIAS=jr;L.DOC=ts;L.MAP=sn;L.NODE_TYPE=oe;L.PAIR=ns;L.SCALAR=Lr;L.SEQ=an;L.hasAnchor=$u;L.isAlias=Au;L.isCollection=is;L.isDocument=Iu;L.isMap=Tu;L.isNode=qu;L.isPair=ju;L.isScalar=rs;L.isSeq=Lu});var lt=w(qr=>{"use strict";var T=E(),F=Symbol("break visit"),os=Symbol("skip children"),G=Symbol("remove node");function cn(t,e){let n=ss(e);T.isDocument(t)?Fe(null,t.contents,n,Object.freeze([t]))===G&&(t.contents=null):Fe(null,t,n,Object.freeze([]))}cn.BREAK=F;cn.SKIP=os;cn.REMOVE=G;function Fe(t,e,n,r){let i=as(t,e,n,r);if(T.isNode(i)||T.isPair(i))return cs(t,r,i),Fe(t,i,n,r);if(typeof i!="symbol"){if(T.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=Fe(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===F)return F;s===G&&(e.items.splice(o,1),o-=1)}}}else if(T.isPair(e)){r=Object.freeze(r.concat(e));let o=Fe("key",e.key,n,r);if(o===F)return F;o===G&&(e.key=null);let s=Fe("value",e.value,n,r);if(s===F)return F;s===G&&(e.value=null)}}return i}async function ln(t,e){let n=ss(e);T.isDocument(t)?await Be(null,t.contents,n,Object.freeze([t]))===G&&(t.contents=null):await Be(null,t,n,Object.freeze([]))}ln.BREAK=F;ln.SKIP=os;ln.REMOVE=G;async function Be(t,e,n,r){let i=await as(t,e,n,r);if(T.isNode(i)||T.isPair(i))return cs(t,r,i),Be(t,i,n,r);if(typeof i!="symbol"){if(T.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await Be(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===F)return F;s===G&&(e.items.splice(o,1),o-=1)}}}else if(T.isPair(e)){r=Object.freeze(r.concat(e));let o=await Be("key",e.key,n,r);if(o===F)return F;o===G&&(e.key=null);let s=await Be("value",e.value,n,r);if(s===F)return F;s===G&&(e.value=null)}}return i}function ss(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 as(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(T.isMap(e))return n.Map?.(t,e,r);if(T.isSeq(e))return n.Seq?.(t,e,r);if(T.isPair(e))return n.Pair?.(t,e,r);if(T.isScalar(e))return n.Scalar?.(t,e,r);if(T.isAlias(e))return n.Alias?.(t,e,r)}function cs(t,e,n){let r=e[e.length-1];if(T.isCollection(r))r.items[t]=n;else if(T.isPair(r))t==="key"?r.key=n:r.value=n;else if(T.isDocument(r))r.contents=n;else{let i=T.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}qr.visit=cn;qr.visitAsync=ln});var $r=w(us=>{"use strict";var ls=E(),Du=lt(),Mu={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wu=t=>t.replace(/[!,[\]{}]/g,e=>Mu[e]),ut=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 r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+Wu(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&ls.isNode(e.contents)){let o={};Du.visit(e.contents,(s,a)=>{ls.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
- `)}};ut.defaultYaml={explicit:!1,version:"1.2"};ut.defaultTags={"!!":"tag:yaml.org,2002:"};us.Directives=ut});var un=w(ft=>{"use strict";var fs=E(),Fu=lt();function Bu(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 ds(t){let e=new Set;return Fu.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function ms(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function Uu(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=ds(t));let s=ms(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(fs.isScalar(s.node)||fs.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}ft.anchorIsValid=Bu;ft.anchorNames=ds;ft.createNodeAnchors=Uu;ft.findNewAnchor=ms});var Dr=w(ps=>{"use strict";function dt(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=dt(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=dt(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=dt(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=dt(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}ps.applyReviver=dt});var de=w(gs=>{"use strict";var Ku=E();function hs(t,e,n){if(Array.isArray(t))return t.map((r,i)=>hs(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Ku.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}gs.toJS=hs});var fn=w(ys=>{"use strict";var zu=Dr(),ws=E(),Ju=de(),Mr=class{constructor(e){Object.defineProperty(this,ws.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:r,onAnchor:i,reviver:o}={}){if(!ws.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Ju.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?zu.applyReviver(o,{"":a},"",a):a}};ys.NodeBase=Mr});var mt=w(vs=>{"use strict";var Yu=un(),Hu=lt(),Ue=E(),Vu=fn(),Gu=de(),Wr=class extends Vu.NodeBase{constructor(e){super(Ue.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 r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],Hu.visit(e,{Node:(o,s)=>{(Ue.isAlias(s)||Ue.hasAnchor(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(s);if(a||(Gu.toJS(s,null,n),a=r.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=dn(i,s,r)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(Yu.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function dn(t,e,n){if(Ue.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Ue.isCollection(e)){let r=0;for(let i of e.items){let o=dn(t,i,n);o>r&&(r=o)}return r}else if(Ue.isPair(e)){let r=dn(t,e.key,n),i=dn(t,e.value,n);return Math.max(r,i)}return 1}vs.Alias=Wr});var A=w(Fr=>{"use strict";var Xu=E(),Qu=fn(),Zu=de(),ef=t=>!t||typeof t!="function"&&typeof t!="object",me=class extends Qu.NodeBase{constructor(e){super(Xu.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Zu.toJS(this.value,e,n)}toString(){return String(this.value)}};me.BLOCK_FOLDED="BLOCK_FOLDED";me.BLOCK_LITERAL="BLOCK_LITERAL";me.PLAIN="PLAIN";me.QUOTE_DOUBLE="QUOTE_DOUBLE";me.QUOTE_SINGLE="QUOTE_SINGLE";Fr.Scalar=me;Fr.isScalarValue=ef});var pt=w(ks=>{"use strict";var tf=mt(),Ne=E(),bs=A(),nf="tag:yaml.org,2002:";function rf(t,e,n){if(e){let r=n.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function of(t,e,n){if(Ne.isDocument(t)&&(t=t.contents),Ne.isNode(t))return t;if(Ne.isPair(t)){let f=n.schema[Ne.MAP].createNode?.(n.schema,null,n);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new tf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=nf+e.slice(2));let l=rf(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new bs.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?s[Ne.MAP]:Symbol.iterator in Object(t)?s[Ne.SEQ]:s[Ne.MAP]}o&&(o(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new bs.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}ks.createNode=of});var pn=w(mn=>{"use strict";var sf=pt(),X=E(),af=fn();function Br(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return sf.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Cs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ur=class extends af.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(r=>X.isNode(r)||X.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Cs(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(X.isCollection(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,Br(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(X.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&X.isScalar(o)?o.value:o:X.isCollection(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!X.isPair(n))return!1;let r=n.value;return r==null||e&&X.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return X.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(X.isCollection(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,Br(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};mn.Collection=Ur;mn.collectionFromPath=Br;mn.isEmptyPath=Cs});var ht=w(hn=>{"use strict";var cf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Kr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var lf=(t,e,n)=>t.endsWith(`
6
- `)?Kr(n,e):n.includes(`
4
+ var Uu=Object.create;var Fr=Object.defineProperty;var Ku=Object.getOwnPropertyDescriptor;var zu=Object.getOwnPropertyNames;var Ju=Object.getPrototypeOf,Yu=Object.prototype.hasOwnProperty;var un=(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 O=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Hu=(t,e)=>{for(var n in e)Fr(t,n,{get:e[n],enumerable:!0})},Gu=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of zu(e))!Yu.call(t,i)&&i!==n&&Fr(t,i,{get:()=>e[i],enumerable:!(r=Ku(e,i))||r.enumerable});return t};var fn=(t,e,n)=>(n=t!=null?Uu(Ju(t)):{},Gu(e||!t||!t.__esModule?Fr(n,"default",{value:t,enumerable:!0}):n,t));var _=w(L=>{"use strict";var Kr=Symbol.for("yaml.alias"),ys=Symbol.for("yaml.document"),pn=Symbol.for("yaml.map"),vs=Symbol.for("yaml.pair"),zr=Symbol.for("yaml.scalar"),hn=Symbol.for("yaml.seq"),ae=Symbol.for("yaml.node.type"),tf=t=>!!t&&typeof t=="object"&&t[ae]===Kr,nf=t=>!!t&&typeof t=="object"&&t[ae]===ys,rf=t=>!!t&&typeof t=="object"&&t[ae]===pn,of=t=>!!t&&typeof t=="object"&&t[ae]===vs,bs=t=>!!t&&typeof t=="object"&&t[ae]===zr,sf=t=>!!t&&typeof t=="object"&&t[ae]===hn;function ks(t){if(t&&typeof t=="object")switch(t[ae]){case pn:case hn:return!0}return!1}function af(t){if(t&&typeof t=="object")switch(t[ae]){case Kr:case pn:case zr:case hn:return!0}return!1}var cf=t=>(bs(t)||ks(t))&&!!t.anchor;L.ALIAS=Kr;L.DOC=ys;L.MAP=pn;L.NODE_TYPE=ae;L.PAIR=vs;L.SCALAR=zr;L.SEQ=hn;L.hasAnchor=cf;L.isAlias=tf;L.isCollection=ks;L.isDocument=nf;L.isMap=rf;L.isNode=af;L.isPair=of;L.isScalar=bs;L.isSeq=sf});var mt=w(Jr=>{"use strict";var T=_(),F=Symbol("break visit"),Cs=Symbol("skip children"),Q=Symbol("remove node");function gn(t,e){let n=Ss(e);T.isDocument(t)?Je(null,t.contents,n,Object.freeze([t]))===Q&&(t.contents=null):Je(null,t,n,Object.freeze([]))}gn.BREAK=F;gn.SKIP=Cs;gn.REMOVE=Q;function Je(t,e,n,r){let i=Es(t,e,n,r);if(T.isNode(i)||T.isPair(i))return _s(t,r,i),Je(t,i,n,r);if(typeof i!="symbol"){if(T.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=Je(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===F)return F;s===Q&&(e.items.splice(o,1),o-=1)}}}else if(T.isPair(e)){r=Object.freeze(r.concat(e));let o=Je("key",e.key,n,r);if(o===F)return F;o===Q&&(e.key=null);let s=Je("value",e.value,n,r);if(s===F)return F;s===Q&&(e.value=null)}}return i}async function wn(t,e){let n=Ss(e);T.isDocument(t)?await Ye(null,t.contents,n,Object.freeze([t]))===Q&&(t.contents=null):await Ye(null,t,n,Object.freeze([]))}wn.BREAK=F;wn.SKIP=Cs;wn.REMOVE=Q;async function Ye(t,e,n,r){let i=await Es(t,e,n,r);if(T.isNode(i)||T.isPair(i))return _s(t,r,i),Ye(t,i,n,r);if(typeof i!="symbol"){if(T.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await Ye(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===F)return F;s===Q&&(e.items.splice(o,1),o-=1)}}}else if(T.isPair(e)){r=Object.freeze(r.concat(e));let o=await Ye("key",e.key,n,r);if(o===F)return F;o===Q&&(e.key=null);let s=await Ye("value",e.value,n,r);if(s===F)return F;s===Q&&(e.value=null)}}return i}function Ss(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 Es(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(T.isMap(e))return n.Map?.(t,e,r);if(T.isSeq(e))return n.Seq?.(t,e,r);if(T.isPair(e))return n.Pair?.(t,e,r);if(T.isScalar(e))return n.Scalar?.(t,e,r);if(T.isAlias(e))return n.Alias?.(t,e,r)}function _s(t,e,n){let r=e[e.length-1];if(T.isCollection(r))r.items[t]=n;else if(T.isPair(r))t==="key"?r.key=n:r.value=n;else if(T.isDocument(r))r.contents=n;else{let i=T.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Jr.visit=gn;Jr.visitAsync=wn});var Yr=w(Ps=>{"use strict";var xs=_(),lf=mt(),uf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ff=t=>t.replace(/[!,[\]{}]/g,e=>uf[e]),pt=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 r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+ff(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&xs.isNode(e.contents)){let o={};lf.visit(e.contents,(s,a)=>{xs.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
+ `)}};pt.defaultYaml={explicit:!1,version:"1.2"};pt.defaultTags={"!!":"tag:yaml.org,2002:"};Ps.Directives=pt});var yn=w(ht=>{"use strict";var Rs=_(),df=mt();function mf(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 Ns(t){let e=new Set;return df.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function Os(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function pf(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=Ns(t));let s=Os(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(Rs.isScalar(s.node)||Rs.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}ht.anchorIsValid=mf;ht.anchorNames=Ns;ht.createNodeAnchors=pf;ht.findNewAnchor=Os});var Hr=w(As=>{"use strict";function gt(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=gt(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=gt(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=gt(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=gt(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}As.applyReviver=gt});var pe=w(Ts=>{"use strict";var hf=_();function Is(t,e,n){if(Array.isArray(t))return t.map((r,i)=>Is(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!hf.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}Ts.toJS=Is});var vn=w(Ls=>{"use strict";var gf=Hr(),js=_(),wf=pe(),Gr=class{constructor(e){Object.defineProperty(this,js.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:r,onAnchor:i,reviver:o}={}){if(!js.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=wf.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?gf.applyReviver(o,{"":a},"",a):a}};Ls.NodeBase=Gr});var wt=w(qs=>{"use strict";var yf=yn(),vf=mt(),He=_(),bf=vn(),kf=pe(),Vr=class extends bf.NodeBase{constructor(e){super(He.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 r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],vf.visit(e,{Node:(o,s)=>{(He.isAlias(s)||He.hasAnchor(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(s);if(a||(kf.toJS(s,null,n),a=r.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=bn(i,s,r)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(yf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function bn(t,e,n){if(He.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(He.isCollection(e)){let r=0;for(let i of e.items){let o=bn(t,i,n);o>r&&(r=o)}return r}else if(He.isPair(e)){let r=bn(t,e.key,n),i=bn(t,e.value,n);return Math.max(r,i)}return 1}qs.Alias=Vr});var A=w(Xr=>{"use strict";var Cf=_(),Sf=vn(),Ef=pe(),_f=t=>!t||typeof t!="function"&&typeof t!="object",he=class extends Sf.NodeBase{constructor(e){super(Cf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Ef.toJS(this.value,e,n)}toString(){return String(this.value)}};he.BLOCK_FOLDED="BLOCK_FOLDED";he.BLOCK_LITERAL="BLOCK_LITERAL";he.PLAIN="PLAIN";he.QUOTE_DOUBLE="QUOTE_DOUBLE";he.QUOTE_SINGLE="QUOTE_SINGLE";Xr.Scalar=he;Xr.isScalarValue=_f});var yt=w(Ms=>{"use strict";var xf=wt(),Te=_(),$s=A(),Pf="tag:yaml.org,2002:";function Rf(t,e,n){if(e){let r=n.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function Nf(t,e,n){if(Te.isDocument(t)&&(t=t.contents),Te.isNode(t))return t;if(Te.isPair(t)){let f=n.schema[Te.MAP].createNode?.(n.schema,null,n);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new xf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Pf+e.slice(2));let l=Rf(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new $s.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?s[Te.MAP]:Symbol.iterator in Object(t)?s[Te.SEQ]:s[Te.MAP]}o&&(o(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new $s.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Ms.createNode=Nf});var Cn=w(kn=>{"use strict";var Of=yt(),Z=_(),Af=vn();function Qr(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return Of.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Ds=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Zr=class extends Af.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(r=>Z.isNode(r)||Z.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Ds(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(Z.isCollection(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,Qr(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(Z.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&Z.isScalar(o)?o.value:o:Z.isCollection(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!Z.isPair(n))return!1;let r=n.value;return r==null||e&&Z.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return Z.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(Z.isCollection(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,Qr(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};kn.Collection=Zr;kn.collectionFromPath=Qr;kn.isEmptyPath=Ds});var vt=w(Sn=>{"use strict";var If=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function ei(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Tf=(t,e,n)=>t.endsWith(`
6
+ `)?ei(n,e):n.includes(`
7
7
  `)?`
8
- `+Kr(n,e):(t.endsWith(" ")?"":" ")+n;hn.indentComment=Kr;hn.lineComment=lf;hn.stringifyComment=cf});var _s=w(gt=>{"use strict";var uf="flow",zr="block",gn="quoted";function ff(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],u={},f=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?l.push(0):f=i-r);let d,p,g=!1,m=-1,h=-1,v=-1;n===zr&&(m=Ss(t,m,e.length),m!==-1&&(f=m+c));for(let k;k=t[m+=1];){if(n===gn&&k==="\\"){switch(h=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}v=m}if(k===`
9
- `)n===zr&&(m=Ss(t,m,e.length)),f=m+e.length+c,d=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
8
+ `+ei(n,e):(t.endsWith(" ")?"":" ")+n;Sn.indentComment=ei;Sn.lineComment=Tf;Sn.stringifyComment=If});var Fs=w(bt=>{"use strict";var jf="flow",ti="block",En="quoted";function Lf(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],u={},f=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?l.push(0):f=i-r);let d,p,g=!1,m=-1,h=-1,y=-1;n===ti&&(m=Ws(t,m,e.length),m!==-1&&(f=m+c));for(let k;k=t[m+=1];){if(n===En&&k==="\\"){switch(h=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if(k===`
9
+ `)n===ti&&(m=Ws(t,m,e.length)),f=m+e.length+c,d=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
10
10
  `&&p!==" "){let C=t[m+1];C&&C!==" "&&C!==`
11
- `&&C!==" "&&(d=m)}if(m>=f)if(d)l.push(d),f=d+c,d=void 0;else if(n===gn){for(;p===" "||p===" ";)p=k,k=t[m+=1],g=!0;let C=m>v+1?m-2:h-1;if(u[C])return t;l.push(C),u[C]=!0,f=C+c,d=void 0}else g=!0}p=k}if(g&&a&&a(),l.length===0)return t;s&&s();let b=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],S=l[k+1]||t.length;C===0?b=`
12
- ${e}${t.slice(0,S)}`:(n===gn&&u[C]&&(b+=`${t[C]}\\`),b+=`
13
- ${e}${t.slice(C+1,S)}`)}return b}function Ss(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
- `);r=e,i=e+1,o=t[i]}return r}gt.FOLD_BLOCK=zr;gt.FOLD_FLOW=uf;gt.FOLD_QUOTED=gn;gt.foldFlowLines=ff});var yt=w(Es=>{"use strict";var Y=A(),pe=_s(),yn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),vn=t=>/^(%|---|\.\.\.)/m.test(t);function df(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
15
- `){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function wt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(vn(t)?" ":""),s="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(s+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{s+=n.slice(a,c);let u=n.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(s+=n.slice(a,c)+`
11
+ `&&C!==" "&&(d=m)}if(m>=f)if(d)l.push(d),f=d+c,d=void 0;else if(n===En){for(;p===" "||p===" ";)p=k,k=t[m+=1],g=!0;let C=m>y+1?m-2:h-1;if(u[C])return t;l.push(C),u[C]=!0,f=C+c,d=void 0}else g=!0}p=k}if(g&&a&&a(),l.length===0)return t;s&&s();let b=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],S=l[k+1]||t.length;C===0?b=`
12
+ ${e}${t.slice(0,S)}`:(n===En&&u[C]&&(b+=`${t[C]}\\`),b+=`
13
+ ${e}${t.slice(C+1,S)}`)}return b}function Ws(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
+ `);r=e,i=e+1,o=t[i]}return r}bt.FOLD_BLOCK=ti;bt.FOLD_FLOW=jf;bt.FOLD_QUOTED=En;bt.foldFlowLines=Lf});var Ct=w(Bs=>{"use strict";var G=A(),ge=Fs(),xn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Pn=t=>/^(%|---|\.\.\.)/m.test(t);function qf(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
15
+ `){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function kt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Pn(t)?" ":""),s="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(s+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{s+=n.slice(a,c);let u=n.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(s+=n.slice(a,c)+`
16
16
 
17
17
  `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)s+=`
18
- `,c+=2;s+=o,n[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+n.slice(a):n,r?s:pe.foldFlowLines(s,o,pe.FOLD_QUOTED,yn(e,!1))}function Jr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return wt(t,e);let n=e.indent||(vn(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?r:pe.foldFlowLines(r,n,pe.FOLD_FLOW,yn(e,!1))}function Ke(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=wt;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=Jr:o&&!i?r=wt:r=n?Jr:wt}return r(t,e)}var Yr;try{Yr=new RegExp(`(^|(?<!
18
+ `,c+=2;s+=o,n[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+n.slice(a):n,r?s:ge.foldFlowLines(s,o,ge.FOLD_QUOTED,xn(e,!1))}function ni(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return kt(t,e);let n=e.indent||(Pn(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?r:ge.foldFlowLines(r,n,ge.FOLD_FLOW,xn(e,!1))}function Ge(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=kt;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=ni:o&&!i?r=kt:r=n?ni:kt}return r(t,e)}var ri;try{ri=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Yr=/\n+(?!\n|$)/g}function wn({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=r.options;if(!s||/\n[\t ]+$/.test(n))return Ke(n,r);let l=r.indent||(r.forceBlockIndent||vn(n)?" ":""),u=s==="literal"?!0:s==="folded"||e===Y.Scalar.BLOCK_FOLDED?!1:e===Y.Scalar.BLOCK_LITERAL?!0:!df(n,c,l.length);if(!n)return u?`|
23
+ |$)`,"g")}catch{ri=/\n+(?!\n|$)/g}function _n({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=r.options;if(!s||/\n[\t ]+$/.test(n))return Ge(n,r);let l=r.indent||(r.forceBlockIndent||Pn(n)?" ":""),u=s==="literal"?!0:s==="folded"||e===G.Scalar.BLOCK_FOLDED?!1:e===G.Scalar.BLOCK_LITERAL?!0:!qf(n,c,l.length);if(!n)return u?`|
24
24
  `:`>
25
25
  `;let f,d;for(d=n.length;d>0;--d){let S=n[d-1];if(S!==`
26
26
  `&&S!==" "&&S!==" ")break}let p=n.substring(d),g=p.indexOf(`
27
27
  `);g===-1?f="-":n===p||g!==p.length-1?(f="+",o&&o()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
28
- `&&(p=p.slice(0,-1)),p=p.replace(Yr,`$&${l}`));let m=!1,h,v=-1;for(h=0;h<n.length;++h){let S=n[h];if(S===" ")m=!0;else if(S===`
29
- `)v=h;else break}let b=n.substring(0,v<h?v+1:h);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let C=(m?l?"2":"1":"")+f;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let S=n.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),_=!1,P=yn(r,!0);s!=="folded"&&e!==Y.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{_=!0});let y=pe.foldFlowLines(`${b}${S}${p}`,l,pe.FOLD_BLOCK,P);if(!_)return`>${C}
31
- ${l}${y}`}return n=n.replace(/\n+/g,`$&${l}`),`|${C}
32
- ${l}${b}${n}${p}`}function mf(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(`
33
- `)||u&&/[[\]{},]/.test(o))return Ke(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
34
- `)?Ke(o,e):wn(t,e,n,r);if(!a&&!u&&i!==Y.Scalar.PLAIN&&o.includes(`
35
- `))return wn(t,e,n,r);if(vn(o)){if(c==="")return e.forceBlockIndent=!0,wn(t,e,n,r);if(a&&c===l)return Ke(o,e)}let f=o.replace(/\n+/g,`$&
36
- ${c}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:g}=e.doc.schema;if(g.some(d)||p?.some(d))return Ke(o,e)}return a?f:pe.foldFlowLines(f,c,pe.FOLD_FLOW,yn(e,!1))}function pf(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Y.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Y.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Y.Scalar.BLOCK_FOLDED:case Y.Scalar.BLOCK_LITERAL:return i||o?Ke(s.value,e):wn(s,e,n,r);case Y.Scalar.QUOTE_DOUBLE:return wt(s.value,e);case Y.Scalar.QUOTE_SINGLE:return Jr(s.value,e);case Y.Scalar.PLAIN:return mf(s,e,n,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Es.stringifyString=pf});var vt=w(Hr=>{"use strict";var hf=un(),he=E(),gf=ht(),wf=yt();function yf(t,e){let n=Object.assign({blockQuote:!0,commentString:gf.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),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function vf(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(he.isScalar(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function bf(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(he.isScalar(t)||he.isCollection(t))&&t.anchor;o&&hf.anchorIsValid(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function kf(t,e,n,r){if(he.isPair(t))return t.toString(e,n,r);if(he.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 i,o=he.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=vf(e.doc.schema.tags,o));let s=bf(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):he.isScalar(o)?wf.stringifyString(o,e,n,r):o.toString(e,n,r);return s?he.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
- ${e.indent}${a}`:a}Hr.createStringifyContext=yf;Hr.stringify=kf});var Ns=w(Rs=>{"use strict";var se=E(),xs=A(),Ps=vt(),bt=ht();function Cf({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=n,d=se.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(se.isCollection(t)||!se.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!f&&(!t||d&&e==null&&!n.inFlow||se.isCollection(t)||(se.isScalar(t)?t.type===xs.Scalar.BLOCK_FOLDED||t.type===xs.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+c});let g=!1,m=!1,h=Ps.stringify(t,n,()=>g=!0,()=>m=!0);if(!p&&!n.inFlow&&h.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||e==null)return g&&r&&r(),h===""?"?":p?`? ${h}`:h}else if(o&&!f||e==null&&p)return h=`? ${h}`,d&&!g?h+=bt.lineComment(h,n.indent,l(d)):m&&i&&i(),h;g&&(d=null),p?(d&&(h+=bt.lineComment(h,n.indent,l(d))),h=`? ${h}
38
- ${a}:`):(h=`${h}:`,d&&(h+=bt.lineComment(h,n.indent,l(d))));let v,b,k;se.isNode(e)?(v=!!e.spaceBefore,b=e.commentBefore,k=e.comment):(v=!1,b=null,k=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!p&&!d&&se.isScalar(e)&&(n.indentAtStart=h.length+1),m=!1,!u&&c.length>=2&&!n.inFlow&&!p&&se.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,S=Ps.stringify(e,n,()=>C=!0,()=>m=!0),_=" ";if(d||v||b){if(_=v?`
39
- `:"",b){let P=l(b);_+=`
40
- ${bt.indentComment(P,n.indent)}`}S===""&&!n.inFlow?_===`
41
- `&&k&&(_=`
28
+ `&&(p=p.slice(0,-1)),p=p.replace(ri,`$&${l}`));let m=!1,h,y=-1;for(h=0;h<n.length;++h){let S=n[h];if(S===" ")m=!0;else if(S===`
29
+ `)y=h;else break}let b=n.substring(0,y<h?y+1:h);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let C=(m?l?"2":"1":"")+f;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let S=n.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,P=xn(r,!0);s!=="folded"&&e!==G.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{E=!0});let v=ge.foldFlowLines(`${b}${S}${p}`,l,ge.FOLD_BLOCK,P);if(!E)return`>${C}
31
+ ${l}${v}`}return n=n.replace(/\n+/g,`$&${l}`),`|${C}
32
+ ${l}${b}${n}${p}`}function $f(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(`
33
+ `)||u&&/[[\]{},]/.test(o))return Ge(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
34
+ `)?Ge(o,e):_n(t,e,n,r);if(!a&&!u&&i!==G.Scalar.PLAIN&&o.includes(`
35
+ `))return _n(t,e,n,r);if(Pn(o)){if(c==="")return e.forceBlockIndent=!0,_n(t,e,n,r);if(a&&c===l)return Ge(o,e)}let f=o.replace(/\n+/g,`$&
36
+ ${c}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:g}=e.doc.schema;if(g.some(d)||p?.some(d))return Ge(o,e)}return a?f:ge.foldFlowLines(f,c,ge.FOLD_FLOW,xn(e,!1))}function Mf(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==G.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=G.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case G.Scalar.BLOCK_FOLDED:case G.Scalar.BLOCK_LITERAL:return i||o?Ge(s.value,e):_n(s,e,n,r);case G.Scalar.QUOTE_DOUBLE:return kt(s.value,e);case G.Scalar.QUOTE_SINGLE:return ni(s.value,e);case G.Scalar.PLAIN:return $f(s,e,n,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Bs.stringifyString=Mf});var St=w(ii=>{"use strict";var Df=yn(),we=_(),Wf=vt(),Ff=Ct();function Bf(t,e){let n=Object.assign({blockQuote:!0,commentString:Wf.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),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Uf(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(we.isScalar(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Kf(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(we.isScalar(t)||we.isCollection(t))&&t.anchor;o&&Df.anchorIsValid(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function zf(t,e,n,r){if(we.isPair(t))return t.toString(e,n,r);if(we.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 i,o=we.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Uf(e.doc.schema.tags,o));let s=Kf(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):we.isScalar(o)?Ff.stringifyString(o,e,n,r):o.toString(e,n,r);return s?we.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
+ ${e.indent}${a}`:a}ii.createStringifyContext=Bf;ii.stringify=zf});var Js=w(zs=>{"use strict";var ce=_(),Us=A(),Ks=St(),Et=vt();function Jf({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=n,d=ce.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ce.isCollection(t)||!ce.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!f&&(!t||d&&e==null&&!n.inFlow||ce.isCollection(t)||(ce.isScalar(t)?t.type===Us.Scalar.BLOCK_FOLDED||t.type===Us.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+c});let g=!1,m=!1,h=Ks.stringify(t,n,()=>g=!0,()=>m=!0);if(!p&&!n.inFlow&&h.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||e==null)return g&&r&&r(),h===""?"?":p?`? ${h}`:h}else if(o&&!f||e==null&&p)return h=`? ${h}`,d&&!g?h+=Et.lineComment(h,n.indent,l(d)):m&&i&&i(),h;g&&(d=null),p?(d&&(h+=Et.lineComment(h,n.indent,l(d))),h=`? ${h}
38
+ ${a}:`):(h=`${h}:`,d&&(h+=Et.lineComment(h,n.indent,l(d))));let y,b,k;ce.isNode(e)?(y=!!e.spaceBefore,b=e.commentBefore,k=e.comment):(y=!1,b=null,k=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!p&&!d&&ce.isScalar(e)&&(n.indentAtStart=h.length+1),m=!1,!u&&c.length>=2&&!n.inFlow&&!p&&ce.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,S=Ks.stringify(e,n,()=>C=!0,()=>m=!0),E=" ";if(d||y||b){if(E=y?`
39
+ `:"",b){let P=l(b);E+=`
40
+ ${Et.indentComment(P,n.indent)}`}S===""&&!n.inFlow?E===`
41
+ `&&k&&(E=`
42
42
 
43
- `):_+=`
44
- ${n.indent}`}else if(!p&&se.isCollection(e)){let P=S[0],y=S.indexOf(`
45
- `),N=y!==-1,J=n.inFlow??e.flow??e.items.length===0;if(N||!J){let ne=!1;if(N&&(P==="&"||P==="!")){let R=S.indexOf(" ");P==="&"&&R!==-1&&R<y&&S[R+1]==="!"&&(R=S.indexOf(" ",R+1)),(R===-1||y<R)&&(ne=!0)}ne||(_=`
43
+ `):E+=`
44
+ ${n.indent}`}else if(!p&&ce.isCollection(e)){let P=S[0],v=S.indexOf(`
45
+ `),N=v!==-1,H=n.inFlow??e.flow??e.items.length===0;if(N||!H){let ie=!1;if(N&&(P==="&"||P==="!")){let R=S.indexOf(" ");P==="&"&&R!==-1&&R<v&&S[R+1]==="!"&&(R=S.indexOf(" ",R+1)),(R===-1||v<R)&&(ie=!0)}ie||(E=`
46
46
  ${n.indent}`)}}else(S===""||S[0]===`
47
- `)&&(_="");return h+=_+S,n.inFlow?C&&r&&r():k&&!C?h+=bt.lineComment(h,n.indent,l(k)):m&&i&&i(),h}Rs.stringifyPair=Cf});var Gr=w(Vr=>{"use strict";var Os=rn("process");function Sf(t,...e){t==="debug"&&console.log(...e)}function _f(t,e){(t==="debug"||t==="warn")&&(typeof Os.emitWarning=="function"?Os.emitWarning(e):console.warn(e))}Vr.debug=Sf;Vr.warn=_f});var _n=w(Sn=>{"use strict";var Cn=E(),As=A(),bn="<<",kn={identify:t=>t===bn||typeof t=="symbol"&&t.description===bn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new As.Scalar(Symbol(bn)),{addToJSMap:Is}),stringify:()=>bn},Ef=(t,e)=>(kn.identify(e)||Cn.isScalar(e)&&(!e.type||e.type===As.Scalar.PLAIN)&&kn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===kn.tag&&n.default);function Is(t,e,n){let r=Ts(t,n);if(Cn.isSeq(r))for(let i of r.items)Xr(t,e,i);else if(Array.isArray(r))for(let i of r)Xr(t,e,i);else Xr(t,e,r)}function Xr(t,e,n){let r=Ts(t,n);if(!Cn.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function Ts(t,e){return t&&Cn.isAlias(e)?e.resolve(t.doc,t):e}Sn.addMergeToJSMap=Is;Sn.isMergeKey=Ef;Sn.merge=kn});var Zr=w(qs=>{"use strict";var xf=Gr(),js=_n(),Pf=vt(),Ls=E(),Qr=de();function Rf(t,e,{key:n,value:r}){if(Ls.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(js.isMergeKey(t,n))js.addMergeToJSMap(t,e,r);else{let i=Qr.toJS(n,"",t);if(e instanceof Map)e.set(i,Qr.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let o=Nf(n,i,t),s=Qr.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Nf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Ls.isNode(t)&&n?.doc){let r=Pf.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),xf.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}qs.addPairToJSMap=Rf});var ge=w(ei=>{"use strict";var $s=pt(),Of=Ns(),Af=Zr(),En=E();function If(t,e,n){let r=$s.createNode(t,void 0,n),i=$s.createNode(e,void 0,n);return new xn(r,i)}var xn=class t{constructor(e,n=null){Object.defineProperty(this,En.NODE_TYPE,{value:En.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return En.isNode(n)&&(n=n.clone(e)),En.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return Af.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?Of.stringifyPair(this,e,n,r):JSON.stringify(this)}};ei.Pair=xn;ei.createPair=If});var ti=w(Ms=>{"use strict";var Oe=E(),Ds=vt(),Pn=ht();function Tf(t,e,n){return(e.inFlow??t.flow?Lf:jf)(t,e,n)}function jf({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:o,type:null}),f=!1,d=[];for(let g=0;g<e.length;++g){let m=e[g],h=null;if(Oe.isNode(m))!f&&m.spaceBefore&&d.push(""),Rn(n,d,m.commentBefore,f),m.comment&&(h=m.comment);else if(Oe.isPair(m)){let b=Oe.isNode(m.key)?m.key:null;b&&(!f&&b.spaceBefore&&d.push(""),Rn(n,d,b.commentBefore,f))}f=!1;let v=Ds.stringify(m,u,()=>h=null,()=>f=!0);h&&(v+=Pn.lineComment(v,o,l(h))),f&&h&&(f=!1),d.push(r+v)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let g=1;g<d.length;++g){let m=d[g];p+=m?`
47
+ `)&&(E="");return h+=E+S,n.inFlow?C&&r&&r():k&&!C?h+=Et.lineComment(h,n.indent,l(k)):m&&i&&i(),h}zs.stringifyPair=Jf});var si=w(oi=>{"use strict";var Ys=un("process");function Yf(t,...e){t==="debug"&&console.log(...e)}function Hf(t,e){(t==="debug"||t==="warn")&&(typeof Ys.emitWarning=="function"?Ys.emitWarning(e):console.warn(e))}oi.debug=Yf;oi.warn=Hf});var In=w(An=>{"use strict";var On=_(),Hs=A(),Rn="<<",Nn={identify:t=>t===Rn||typeof t=="symbol"&&t.description===Rn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Hs.Scalar(Symbol(Rn)),{addToJSMap:Gs}),stringify:()=>Rn},Gf=(t,e)=>(Nn.identify(e)||On.isScalar(e)&&(!e.type||e.type===Hs.Scalar.PLAIN)&&Nn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Nn.tag&&n.default);function Gs(t,e,n){let r=Vs(t,n);if(On.isSeq(r))for(let i of r.items)ai(t,e,i);else if(Array.isArray(r))for(let i of r)ai(t,e,i);else ai(t,e,r)}function ai(t,e,n){let r=Vs(t,n);if(!On.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function Vs(t,e){return t&&On.isAlias(e)?e.resolve(t.doc,t):e}An.addMergeToJSMap=Gs;An.isMergeKey=Gf;An.merge=Nn});var li=w(Zs=>{"use strict";var Vf=si(),Xs=In(),Xf=St(),Qs=_(),ci=pe();function Qf(t,e,{key:n,value:r}){if(Qs.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(Xs.isMergeKey(t,n))Xs.addMergeToJSMap(t,e,r);else{let i=ci.toJS(n,"",t);if(e instanceof Map)e.set(i,ci.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let o=Zf(n,i,t),s=ci.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Zf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Qs.isNode(t)&&n?.doc){let r=Xf.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Vf.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}Zs.addPairToJSMap=Qf});var ye=w(ui=>{"use strict";var ea=yt(),ed=Js(),td=li(),Tn=_();function nd(t,e,n){let r=ea.createNode(t,void 0,n),i=ea.createNode(e,void 0,n);return new jn(r,i)}var jn=class t{constructor(e,n=null){Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Tn.isNode(n)&&(n=n.clone(e)),Tn.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return td.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?ed.stringifyPair(this,e,n,r):JSON.stringify(this)}};ui.Pair=jn;ui.createPair=nd});var fi=w(na=>{"use strict";var je=_(),ta=St(),Ln=vt();function rd(t,e,n){return(e.inFlow??t.flow?od:id)(t,e,n)}function id({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:o,type:null}),f=!1,d=[];for(let g=0;g<e.length;++g){let m=e[g],h=null;if(je.isNode(m))!f&&m.spaceBefore&&d.push(""),qn(n,d,m.commentBefore,f),m.comment&&(h=m.comment);else if(je.isPair(m)){let b=je.isNode(m.key)?m.key:null;b&&(!f&&b.spaceBefore&&d.push(""),qn(n,d,b.commentBefore,f))}f=!1;let y=ta.stringify(m,u,()=>h=null,()=>f=!0);h&&(y+=Ln.lineComment(y,o,l(h))),f&&h&&(f=!1),d.push(r+y)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let g=1;g<d.length;++g){let m=d[g];p+=m?`
48
48
  ${c}${m}`:`
49
49
  `}}return t?(p+=`
50
- `+Pn.indentComment(l(t),c),a&&a()):f&&s&&s(),p}function Lf({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<t.length;++g){let m=t[g],h=null;if(Oe.isNode(m))m.spaceBefore&&f.push(""),Rn(e,f,m.commentBefore,!1),m.comment&&(h=m.comment);else if(Oe.isPair(m)){let b=Oe.isNode(m.key)?m.key:null;b&&(b.spaceBefore&&f.push(""),Rn(e,f,b.commentBefore,!1),b.comment&&(l=!0));let k=Oe.isNode(m.value)?m.value:null;k?(k.comment&&(h=k.comment),k.commentBefore&&(l=!0)):m.value==null&&b?.comment&&(h=b.comment)}h&&(l=!0);let v=Ds.stringify(m,c,()=>h=null);l||(l=f.length>u||v.includes(`
51
- `)),g<t.length-1?v+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((b,k)=>b+k.length+2,2)+(v.length+2)>e.options.lineWidth)),l&&(v+=",")),h&&(v+=Pn.lineComment(v,r,a(h))),f.push(v),u=f.length}let{start:d,end:p}=n;if(f.length===0)return d+p;if(!l){let g=f.reduce((m,h)=>m+h.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let m of f)g+=m?`
50
+ `+Ln.indentComment(l(t),c),a&&a()):f&&s&&s(),p}function od({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<t.length;++g){let m=t[g],h=null;if(je.isNode(m))m.spaceBefore&&f.push(""),qn(e,f,m.commentBefore,!1),m.comment&&(h=m.comment);else if(je.isPair(m)){let b=je.isNode(m.key)?m.key:null;b&&(b.spaceBefore&&f.push(""),qn(e,f,b.commentBefore,!1),b.comment&&(l=!0));let k=je.isNode(m.value)?m.value:null;k?(k.comment&&(h=k.comment),k.commentBefore&&(l=!0)):m.value==null&&b?.comment&&(h=b.comment)}h&&(l=!0);let y=ta.stringify(m,c,()=>h=null);l||(l=f.length>u||y.includes(`
51
+ `)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((b,k)=>b+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),h&&(y+=Ln.lineComment(y,r,a(h))),f.push(y),u=f.length}let{start:d,end:p}=n;if(f.length===0)return d+p;if(!l){let g=f.reduce((m,h)=>m+h.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let m of f)g+=m?`
52
52
  ${o}${i}${m}`:`
53
53
  `;return`${g}
54
- ${i}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function Rn({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=Pn.indentComment(e(r),t);n.push(o.trimStart())}}Ms.stringifyCollection=Tf});var ye=w(ri=>{"use strict";var qf=ti(),$f=Zr(),Df=pn(),we=E(),Nn=ge(),Mf=A();function kt(t,e){let n=we.isScalar(e)?e.value:e;for(let r of t)if(we.isPair(r)&&(r.key===e||r.key===n||we.isScalar(r.key)&&r.key.value===n))return r}var ni=class extends Df.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(we.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(n,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Nn.createPair(c,l,r))};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"&&s.items.sort(e.sortMapEntries),s}add(e,n){let r;we.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Nn.Pair(e,e?.value):r=new Nn.Pair(e.key,e.value);let i=kt(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);we.isScalar(i.value)&&Mf.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=kt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=kt(this.items,e)?.value;return(!n&&we.isScalar(i)?i.value:i)??void 0}has(e){return!!kt(this.items,e)}set(e,n){this.add(new Nn.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)$f.addPairToJSMap(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!we.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),qf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};ri.YAMLMap=ni;ri.findPair=kt});var ze=w(Fs=>{"use strict";var Wf=E(),Ws=ye(),Ff={collection:"map",default:!0,nodeClass:Ws.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Wf.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Ws.YAMLMap.from(t,e,n)};Fs.map=Ff});var ve=w(Bs=>{"use strict";var Bf=pt(),Uf=ti(),Kf=pn(),An=E(),zf=A(),Jf=de(),ii=class extends Kf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(An.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=On(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=On(e);if(typeof r!="number")return;let i=this.items[r];return!n&&An.isScalar(i)?i.value:i}has(e){let n=On(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=On(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];An.isScalar(i)&&zf.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(Jf.toJS(o,String(i++),n));return r}toString(e,n,r){return e?Uf.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let c=n instanceof Set?a:String(s++);a=i.call(n,c,a)}o.items.push(Bf.createNode(a,void 0,r))}}return o}};function On(t){let e=An.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Bs.YAMLSeq=ii});var Je=w(Ks=>{"use strict";var Yf=E(),Us=ve(),Hf={collection:"seq",default:!0,nodeClass:Us.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Yf.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Us.YAMLSeq.from(t,e,n)};Ks.seq=Hf});var Ct=w(zs=>{"use strict";var Vf=yt(),Gf={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),Vf.stringifyString(t,e,n,r)}};zs.string=Gf});var In=w(Hs=>{"use strict";var Js=A(),Ys={identify:t=>t==null,createNode:()=>new Js.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Js.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Ys.test.test(t)?t:e.options.nullStr};Hs.nullTag=Ys});var oi=w(Gs=>{"use strict";var Xf=A(),Vs={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Xf.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Vs.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};Gs.boolTag=Vs});var Ye=w(Xs=>{"use strict";function Qf({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Xs.stringifyNumber=Qf});var ai=w(Tn=>{"use strict";var Zf=A(),si=Ye(),ed={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:si.stringifyNumber},td={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():si.stringifyNumber(t)}},nd={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 Zf.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:si.stringifyNumber};Tn.float=nd;Tn.floatExp=td;Tn.floatNaN=ed});var li=w(Ln=>{"use strict";var Qs=Ye(),jn=t=>typeof t=="bigint"||Number.isInteger(t),ci=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function Zs(t,e,n){let{value:r}=t;return jn(r)&&r>=0?n+r.toString(e):Qs.stringifyNumber(t)}var rd={identify:t=>jn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ci(t,2,8,n),stringify:t=>Zs(t,8,"0o")},id={identify:jn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ci(t,0,10,n),stringify:Qs.stringifyNumber},od={identify:t=>jn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ci(t,2,16,n),stringify:t=>Zs(t,16,"0x")};Ln.int=id;Ln.intHex=od;Ln.intOct=rd});var ta=w(ea=>{"use strict";var sd=ze(),ad=In(),cd=Je(),ld=Ct(),ud=oi(),ui=ai(),fi=li(),fd=[sd.map,cd.seq,ld.string,ad.nullTag,ud.boolTag,fi.intOct,fi.int,fi.intHex,ui.floatNaN,ui.floatExp,ui.float];ea.schema=fd});var ia=w(ra=>{"use strict";var dd=A(),md=ze(),pd=Je();function na(t){return typeof t=="bigint"||Number.isInteger(t)}var qn=({value:t})=>JSON.stringify(t),hd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:qn},{identify:t=>t==null,createNode:()=>new dd.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:na,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})=>na(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}],gd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},wd=[md.map,pd.seq].concat(hd,gd);ra.schema=wd});var mi=w(oa=>{"use strict";var St=rn("buffer"),di=A(),yd=yt(),vd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof St.Buffer=="function")return St.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}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},r,i,o){if(!n)return"";let s=n,a;if(typeof St.Buffer=="function")a=s instanceof St.Buffer?s.toString("base64"):St.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[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=di.Scalar.BLOCK_LITERAL),e!==di.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=a.substr(d,c);a=u.join(e===di.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return yd.stringifyString({comment:t,type:e,value:a},r,i,o)}};oa.binary=vd});var Mn=w(Dn=>{"use strict";var $n=E(),pi=ge(),bd=A(),kd=ve();function sa(t,e){if($n.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!$n.isPair(r)){if($n.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new pi.Pair(new bd.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
54
+ ${i}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function qn({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=Ln.indentComment(e(r),t);n.push(o.trimStart())}}na.stringifyCollection=rd});var be=w(mi=>{"use strict";var sd=fi(),ad=li(),cd=Cn(),ve=_(),$n=ye(),ld=A();function _t(t,e){let n=ve.isScalar(e)?e.value:e;for(let r of t)if(ve.isPair(r)&&(r.key===e||r.key===n||ve.isScalar(r.key)&&r.key.value===n))return r}var di=class extends cd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ve.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(n,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push($n.createPair(c,l,r))};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"&&s.items.sort(e.sortMapEntries),s}add(e,n){let r;ve.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new $n.Pair(e,e?.value):r=new $n.Pair(e.key,e.value);let i=_t(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);ve.isScalar(i.value)&&ld.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=_t(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=_t(this.items,e)?.value;return(!n&&ve.isScalar(i)?i.value:i)??void 0}has(e){return!!_t(this.items,e)}set(e,n){this.add(new $n.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)ad.addPairToJSMap(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!ve.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),sd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};mi.YAMLMap=di;mi.findPair=_t});var Ve=w(ia=>{"use strict";var ud=_(),ra=be(),fd={collection:"map",default:!0,nodeClass:ra.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ud.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>ra.YAMLMap.from(t,e,n)};ia.map=fd});var ke=w(oa=>{"use strict";var dd=yt(),md=fi(),pd=Cn(),Dn=_(),hd=A(),gd=pe(),pi=class extends pd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Dn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Mn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=Mn(e);if(typeof r!="number")return;let i=this.items[r];return!n&&Dn.isScalar(i)?i.value:i}has(e){let n=Mn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=Mn(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Dn.isScalar(i)&&hd.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(gd.toJS(o,String(i++),n));return r}toString(e,n,r){return e?md.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let c=n instanceof Set?a:String(s++);a=i.call(n,c,a)}o.items.push(dd.createNode(a,void 0,r))}}return o}};function Mn(t){let e=Dn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}oa.YAMLSeq=pi});var Xe=w(aa=>{"use strict";var wd=_(),sa=ke(),yd={collection:"seq",default:!0,nodeClass:sa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return wd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>sa.YAMLSeq.from(t,e,n)};aa.seq=yd});var xt=w(ca=>{"use strict";var vd=Ct(),bd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),vd.stringifyString(t,e,n,r)}};ca.string=bd});var Wn=w(fa=>{"use strict";var la=A(),ua={identify:t=>t==null,createNode:()=>new la.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new la.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&ua.test.test(t)?t:e.options.nullStr};fa.nullTag=ua});var hi=w(ma=>{"use strict";var kd=A(),da={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new kd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&da.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};ma.boolTag=da});var Qe=w(pa=>{"use strict";function Cd({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}pa.stringifyNumber=Cd});var wi=w(Fn=>{"use strict";var Sd=A(),gi=Qe(),Ed={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:gi.stringifyNumber},_d={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():gi.stringifyNumber(t)}},xd={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 Sd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:gi.stringifyNumber};Fn.float=xd;Fn.floatExp=_d;Fn.floatNaN=Ed});var vi=w(Un=>{"use strict";var ha=Qe(),Bn=t=>typeof t=="bigint"||Number.isInteger(t),yi=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function ga(t,e,n){let{value:r}=t;return Bn(r)&&r>=0?n+r.toString(e):ha.stringifyNumber(t)}var Pd={identify:t=>Bn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>yi(t,2,8,n),stringify:t=>ga(t,8,"0o")},Rd={identify:Bn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>yi(t,0,10,n),stringify:ha.stringifyNumber},Nd={identify:t=>Bn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>yi(t,2,16,n),stringify:t=>ga(t,16,"0x")};Un.int=Rd;Un.intHex=Nd;Un.intOct=Pd});var ya=w(wa=>{"use strict";var Od=Ve(),Ad=Wn(),Id=Xe(),Td=xt(),jd=hi(),bi=wi(),ki=vi(),Ld=[Od.map,Id.seq,Td.string,Ad.nullTag,jd.boolTag,ki.intOct,ki.int,ki.intHex,bi.floatNaN,bi.floatExp,bi.float];wa.schema=Ld});var ka=w(ba=>{"use strict";var qd=A(),$d=Ve(),Md=Xe();function va(t){return typeof t=="bigint"||Number.isInteger(t)}var Kn=({value:t})=>JSON.stringify(t),Dd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Kn},{identify:t=>t==null,createNode:()=>new qd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Kn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Kn},{identify:va,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})=>va(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:Kn}],Wd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Fd=[$d.map,Md.seq].concat(Dd,Wd);ba.schema=Fd});var Si=w(Ca=>{"use strict";var Pt=un("buffer"),Ci=A(),Bd=Ct(),Ud={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Pt.Buffer=="function")return Pt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}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},r,i,o){if(!n)return"";let s=n,a;if(typeof Pt.Buffer=="function")a=s instanceof Pt.Buffer?s.toString("base64"):Pt.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[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=Ci.Scalar.BLOCK_LITERAL),e!==Ci.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=a.substr(d,c);a=u.join(e===Ci.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Bd.stringifyString({comment:t,type:e,value:a},r,i,o)}};Ca.binary=Ud});var Yn=w(Jn=>{"use strict";var zn=_(),Ei=ye(),Kd=A(),zd=ke();function Sa(t,e){if(zn.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!zn.isPair(r)){if(zn.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Ei.Pair(new Kd.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
56
56
  ${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
57
- ${o.comment}`:r.comment}r=i}t.items[n]=$n.isPair(r)?r:new pi.Pair(r)}}else e("Expected a sequence for this tag");return t}function aa(t,e,n){let{replacer:r}=n,i=new kd.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(pi.createPair(a,c,n))}return i}var Cd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:sa,createNode:aa};Dn.createPairs=aa;Dn.pairs=Cd;Dn.resolvePairs=sa});var wi=w(gi=>{"use strict";var ca=E(),hi=de(),_t=ye(),Sd=ve(),la=Mn(),Ae=class t extends Sd.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 r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(ca.isPair(i)?(o=hi.toJS(i.key,"",n),s=hi.toJS(i.value,o,n)):o=hi.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=la.createPairs(e,n,r),o=new this;return o.items=i.items,o}};Ae.tag="tag:yaml.org,2002:omap";var _d={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ae,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=la.resolvePairs(t,e),r=[];for(let{key:i}of n.items)ca.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Ae,n)},createNode:(t,e,n)=>Ae.from(t,e,n)};gi.YAMLOMap=Ae;gi.omap=_d});var pa=w(yi=>{"use strict";var ua=A();function fa({value:t,source:e},n){return e&&(t?da:ma).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 ua.Scalar(!0),stringify:fa},ma={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 ua.Scalar(!1),stringify:fa};yi.falseTag=ma;yi.trueTag=da});var ha=w(Wn=>{"use strict";var Ed=A(),vi=Ye(),xd={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:vi.stringifyNumber},Pd={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():vi.stringifyNumber(t)}},Rd={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 Ed.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:vi.stringifyNumber};Wn.float=Rd;Wn.floatExp=Pd;Wn.floatNaN=xd});var wa=w(xt=>{"use strict";var ga=Ye(),Et=t=>typeof t=="bigint"||Number.isInteger(t);function Fn(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function bi(t,e,n){let{value:r}=t;if(Et(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return ga.stringifyNumber(t)}var Nd={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Fn(t,2,2,n),stringify:t=>bi(t,2,"0b")},Od={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Fn(t,1,8,n),stringify:t=>bi(t,8,"0")},Ad={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Fn(t,0,10,n),stringify:ga.stringifyNumber},Id={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Fn(t,2,16,n),stringify:t=>bi(t,16,"0x")};xt.int=Ad;xt.intBin=Nd;xt.intHex=Id;xt.intOct=Od});var Ci=w(ki=>{"use strict";var Kn=E(),Bn=ge(),Un=ye(),Ie=class t extends Un.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Kn.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Bn.Pair(e.key,null):n=new Bn.Pair(e,null),Un.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=Un.findPair(this.items,e);return!n&&Kn.isPair(r)?Kn.isScalar(r.key)?r.key.value:r.key:r}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 r=Un.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Bn.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(Bn.createPair(s,null,r));return o}};Ie.tag="tag:yaml.org,2002:set";var Td={collection:"map",identify:t=>t instanceof Set,nodeClass:Ie,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Ie.from(t,e,n),resolve(t,e){if(Kn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ie,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ki.YAMLSet=Ie;ki.set=Td});var _i=w(zn=>{"use strict";var jd=Ye();function Si(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function ya(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return jd.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Ld={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})=>Si(t,n),stringify:ya},qd={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=>Si(t,!1),stringify:ya},va={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(va.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let f=Si(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};zn.floatTime=qd;zn.intTime=Ld;zn.timestamp=va});var Ca=w(ka=>{"use strict";var $d=ze(),Dd=In(),Md=Je(),Wd=Ct(),Fd=mi(),ba=pa(),Ei=ha(),Jn=wa(),Bd=_n(),Ud=wi(),Kd=Mn(),zd=Ci(),xi=_i(),Jd=[$d.map,Md.seq,Wd.string,Dd.nullTag,ba.trueTag,ba.falseTag,Jn.intBin,Jn.intOct,Jn.int,Jn.intHex,Ei.floatNaN,Ei.floatExp,Ei.float,Fd.binary,Bd.merge,Ud.omap,Kd.pairs,zd.set,xi.intTime,xi.floatTime,xi.timestamp];ka.schema=Jd});var Ia=w(Ni=>{"use strict";var xa=ze(),Yd=In(),Pa=Je(),Hd=Ct(),Vd=oi(),Pi=ai(),Ri=li(),Gd=ta(),Xd=ia(),Ra=mi(),Pt=_n(),Na=wi(),Oa=Mn(),Sa=Ca(),Aa=Ci(),Yn=_i(),_a=new Map([["core",Gd.schema],["failsafe",[xa.map,Pa.seq,Hd.string]],["json",Xd.schema],["yaml11",Sa.schema],["yaml-1.1",Sa.schema]]),Ea={binary:Ra.binary,bool:Vd.boolTag,float:Pi.float,floatExp:Pi.floatExp,floatNaN:Pi.floatNaN,floatTime:Yn.floatTime,int:Ri.int,intHex:Ri.intHex,intOct:Ri.intOct,intTime:Yn.intTime,map:xa.map,merge:Pt.merge,null:Yd.nullTag,omap:Na.omap,pairs:Oa.pairs,seq:Pa.seq,set:Aa.set,timestamp:Yn.timestamp},Qd={"tag:yaml.org,2002:binary":Ra.binary,"tag:yaml.org,2002:merge":Pt.merge,"tag:yaml.org,2002:omap":Na.omap,"tag:yaml.org,2002:pairs":Oa.pairs,"tag:yaml.org,2002:set":Aa.set,"tag:yaml.org,2002:timestamp":Yn.timestamp};function Zd(t,e,n){let r=_a.get(e);if(r&&!t)return n&&!r.includes(Pt.merge)?r.concat(Pt.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(_a.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Pt.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?Ea[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Ea).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}Ni.coreKnownTags=Qd;Ni.getTags=Zd});var Ii=w(Ta=>{"use strict";var Oi=E(),em=ze(),tm=Je(),nm=Ct(),Hn=Ia(),rm=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Ai=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Hn.getTags(e,"compat"):e?Hn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Hn.coreKnownTags:{},this.tags=Hn.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Oi.MAP,{value:em.map}),Object.defineProperty(this,Oi.SCALAR,{value:nm.string}),Object.defineProperty(this,Oi.SEQ,{value:tm.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?rm:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Ta.Schema=Ai});var La=w(ja=>{"use strict";var im=E(),Ti=vt(),Rt=ht();function om(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=Ti.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(Rt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(im.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);n.push(Rt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=Ti.stringify(t.contents,i,()=>a=null,c);a&&(l+=Rt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(Ti.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
- `)?(n.push("..."),n.push(Rt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(Rt.indentComment(o(c),"")))}return n.join(`
57
+ ${o.comment}`:r.comment}r=i}t.items[n]=zn.isPair(r)?r:new Ei.Pair(r)}}else e("Expected a sequence for this tag");return t}function Ea(t,e,n){let{replacer:r}=n,i=new zd.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Ei.createPair(a,c,n))}return i}var Jd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Sa,createNode:Ea};Jn.createPairs=Ea;Jn.pairs=Jd;Jn.resolvePairs=Sa});var Pi=w(xi=>{"use strict";var _a=_(),_i=pe(),Rt=be(),Yd=ke(),xa=Yn(),Le=class t extends Yd.YAMLSeq{constructor(){super(),this.add=Rt.YAMLMap.prototype.add.bind(this),this.delete=Rt.YAMLMap.prototype.delete.bind(this),this.get=Rt.YAMLMap.prototype.get.bind(this),this.has=Rt.YAMLMap.prototype.has.bind(this),this.set=Rt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(_a.isPair(i)?(o=_i.toJS(i.key,"",n),s=_i.toJS(i.value,o,n)):o=_i.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=xa.createPairs(e,n,r),o=new this;return o.items=i.items,o}};Le.tag="tag:yaml.org,2002:omap";var Hd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Le,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=xa.resolvePairs(t,e),r=[];for(let{key:i}of n.items)_a.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Le,n)},createNode:(t,e,n)=>Le.from(t,e,n)};xi.YAMLOMap=Le;xi.omap=Hd});var Aa=w(Ri=>{"use strict";var Pa=A();function Ra({value:t,source:e},n){return e&&(t?Na:Oa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Na={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 Pa.Scalar(!0),stringify:Ra},Oa={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 Pa.Scalar(!1),stringify:Ra};Ri.falseTag=Oa;Ri.trueTag=Na});var Ia=w(Hn=>{"use strict";var Gd=A(),Ni=Qe(),Vd={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:Ni.stringifyNumber},Xd={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():Ni.stringifyNumber(t)}},Qd={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 Gd.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Ni.stringifyNumber};Hn.float=Qd;Hn.floatExp=Xd;Hn.floatNaN=Vd});var ja=w(Ot=>{"use strict";var Ta=Qe(),Nt=t=>typeof t=="bigint"||Number.isInteger(t);function Gn(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function Oi(t,e,n){let{value:r}=t;if(Nt(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return Ta.stringifyNumber(t)}var Zd={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Gn(t,2,2,n),stringify:t=>Oi(t,2,"0b")},em={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Gn(t,1,8,n),stringify:t=>Oi(t,8,"0")},tm={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Gn(t,0,10,n),stringify:Ta.stringifyNumber},nm={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Gn(t,2,16,n),stringify:t=>Oi(t,16,"0x")};Ot.int=tm;Ot.intBin=Zd;Ot.intHex=nm;Ot.intOct=em});var Ii=w(Ai=>{"use strict";var Qn=_(),Vn=ye(),Xn=be(),qe=class t extends Xn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Qn.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Vn.Pair(e.key,null):n=new Vn.Pair(e,null),Xn.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=Xn.findPair(this.items,e);return!n&&Qn.isPair(r)?Qn.isScalar(r.key)?r.key.value:r.key:r}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 r=Xn.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Vn.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(Vn.createPair(s,null,r));return o}};qe.tag="tag:yaml.org,2002:set";var rm={collection:"map",identify:t=>t instanceof Set,nodeClass:qe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>qe.from(t,e,n),resolve(t,e){if(Qn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new qe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Ai.YAMLSet=qe;Ai.set=rm});var ji=w(Zn=>{"use strict";var im=Qe();function Ti(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function La(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return im.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var om={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})=>Ti(t,n),stringify:La},sm={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=>Ti(t,!1),stringify:La},qa={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(qa.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let f=Ti(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Zn.floatTime=sm;Zn.intTime=om;Zn.timestamp=qa});var Da=w(Ma=>{"use strict";var am=Ve(),cm=Wn(),lm=Xe(),um=xt(),fm=Si(),$a=Aa(),Li=Ia(),er=ja(),dm=In(),mm=Pi(),pm=Yn(),hm=Ii(),qi=ji(),gm=[am.map,lm.seq,um.string,cm.nullTag,$a.trueTag,$a.falseTag,er.intBin,er.intOct,er.int,er.intHex,Li.floatNaN,Li.floatExp,Li.float,fm.binary,dm.merge,mm.omap,pm.pairs,hm.set,qi.intTime,qi.floatTime,qi.timestamp];Ma.schema=gm});var Ga=w(Di=>{"use strict";var Ua=Ve(),wm=Wn(),Ka=Xe(),ym=xt(),vm=hi(),$i=wi(),Mi=vi(),bm=ya(),km=ka(),za=Si(),At=In(),Ja=Pi(),Ya=Yn(),Wa=Da(),Ha=Ii(),tr=ji(),Fa=new Map([["core",bm.schema],["failsafe",[Ua.map,Ka.seq,ym.string]],["json",km.schema],["yaml11",Wa.schema],["yaml-1.1",Wa.schema]]),Ba={binary:za.binary,bool:vm.boolTag,float:$i.float,floatExp:$i.floatExp,floatNaN:$i.floatNaN,floatTime:tr.floatTime,int:Mi.int,intHex:Mi.intHex,intOct:Mi.intOct,intTime:tr.intTime,map:Ua.map,merge:At.merge,null:wm.nullTag,omap:Ja.omap,pairs:Ya.pairs,seq:Ka.seq,set:Ha.set,timestamp:tr.timestamp},Cm={"tag:yaml.org,2002:binary":za.binary,"tag:yaml.org,2002:merge":At.merge,"tag:yaml.org,2002:omap":Ja.omap,"tag:yaml.org,2002:pairs":Ya.pairs,"tag:yaml.org,2002:set":Ha.set,"tag:yaml.org,2002:timestamp":tr.timestamp};function Sm(t,e,n){let r=Fa.get(e);if(r&&!t)return n&&!r.includes(At.merge)?r.concat(At.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Fa.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(At.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?Ba[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Ba).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}Di.coreKnownTags=Cm;Di.getTags=Sm});var Bi=w(Va=>{"use strict";var Wi=_(),Em=Ve(),_m=Xe(),xm=xt(),nr=Ga(),Pm=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Fi=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?nr.getTags(e,"compat"):e?nr.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?nr.coreKnownTags:{},this.tags=nr.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Wi.MAP,{value:Em.map}),Object.defineProperty(this,Wi.SCALAR,{value:xm.string}),Object.defineProperty(this,Wi.SEQ,{value:_m.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Pm:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Va.Schema=Fi});var Qa=w(Xa=>{"use strict";var Rm=_(),Ui=St(),It=vt();function Nm(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=Ui.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(It.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Rm.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);n.push(It.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=Ui.stringify(t.contents,i,()=>a=null,c);a&&(l+=It.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(Ui.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
+ `)?(n.push("..."),n.push(It.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(It.indentComment(o(c),"")))}return n.join(`
59
59
  `)+`
60
- `}ja.stringifyDocument=om});var Nt=w(qa=>{"use strict";var sm=mt(),He=pn(),z=E(),am=ge(),cm=de(),lm=Ii(),um=La(),ji=un(),fm=Dr(),dm=pt(),Li=$r(),qi=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,z.NODE_TYPE,{value:z.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new Li.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[z.NODE_TYPE]:{value:z.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=z.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Ve(this.contents)&&this.contents.add(e)}addIn(e,n){Ve(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=ji.anchorNames(this);e.anchor=!n||r.has(n)?ji.findNewAnchor(n||"a",r):n}return new sm.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let h=b=>typeof b=="number"||b instanceof String||b instanceof Number,v=n.filter(h).map(String);v.length>0&&(n=n.concat(v)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=ji.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},m=dm.createNode(e,u,g);return a&&z.isCollection(m)&&(m.flow=!0),d(),m}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new am.Pair(i,o)}delete(e){return Ve(this.contents)?this.contents.delete(e):!1}deleteIn(e){return He.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Ve(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return z.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return He.isEmptyPath(e)?!n&&z.isScalar(this.contents)?this.contents.value:this.contents:z.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return z.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return He.isEmptyPath(e)?this.contents!==void 0:z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=He.collectionFromPath(this.schema,[e],n):Ve(this.contents)&&this.contents.set(e,n)}setIn(e,n){He.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=He.collectionFromPath(this.schema,Array.from(e),n):Ve(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Li.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Li.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new lm.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=cm.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?fm.applyReviver(s,{"":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 um.stringifyDocument(this,e)}};function Ve(t){if(z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}qa.Document=qi});var It=w(At=>{"use strict";var Ot=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},$i=class extends Ot{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Di=class extends Ot{constructor(e,n,r){super("YAMLWarning",e,n,r)}},mm=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`…
60
+ `}Xa.stringifyDocument=Nm});var Tt=w(Za=>{"use strict";var Om=wt(),Ze=Cn(),Y=_(),Am=ye(),Im=pe(),Tm=Bi(),jm=Qa(),Ki=yn(),Lm=Hr(),qm=yt(),zi=Yr(),Ji=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new zi.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[Y.NODE_TYPE]:{value:Y.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=Y.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){et(this.contents)&&this.contents.add(e)}addIn(e,n){et(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=Ki.anchorNames(this);e.anchor=!n||r.has(n)?Ki.findNewAnchor(n||"a",r):n}return new Om.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let h=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=n.filter(h).map(String);y.length>0&&(n=n.concat(y)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=Ki.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},m=qm.createNode(e,u,g);return a&&Y.isCollection(m)&&(m.flow=!0),d(),m}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new Am.Pair(i,o)}delete(e){return et(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ze.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):et(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Y.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Ze.isEmptyPath(e)?!n&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Y.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ze.isEmptyPath(e)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Ze.collectionFromPath(this.schema,[e],n):et(this.contents)&&this.contents.set(e,n)}setIn(e,n){Ze.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=Ze.collectionFromPath(this.schema,Array.from(e),n):et(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new zi.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new zi.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Tm.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Im.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Lm.applyReviver(s,{"":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 jm.stringifyDocument(this,e)}};function et(t){if(Y.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Za.Document=Ji});var qt=w(Lt=>{"use strict";var jt=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},Yi=class extends jt{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Hi=class extends jt{constructor(e,n,r){super("YAMLWarning",e,n,r)}},$m=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`…
61
61
  `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=n.linePos[1];c?.line===r&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
62
62
 
63
63
  ${s}
64
64
  ${l}
65
- `}};At.YAMLError=Ot;At.YAMLParseError=$i;At.YAMLWarning=Di;At.prettifyError=mm});var Tt=w($a=>{"use strict";function pm(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,f="",d="",p=!1,g=!1,m=null,h=null,v=null,b=null,k=null,C=null,S=null;for(let y of t)switch(g&&(y.type!=="space"&&y.type!=="newline"&&y.type!=="comma"&&o(y.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),m&&(l&&y.type!=="comment"&&y.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),y.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&y.source.includes(" ")&&(m=y),u=!0;break;case"comment":{u||o(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=y.source.substring(1)||" ";f?f+=d+N:f=N,d="",l=!1;break}case"newline":l?f?f+=y.source:(!C||n!=="seq-item-ind")&&(c=!0):d+=y.source,l=!0,p=!0,(h||v)&&(b=y),u=!0;break;case"anchor":h&&o(y,"MULTIPLE_ANCHORS","A node can have at most one anchor"),y.source.endsWith(":")&&o(y.offset+y.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=y,S??(S=y.offset),l=!1,u=!1,g=!0;break;case"tag":{v&&o(y,"MULTIPLE_TAGS","A node can have at most one tag"),v=y,S??(S=y.offset),l=!1,u=!1,g=!0;break}case n:(h||v)&&o(y,"BAD_PROP_ORDER",`Anchors and tags must be after the ${y.source} indicator`),C&&o(y,"UNEXPECTED_TOKEN",`Unexpected ${y.source} in ${e??"collection"}`),C=y,l=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){k&&o(y,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=y,l=!1,u=!1;break}default:o(y,"UNEXPECTED_TOKEN",`Unexpected ${y.type} token`),l=!1,u=!1}let _=t[t.length-1],P=_?_.offset+_.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:f,hasNewline:p,anchor:h,tag:v,newlineAfterProp:b,end:P,start:S??P}}$a.resolveProps=pm});var Vn=w(Da=>{"use strict";function Mi(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(Mi(e.key)||Mi(e.value))return!0}return!1;default:return!0}}Da.containsNewline=Mi});var Wi=w(Ma=>{"use strict";var hm=Vn();function gm(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&hm.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ma.flowIndentCheck=gm});var Fi=w(Fa=>{"use strict";var Wa=E();function wm(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||Wa.isScalar(o)&&Wa.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}Fa.mapIncludes=wm});var Ya=w(Ja=>{"use strict";var Ba=ge(),ym=ye(),Ua=Tt(),vm=Vn(),Ka=Wi(),bm=Fi(),za="All mapping items must start at the same column";function km({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??ym.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:f,key:d,sep:p,value:g}=u,m=Ua.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),h=!m.found;if(h){if(d&&(d.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(c,"BAD_INDENT",za)),!m.anchor&&!m.tag&&!p){l=m.end,m.comment&&(a.comment?a.comment+=`
67
- `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||vm.containsNewline(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==r.indent&&i(c,"BAD_INDENT",za);n.atKey=!0;let v=m.end,b=d?t(n,d,m,i):e(n,v,f,null,m,i);n.schema.compat&&Ka.flowIndentCheck(r.indent,d,i),n.atKey=!1,bm.mapIncludes(n,a.items,b)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let k=Ua.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:b.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){h&&(g?.type==="block-map"&&!k.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<k.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=g?t(n,g,k,i):e(n,c,p,null,k,i);n.schema.compat&&Ka.flowIndentCheck(r.indent,g,i),c=C.range[2];let S=new Ba.Pair(b,C);n.options.keepSourceTokens&&(S.srcToken=u),a.items.push(S)}else{h&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(b.comment?b.comment+=`
68
- `+k.comment:b.comment=k.comment);let C=new Ba.Pair(b);n.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}Ja.resolveBlockMap=km});var Va=w(Ha=>{"use strict";var Cm=ve(),Sm=Tt(),_m=Wi();function Em({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Cm.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:f}of r.items){let d=Sm.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?t(n,f,d,i):e(n,d.end,u,null,d,i);n.schema.compat&&_m.flowIndentCheck(r.indent,f,i),c=p.range[2],a.items.push(p)}return a.range=[r.offset,c,l??c],a}Ha.resolveBlockSeq=Em});var Ge=w(Ga=>{"use strict";function xm(t,e,n,r){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Ga.resolveEnd=xm});var ec=w(Za=>{"use strict";var Pm=E(),Rm=ge(),Xa=ye(),Nm=ve(),Om=Ge(),Qa=Tt(),Am=Vn(),Im=Fi(),Bi="Block collections are not allowed within flow collections",Ui=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Tm({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Xa.YAMLMap:Nm.YAMLSeq),l=new c(n.schema);l.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let h=0;h<r.items.length;++h){let v=r.items[h],{start:b,key:k,sep:C,value:S}=v,_=Qa.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!_.found){if(!_.anchor&&!_.tag&&!C&&!S){h===0&&_.comma?i(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<r.items.length-1&&i(_.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),_.comment&&(l.comment?l.comment+=`
69
- `+_.comment:l.comment=_.comment),f=_.end;continue}!s&&n.options.strict&&Am.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)_.comma&&i(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(_.comma||i(_.start,"MISSING_CHAR",`Missing , between ${a} items`),_.comment){let P="";e:for(let y of b)switch(y.type){case"comma":case"space":break;case"comment":P=y.source.substring(1);break e;default:break e}if(P){let y=l.items[l.items.length-1];Pm.isPair(y)&&(y=y.value??y.key),y.comment?y.comment+=`
70
- `+P:y.comment=P,_.comment=_.comment.substring(P.length+1)}}if(!s&&!C&&!_.found){let P=S?t(n,S,_,i):e(n,_.end,C,null,_,i);l.items.push(P),f=P.range[2],Ui(S)&&i(P.range,"BLOCK_IN_FLOW",Bi)}else{n.atKey=!0;let P=_.end,y=k?t(n,k,_,i):e(n,P,b,null,_,i);Ui(k)&&i(y.range,"BLOCK_IN_FLOW",Bi),n.atKey=!1;let N=Qa.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:S,offset:y.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(N.found){if(!s&&!_.found&&n.options.strict){if(C)for(let R of C){if(R===N.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}_.start<N.found.offset-1024&&i(N.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?i(S,"MISSING_CHAR",`Missing space after : in ${a}`):i(N.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let J=S?t(n,S,N,i):N.found?e(n,N.end,C,null,N,i):null;J?Ui(S)&&i(J.range,"BLOCK_IN_FLOW",Bi):N.comment&&(y.comment?y.comment+=`
71
- `+N.comment:y.comment=N.comment);let ne=new Rm.Pair(y,J);if(n.options.keepSourceTokens&&(ne.srcToken=v),s){let R=l;Im.mapIncludes(n,R.items,y)&&i(P,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(ne)}else{let R=new Xa.YAMLMap(n.schema);R.flow=!0,R.items.push(ne);let D=(J??y).range;R.range=[y.range[0],D[1],D[2]],l.items.push(R)}f=J?J.range[2]:N.end}}let d=s?"}":"]",[p,...g]=r.end,m=f;if(p?.source===d)m=p.offset+p.source.length;else{let h=a[0].toUpperCase()+a.substring(1),v=u?`${h} must end with a ${d}`:`${h} in block collection must be sufficiently indented and end with a ${d}`;i(f,u?"MISSING_CHAR":"BAD_INDENT",v),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let h=Om.resolveEnd(g,m,n.options.strict,i);h.comment&&(l.comment?l.comment+=`
72
- `+h.comment:l.comment=h.comment),l.range=[r.offset,m,h.offset]}else l.range=[r.offset,m,m];return l}Za.resolveFlowCollection=Tm});var nc=w(tc=>{"use strict";var jm=E(),Lm=A(),qm=ye(),$m=ve(),Dm=Ya(),Mm=Va(),Wm=ec();function Ki(t,e,n,r,i,o){let s=n.type==="block-map"?Dm.resolveBlockMap(t,e,n,r,o):n.type==="block-seq"?Mm.resolveBlockSeq(t,e,n,r,o):Wm.resolveFlowCollection(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Fm(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=r,g=d&&o?d.offset>o.offset?d:o:d??o;g&&(!p||p.offset<g.offset)&&i(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(!o||!s||s==="!"||s===qm.YAMLMap.tagName&&a==="map"||s===$m.YAMLSeq.tagName&&a==="seq")return Ki(t,e,n,i,s);let c=e.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!c){let d=e.schema.knownTags[s];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Ki(t,e,n,i,s)}let l=Ki(t,e,n,i,s,c),u=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,f=jm.isNode(u)?u:new Lm.Scalar(u);return f.range=l.range,f.tag=s,c?.format&&(f.format=c.format),f}tc.composeCollection=Fm});var Ji=w(rc=>{"use strict";var zi=A();function Bm(t,e,n){let r=e.offset,i=Um(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?zi.Scalar.BLOCK_FOLDED:zi.Scalar.BLOCK_LITERAL,s=e.source?Km(e.source):[],a=s.length;for(let m=s.length-1;m>=0;--m){let h=s[m][1];if(h===""||h==="\r")a=m;else break}if(a===0){let m=i.chomp==="+"&&s.length>0?`
73
- `.repeat(Math.max(1,s.length-1)):"",h=r+i.length;return e.source&&(h+=e.source.length),{value:m,type:o,comment:i.comment,range:[r,h,h]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let m=0;m<a;++m){let[h,v]=s[m];if(v===""||v==="\r")i.indent===0&&h.length>c&&(c=h.length);else{h.length<c&&n(l+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=h.length),u=m,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=h.length+v.length+1}for(let m=s.length-1;m>=a;--m)s[m][0].length>c&&(a=m+1);let f="",d="",p=!1;for(let m=0;m<u;++m)f+=s[m][0].slice(c)+`
74
- `;for(let m=u;m<a;++m){let[h,v]=s[m];l+=h.length+v.length+1;let b=v[v.length-1]==="\r";if(b&&(v=v.slice(0,-1)),v&&h.length<c){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-v.length-(b?2:1),"BAD_INDENT",C),h=""}o===zi.Scalar.BLOCK_LITERAL?(f+=d+h.slice(c)+v,d=`
75
- `):h.length>c||v[0]===" "?(d===" "?d=`
65
+ `}};Lt.YAMLError=jt;Lt.YAMLParseError=Yi;Lt.YAMLWarning=Hi;Lt.prettifyError=$m});var $t=w(ec=>{"use strict";function Mm(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,f="",d="",p=!1,g=!1,m=null,h=null,y=null,b=null,k=null,C=null,S=null;for(let v of t)switch(g&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&o(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),m&&(l&&v.type!=="comment"&&v.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),v.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&v.source.includes(" ")&&(m=v),u=!0;break;case"comment":{u||o(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=v.source.substring(1)||" ";f?f+=d+N:f=N,d="",l=!1;break}case"newline":l?f?f+=v.source:(!C||n!=="seq-item-ind")&&(c=!0):d+=v.source,l=!0,p=!0,(h||y)&&(b=v),u=!0;break;case"anchor":h&&o(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&o(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=v,S??(S=v.offset),l=!1,u=!1,g=!0;break;case"tag":{y&&o(v,"MULTIPLE_TAGS","A node can have at most one tag"),y=v,S??(S=v.offset),l=!1,u=!1,g=!0;break}case n:(h||y)&&o(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),C&&o(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${e??"collection"}`),C=v,l=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){k&&o(v,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=v,l=!1,u=!1;break}default:o(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),l=!1,u=!1}let E=t[t.length-1],P=E?E.offset+E.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:f,hasNewline:p,anchor:h,tag:y,newlineAfterProp:b,end:P,start:S??P}}ec.resolveProps=Mm});var rr=w(tc=>{"use strict";function Gi(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(Gi(e.key)||Gi(e.value))return!0}return!1;default:return!0}}tc.containsNewline=Gi});var Vi=w(nc=>{"use strict";var Dm=rr();function Wm(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Dm.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}nc.flowIndentCheck=Wm});var Xi=w(ic=>{"use strict";var rc=_();function Fm(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||rc.isScalar(o)&&rc.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}ic.mapIncludes=Fm});var uc=w(lc=>{"use strict";var oc=ye(),Bm=be(),sc=$t(),Um=rr(),ac=Vi(),Km=Xi(),cc="All mapping items must start at the same column";function zm({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Bm.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:f,key:d,sep:p,value:g}=u,m=sc.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),h=!m.found;if(h){if(d&&(d.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(c,"BAD_INDENT",cc)),!m.anchor&&!m.tag&&!p){l=m.end,m.comment&&(a.comment?a.comment+=`
67
+ `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||Um.containsNewline(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==r.indent&&i(c,"BAD_INDENT",cc);n.atKey=!0;let y=m.end,b=d?t(n,d,m,i):e(n,y,f,null,m,i);n.schema.compat&&ac.flowIndentCheck(r.indent,d,i),n.atKey=!1,Km.mapIncludes(n,a.items,b)&&i(y,"DUPLICATE_KEY","Map keys must be unique");let k=sc.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:b.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){h&&(g?.type==="block-map"&&!k.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<k.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=g?t(n,g,k,i):e(n,c,p,null,k,i);n.schema.compat&&ac.flowIndentCheck(r.indent,g,i),c=C.range[2];let S=new oc.Pair(b,C);n.options.keepSourceTokens&&(S.srcToken=u),a.items.push(S)}else{h&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(b.comment?b.comment+=`
68
+ `+k.comment:b.comment=k.comment);let C=new oc.Pair(b);n.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}lc.resolveBlockMap=zm});var dc=w(fc=>{"use strict";var Jm=ke(),Ym=$t(),Hm=Vi();function Gm({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Jm.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:f}of r.items){let d=Ym.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?t(n,f,d,i):e(n,d.end,u,null,d,i);n.schema.compat&&Hm.flowIndentCheck(r.indent,f,i),c=p.range[2],a.items.push(p)}return a.range=[r.offset,c,l??c],a}fc.resolveBlockSeq=Gm});var tt=w(mc=>{"use strict";function Vm(t,e,n,r){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}mc.resolveEnd=Vm});var wc=w(gc=>{"use strict";var Xm=_(),Qm=ye(),pc=be(),Zm=ke(),ep=tt(),hc=$t(),tp=rr(),np=Xi(),Qi="Block collections are not allowed within flow collections",Zi=t=>t&&(t.type==="block-map"||t.type==="block-seq");function rp({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?pc.YAMLMap:Zm.YAMLSeq),l=new c(n.schema);l.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let h=0;h<r.items.length;++h){let y=r.items[h],{start:b,key:k,sep:C,value:S}=y,E=hc.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!C&&!S){h===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<r.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),f=E.end;continue}!s&&n.options.strict&&tp.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let P="";e:for(let v of b)switch(v.type){case"comma":case"space":break;case"comment":P=v.source.substring(1);break e;default:break e}if(P){let v=l.items[l.items.length-1];Xm.isPair(v)&&(v=v.value??v.key),v.comment?v.comment+=`
70
+ `+P:v.comment=P,E.comment=E.comment.substring(P.length+1)}}if(!s&&!C&&!E.found){let P=S?t(n,S,E,i):e(n,E.end,C,null,E,i);l.items.push(P),f=P.range[2],Zi(S)&&i(P.range,"BLOCK_IN_FLOW",Qi)}else{n.atKey=!0;let P=E.end,v=k?t(n,k,E,i):e(n,P,b,null,E,i);Zi(k)&&i(v.range,"BLOCK_IN_FLOW",Qi),n.atKey=!1;let N=hc.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:S,offset:v.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(N.found){if(!s&&!E.found&&n.options.strict){if(C)for(let R of C){if(R===N.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<N.found.offset-1024&&i(N.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?i(S,"MISSING_CHAR",`Missing space after : in ${a}`):i(N.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let H=S?t(n,S,N,i):N.found?e(n,N.end,C,null,N,i):null;H?Zi(S)&&i(H.range,"BLOCK_IN_FLOW",Qi):N.comment&&(v.comment?v.comment+=`
71
+ `+N.comment:v.comment=N.comment);let ie=new Qm.Pair(v,H);if(n.options.keepSourceTokens&&(ie.srcToken=y),s){let R=l;np.mapIncludes(n,R.items,v)&&i(P,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(ie)}else{let R=new pc.YAMLMap(n.schema);R.flow=!0,R.items.push(ie);let M=(H??v).range;R.range=[v.range[0],M[1],M[2]],l.items.push(R)}f=H?H.range[2]:N.end}}let d=s?"}":"]",[p,...g]=r.end,m=f;if(p?.source===d)m=p.offset+p.source.length;else{let h=a[0].toUpperCase()+a.substring(1),y=u?`${h} must end with a ${d}`:`${h} in block collection must be sufficiently indented and end with a ${d}`;i(f,u?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let h=ep.resolveEnd(g,m,n.options.strict,i);h.comment&&(l.comment?l.comment+=`
72
+ `+h.comment:l.comment=h.comment),l.range=[r.offset,m,h.offset]}else l.range=[r.offset,m,m];return l}gc.resolveFlowCollection=rp});var vc=w(yc=>{"use strict";var ip=_(),op=A(),sp=be(),ap=ke(),cp=uc(),lp=dc(),up=wc();function eo(t,e,n,r,i,o){let s=n.type==="block-map"?cp.resolveBlockMap(t,e,n,r,o):n.type==="block-seq"?lp.resolveBlockSeq(t,e,n,r,o):up.resolveFlowCollection(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function fp(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=r,g=d&&o?d.offset>o.offset?d:o:d??o;g&&(!p||p.offset<g.offset)&&i(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(!o||!s||s==="!"||s===sp.YAMLMap.tagName&&a==="map"||s===ap.YAMLSeq.tagName&&a==="seq")return eo(t,e,n,i,s);let c=e.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!c){let d=e.schema.knownTags[s];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),eo(t,e,n,i,s)}let l=eo(t,e,n,i,s,c),u=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,f=ip.isNode(u)?u:new op.Scalar(u);return f.range=l.range,f.tag=s,c?.format&&(f.format=c.format),f}yc.composeCollection=fp});var no=w(bc=>{"use strict";var to=A();function dp(t,e,n){let r=e.offset,i=mp(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?to.Scalar.BLOCK_FOLDED:to.Scalar.BLOCK_LITERAL,s=e.source?pp(e.source):[],a=s.length;for(let m=s.length-1;m>=0;--m){let h=s[m][1];if(h===""||h==="\r")a=m;else break}if(a===0){let m=i.chomp==="+"&&s.length>0?`
73
+ `.repeat(Math.max(1,s.length-1)):"",h=r+i.length;return e.source&&(h+=e.source.length),{value:m,type:o,comment:i.comment,range:[r,h,h]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let m=0;m<a;++m){let[h,y]=s[m];if(y===""||y==="\r")i.indent===0&&h.length>c&&(c=h.length);else{h.length<c&&n(l+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=h.length),u=m,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=h.length+y.length+1}for(let m=s.length-1;m>=a;--m)s[m][0].length>c&&(a=m+1);let f="",d="",p=!1;for(let m=0;m<u;++m)f+=s[m][0].slice(c)+`
74
+ `;for(let m=u;m<a;++m){let[h,y]=s[m];l+=h.length+y.length+1;let b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&h.length<c){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-y.length-(b?2:1),"BAD_INDENT",C),h=""}o===to.Scalar.BLOCK_LITERAL?(f+=d+h.slice(c)+y,d=`
75
+ `):h.length>c||y[0]===" "?(d===" "?d=`
76
76
  `:!p&&d===`
77
77
  `&&(d=`
78
78
 
79
- `),f+=d+h.slice(c)+v,d=`
80
- `,p=!0):v===""?d===`
79
+ `),f+=d+h.slice(c)+y,d=`
80
+ `,p=!0):y===""?d===`
81
81
  `?f+=`
82
82
  `:d=`
83
- `:(f+=d+v,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;m<s.length;++m)f+=`
83
+ `:(f+=d+y,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;m<s.length;++m)f+=`
84
84
  `+s[m][0].slice(c);f[f.length-1]!==`
85
85
  `&&(f+=`
86
86
  `);break;default:f+=`
87
- `}let g=r+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[r,g,g]}}function Um({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let p=i[d];if(!a&&(p==="-"||p==="+"))a=p;else{let g=Number(p);!s&&g?s=g:c===-1&&(c=t+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",f=i.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":l=!0;case"newline":f+=p.source.length;break;case"comment":n&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let m=p.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:f}}function Km(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}rc.resolveBlockScalar=Bm});var Hi=w(oc=>{"use strict";var Yi=A(),zm=Ge();function Jm(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,c,l=(d,p,g)=>n(r+d,p,g);switch(i){case"scalar":a=Yi.Scalar.PLAIN,c=Ym(o,l);break;case"single-quoted-scalar":a=Yi.Scalar.QUOTE_SINGLE,c=Hm(o,l);break;case"double-quoted-scalar":a=Yi.Scalar.QUOTE_DOUBLE,c=Vm(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let u=r+o.length,f=zm.resolveEnd(s,u,e,n);return{value:c,type:a,comment:f.comment,range:[r,u,f.offset]}}function Ym(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}`),ic(t)}function Hm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),ic(t.slice(1,-1)).replace(/''/g,"'")}function ic(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let g=r+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[r,g,g]}}function mp({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let p=i[d];if(!a&&(p==="-"||p==="+"))a=p;else{let g=Number(p);!s&&g?s=g:c===-1&&(c=t+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",f=i.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":l=!0;case"newline":f+=p.source.length;break;case"comment":n&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let m=p.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:f}}function pp(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}bc.resolveBlockScalar=dp});var io=w(Cc=>{"use strict";var ro=A(),hp=tt();function gp(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,c,l=(d,p,g)=>n(r+d,p,g);switch(i){case"scalar":a=ro.Scalar.PLAIN,c=wp(o,l);break;case"single-quoted-scalar":a=ro.Scalar.QUOTE_SINGLE,c=yp(o,l);break;case"double-quoted-scalar":a=ro.Scalar.QUOTE_DOUBLE,c=vp(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let u=r+o.length,f=hp.resolveEnd(s,u,e,n);return{value:c,type:a,comment:f.comment,range:[r,u,f.offset]}}function wp(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}`),kc(t)}function yp(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),kc(t.slice(1,-1)).replace(/''/g,"'")}function kc(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 r=e.exec(t);if(!r)return t;let i=r[1],o=" ",s=e.lastIndex;for(n.lastIndex=s;r=n.exec(t);)r[1]===""?o===`
90
90
  `?i+=o:o=`
91
- `:(i+=o+r[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(t),i+o+(r?.[1]??"")}function Vm(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
91
+ `:(i+=o+r[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(t),i+o+(r?.[1]??"")}function vp(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
92
92
  `))if(i===`
93
- `){let{fold:o,offset:s}=Gm(t,r);n+=o,r=s}else if(i==="\\"){let o=t[++r],s=Xm[o];if(s)n+=s;else if(o===`
93
+ `){let{fold:o,offset:s}=bp(t,r);n+=o,r=s}else if(i==="\\"){let o=t[++r],s=kp[o];if(s)n+=s;else if(o===`
94
94
  `)for(o=t[r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="\r"&&t[r+1]===`
95
- `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Qm(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,s=t[r+1];for(;s===" "||s===" ";)s=t[++r+1];s!==`
95
+ `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Cp(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,s=t[r+1];for(;s===" "||s===" ";)s=t[++r+1];s!==`
96
96
  `&&!(s==="\r"&&t[r+2]===`
97
- `)&&(n+=r>o?t.slice(o,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Gm(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
97
+ `)&&(n+=r>o?t.slice(o,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function bp(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
98
98
  `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
99
99
  `);)r===`
100
100
  `&&(n+=`
101
- `),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Xm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Qm(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}oc.resolveFlowScalar=Jm});var cc=w(ac=>{"use strict";var Te=E(),sc=A(),Zm=Ji(),ep=Hi();function tp(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Zm.resolveBlockScalar(t,e,r):ep.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Te.SCALAR]:c?l=np(t.schema,i,c,n,r):e.type==="scalar"?l=rp(t,i,e,r):l=t.schema[Te.SCALAR];let u;try{let f=l.resolve(i,d=>r(n??e,"TAG_RESOLVE_FAILED",d),t.options);u=Te.isScalar(f)?f:new sc.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);r(n??e,"TAG_RESOLVE_FAILED",d),u=new sc.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function np(t,e,n,r,i){if(n==="!")return t[Te.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Te.SCALAR])}function rp({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[Te.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[Te.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}ac.composeScalar=tp});var uc=w(lc=>{"use strict";function ip(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}lc.emptyScalarPosition=ip});var mc=w(Gi=>{"use strict";var op=mt(),sp=E(),ap=nc(),fc=cc(),cp=Ge(),lp=uc(),up={composeNode:dc,composeEmptyNode:Vi};function dc(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,u=!0;switch(e.type){case"alias":l=fp(t,e,r),(a||c)&&r(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=fc.composeScalar(t,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=ap.composeCollection(up,t,e,n,r),a&&(l.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=Vi(t,e.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!sp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function Vi(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:lp.emptyScalarPosition(e,n,r),indent:-1,source:""},f=fc.composeScalar(t,u,a,l);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=c),f}function fp({options:t},{offset:e,source:n,end:r},i){let o=new op.Alias(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=cp.resolveEnd(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}Gi.composeEmptyNode=Vi;Gi.composeNode=dc});var gc=w(hc=>{"use strict";var dp=Nt(),pc=mc(),mp=Ge(),pp=Tt();function hp(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new dp.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=pp.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?pc.composeNode(l,i,u,s):pc.composeEmptyNode(l,u.end,r,null,u,s);let f=c.contents.range[2],d=mp.resolveEnd(o,f,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,f,d.offset],c}hc.composeDoc=hp});var Qi=w(vc=>{"use strict";var gp=rn("process"),wp=$r(),yp=Nt(),jt=It(),wc=E(),vp=gc(),bp=Ge();function Lt(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,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
101
+ `),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var kp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Cp(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Cc.resolveFlowScalar=gp});var _c=w(Ec=>{"use strict";var $e=_(),Sc=A(),Sp=no(),Ep=io();function _p(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Sp.resolveBlockScalar(t,e,r):Ep.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[$e.SCALAR]:c?l=xp(t.schema,i,c,n,r):e.type==="scalar"?l=Pp(t,i,e,r):l=t.schema[$e.SCALAR];let u;try{let f=l.resolve(i,d=>r(n??e,"TAG_RESOLVE_FAILED",d),t.options);u=$e.isScalar(f)?f:new Sc.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);r(n??e,"TAG_RESOLVE_FAILED",d),u=new Sc.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function xp(t,e,n,r,i){if(n==="!")return t[$e.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[$e.SCALAR])}function Pp({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[$e.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[$e.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}Ec.composeScalar=_p});var Pc=w(xc=>{"use strict";function Rp(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}xc.emptyScalarPosition=Rp});var Oc=w(so=>{"use strict";var Np=wt(),Op=_(),Ap=vc(),Rc=_c(),Ip=tt(),Tp=Pc(),jp={composeNode:Nc,composeEmptyNode:oo};function Nc(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,u=!0;switch(e.type){case"alias":l=Lp(t,e,r),(a||c)&&r(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=Rc.composeScalar(t,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ap.composeCollection(jp,t,e,n,r),a&&(l.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=oo(t,e.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Op.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function oo(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Tp.emptyScalarPosition(e,n,r),indent:-1,source:""},f=Rc.composeScalar(t,u,a,l);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=c),f}function Lp({options:t},{offset:e,source:n,end:r},i){let o=new Np.Alias(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=Ip.resolveEnd(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}so.composeEmptyNode=oo;so.composeNode=Nc});var Tc=w(Ic=>{"use strict";var qp=Tt(),Ac=Oc(),$p=tt(),Mp=$t();function Dp(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new qp.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Mp.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Ac.composeNode(l,i,u,s):Ac.composeEmptyNode(l,u.end,r,null,u,s);let f=c.contents.range[2],d=$p.resolveEnd(o,f,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,f,d.offset],c}Ic.composeDoc=Dp});var co=w(qc=>{"use strict";var Wp=un("process"),Fp=Yr(),Bp=Tt(),Mt=qt(),jc=_(),Up=Tc(),Kp=tt();function Dt(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 Lc(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var Xi=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=Lt(n);o?this.warnings.push(new jt.YAMLWarning(s,r,i)):this.errors.push(new jt.YAMLParseError(s,r,i))},this.directives=new wp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=yc(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
- ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(wc.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];wc.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
105
+ `)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var ao=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=Dt(n);o?this.warnings.push(new Mt.YAMLWarning(s,r,i)):this.errors.push(new Mt.YAMLParseError(s,r,i))},this.directives=new Fp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=Lc(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
+ ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(jc.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];jc.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
107
107
  ${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
108
- ${s}`:r}}if(n){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}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,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(gp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=Lt(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=vp.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,r=new jt.YAMLParseError(Lt(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new jt.YAMLParseError(Lt(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=bp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new jt.YAMLParseError(Lt(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 r=Object.assign({_directives:this.directives},this.options),i=new yp.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};vc.Composer=Xi});var Cc=w(Gn=>{"use strict";var kp=Ji(),Cp=Hi(),Sp=It(),bc=yt();function _p(t,e=!0,n){if(t){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new Sp.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Cp.resolveFlowScalar(t,e,r);case"block-scalar":return kp.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Ep(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=bc.stringifyString({type:s,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
108
+ ${s}`:r}}if(n){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Lc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(Wp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=Dt(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Up.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,r=new Mt.YAMLParseError(Dt(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Mt.YAMLParseError(Dt(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=Kp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Mt.YAMLParseError(Dt(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 r=Object.assign({_directives:this.directives},this.options),i=new Bp.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};qc.Composer=ao});var Dc=w(ir=>{"use strict";var zp=no(),Jp=io(),Yp=qt(),$c=Ct();function Hp(t,e=!0,n){if(t){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new Yp.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Jp.resolveFlowScalar(t,e,r);case"block-scalar":return zp.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Gp(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=$c.stringifyString({type:s,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
111
  `),u=a.substring(0,l),f=a.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:o,indent:r,source:u}];return kc(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
113
- `}),{type:"block-scalar",offset:o,indent:r,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function xp(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=bc.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Pp(t,c);break;case'"':Zi(t,c,"double-quoted-scalar");break;case"'":Zi(t,c,"single-quoted-scalar");break;default:Zi(t,c,"scalar")}}function Pp(t,e){let n=e.indexOf(`
112
+ `,d=[{type:"block-scalar-header",offset:o,indent:r,source:u}];return Mc(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:o,indent:r,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function Vp(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=$c.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Xp(t,c);break;case'"':lo(t,c,"double-quoted-scalar");break;case"'":lo(t,c,"single-quoted-scalar");break;default:lo(t,c,"scalar")}}function Xp(t,e){let n=e.indexOf(`
114
114
  `),r=e.substring(0,n),i=e.substring(n+1)+`
115
- `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];kc(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
116
- `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function kc(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 Zi(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 r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of r)o.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}Gn.createScalarToken=Ep;Gn.resolveAsScalar=_p;Gn.setScalarValue=xp});var _c=w(Sc=>{"use strict";var Rp=t=>"type"in t?Qn(t):Xn(t);function Qn(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Qn(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Xn(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Xn(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Xn(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 Xn({start:t,key:e,sep:n,value:r}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Qn(e)),n)for(let o of n)i+=o.source;return r&&(i+=Qn(r)),i}Sc.stringify=Rp});var Rc=w(Pc=>{"use strict";var eo=Symbol("break visit"),Np=Symbol("skip children"),Ec=Symbol("remove item");function je(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),xc(Object.freeze([]),t,e)}je.BREAK=eo;je.SKIP=Np;je.REMOVE=Ec;je.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};je.parentCollection=(t,e)=>{let n=je.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function xc(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=xc(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===eo)return eo;a===Ec&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}Pc.visit=je});var Zn=w(B=>{"use strict";var to=Cc(),Op=_c(),Ap=Rc(),no="\uFEFF",ro="",io="",oo="",Ip=t=>!!t&&"items"in t,Tp=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function jp(t){switch(t){case no:return"<BOM>";case ro:return"<DOC>";case io:return"<FLOW_END>";case oo:return"<SCALAR>";default:return JSON.stringify(t)}}function Lp(t){switch(t){case no:return"byte-order-mark";case ro:return"doc-mode";case io:return"flow-error-end";case oo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
+ `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];Mc(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function Mc(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 lo(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 r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of r)o.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}ir.createScalarToken=Gp;ir.resolveAsScalar=Hp;ir.setScalarValue=Vp});var Fc=w(Wc=>{"use strict";var Qp=t=>"type"in t?sr(t):or(t);function sr(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=sr(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=or(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=or(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=or(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 or({start:t,key:e,sep:n,value:r}){let i="";for(let o of t)i+=o.source;if(e&&(i+=sr(e)),n)for(let o of n)i+=o.source;return r&&(i+=sr(r)),i}Wc.stringify=Qp});var zc=w(Kc=>{"use strict";var uo=Symbol("break visit"),Zp=Symbol("skip children"),Bc=Symbol("remove item");function Me(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Uc(Object.freeze([]),t,e)}Me.BREAK=uo;Me.SKIP=Zp;Me.REMOVE=Bc;Me.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};Me.parentCollection=(t,e)=>{let n=Me.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Uc(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=Uc(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===uo)return uo;a===Bc&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}Kc.visit=Me});var ar=w(B=>{"use strict";var fo=Dc(),eh=Fc(),th=zc(),mo="\uFEFF",po="",ho="",go="",nh=t=>!!t&&"items"in t,rh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function ih(t){switch(t){case mo:return"<BOM>";case po:return"<DOC>";case ho:return"<FLOW_END>";case go:return"<SCALAR>";default:return JSON.stringify(t)}}function oh(t){switch(t){case mo:return"byte-order-mark";case po:return"doc-mode";case ho:return"flow-error-end";case go: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}B.createScalarToken=to.createScalarToken;B.resolveAsScalar=to.resolveAsScalar;B.setScalarValue=to.setScalarValue;B.stringify=Op.stringify;B.visit=Ap.visit;B.BOM=no;B.DOCUMENT=ro;B.FLOW_END=io;B.SCALAR=oo;B.isCollection=Ip;B.isScalar=Tp;B.prettyToken=jp;B.tokenType=Lp});var co=w(Oc=>{"use strict";var qt=Zn();function H(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var Nc=new Set("0123456789ABCDEFabcdef"),qp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),er=new Set(",[]{}"),$p=new Set(` ,[]{}
121
- \r `),so=t=>!t||$p.has(t),ao=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 r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}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}B.createScalarToken=fo.createScalarToken;B.resolveAsScalar=fo.resolveAsScalar;B.setScalarValue=fo.setScalarValue;B.stringify=eh.stringify;B.visit=th.visit;B.BOM=mo;B.DOCUMENT=po;B.FLOW_END=ho;B.SCALAR=go;B.isCollection=nh;B.isScalar=rh;B.prettyToken=ih;B.tokenType=oh});var vo=w(Yc=>{"use strict";var Wt=ar();function V(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var Jc=new Set("0123456789ABCDEFabcdef"),sh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),cr=new Set(",[]{}"),ah=new Set(` ,[]{}
121
+ \r `),wo=t=>!t||ah.has(t),yo=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 r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}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 r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
124
124
  `||!i&&!this.atEnd)return e+r+1}return n===`
125
- `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&H(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]===qt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),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 qt.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==="...")&&H(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&&!H(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===":")&&H(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"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(so),"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,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&H(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield qt.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"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(so),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||H(s)||s===",")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 o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
125
+ `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&V(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]===Wt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),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 Wt.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==="...")&&V(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&&!V(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===":")&&V(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"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(wo),"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,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&V(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Wt.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"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(wo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||V(s)||s===",")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 o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
127
127
  `,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
128
- `,o)}i!==-1&&(n=i-(r[i-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=>H(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
128
+ `,o)}i!==-1&&(n=i-(r[i-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=>V(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
129
129
  `:e=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
130
130
  `)break}default:break e}if(!r&&!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 o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
131
131
  `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
132
  `;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
133
- `&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield qt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(H(o)||e&&er.has(o))break;n=r}else if(H(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
133
+ `&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield Wt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(V(o)||e&&cr.has(o))break;n=r}else if(V(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
134
134
  `?(r+=1,i=`
135
- `,o=this.buffer[r+1]):n=r),o==="#"||e&&er.has(o))break;if(i===`
136
- `){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&er.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield qt.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 r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.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(so),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(H(r)||n&&er.has(r)){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(;!H(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(qp.has(n))n=this.buffer[++e];else if(n==="%"&&Nc.has(this.buffer[e+1])&&Nc.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
+ `,o=this.buffer[r+1]):n=r),o==="#"||e&&cr.has(o))break;if(i===`
136
+ `){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&cr.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Wt.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 r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.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(wo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(V(r)||n&&cr.has(r)){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(;!V(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(sh.has(n))n=this.buffer[++e];else if(n==="%"&&Jc.has(this.buffer[e+1])&&Jc.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,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Oc.Lexer=ao});var uo=w(Ac=>{"use strict";var lo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};Ac.LineCounter=lo});var mo=w(qc=>{"use strict";var Dp=rn("process"),Ic=Zn(),Mp=co();function be(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Tc(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 Lc(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 tr(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 Xe(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 nr(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 jc(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!be(e.start,"explicit-key-ind")&&!be(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Lc(e.value)?e.value.end?nr(e.value.end,e.sep):e.value.end=e.sep:nr(e.start,e.sep),delete e.sep)}var fo=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 Mp.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,Dp.env.LOG_TOKENS&&console.log("|",Ic.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Ic.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 r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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 r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&jc(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Tc(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.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":{Tc(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=tr(this.peek(2)),r=Xe(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}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,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Yc.Lexer=yo});var ko=w(Hc=>{"use strict";var bo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};Hc.LineCounter=bo});var So=w(Zc=>{"use strict";var ch=un("process"),Gc=ar(),lh=vo();function Ce(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Vc(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 Qc(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 lr(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 nt(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 ur(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 Xc(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ce(e.start,"explicit-key-ind")&&!Ce(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Qc(e.value)?e.value.end?ur(e.value.end,e.sep):e.value.end=e.sep:ur(e.start,e.sep),delete e.sep)}var Co=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 lh.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,ch.env.LOG_TOKENS&&console.log("|",Gc.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Gc.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 r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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 r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Xc(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Vc(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.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":{Vc(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=lr(this.peek(2)),r=nt(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}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 r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){nr(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),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):i||n.value?(o.push(this.sourceToken),e.items.push({start:o,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(be(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Lc(n.key)&&!be(n.sep,"newline")){let s=Xe(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:s,key:a,sep:c}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(be(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=Xe(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):be(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 s=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!be(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 r&&e.items.push({start:o});this.stack.push(s);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 r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){nr(i,n.start),i.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||be(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.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 i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=tr(r),o=Xe(i);jc(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};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 r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ur(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),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):i||n.value?(o.push(this.sourceToken),e.items.push({start:o,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(Ce(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Qc(n.key)&&!Ce(n.sep,"newline")){let s=nt(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:s,key:a,sep:c}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(Ce(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=nt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ce(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 s=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ce(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 r&&e.items.push({start:o});this.stack.push(s);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 r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ur(i,n.start),i.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||Ce(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.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 i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=lr(r),o=nt(i);Xc(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};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=tr(e),r=Xe(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=tr(e),r=Xe(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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())}}};qc.Parser=fo});var Fc=w(Dt=>{"use strict";var $c=Qi(),Wp=Nt(),$t=It(),Fp=Gr(),Bp=E(),Up=uo(),Dc=mo();function Mc(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Up.LineCounter||null,prettyErrors:e}}function Kp(t,e={}){let{lineCounter:n,prettyErrors:r}=Mc(e),i=new Dc.Parser(n?.addNewLine),o=new $c.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach($t.prettifyError(t,n)),a.warnings.forEach($t.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function Wc(t,e={}){let{lineCounter:n,prettyErrors:r}=Mc(e),i=new Dc.Parser(n?.addNewLine),o=new $c.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new $t.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach($t.prettifyError(t,n)),s.warnings.forEach($t.prettifyError(t,n))),s}function zp(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Wc(t,n);if(!i)return null;if(i.warnings.forEach(o=>Fp.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Jp(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return Bp.isDocument(t)&&!r?t.toString(n):new Wp.Document(t,r,n).toString(n)}Dt.parse=zp;Dt.parseAllDocuments=Kp;Dt.parseDocument=Wc;Dt.stringify=Jp});var Mt=w(x=>{"use strict";var Yp=Qi(),Hp=Nt(),Vp=Ii(),po=It(),Gp=mt(),ke=E(),Xp=ge(),Qp=A(),Zp=ye(),eh=ve(),th=Zn(),nh=co(),rh=uo(),ih=mo(),rr=Fc(),Bc=lt();x.Composer=Yp.Composer;x.Document=Hp.Document;x.Schema=Vp.Schema;x.YAMLError=po.YAMLError;x.YAMLParseError=po.YAMLParseError;x.YAMLWarning=po.YAMLWarning;x.Alias=Gp.Alias;x.isAlias=ke.isAlias;x.isCollection=ke.isCollection;x.isDocument=ke.isDocument;x.isMap=ke.isMap;x.isNode=ke.isNode;x.isPair=ke.isPair;x.isScalar=ke.isScalar;x.isSeq=ke.isSeq;x.Pair=Xp.Pair;x.Scalar=Qp.Scalar;x.YAMLMap=Zp.YAMLMap;x.YAMLSeq=eh.YAMLSeq;x.CST=th;x.Lexer=nh.Lexer;x.LineCounter=rh.LineCounter;x.Parser=ih.Parser;x.parse=rr.parse;x.parseAllDocuments=rr.parseAllDocuments;x.parseDocument=rr.parseDocument;x.stringify=rr.stringify;x.visit=Bc.visit;x.visitAsync=Bc.visitAsync});import Ce from"path";function fh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Ce.posix.isAbsolute(n)||Ce.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let r=n.replaceAll("\\","/").split("/");if(r.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function ir(t){let e=fh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Vc(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 Qe(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||Ce.posix.isAbsolute(r)||Ce.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function ae(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Gc(t,e,n){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return r}function Xc(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>go)throw new Error(`${e} exceeds ${go} characters`);let n=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?n+=1:t[r]==="*"&&(n+=1,t[r+1]==="*"&&(r+=1));if(n>wo)throw new Error(`${e} contains more than ${wo} wildcard tokens`);return t}function Yc(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(r=>Xc(r,e)))].sort((r,i)=>r.localeCompare(i,"en"))}function Wt(t,e,n){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${n} must be a positive integer`);return r}function Hc(t,e,n){let r=Wt(t,e,n);if(r>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${n} is too large to convert to bytes safely`);return r}function dh(t){if(t===void 0)return{...Q,include:[...Q.include],exclude:[...Q.exclude]};let e=ae(t,"native.snapshot");return{include:Yc(e.include,"native.snapshot.include",Q.include),exclude:Yc(e.exclude,"native.snapshot.exclude",Q.exclude),max_files:Wt(e.max_files,Q.max_files,"native.snapshot.max_files"),max_total_bytes:Wt(e.max_total_bytes,Q.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Wt(e.max_duration_ms,Q.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:Wt(e.max_selection_records,Q.max_selection_records,"native.snapshot.max_selection_records")}}function mh(t){if(t===void 0)return;let e=ae(t,"native.pending_root_move"),n=e.id,r=e.from_artifact_root,i=e.to_artifact_root,o=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 r!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=ae(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:n,fromArtifactRoot:ir(r),toArtifactRoot:ir(i),stage:o,...s?{cleanup:s}:{}}}function ph(t){if(t===void 0)return;let e=ae(t,"native.finish");if(e.pull_request===void 0)return{};let n=ae(e.pull_request,"native.finish.pull_request");if(n.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(n.command)||n.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(n.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let r=n.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(Ce.posix.isAbsolute(r[0])||Ce.win32.isAbsolute(r[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=n.timeout_ms??ah;if(!Number.isSafeInteger(i)||i<1||i>Jc)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Jc}`);return{pull_request:{provider:"repository-command",command:r,timeout_ms:i}}}function hh(t,e={}){let n=ae(t,"native"),r=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let i=n.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=n.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=n.max_verify_failures??oh;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=n.document_writes??"allow";if(a!=="allow"&&a!=="revert")throw new Error("native.document_writes must be allow or revert");let c=mh(n.pending_root_move),l=ph(n.finish);return{artifact_root:ir(r),language:Gc(n.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,...a==="revert"?{document_writes:a}:{},snapshot:dh(n.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function gh(t){let e=ae(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");let o=e.document_evidence??"neutral";if(o!=="neutral"&&o!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:Vc(e.artifact_layout),language:Gc(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:r,auto_transition:i,...o==="strict"?{document_evidence:o}:{}}}function wh(t){let n=ae(t,"hook").allow_paths??[];if(!Array.isArray(n))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(n.map((r,i)=>Qe(r,`hook.allow_paths[${i}]`)))]}}function yh(t){if(t===void 0)return{...ho};let e=ae(t,"memory"),n=e.learning??ho.learning,r=e.retrieval??ho.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof r!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:r}}function vo(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function vh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||n.includes("\\")||n.includes("\0")||Ce.posix.isAbsolute(n)||Ce.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!n.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(n.length>Uc)throw new Error(`${e} exceeds ${Uc} characters`);let r=0;for(let i=0;i<n.length;i+=1)n[i]==="?"?r+=1:n[i]==="*"&&(r+=1,n[i+1]==="*"&&(i+=1));if(r>Kc)throw new Error(`${e} contains more than ${Kc} wildcard tokens`);return n}function bh(t){let e=vo(t,"knowledge.local"),n=e.include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");let r={include:[...new Set(n.map((i,o)=>vh(i,`knowledge.local.include[${o}]`)))],max_file_mb:Hc(e.max_file_mb,zc.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:Hc(e.max_total_mb,zc.max_total_mb,"knowledge.local.max_total_mb")};if(r.max_file_mb>r.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return r}function kh(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let n=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),r=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&r))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function Ch(t){let e=vo(t,"knowledge.remote"),n=kh(e.endpoint),r=e.token_env;if(r!==void 0&&(typeof r!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:n,...r===void 0?{}:{token_env:r},...i===void 0?{}:{scope:i},timeout_ms:o}}function Sh(t){if(t===void 0)return{...sh};let e=vo(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let r=e.local===void 0?void 0:bh(e.local);if(n==="local")return{provider:n,...r?{local:r}:{}};let i=e.remote===void 0?void 0:Ch(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...r?{local:r}:{},remote:i}}function _h(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Eh(t,e,n,r,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let f=[...new Set(u)];if(!f.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(f.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:f,ambient_resume:s,...e?{hook:e}:{},memory:n,knowledge:r,...i?{native:i}:{},...o?{classic:o}:{}}}function Ze(t,e={}){let n=(0,yo.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let r=n.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=r,o=_h(i.ambient_resume),s=i.hook===void 0?void 0:wh(i.hook),a=yh(i.memory),c=Sh(i.knowledge),l=i.native===void 0?void 0:hh(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:gh(i.classic),f=Eh(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:f,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}var yo,Ft,go,wo,Uc,Kc,oh,ho,zc,sh,ah,Jc,ch,lh,uh,Q,Se=O(()=>{"use strict";yo=on(Mt(),1),Ft=Number.MAX_SAFE_INTEGER,go=1024,wo=64,Uc=1024,Kc=64,oh=5,ho={learning:!0,retrieval:!0},zc={include:[],max_file_mb:1,max_total_mb:32},sh={provider:"local"},ah=12e4,Jc=6e5,ch=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],lh=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],uh=[...ch,...lh].sort((t,e)=>t.localeCompare(e,"en")),Q={include:["**/*"],exclude:[...uh],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4}});function _e(t){return t!==0&&t!==0n&&t!=="0"}function Qc(t,e){return _e(t.dev)&&_e(e.dev)&&_e(t.ino)&&_e(e.ino)}function Ee(t,e){let n=_e(t.dev)&&_e(e.dev);if(n&&t.dev!==e.dev)return!1;let r=_e(t.ino)&&_e(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var or=O(()=>{"use strict"});import{constants as sr,promises as Le}from"fs";function bo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Zc(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Bt(t){return{dev:t.dev,ino:t.ino,birthtime:bo(t)}}function ar(t,e){let n=Bt(t),r=Bt(e);return Qc(n,r)?Ee(n,r):Ee(n,r)&&bo(t)===bo(e)&&Zc(t)===Zc(e)&&t.size===e.size}async function ko(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await Le.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new xe("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new xe("too-large",`${r} exceeds ${e} bytes`);let s=await Le.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:Bt(o)});let a=process.platform==="win32"?sr.O_RDONLY:sr.O_RDONLY|sr.O_NOFOLLOW|sr.O_NONBLOCK,c;try{c=await Le.open(t,a)}catch(l){throw l.code==="ELOOP"?new xe("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:i}),Le.lstat(t,{bigint:i}),Le.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!ar(o,l)||!ar(o,u))throw new xe("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:f,identity:Bt(l)}),await n.hooks?.afterOpen?.();let d=[],p=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:k}=await c.read(g,0,Math.min(g.length,b),null);if(k===0)break;if(p+=k,p>e)throw new xe("too-large",`${r} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,k)))}await n.hooks?.beforeFinalCheck?.();let[m,h,v]=await Promise.all([c.stat({bigint:i}),Le.lstat(t,{bigint:i}),Le.realpath(t)]);if(!h.isFile()||h.isSymbolicLink()||v!==s||!ar(o,m)||!ar(o,h))throw new xe("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:v,identity:Bt(m)}),{bytes:Buffer.concat(d,p),stat:m,realPath:v}}finally{await c.close()}}var xe,Co=O(()=>{"use strict";or();xe=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}}});import{promises as cr}from"fs";import Pe from"path";function xh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function So(t,e){let n=Pe.relative(t,e);return n===""||!Pe.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Pe.sep}`)}async function el(t,e){let n=Pe.resolve(t),r=await cr.lstat(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return cr.realpath(n)}async function tl(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=Pe.join(i,n[o]);let s;try{s=await cr.lstat(i)}catch(u){if(xh(u))return{exists:!1,kind:"missing"};throw u}let a=Pe.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${r.label} ancestor ${a} must be a real directory`);if(c&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await cr.realpath(i);if(!So(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function $(t,e,n){let r=Qe(e,n.label),i=Pe.resolve(t),o=await el(i,n.label),s=r.split("/"),a=Pe.resolve(i,...s);if(!So(i,a))throw new Error(`${n.label} must stay inside the project root`);let c=await tl(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:c.exists,kind:c.kind}}async function U(t,e,n,r){let i=await $(t,e,{label:r.label,expected:"file"});if(!i.exists){let s=new Error(`${r.label} does not exist`);throw s.code="ENOENT",s}let o=await el(i.projectRoot,r.label);return ko(i.target,n,{...r,verify:async(s,a)=>{if(!So(o,a.realPath))throw new Error(`${r.label} resolves outside the project root`);await tl(i.projectRoot,o,i.relative.split("/"),{label:r.label,expected:"file"})}})}var V=O(()=>{"use strict";Co();Se()});import{createHash as Ph}from"crypto";function Rh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Kt(t,e={}){return(await lr(t,e)).document}async function Nh(t){try{return(await U(t,Ut,Ft,{label:Ut})).bytes}catch(e){if(Rh(e))return null;throw e}}function Oh(t){return t?{exists:!0,sha256:Ph("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function lr(t,e={}){let n=await Nh(t);return{document:n?Ze(n.toString("utf8"),e):null,identity:Oh(n)}}async function _o(t){return(await Kt(t))?.config??null}var Ut,et=O(()=>{"use strict";Se();V();Ut=".comet/config.yaml"});import{promises as xo}from"node:fs";async function Po(t,e){let n;for(let r=0;r<=Eo.length;r+=1)try{return await t()}catch(i){n=i;let o=i.code;if(r===Eo.length||!Ah.has(o??""))throw i;await new Promise(s=>setTimeout(s,Eo[r]))}throw n}async function nl(t,e){await Po(()=>xo.rename(t,e),`rename ${e}`)}async function ur(t){await Po(()=>xo.unlink(t),`unlink ${t}`)}async function rl(t,e){await Po(()=>xo.link(t,e),`link ${e}`)}var Ah,Eo,Ro=O(()=>{"use strict";Ah=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),Eo=[50,100,200]});import{randomUUID as Ih}from"crypto";import{constants as Th,promises as j}from"fs";import q from"path";async function No(t,e){try{return await rl(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await j.copyFile(t,e,Th.COPYFILE_EXCL),{linked:!1}}function qe(t,e){let n=q.relative(t,e);return n===""||!q.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${q.sep}`)}function fr(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function jh(t,e){return Ee(t,fr(e))}function dr(t,e){return Ee(fr(t),fr(e))}function il(t,e){return dr(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function mr(t){let e=await j.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 j.realpath(t),...fr(e)}}async function ce(t){for(let e of t){let n=await j.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!jh(e,n)||await j.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Lh(t,e,n){let[r,i]=await Promise.all([j.lstat(t),j.realpath(t),ce(n)]);if(!r.isFile()||r.isSymbolicLink()||!dr(r,e)||!qe(n[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return r}async function qh(t,e){let n=q.resolve(t),r=q.resolve(e);if(!qe(n,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await mr(n)],o=q.relative(n,r).split(q.sep).filter(Boolean),s=n;for(let a of o){await ce(i),s=q.join(s,a);try{await j.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await mr(s);if(!qe(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await ce(i),i}async function $h(t,e){let n=q.resolve(t),r=q.resolve(e);if(!qe(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await mr(n)],o=q.relative(n,r).split(q.sep).filter(Boolean),s=n;for(let a of o){s=q.join(s,a);try{let c=await mr(s);if(!qe(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ce(i),i}async function ol(t){let e;try{e=await j.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function Dh(t,e,n){let r=q.dirname(t),i=await qh(n.containedRoot,r),o=q.join(r,`.${q.basename(t)}.${Ih()}.tmp`),s,a,c;try{await n.beforeTemporaryOpen?.(),s=await j.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([j.lstat(o),j.realpath(o)]);if(await ce(i),!l.isFile()||l.isSymbolicLink()||!dr(a,l)||!qe(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!dr(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await n.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await Lh(o,c,i),await n.beforeCommit?.(),await ce(i);let f=await j.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!c||!il(f,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await No(o,t),await j.unlink(o)):await nl(o,t),await ol(r)}catch(l){await s?.close();try{await ce(i),await j.rm(o,{force:!0})}catch{}throw l}}async function Z(t,e,n){await Dh(t,e,n)}async function zt(t,e){let n=q.dirname(t),r=await $h(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await j.lstat(t),o=await j.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!qe(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ce(r);let[s,a]=await Promise.all([j.lstat(t),j.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!il(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await ur(t),await ce(r),await ol(n),!0}var Re=O(()=>{"use strict";Ro();or()});var Uv,Oo=O(()=>{"use strict";Re();et();V();Uv=16*1024});var Io=O(()=>{"use strict";Re();Se();et();V();Oo()});var hr=O(()=>{"use strict"});var xl=O(()=>{"use strict"});var qo=O(()=>{"use strict";hr()});var Pl=O(()=>{"use strict";hr();qo()});var kg,Rl=O(()=>{"use strict";kg=on(Mt(),1);Re();Se();V()});var Db,Nl=O(()=>{"use strict";Re();V();Db=4*1024*1024});function Sg(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function Ol(t,e){return(...n)=>{let r=Cg;if(r===null)return e(...n);let i=Sg(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}var Cg,Al=O(()=>{"use strict";Cg=null});var Ub,Il=O(()=>{"use strict";Al();et();Ub=Ol("hookWritePolicy",async t=>(await _o(t))?.hook??{allow_paths:[]})});var _g,Tl=O(()=>{"use strict";Co();_g=16*1024});var jl=O(()=>{"use strict";hr();Re();xl();Pl();Se();Rl();V();et();Io();Nl();Il();Tl();Oo();qo()});import{TextDecoder as xg}from"util";function Ll(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Pg(t,e){try{return new xg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function $o(t,e,n,r,i={}){try{let o=await U(t,e,n,{label:r,hooks:i.hooks});return{result:o,text:Pg(o,r)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function ql(t,e,n,r,i={}){return(await $o(t,e,n,r,i))?.text??null}async function $l(t,e,n,r,i,o={}){if(Buffer.byteLength(n,"utf8")>r)throw new Error(`${i} exceeds ${r} bytes`);let s=await $o(t,e,r,i),a=await $(t,e,{label:i,expected:"file"});await Z(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await $o(t,e,r,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!Ee(Ll(s.result.stat),Ll(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Dl(t,e,n,r={}){let i=await $(t,e,{label:n,expected:"file"});return i.exists?zt(i.target,{containedRoot:i.projectRoot,beforeRemove:r.beforeRemove}):!1}var Ml=O(()=>{"use strict";jl();or()});var Ul={};Ru(Ul,{RUN_STATE_FILE:()=>gr,applyRunStateToDocument:()=>Fl,readRunState:()=>Do,removeRunState:()=>Mo,runStateFromDocument:()=>it,writeRunState:()=>wr});import Rg from"path";function Gt(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 Vt(t,e){let n=Gt(t,e);if(Rg.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 Ng(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(n))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function it(t){if(!t.run_id)return null;let e=Gt(t,"run_id"),n=Gt(t,"skill"),r=Gt(t,"skill_version"),i=Gt(t,"skill_hash"),o=Vt(t,"pending_ref"),s=Vt(t,"trajectory_ref"),a=Vt(t,"context_ref"),c=Vt(t,"artifacts_ref"),l=Vt(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:r,skillHash:i,orchestration:t.orchestration,currentStep:Wl(t,"current_step"),iteration:u,pending:Wl(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Ng(t)}}function Fl(t,e){e?t.run_id=e.runId:delete t.run_id}function Og(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 Ag(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 it(e)}async function Do(t,e={}){let n=await ql(t,gr,Bl,"Run state",e);if(n===null)return null;let r=JSON.parse(n);return Ag(r)}async function wr(t,e,n={}){await $l(t,gr,JSON.stringify(Og(e),null,2),Bl,"Run state",n)}async function Mo(t,e={}){await Dl(t,gr,"Run state",e)}var Wl,gr,Bl,yr=O(()=>{"use strict";Ml();Wl=(t,e)=>{let n=t[e];return n==null?null:String(n)};gr=".comet/run-state.json",Bl=Number.MAX_SAFE_INTEGER});function Zo(t){return t.charCodeAt(0)===65279?t.slice(1):t}import Cw from"node:path";import{promises as ll}from"fs";import I from"path";import{promises as es}from"fs";async function Ir(t){try{return await es.access(t),!0}catch(e){if(Ou(e))return!1;throw e}}async function Tr(t){try{return await es.readdir(t)}catch(e){let n=e?.code;if(n==="ENOENT"||n==="ENOTDIR")return[];throw e}}function Ou(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}Se();et();Io();V();var Jt=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},cl=".comet/config.yaml";function ul(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function fl(t){await $(t,cl,{label:cl,expected:"file"})}function dl(t,e){let n=I.resolve(t),r=e==="docs"?I.join(n,"docs"):n,i=I.join(r,"openspec"),o=I.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:r,openSpecRoot:i,changesDir:I.join(i,"changes"),archiveDir:I.join(i,"changes","archive"),specsDir:I.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:I.join(o,"specs"),superpowersPlansDir:I.join(o,"plans"),superpowersReportsDir:I.join(o,"reports")}}async function Uh(t){await fl(t);let e=await Kt(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new Jt;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new Jt("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Kh(t,e){return dl(t,e??await Uh(t))}async function zh(t){try{return await ll.lstat(t),!0}catch(e){if(ul(e))return!1;throw e}}async function Jh(t,e){let n=await Kh(t,e),r=n.artifactLayout==="legacy"?"docs":"legacy",i=dl(t,r).openSpecRoot,[o,s]=await Promise.all([$(n.projectRoot,tt(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),zh(i)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function Yh(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let r=tt(t.projectRoot,n);await $(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function Yt(t,e){let n=await Jh(t,e);if(await Yh(n.paths),!n.configuredRootExists){let r=tt(n.paths.projectRoot,n.paths.openSpecRoot),i=tt(n.paths.projectRoot,n.alternateRoot);throw new Jt(`Configured Classic OpenSpec root is missing: ${r} (alternate ${i} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function ml(t){let e=I.resolve(t),n=null;try{(await ll.lstat(e)).isDirectory()||(e=I.dirname(e))}catch(r){if(!ul(r))throw r}for(;;){I.basename(e)==="openspec"&&(n=I.dirname(e));let r=I.join(e,".comet","config.yaml"),i=!1;if(await Ir(r))try{await fl(e);let s=(await Kt(e))?.value;i=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(i||await Ir(I.join(e,".git")))return e;let o=I.dirname(e);if(o===e)return n??I.resolve(t);e=o}}function tt(t,e){return I.relative(I.resolve(t),e).replaceAll("\\","/")}import{execFile as Sw}from"child_process";import st from"path";import{AsyncLocalStorage as Gg}from"node:async_hooks";Ro();import{randomUUID as cg}from"node:crypto";import{promises as $e}from"node:fs";import Sl from"node:os";import Cl from"node:path";import{promises as yl}from"node:fs";import vl from"node:path";import{execFileSync as Qh}from"node:child_process";import wl from"node:path";import{existsSync as Hh}from"node:fs";import Ht from"node:path";var Vh=/[&|<>()^%"!\r\n]/u,cb=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");function pl(t,e){let n=e.toLowerCase();return Object.entries(t).find(([r,i])=>r.toLowerCase()===n&&i!==void 0)?.[1]}function Gh(t){let e=(pl(t,"PATHEXT")??".COM;.EXE;.BAT;.CMD").split(";").map(n=>n.trim().toLowerCase()).filter(Boolean);return[...new Set([...e,".ps1"])]}function Xh(t,e,n){let i=Ht.win32.isAbsolute(t)||/[\\/]/u.test(t)?[""]:(pl(e,"PATH")??"").split(Ht.delimiter).map(a=>a.trim().replace(/^"(.*)"$/u,"$1")).filter(Boolean),s=Ht.win32.extname(t)?[t]:Gh(e).map(a=>`${t}${a}`);return i.flatMap(a=>s.map(c=>a?Ht.join(a,c):Ht.resolve(n,c)))}function hl(t,e,n){return Xh(t,e,n).find(r=>Hh(r))??t}function gl(t){if(t.some(e=>Vh.test(e)))throw new Error("Windows batch check arguments must not contain shell syntax")}var Zh=6e4,eg=8*1024*1024,nt=class extends Error{constructor(n,r,i,o){super(`${n} ${r.join(" ")} failed${i?`: ${i}`:""}`,o);this.command=n;this.args=r;this.stderr=i;this.name="ExternalCommandError",this.timedOut=o?.timedOut===!0}command;args;stderr;timedOut};function tg(t){return t instanceof Error&&(t.code==="ETIMEDOUT"||t.killed===!0&&t.signal==="SIGTERM")}function rt(t,e,n={}){let r=n.timeoutMs??Zh,i=n.maxBufferBytes??eg;if(!Number.isSafeInteger(r)||r<1)throw new Error("External command timeout must be a positive integer");if(!Number.isSafeInteger(i)||i<1)throw new Error("External command max buffer must be a positive integer");let o=wl.resolve(n.cwd??process.cwd()),s=n.env??process.env,a=process.platform==="win32"?hl(t,s,o):t,c=wl.win32.extname(a).toLowerCase(),l=c===".bat"||c===".cmd";process.platform==="win32"&&l&&gl(e);try{return Qh(a,[...e],{cwd:o,env:s,...n.input!==void 0?{input:n.input}:{},encoding:"utf8",stdio:[n.input===void 0?"ignore":"pipe","pipe","pipe"],timeout:r,maxBuffer:i,windowsHide:!0,shell:process.platform==="win32"&&l})}catch(u){let f=typeof u.stderr=="string"?u.stderr.trim():Buffer.isBuffer(u.stderr)?u.stderr.toString("utf8").trim():"";throw new nt(t,e,f,{cause:u,timedOut:tg(u)})}}var To=null,ng=6e4,rg=1e4,jo=new Map;function ig(t){let e=jo.get(t);if(!e)return;let n=e.value===null?rg:ng;if(Date.now()-e.at>n){jo.delete(t);return}return e.value}async function Lo(t){if(t===process.pid&&To!==null)return To;let e=ig(t);if(e!==void 0)return e;let n=await og(t);return t===process.pid&&n!==null&&(To=n),t!==process.pid&&jo.set(t,{value:n,at:Date.now()}),n}async function og(t){if(!Number.isSafeInteger(t)||t<=0)return null;try{if(process.platform==="linux"){let[e,n]=await Promise.all([yl.readFile(`/proc/${t}/stat`,"utf8"),yl.readFile("/proc/sys/kernel/random/boot_id","utf8")]),r=e.slice(e.lastIndexOf(")")+2).trim().split(/\s+/u)[19];return/^\d+$/u.test(r??"")?`linux:${n.trim()}:${r}`:null}if(process.platform==="win32")return await ag(t);if(process.platform==="darwin"){let e=rt("/bin/ps",["-p",String(t),"-o","lstart="],{timeoutMs:5e3,maxBufferBytes:4096,env:{...process.env,LC_ALL:"C",TZ:"UTC0"}}).trim();return e?`darwin:${e}`:null}}catch{}return null}function sg(t){let e=t.trim();return/^\d+$/u.test(e)?`win32-ps:${e}`:null}async function ag(t){try{let i=rt(vl.win32.join(process.env.SystemRoot??"C:\\Windows","System32","wbem","WMIC.exe"),["process","where",`processid=${t}`,"get","creationdate","/value"],{timeoutMs:5e3,maxBufferBytes:4096}),o=/^CreationDate=(\S+)/mu.exec(i);if(o)return`win32-wmic:${o[1]}`}catch{}let e=process.env.SystemRoot??"C:\\Windows",n=vl.win32.join(e,"System32","WindowsPowerShell","v1.0","powershell.exe"),r=rt(n,["-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${t} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks.ToString()`],{timeoutMs:8e3,maxBufferBytes:4096}).trim();return sg(r)}var bl=new Set(["win32-wmic","win32-ps"]);function pr(t){let e=t.indexOf(":");return e===-1?"":t.slice(0,e)}async function kl(t,e){if(!Number.isSafeInteger(t)||t<=0)return"alive";try{process.kill(t,0)}catch(r){if(r.code==="ESRCH")return"dead"}if(!e)return"unknown";let n=await Lo(t);return n===e?"alive":n===null||pr(n)!==pr(e)&&bl.has(pr(n))&&bl.has(pr(e))?"unknown":"dead"}var lg=3e4,ug=20,fg=5*6e4,dg=1e4;async function _l(t,e,n={}){let r=Cl.resolve(t);await $e.mkdir(Cl.dirname(r),{recursive:!0});let i=Date.now(),o=n.timeoutMs??lg,s=n.retryMs??ug,a=n.malformedLockStaleMs??fg,c=await Lo(process.pid),l={pid:process.pid,nonce:cg(),createdAt:Date.now(),hostname:Sl.hostname(),...c===null?{}:{processIdentity:c}},u=!1;for(;!u;){let f;try{f=await $e.open(r,"wx"),await f.writeFile(JSON.stringify(l),"utf8"),u=!0}catch(d){if(d.code!=="EEXIST")throw d;if(await mg(r,a))continue;if(Date.now()-i>=o)throw new Error(`Timed out waiting for file lock: ${r}`,{cause:d});await new Promise(p=>setTimeout(p,s))}finally{await f?.close()}}try{return await e()}finally{await pg(r,l.nonce)}}async function mg(t,e){let n,r;try{[n,r]=await Promise.all([$e.readFile(t,"utf8"),$e.stat(t)])}catch(o){return o.code==="ENOENT"}let i=El(n);if(i!==null&&(i.hostname!==void 0&&i.hostname!==Sl.hostname()||await kl(i.pid,i.processIdentity)!=="dead"))return!1;if(i===null){let o=n.trim().length===0?dg:e;if(Date.now()-Number(r.mtimeMs)<o)return!1}try{return await $e.readFile(t,"utf8")!==n?!1:(await $e.rm(t),!0)}catch(o){return o.code==="ENOENT"}}async function pg(t,e){try{if(El(await $e.readFile(t,"utf8"))?.nonce!==e)return;await ur(t)}catch(n){let r=n.code;if(r==="ENOENT")return;process.stderr.write(`[comet] warning: could not remove lock file ${t} (${r??n}); it will be recovered automatically
143
- `)}}function El(t){try{let e=JSON.parse(t);return Number.isSafeInteger(e.pid)&&Number(e.pid)>0&&typeof e.nonce=="string"&&e.nonce.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&(e.hostname===void 0||typeof e.hostname=="string"&&e.hostname.length>0)&&(e.processIdentity===void 0||typeof e.processIdentity=="string"&&e.processIdentity.length>0)?{pid:Number(e.pid),nonce:e.nonce,createdAt:e.createdAt,...e.hostname===void 0?{}:{hostname:e.hostname},...e.processIdentity===void 0?{}:{processIdentity:e.processIdentity}}:null}catch{return null}}V();var kr=on(Mt(),1);Re();V();yr();var Kl=["full","hotfix","tweak"],zl=1,Ig=["open","design","build","verify","archive"],Tg=["en","zh-CN"],jg=["off","beta"],Lg=["subagent-driven-development","executing-plans","direct","autonomous"],qg=["plan-ready"],$g=["confirmed"],Dg=["tdd","direct"],Mg=["off","standard","thorough"],Wg=["current","branch","worktree"],Fg=["light","full"],Bg=["pending","pass","fail"],Ug=["pending","handled"],Kg=["pending","confirmed"],De=["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","check_epoch","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],Xt=["run_id"],zg=new Set([...De,...Xt]),Jg=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Wo(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ot(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 M(t,e,n,r=!0){let i=t[e];if(i==null||i===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!n.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${r?" or null":""}`);return i}function Fo(t,e,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function Jl(t,e,n=0){let r=t[e];if(r==null||r==="")return n;if(typeof r!="number"||!Number.isSafeInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function vr(t,e){let n=ot(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 Yg(t,e){let n=ot(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!==zl)throw new Error(`Invalid Classic state: classic_migration must be ${zl}`);return e}function Vg(t){if(!De.some(n=>Wo(t,n)))return null;for(let n of Jg)if(!Wo(t,n))return null;return{workflow:M(t,"workflow",Kl,!1),language:M(t,"language",Tg),phase:M(t,"phase",Ig,!1),contextCompression:M(t,"context_compression",jg),buildMode:M(t,"build_mode",Lg),buildPause:M(t,"build_pause",qg),subagentDispatch:M(t,"subagent_dispatch",$g),tddMode:M(t,"tdd_mode",Dg),reviewMode:M(t,"review_mode",Mg),isolation:M(t,"isolation",Wg),boundBranch:ot(t,"bound_branch"),verifyMode:M(t,"verify_mode",Fg),autoTransition:Fo(t,"auto_transition"),baseRef:ot(t,"base_ref"),designDoc:vr(t,"design_doc"),plan:vr(t,"plan"),verifyResult:M(t,"verify_result",Bg,!1),verifyFailures:Jl(t,"verify_failures"),...Wo(t,"check_epoch")?{checkEpoch:Jl(t,"check_epoch")}:{},verificationReport:vr(t,"verification_report"),branchStatus:M(t,"branch_status",Ug),createdAt:ot(t,"created_at"),verifiedAt:ot(t,"verified_at"),archiveConfirmation:M(t,"archive_confirmation",Kg),archived:Fo(t,"archived",!1),directOverride:Fo(t,"direct_override"),handoffContext:vr(t,"handoff_context"),handoffHash:Yg(t,"handoff_hash"),classicProfile:M(t,"classic_profile",Kl),classicMigration:Hg(t)}}function Yl(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=it(t)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:Vg(t),run:n,unknownKeys:Object.keys(t).filter(r=>!zg.has(r))}}yr();var Hl=new Gg,Vl=".comet-state-transaction.json";async function Xg(t,e){let n=st.resolve(t);return Hl.getStore()===n?e():(await $(n,".comet-state.lock",{label:"Classic state lock",expected:"file"}),_l(st.join(n,".comet-state.lock"),()=>Hl.run(n,async()=>(await Zg(n),e()))))}async function Gl(t,e){try{return(await U(t,e,Number.MAX_SAFE_INTEGER,{label:"Classic state transaction"})).bytes.toString("utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}}function Qg(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid Classic transaction Run");let e=t,n=it({run_id:e.runId,skill:e.skill,skill_version:e.skillVersion,skill_hash:e.skillHash,orchestration:e.orchestration,current_step:e.currentStep,iteration:e.iteration,pending:e.pending,pending_ref:e.pendingRef,trajectory_ref:e.trajectoryRef,context_ref:e.contextRef,artifacts_ref:e.artifactsRef,checkpoint_ref:e.checkpointRef,run_status:e.status,run_retries:e.retries});if(!n)throw new Error("Invalid Classic transaction Run identity");return n}async function Zg(t){let e=await Gl(t,Vl);if(e===null)return;let n=JSON.parse(e);if(!n||n.schema!=="comet.classic.state-transaction.v1"||n.beforeYaml!==null&&typeof n.beforeYaml!="string"||typeof n.afterYaml!="string")throw new Error("Invalid Classic state transaction");let r=await Gl(t,".comet.yaml");if(r!==n.beforeYaml&&r!==n.afterYaml)throw new Error("Classic state transaction conflicts with current YAML; preserve files for recovery");let i=Qg(r===n.afterYaml?n.afterRun:n.beforeRun);i?await wr(t,i):await Mo(t),await zt(st.join(t,Vl),{containedRoot:t})}function br(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 ew(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 tw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function nw(t){let e;try{e=(await U(st.dirname(t),st.basename(t),Number.MAX_SAFE_INTEGER,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new kr.Document({})}let n=(0,kr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return br(n),n}async function Bo(t,e={}){return Xg(t,()=>rw(t,e))}async function rw(t,e){let n=e.migrate!==!1,r=st.join(t,".comet.yaml"),i=await nw(r),o=br(i),s=tw(i);s&&(o=br(i));let a=await Do(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(yr(),Ul));a=c(o),a&&n&&(await wr(t,a),ew(i),s=!0)}return s&&n&&await Z(r,i.toString(),{containedRoot:t}),Yl(br(i),a)}var nu=on(Mt(),1);import te from"node:path";import{createHash as _r,randomUUID as vC}from"node:crypto";var iw=new Set(["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_GRAFT_FILE","GIT_SHALLOW_FILE","GIT_PREFIX","GIT_IMPLICIT_WORK_TREE","GIT_NO_REPLACE_OBJECTS","GIT_REPLACE_REF_BASE","GIT_CONFIG","GIT_CONFIG_PARAMETERS","GIT_CONFIG_COUNT"]);function ow(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>{let n=e.toUpperCase();return!iw.has(n)&&!/^GIT_CONFIG_(KEY|VALUE)_\d+$/u.test(n)}))}function Xl(t){return{...ow(t.environment),...t.authentication?{}:{GIT_CONFIG_GLOBAL:process.platform==="win32"?"NUL":"/dev/null",GIT_CONFIG_NOSYSTEM:"1"},GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",SSH_ASKPASS_REQUIRE:"never",GIT_NO_REPLACE_OBJECTS:"1",GH_PROMPT_DISABLED:"1"}}Re();Se();V();import Qt from"path";var sw=Number.MAX_SAFE_INTEGER;function Ql(t,e,n){let r=Qt.resolve(t),i=Qt.isAbsolute(e)?Qt.resolve(e):Qt.resolve(r,e),o=Qt.relative(r,i).replaceAll("\\","/");return{root:r,relative:Qe(o,n),target:i}}async function le(t,e,n){let r=Ql(t,e,n.label);return $(r.root,r.relative,n)}async function ue(t,e,n){return(await le(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function Me(t,e,n){return(await aw(t,e,n)).toString("utf8")}async function aw(t,e,n){let r=Ql(t,e,n.label);return(await U(r.root,r.relative,n.maxBytes??sw,{label:n.label,hooks:n.hooks})).bytes}function We(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Classic progress requires a JSON object");return t}function Ko(t,e){let n=Object.keys(t).filter(r=>!e.includes(r));if(n.length)throw new Error(`Unknown Classic progress field(s): ${n.join(", ")}; allowed fields: ${e.join(", ")}`)}function ee(t,e){if(typeof t!="string"||!t.trim()||t.length>4096||[...t].some(n=>n.charCodeAt(0)<32||n.charCodeAt(0)===127))throw new Error(`Invalid Classic progress ${e}`);return t}async function lw(t,e,n){let r=te.join(e,".comet",n);if(await ue(t,r,{label:"Classic progress",expected:"file"}))return JSON.parse(await Me(t,r,{label:"Classic progress"}))}function uw(t,e){let n=_r("sha256").update(e).digest("hex");return te.join(t,".comet","runtime","classic-delivery",`${n}.json`)}async function fw(t,e){let n=uw(t,e);if(!await ue(t,n,{label:"Classic delivery reauthorization",expected:"file"}))return null;let r=We(JSON.parse(await Me(t,n,{label:"Classic delivery reauthorization"})));if(Ko(r,["schemaVersion","changeIdentity","previousAuthorizationId","authorizationId","action","targetBranch","remote","authorizedRemoteUrl"]),r.schemaVersion!==1||r.changeIdentity!==e)throw new Error("Classic delivery reauthorization identity is invalid");let i=zo({action:r.action,targetBranch:r.targetBranch,...r.remote===void 0?{}:{remote:r.remote}},!0);if(i.commit!==void 0||i.prUrl!==void 0)throw new Error("Classic delivery reauthorization cannot change sealed commit or PR evidence");return{schemaVersion:1,changeIdentity:e,previousAuthorizationId:ee(r.previousAuthorizationId,"previousAuthorizationId"),authorizationId:ee(r.authorizationId,"authorizationId"),...i,...r.authorizedRemoteUrl===void 0?{}:{authorizedRemoteUrl:ee(r.authorizedRemoteUrl,"authorizedRemoteUrl")}}}function zo(t,e=!1){let n=We(t);if(Ko(n,["action","targetBranch","remote","commit","prUrl",...e?["schemaVersion","changeIdentity","authorizedRemoteUrl","authorizationId"]:[]]),!["local","push","pr"].includes(n.action))throw new Error(`Invalid Classic delivery action '${String(n.action)}'; actions: local|push|pr`);let r=ee(n.targetBranch,"targetBranch");if(r.startsWith("-")||/[~^:?*[\\\s]/u.test(r)||r.includes("..")||r.includes("@{"))throw new Error("Invalid Classic delivery targetBranch");let i={action:n.action,targetBranch:r};if(n.remote!==void 0){let o=ee(n.remote,"remote");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/u.test(o))throw new Error("Classic delivery remote must be a name, not a URL");i.remote=o}if(n.commit!==void 0){let o=ee(n.commit,"commit");if(!/^(?:[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$/u.test(o))throw new Error("Classic delivery commit must be a full object ID");i.commit=o.toLowerCase()}if(n.prUrl!==void 0){let o=ee(n.prUrl,"prUrl"),s=new URL(o);if(s.protocol!=="https:"||s.username||s.password)throw new Error("Invalid Classic delivery prUrl");i.prUrl=o}return i}function ru(t){let e=(0,nu.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length)throw new Error("Invalid Classic delivery change state");return We(e.toJS())}function iu(t,e){if(typeof t.run_id=="string"&&t.run_id)return`run:${t.run_id}`;let n=t.archived===!0?te.basename(e).replace(/^\d{4}-\d{2}-\d{2}-/u,""):te.basename(e);if(typeof t.created_at!="string"||typeof t.base_ref!="string")throw new Error("Classic delivery requires stable change identity");return`legacy:${_r("sha256").update(JSON.stringify([n,t.created_at,t.base_ref])).digest("hex")}`}async function dw(t,e){return ru(await Me(t,te.join(e,".comet.yaml"),{label:"Classic delivery state"}))}var Sr=class extends Error{constructor(e,n){super(`Classic delivery git command timed out: ${[e,...n].join(" ")}`)}};function Uo(t,e,n,r){return rt(e,n,{cwd:t,timeoutMs:5e3,env:Xl({authentication:r})}).trim()}function tn(t,e,n,r=!1){try{return Uo(t,e,n,r)}catch{return null}}function mw(t,e,n,r=!1){try{return Uo(t,e,n,r)}catch(i){if(!(i instanceof nt)||!i.timedOut)return null;try{return Uo(t,e,n,r)}catch(o){if(o instanceof nt&&o.timedOut)throw new Sr(e,n);return null}}}function Zt(t,e){return tn(t,"git",["-C",t,...e])}function en(t,e){return mw(t,"git",["-C",t,...e])}function Zl(t,e,n=!1){return tn(t,"git",["-C",t,"remote","get-url",...n?["--push"]:[],e],!0)}function pw(t,e){let n=te.relative(t,e).replaceAll("\\","/");return[`:(literal)${n}`,...[".comet-state.lock",".comet-state-transaction.json"].map(r=>`:(exclude,literal)${n}/${r}`)]}function eu(t,e,n,r){let i=te.relative(t,e).replaceAll("\\","/"),o=pw(t,e),s=en(t,["show",`${n}:${i}/.comet.yaml`]);if(!s)return!1;try{let a=ru(s);return a.archived===!0&&iu(a,e)===r&&en(t,["merge-base","--is-ancestor",n,"HEAD"])!==null&&en(t,["diff","--quiet","--no-ext-diff","--no-textconv",n,"--",...o])!==null&&en(t,["ls-files","--others","--exclude-standard","--",...o])===""}catch(a){if(a instanceof Sr)throw a;return!1}}function hw(t,e){let n=`${_r("sha256").update(e).digest("hex")}.json`,r=en(t,["rev-parse","--path-format=absolute","--git-common-dir"]);return[{root:t,file:te.join(t,".comet","classic-deliveries",n)},...r?[{root:r,file:te.join(r,"comet","classic-deliveries",n)}]:[]]}async function gw(t,e){let n=null;for(let r of hw(t,e)){if(!await ue(r.root,r.file,{label:"Classic delivery receipt",expected:"file"}))continue;let i=We(JSON.parse(await Me(r.root,r.file,{label:"Classic delivery receipt"})));if(Ko(i,["schemaVersion","changeIdentity","authorizationId","invalidated","commit","prUrl"]),i.schemaVersion!==1||i.changeIdentity!==e)throw new Error("Invalid Classic delivery receipt schema or identity");if(i.invalidated!==void 0&&typeof i.invalidated!="boolean")throw new Error("Invalid Classic delivery receipt invalidation");let o=zo({action:"local",targetBranch:"main",...i.commit!==void 0?{commit:i.commit}:{},...i.prUrl!==void 0?{prUrl:i.prUrl}:{}}),s={schemaVersion:1,changeIdentity:e,authorizationId:ee(i.authorizationId,"authorizationId"),...i.invalidated===!0?{invalidated:!0}:{},...o.commit?{commit:o.commit}:{},...o.prUrl?{prUrl:o.prUrl}:{}};if(n&&JSON.stringify(n)!==JSON.stringify(s))throw new Error("Conflicting Classic delivery receipts");n=s}return n}function ww(t){return t.authorizationId===void 0?`legacy:${_r("sha256").update(JSON.stringify(t)).digest("hex")}`:ee(t.authorizationId,"authorizationId")}function tu(t,e,n){return e===n||Zt(t,["merge-base","--is-ancestor",e,n])!==null}function yw(t){let e=/^git@([^:/]+):([^/]+\/[^/]+)$/u.exec(t);try{let n=new URL(e?`ssh://git@${e[1]}/${e[2]}`:t);if(!["https:","ssh:"].includes(n.protocol)||n.password||n.search||n.hash||n.port||n.protocol==="https:"&&n.username)return null;let r=n.pathname.replace(/\.git\/?$/u,"").replace(/\/$/u,"").split("/").filter(Boolean);return r.length!==2||r.some(i=>!/^[a-zA-Z0-9_.-]+$/u.test(i))?null:`${n.hostname}/${r.join("/")}`.toLowerCase()}catch{return null}}function Cr(t,e){try{let n=new URL(t);if(n.protocol!=="https:"||n.username||n.password||n.port||n.search||n.hash)return null;let r=/^\/([^/]+)\/([^/]+)\/pull\/([1-9]\d*)\/?$/u.exec(n.pathname);return r&&`${n.hostname}/${r[1]}/${r[2]}`.toLowerCase()===e?`https://${n.hostname}/${r[1]}/${r[2]}/pull/${r[3]}`:null}catch{return null}}async function ou(t,e,n={}){let r=await lw(t,e,"delivery.json");if(r===void 0)return{delivery:null,verification:{status:"needsAuthorization"}};let i=We(r);if(i.schemaVersion!==1)throw new Error("Unsupported Classic delivery schemaVersion");let o=zo(i,!0),s=await dw(t,e),a=iu(s,e);if(i.changeIdentity!==a)throw new Error("Classic delivery change identity mismatch");let c=ww(i),l=await fw(t,a);if(l&&l.previousAuthorizationId!==c)throw new Error("Classic delivery reauthorization is stale for the sealed authorization");let u=l?{action:l.action,targetBranch:l.targetBranch,...l.remote===void 0?{}:{remote:l.remote}}:o,f=l?.authorizationId??c,d=await gw(t,a),p=d?.authorizationId===f?d:null;if(p?.invalidated)return{delivery:null,verification:{status:"needsAuthorization",invalidated:!0}};for(let D of["commit","prUrl"]){if(D==="commit"&&p?.[D]&&u[D]&&p[D]!==u[D])throw new Error("Classic delivery receipt conflicts with authorization evidence");p?.[D]&&(u[D]=p[D])}let g=i.authorizedRemoteUrl===void 0?void 0:ee(i.authorizedRemoteUrl,"authorizedRemoteUrl"),m=l?.authorizedRemoteUrl??g,h={...u,schemaVersion:1,changeIdentity:a,authorizationId:f,...m?{authorizedRemoteUrl:m}:{}},v=Zt(t,["symbolic-ref","--quiet","--short","HEAD"]),b=te.relative(t,e).replaceAll("\\","/"),k=null;!u.commit&&s.archived===!0&&(k=Zt(t,["log","-20","--format=%H","HEAD","--",`:(literal)${b}/.comet.yaml`])?.split(/\r?\n/u).find(fe=>/^[a-f0-9]{40,64}$/u.test(fe)&&eu(t,e,fe,a))??null);let C=u.commit??k,S=!!C&&Zt(t,["cat-file","-t",C])==="commit",_=s.archived===!0&&S&&eu(t,e,C,a),P=v===u.targetBranch&&(!s.bound_branch||l!==null||s.bound_branch===v)&&_,y=!1,N=!1,J=null,ne=n.verifyRemote&&u.action!=="local"?"unavailable":"notChecked",R="notChecked";if(n.verifyRemote&&P&&u.action!=="local"&&u.remote&&m&&Zl(t,u.remote)===m&&Zl(t,u.remote,!0)===m){let D=`refs/heads/${u.targetBranch}`,fe=tn(t,"git",["-C",t,"-c","protocol.allow=never","-c","protocol.https.allow=always","-c","protocol.ssh.allow=always","-c","protocol.file.allow=always","ls-remote","--refs",u.remote,D],!0),Go=fe?.split(/\r?\n/u)??[],Xo=Go.length===1?/^([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(Go[0]):null,ct=Xo?.[2]===D?Xo[1]:null;y=!!C&&!!ct&&tu(t,C,ct),ne=y?"verified":fe===""?"missing":fe===null||!ct||Zt(t,["cat-file","-t",ct])!=="commit"?"unavailable":"missing";let re=yw(m),Pr=re&&u.prUrl?Cr(u.prUrl,re):null,Rr=y||fe==="",Qo=K=>K.headRefName===u.targetBranch&&typeof K.headRefOid=="string"&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(K.headRefOid)&&(y?K.headRefOid===ct&&["OPEN","MERGED"].includes(K.state):fe===""&&K.state==="MERGED"&&!!C&&tu(t,C,K.headRefOid));if(Rr&&u.action==="pr"&&(R="unavailable"),Rr&&u.action==="pr"&&Pr&&re){let K=tn(t,"gh",["pr","view",Pr,"--repo",re,"--json","url,headRefName,headRefOid,state"],!0);try{let ie=K?We(JSON.parse(K)):null;N=!!ie&&typeof ie.url=="string"&&Cr(ie.url,re)===Pr&&Qo(ie),R=N?"verified":ie?"missing":"unavailable"}catch{N=!1,R="unavailable"}}else if(Rr&&u.action==="pr"&&!u.prUrl&&re){let K=tn(t,"gh",["pr","list","--repo",re,"--head",u.targetBranch,"--state","all","--json","url,headRefName,headRefOid,state","--limit","100"],!0);try{let ie=K===null?null:JSON.parse(K);if(!Array.isArray(ie)||ie.length>=100)throw new Error("Incomplete PR discovery");let Nr=ie.map(We).filter(Or=>typeof Or.url=="string"&&Cr(Or.url,re)&&Qo(Or));Nr.length===1?(J=Cr(Nr[0].url,re),N=!0,R="verified"):R=Nr.length===0?"missing":"unavailable"}catch{R="unavailable"}}}return{delivery:h,verification:{status:P&&(u.action==="local"||(u.action==="push"?y:N))?"complete":"needsVerification",currentBranch:v,commitExists:S,archiveCommitted:_,observedCommit:k,observedPrUrl:J,remoteVerified:y,prVerified:N,remoteStatus:ne,prStatus:R}}}import su from"path";function Er(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}'
144
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function vw(t){let e=Er(t);if(e)throw new Error(e)}function bw(t,e){return{label:tt(t,e),directory:e}}async function kw(t,e,n){let r=bw(t,e);if(!(await le(t,e,{label:n,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await le(t,su.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}async function au(t,e=process.cwd()){vw(t);let n=await Yt(e),r=await kw(n.projectRoot,su.join(n.changesDir,t),`Classic active change ${t}`);return{...r.change,exists:r.exists,stateExists:r.stateExists}}var at="comet.resume_probe.v1";function cu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function _w(t){if(!cu(t))throw new Error("Invalid CometResumeProbeInput: input must be an object");if(t.schema_version!==at)throw new Error(`Invalid CometResumeProbeInput: schema_version must be ${at}`);if(typeof t.utterance!="string")throw new Error("Invalid CometResumeProbeInput: utterance must be a string");let e=cu(t.agent_context)?t.agent_context:{};return{schema_version:at,utterance:t.utterance,locale:typeof t.locale=="string"?t.locale:"unknown",agent_context:{non_trivial_work:e.non_trivial_work===!0,already_in_comet_flow:e.already_in_comet_flow===!0}}}function W(t,e,n,r,i=[]){return{schema_version:at,action:t,changeName:e?.name??null,phase:e?.phase??null,nextCommand:t==="auto_resume"||t==="ask_user"?e?.nextCommand??null:null,confidence:n,reason:r,evidence:i}}async function Ew(t,e,n){return await ue(t,e,{label:n,expected:"file"})?Me(t,e,{label:n}):""}async function Yo(t,e,n){let r=["proposal.md","design.md","tasks.md"],i=[n.name,n.workflow,n.phase];for(let o of r)i.push(await Ew(t,`${e}/${o}`,`Classic change ${n.name} ${o}`));return i.join(`
145
- `).toLowerCase()}function xw(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}function uu(t,e,n){let r=n.classic,i=n.unknownKeys.filter(o=>o!=="run_id");return r?i.length>0?{name:e,valid:!1,workflow:r.workflow,phase:r.phase,currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:`unknown field(s): ${i.join(", ")}`}:{name:e,valid:!0,workflow:r.workflow,phase:r.phase,currentStep:null,nextCommand:xw(r.phase),runtimeMode:"engine-projection",runtimeEval:null,evidence:[]}:{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:`${t} does not contain valid Comet state`}}async function Pw(t,e){return await ue(t,`${e}/proposal.md`,{label:"Classic proposal",expected:"file"})||await ue(t,`${e}/design.md`,{label:"Classic design",expected:"file"})||await ue(t,`${e}/tasks.md`,{label:"Classic tasks",expected:"file"})}async function Rw(t){let e=(await Yt(t)).changesDir;if(!(await le(t,e,{label:"Classic changes directory",expected:"directory"})).exists)return[];let r=await Tr(e),i=[];for(let o of r){if(o==="archive"||Er(o))continue;let s=await au(o,t);if(!s.exists)continue;let a=s.directory;if(!s.stateExists){if(!await Pw(t,a))continue;let h={name:o,workflow:"unknown",phase:"invalid",nextCommand:null,diagnostic:{name:o,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:"missing Comet state"},buildPause:null,hasClassicProjection:!1,verifyResult:null,archived:!1,text:"",missingCometState:!0};h.text=await Yo(t,a,h),i.push(h);continue}let l=await Bo(a,{migrate:!1}),u=l.classic,f=uu(a,o,l),d=!!u,p=u?.phase??f.phase,g=u?.workflow??f.workflow;if(p==="archive"||u?.archived)continue;let m={name:o,workflow:g,phase:p,nextCommand:f.nextCommand,diagnostic:f,buildPause:u?.buildPause??null,hasClassicProjection:d,verifyResult:u?.verifyResult??null,archived:u?.archived??!1,text:"",missingCometState:!1};m.text=await Yo(t,a,m),i.push(m)}return i}function Nw(t){let e=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(t)?.[1]??t;return Er(e)===null?e:null}async function Ow(t){let e=await Yt(t);if(!(await le(t,e.archiveDir,{label:"Classic archive directory",expected:"directory"})).exists)return[];let r=[];for(let i of await Tr(e.archiveDir)){let o=Nw(i);if(!o)continue;let s=Cw.join(e.archiveDir,i),a=await le(t,s,{label:`Classic archived change ${i}`,expected:"directory"});if(!a.exists)continue;let c=await Bo(a.target,{migrate:!1}),l=c.classic;if(!l?.archived||l.phase!=="archive")continue;let u=await ou(t,a.target);if(["complete","local-verified"].includes(u.verification.status))continue;let f=uu(a.target,o,c),d={name:o,workflow:l.workflow,phase:"archive",nextCommand:"/comet-archive",diagnostic:f,buildPause:null,hasClassicProjection:!0,verifyResult:l.verifyResult,archived:!0,text:"",missingCometState:!1};d.text=await Yo(t,a.target,d),r.push(d)}return r}var Aw=["continue","resume","carry on","finish","run it","commit","verify","archive","继续","接着","恢复","跑完","提交","验证","归档","修刚才"],Iw=["what","why","how","explain","summarize","reliable","靠谱吗","是什么","为什么","解释","总结","取名","命名"],Tw=new Set(["add","build","cache","change","code","design","docs","file","fix","implement","plan","readme","task","test","update","修改","更新","修复","添加","文档","任务","计划","实现"]),jw=["do not resume","don't resume","without comet","skip comet","不要恢复","不走 comet","不要走 comet","直接解释","只回答"];function Jo(t,e){return e.some(n=>t.includes(n))}function lu(t){return t.missingCometState||!t.hasClassicProjection||!t.diagnostic.valid||t.phase==="archive"||t.verifyResult==="fail"||t.diagnostic.runtimeEval&&!t.diagnostic.runtimeEval.passed?!0:t.phase!=="build"?!1:t.buildPause==="plan-ready"}function Lw(t,e){let n=t.toLowerCase(),r=[];n.includes(e.name.toLowerCase())&&r.push({source:"user",quote:e.name});let i=e.text.split(/[^a-zA-Z0-9_\-\u4e00-\u9fff/]+/u).map(s=>s.trim().toLowerCase()).filter(s=>s.length>=4&&!Tw.has(s)),o=[...new Set(i.filter(s=>n.includes(s)))].slice(0,3);for(let s of o)r.push({source:"repo",quote:s});return r}async function qw(t){return new Promise(e=>{Sw("git",["status","--short","--untracked-files=all"],{cwd:t,timeout:3e3,maxBuffer:2*1024*1024,windowsHide:!0},(n,r)=>{if(n||typeof r!="string"){e([]);return}e(r.split(/\r?\n/u).map(i=>i.trim()).filter(Boolean))})})}async function fu(t,e){let n=_w(e),r=n.utterance.trim(),i=r.toLowerCase();if(n.agent_context.already_in_comet_flow)return W("out_of_scope",null,"low","already in Comet flow");if(Jo(i,jw))return W("out_of_scope",null,"low","user opted out of Comet resume",[{source:"user",quote:r}]);let o=await Rw(t),s=new Set(o.map(({name:g})=>g)),a=(await Ow(t)).filter(({name:g})=>!s.has(g)),c=[...o,...a];if(c.length===0)return W("none",null,"none","no active Comet changes");let l=await qw(t);if(c.length>1){let g=c.find(m=>i.includes(m.name.toLowerCase()));return g?l.length>0?W("ask_user",g,"low","uncommitted worktree changes require attribution",[{source:"repo",quote:`${l.length} dirty file(s)`}]):lu(g)?W("ask_user",g,"low","active change is at a decision point"):W("auto_resume",g,"high","request names an active change",[{source:"user",quote:g.name}]):W("ask_user",null,"low","multiple active changes require a change name")}let[u]=c;if(l.length>0)return W("ask_user",u,"low","uncommitted worktree changes require attribution",[{source:"repo",quote:`${l.length} dirty file(s)`}]);if(lu(u))return u.archived?W("ask_user",u,"low","archived change has pending delivery",[{source:"state",quote:"archived: true"},{source:"state",quote:"delivery is not complete"}]):u.missingCometState?W("ask_user",u,"low","active OpenSpec change is missing Comet state"):W("ask_user",u,"low","active change is at a decision point",[{source:"state",quote:`phase: ${u.phase}`}]);let f=Jo(i,Aw);if(!n.agent_context.non_trivial_work&&Jo(i,Iw)&&!f)return W("out_of_scope",u,"low","user asked a question without workflow work");let p=Lw(r,u);return f||p.length>0?W("auto_resume",u,"high","single active change and request is related",[{source:"state",quote:`phase: ${u.phase}`},...p]):n.agent_context.non_trivial_work?W("ask_user",u,"low","single active change exists but request looks unrelated"):W("out_of_scope",u,"low","request is not workflow work")}import{AsyncLocalStorage as $w}from"async_hooks";import{promises as du}from"fs";import nn from"path";var Ho=new $w;function Dw(t,e){let n=nn.relative(t,e);return n===""||!nn.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${nn.sep}`)}async function Mw(t){let e=nn.resolve(t.invocationCwd??process.cwd()),n=nn.resolve(t.projectRoot??await ml(e)),[r,i]=await Promise.all([du.realpath(e),du.realpath(n)]);if(!Dw(i,r))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n,observations:new Map}}async function Ww(t,e){let n=Ho.getStore();if(n)return e(n);let r=await Mw(t);return Ho.run(r,()=>e(r))}function mu(){let t=Ho.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function pu(t){return(e,n)=>Ww(n,()=>t(e,n))}function xr(t,e,n){return{exitCode:t,...e===void 0?{}:{stdout:e},...n===void 0?{}:{stderr:n}}}function hu(){return xr(64,void 0,`Usage: comet-resume-probe.mjs probe <input-json>
146
- Usage: comet-resume-probe.mjs probe --stdin`)}async function Fw(){let t=[];for await(let e of process.stdin)t.push(Buffer.isBuffer(e)?e:Buffer.from(String(e)));return Zo(Buffer.concat(t).toString("utf8"))}function Bw(t){return{schema_version:at,utterance:t,locale:"unknown",agent_context:{non_trivial_work:!0,already_in_comet_flow:!1}}}function Uw(t){try{return JSON.parse(t)}catch{return Bw(t)}}var gu=pu(async t=>{let[e,n]=t;if(e!=="probe")return hu();let r=n==="--stdin",i=r?await Fw():n;if(!i)return hu();try{let o=r?Uw(i):JSON.parse(i),s=await fu(mu(),o);return xr(0,`${JSON.stringify(s,null,2)}
147
- `)}catch(o){return o instanceof SyntaxError?xr(1,void 0,`Invalid JSON: ${o.message}`):xr(1,void 0,o instanceof Error?o.message:String(o))}});var wu=["open-complete","design-complete","build-complete","verify-pass","verify-fail","archive-confirm","archive-reopen","archived","preset-escalate"];var Kw=new Set([...Xt,"archive_confirmation","verify_failures","check_epoch","classic_profile","classic_migration","bound_branch"]),yu=new Set(De.filter(t=>!Kw.has(t))),Vo={workflow:["full","hotfix","tweak"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct","autonomous"],build_pause:["null","plan-ready"],subagent_dispatch:["null","confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]};var zw=`
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=lr(e),r=nt(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=lr(e),r=nt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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())}}};Zc.Parser=Co});var il=w(Bt=>{"use strict";var el=co(),uh=Tt(),Ft=qt(),fh=si(),dh=_(),mh=ko(),tl=So();function nl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new mh.LineCounter||null,prettyErrors:e}}function ph(t,e={}){let{lineCounter:n,prettyErrors:r}=nl(e),i=new tl.Parser(n?.addNewLine),o=new el.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach(Ft.prettifyError(t,n)),a.warnings.forEach(Ft.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function rl(t,e={}){let{lineCounter:n,prettyErrors:r}=nl(e),i=new tl.Parser(n?.addNewLine),o=new el.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ft.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(Ft.prettifyError(t,n)),s.warnings.forEach(Ft.prettifyError(t,n))),s}function hh(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=rl(t,n);if(!i)return null;if(i.warnings.forEach(o=>fh.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function gh(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return dh.isDocument(t)&&!r?t.toString(n):new uh.Document(t,r,n).toString(n)}Bt.parse=hh;Bt.parseAllDocuments=ph;Bt.parseDocument=rl;Bt.stringify=gh});var Ut=w(x=>{"use strict";var wh=co(),yh=Tt(),vh=Bi(),Eo=qt(),bh=wt(),Se=_(),kh=ye(),Ch=A(),Sh=be(),Eh=ke(),_h=ar(),xh=vo(),Ph=ko(),Rh=So(),fr=il(),ol=mt();x.Composer=wh.Composer;x.Document=yh.Document;x.Schema=vh.Schema;x.YAMLError=Eo.YAMLError;x.YAMLParseError=Eo.YAMLParseError;x.YAMLWarning=Eo.YAMLWarning;x.Alias=bh.Alias;x.isAlias=Se.isAlias;x.isCollection=Se.isCollection;x.isDocument=Se.isDocument;x.isMap=Se.isMap;x.isNode=Se.isNode;x.isPair=Se.isPair;x.isScalar=Se.isScalar;x.isSeq=Se.isSeq;x.Pair=kh.Pair;x.Scalar=Ch.Scalar;x.YAMLMap=Sh.YAMLMap;x.YAMLSeq=Eh.YAMLSeq;x.CST=_h;x.Lexer=xh.Lexer;x.LineCounter=Ph.LineCounter;x.Parser=Rh.Parser;x.parse=fr.parse;x.parseAllDocuments=fr.parseAllDocuments;x.parseDocument=fr.parseDocument;x.stringify=fr.stringify;x.visit=ol.visit;x.visitAsync=ol.visitAsync});import Ee from"path";function Lh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Ee.posix.isAbsolute(n)||Ee.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let r=n.replaceAll("\\","/").split("/");if(r.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function dr(t){let e=Lh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function dl(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 rt(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||Ee.posix.isAbsolute(r)||Ee.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function le(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function ml(t,e,n){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return r}function pl(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>xo)throw new Error(`${e} exceeds ${xo} characters`);let n=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?n+=1:t[r]==="*"&&(n+=1,t[r+1]==="*"&&(r+=1));if(n>Po)throw new Error(`${e} contains more than ${Po} wildcard tokens`);return t}function ul(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(r=>pl(r,e)))].sort((r,i)=>r.localeCompare(i,"en"))}function Kt(t,e,n){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${n} must be a positive integer`);return r}function fl(t,e,n){let r=Kt(t,e,n);if(r>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${n} is too large to convert to bytes safely`);return r}function qh(t){if(t===void 0)return{...ee,include:[...ee.include],exclude:[...ee.exclude]};let e=le(t,"native.snapshot");return{include:ul(e.include,"native.snapshot.include",ee.include),exclude:ul(e.exclude,"native.snapshot.exclude",ee.exclude),max_files:Kt(e.max_files,ee.max_files,"native.snapshot.max_files"),max_total_bytes:Kt(e.max_total_bytes,ee.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Kt(e.max_duration_ms,ee.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:Kt(e.max_selection_records,ee.max_selection_records,"native.snapshot.max_selection_records")}}function $h(t){if(t===void 0)return;let e=le(t,"native.pending_root_move"),n=e.id,r=e.from_artifact_root,i=e.to_artifact_root,o=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 r!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=le(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:n,fromArtifactRoot:dr(r),toArtifactRoot:dr(i),stage:o,...s?{cleanup:s}:{}}}function Mh(t){if(t===void 0)return;let e=le(t,"native.finish");if(e.pull_request===void 0)return{};let n=le(e.pull_request,"native.finish.pull_request");if(n.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(n.command)||n.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(n.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let r=n.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(Ee.posix.isAbsolute(r[0])||Ee.win32.isAbsolute(r[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=n.timeout_ms??Ah;if(!Number.isSafeInteger(i)||i<1||i>ll)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${ll}`);return{pull_request:{provider:"repository-command",command:r,timeout_ms:i}}}function Dh(t,e={}){let n=le(t,"native"),r=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let i=n.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=n.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=n.max_verify_failures??Nh;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=n.document_writes??"allow";if(a!=="allow"&&a!=="revert")throw new Error("native.document_writes must be allow or revert");let c=$h(n.pending_root_move),l=Mh(n.finish);return{artifact_root:dr(r),language:ml(n.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,...a==="revert"?{document_writes:a}:{},snapshot:qh(n.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function Wh(t){let e=le(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");let o=e.document_evidence??"neutral";if(o!=="neutral"&&o!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:dl(e.artifact_layout),language:ml(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:r,auto_transition:i,...o==="strict"?{document_evidence:o}:{}}}function Fh(t){let n=le(t,"hook").allow_paths??[];if(!Array.isArray(n))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(n.map((r,i)=>rt(r,`hook.allow_paths[${i}]`)))]}}function Bh(t){if(t===void 0)return{..._o};let e=le(t,"memory"),n=e.learning??_o.learning,r=e.retrieval??_o.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof r!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:r}}function No(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Uh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||n.includes("\\")||n.includes("\0")||Ee.posix.isAbsolute(n)||Ee.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!n.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(n.length>sl)throw new Error(`${e} exceeds ${sl} characters`);let r=0;for(let i=0;i<n.length;i+=1)n[i]==="?"?r+=1:n[i]==="*"&&(r+=1,n[i+1]==="*"&&(i+=1));if(r>al)throw new Error(`${e} contains more than ${al} wildcard tokens`);return n}function Kh(t){let e=No(t,"knowledge.local"),n=e.include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");let r={include:[...new Set(n.map((i,o)=>Uh(i,`knowledge.local.include[${o}]`)))],max_file_mb:fl(e.max_file_mb,cl.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:fl(e.max_total_mb,cl.max_total_mb,"knowledge.local.max_total_mb")};if(r.max_file_mb>r.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return r}function zh(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let n=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),r=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&r))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function Jh(t){let e=No(t,"knowledge.remote"),n=zh(e.endpoint),r=e.token_env;if(r!==void 0&&(typeof r!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:n,...r===void 0?{}:{token_env:r},...i===void 0?{}:{scope:i},timeout_ms:o}}function Yh(t){if(t===void 0)return{...Oh};let e=No(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let r=e.local===void 0?void 0:Kh(e.local);if(n==="local")return{provider:n,...r?{local:r}:{}};let i=e.remote===void 0?void 0:Jh(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...r?{local:r}:{},remote:i}}function Hh(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Gh(t,e,n,r,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let f=[...new Set(u)];if(!f.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(f.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:f,ambient_resume:s,...e?{hook:e}:{},memory:n,knowledge:r,...i?{native:i}:{},...o?{classic:o}:{}}}function it(t,e={}){let n=(0,Ro.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let r=n.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=r,o=Hh(i.ambient_resume),s=i.hook===void 0?void 0:Fh(i.hook),a=Bh(i.memory),c=Yh(i.knowledge),l=i.native===void 0?void 0:Dh(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:Wh(i.classic),f=Gh(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:f,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}var Ro,zt,xo,Po,sl,al,Nh,_o,cl,Oh,Ah,ll,Ih,Th,jh,ee,_e=O(()=>{"use strict";Ro=fn(Ut(),1),zt=Number.MAX_SAFE_INTEGER,xo=1024,Po=64,sl=1024,al=64,Nh=5,_o={learning:!0,retrieval:!0},cl={include:[],max_file_mb:1,max_total_mb:32},Oh={provider:"local"},Ah=12e4,ll=6e5,Ih=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Th=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],jh=[...Ih,...Th].sort((t,e)=>t.localeCompare(e,"en")),ee={include:["**/*"],exclude:[...jh],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4}});function xe(t){return t!==0&&t!==0n&&t!=="0"}function hl(t,e){return xe(t.dev)&&xe(e.dev)&&xe(t.ino)&&xe(e.ino)}function Pe(t,e){let n=xe(t.dev)&&xe(e.dev);if(n&&t.dev!==e.dev)return!1;let r=xe(t.ino)&&xe(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var mr=O(()=>{"use strict"});import{constants as pr,promises as De}from"fs";function Oo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function gl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Jt(t){return{dev:t.dev,ino:t.ino,birthtime:Oo(t)}}function hr(t,e){let n=Jt(t),r=Jt(e);return hl(n,r)?Pe(n,r):Pe(n,r)&&Oo(t)===Oo(e)&&gl(t)===gl(e)&&t.size===e.size}async function Ao(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await De.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new Re("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Re("too-large",`${r} exceeds ${e} bytes`);let s=await De.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:Jt(o)});let a=process.platform==="win32"?pr.O_RDONLY:pr.O_RDONLY|pr.O_NOFOLLOW|pr.O_NONBLOCK,c;try{c=await De.open(t,a)}catch(l){throw l.code==="ELOOP"?new Re("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:i}),De.lstat(t,{bigint:i}),De.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!hr(o,l)||!hr(o,u))throw new Re("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:f,identity:Jt(l)}),await n.hooks?.afterOpen?.();let d=[],p=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:k}=await c.read(g,0,Math.min(g.length,b),null);if(k===0)break;if(p+=k,p>e)throw new Re("too-large",`${r} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,k)))}await n.hooks?.beforeFinalCheck?.();let[m,h,y]=await Promise.all([c.stat({bigint:i}),De.lstat(t,{bigint:i}),De.realpath(t)]);if(!h.isFile()||h.isSymbolicLink()||y!==s||!hr(o,m)||!hr(o,h))throw new Re("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:y,identity:Jt(m)}),{bytes:Buffer.concat(d,p),stat:m,realPath:y}}finally{await c.close()}}var Re,Io=O(()=>{"use strict";mr();Re=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}}});import{promises as gr}from"fs";import Ne from"path";function Vh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function To(t,e){let n=Ne.relative(t,e);return n===""||!Ne.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Ne.sep}`)}async function wl(t,e){let n=Ne.resolve(t),r=await gr.lstat(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return gr.realpath(n)}async function yl(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=Ne.join(i,n[o]);let s;try{s=await gr.lstat(i)}catch(u){if(Vh(u))return{exists:!1,kind:"missing"};throw u}let a=Ne.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${r.label} ancestor ${a} must be a real directory`);if(c&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await gr.realpath(i);if(!To(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function q(t,e,n){let r=rt(e,n.label),i=Ne.resolve(t),o=await wl(i,n.label),s=r.split("/"),a=Ne.resolve(i,...s);if(!To(i,a))throw new Error(`${n.label} must stay inside the project root`);let c=await yl(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:c.exists,kind:c.kind}}async function U(t,e,n,r){let i=await q(t,e,{label:r.label,expected:"file"});if(!i.exists){let s=new Error(`${r.label} does not exist`);throw s.code="ENOENT",s}let o=await wl(i.projectRoot,r.label);return Ao(i.target,n,{...r,verify:async(s,a)=>{if(!To(o,a.realPath))throw new Error(`${r.label} resolves outside the project root`);await yl(i.projectRoot,o,i.relative.split("/"),{label:r.label,expected:"file"})}})}var X=O(()=>{"use strict";Io();_e()});import{createHash as Xh}from"crypto";function Qh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ht(t,e={}){return(await wr(t,e)).document}async function Zh(t){try{return(await U(t,Yt,zt,{label:Yt})).bytes}catch(e){if(Qh(e))return null;throw e}}function eg(t){return t?{exists:!0,sha256:Xh("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function wr(t,e={}){let n=await Zh(t);return{document:n?it(n.toString("utf8"),e):null,identity:eg(n)}}async function jo(t){return(await Ht(t))?.config??null}var Yt,ot=O(()=>{"use strict";_e();X();Yt=".comet/config.yaml"});import{promises as qo}from"node:fs";async function $o(t,e){let n;for(let r=0;r<=Lo.length;r+=1)try{return await t()}catch(i){n=i;let o=i.code;if(r===Lo.length||!tg.has(o??""))throw i;await new Promise(s=>setTimeout(s,Lo[r]))}throw n}async function vl(t,e){await $o(()=>qo.rename(t,e),`rename ${e}`)}async function yr(t){await $o(()=>qo.unlink(t),`unlink ${t}`)}async function bl(t,e){await $o(()=>qo.link(t,e),`link ${e}`)}var tg,Lo,Mo=O(()=>{"use strict";tg=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),Lo=[50,100,200]});import{randomUUID as ng}from"crypto";import{constants as rg,promises as j}from"fs";import $ from"path";async function Do(t,e){try{return await bl(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await j.copyFile(t,e,rg.COPYFILE_EXCL),{linked:!1}}function We(t,e){let n=$.relative(t,e);return n===""||!$.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${$.sep}`)}function vr(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function ig(t,e){return Pe(t,vr(e))}function br(t,e){return Pe(vr(t),vr(e))}function kl(t,e){return br(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function kr(t){let e=await j.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 j.realpath(t),...vr(e)}}async function ue(t){for(let e of t){let n=await j.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!ig(e,n)||await j.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function og(t,e,n){let[r,i]=await Promise.all([j.lstat(t),j.realpath(t),ue(n)]);if(!r.isFile()||r.isSymbolicLink()||!br(r,e)||!We(n[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return r}async function sg(t,e){let n=$.resolve(t),r=$.resolve(e);if(!We(n,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await kr(n)],o=$.relative(n,r).split($.sep).filter(Boolean),s=n;for(let a of o){await ue(i),s=$.join(s,a);try{await j.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await kr(s);if(!We(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await ue(i),i}async function ag(t,e){let n=$.resolve(t),r=$.resolve(e);if(!We(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await kr(n)],o=$.relative(n,r).split($.sep).filter(Boolean),s=n;for(let a of o){s=$.join(s,a);try{let c=await kr(s);if(!We(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ue(i),i}async function Cl(t){let e;try{e=await j.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function cg(t,e,n){let r=$.dirname(t),i=await sg(n.containedRoot,r),o=$.join(r,`.${$.basename(t)}.${ng()}.tmp`),s,a,c;try{await n.beforeTemporaryOpen?.(),s=await j.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([j.lstat(o),j.realpath(o)]);if(await ue(i),!l.isFile()||l.isSymbolicLink()||!br(a,l)||!We(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!br(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await n.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await og(o,c,i),await n.beforeCommit?.(),await ue(i);let f=await j.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!c||!kl(f,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await Do(o,t),await j.unlink(o)):await vl(o,t),await Cl(r)}catch(l){await s?.close();try{await ue(i),await j.rm(o,{force:!0})}catch{}throw l}}async function te(t,e,n){await cg(t,e,n)}async function Gt(t,e){let n=$.dirname(t),r=await ag(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await j.lstat(t),o=await j.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!We(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ue(r);let[s,a]=await Promise.all([j.lstat(t),j.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!kl(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await yr(t),await ue(r),await Cl(n),!0}var Oe=O(()=>{"use strict";Mo();mr()});var kb,Wo=O(()=>{"use strict";Oe();ot();X();kb=16*1024});var Bo=O(()=>{"use strict";Oe();_e();ot();X();Wo()});var _r=O(()=>{"use strict"});var Yl=O(()=>{"use strict"});var Vo=O(()=>{"use strict";_r()});var Hl=O(()=>{"use strict";_r();Vo()});var Jg,Gl=O(()=>{"use strict";Jg=fn(Ut(),1);Oe();_e();X()});var Sk,Vl=O(()=>{"use strict";Oe();X();Sk=4*1024*1024});import{AsyncLocalStorage as Yg}from"node:async_hooks";function Gg(){let t=Hg.getStore();return t?.active?t:null}function Vg(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function Xl(t,e){return(...n)=>{let r=Gg();if(r===null)return e(...n);let i=Vg(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.get(i)?.value===s&&r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}var Hg,Ql=O(()=>{"use strict";Hg=new Yg});var Nk,Zl=O(()=>{"use strict";Ql();ot();Nk=Xl("hookWritePolicy",async t=>(await jo(t))?.hook??{allow_paths:[]})});var Xg,eu=O(()=>{"use strict";Io();Xg=16*1024});var tu=O(()=>{"use strict";_r();Oe();Yl();Hl();_e();Gl();X();ot();Bo();Vl();Zl();eu();Wo();Vo()});import{TextDecoder as Zg}from"util";function nu(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function ew(t,e){try{return new Zg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function Xo(t,e,n,r,i={}){try{let o=await U(t,e,n,{label:r,hooks:i.hooks});return{result:o,text:ew(o,r)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function ru(t,e,n,r,i={}){return(await Xo(t,e,n,r,i))?.text??null}async function iu(t,e,n,r,i,o={}){if(Buffer.byteLength(n,"utf8")>r)throw new Error(`${i} exceeds ${r} bytes`);let s=await Xo(t,e,r,i),a=await q(t,e,{label:i,expected:"file"});await te(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await Xo(t,e,r,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!Pe(nu(s.result.stat),nu(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function ou(t,e,n,r={}){let i=await q(t,e,{label:n,expected:"file"});return i.exists?Gt(i.target,{containedRoot:i.projectRoot,beforeRemove:r.beforeRemove}):!1}var su=O(()=>{"use strict";tu();mr()});var uu={};Hu(uu,{RUN_STATE_FILE:()=>ct,applyRunStateToDocument:()=>cu,readRunState:()=>xr,removeRunState:()=>Qo,runStateFromDocument:()=>at,writeRunState:()=>Pr});import tw from"path";function tn(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 en(t,e){let n=tn(t,e);if(tw.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 nw(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(n))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function at(t){if(!t.run_id)return null;let e=tn(t,"run_id"),n=tn(t,"skill"),r=tn(t,"skill_version"),i=tn(t,"skill_hash"),o=en(t,"pending_ref"),s=en(t,"trajectory_ref"),a=en(t,"context_ref"),c=en(t,"artifacts_ref"),l=en(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:r,skillHash:i,orchestration:t.orchestration,currentStep:au(t,"current_step"),iteration:u,pending:au(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:nw(t)}}function cu(t,e){e?t.run_id=e.runId:delete t.run_id}function rw(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 iw(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 at(e)}async function xr(t,e={}){let n=await ru(t,ct,lu,"Run state",e);if(n===null)return null;let r=JSON.parse(n);return iw(r)}async function Pr(t,e,n={}){await iu(t,ct,JSON.stringify(rw(e),null,2),lu,"Run state",n)}async function Qo(t,e={}){await ou(t,ct,"Run state",e)}var au,ct,lu,Rr=O(()=>{"use strict";su();au=(t,e)=>{let n=t[e];return n==null?null:String(n)};ct=".comet/run-state.json",lu=Number.MAX_SAFE_INTEGER});function ps(t){return t.charCodeAt(0)===65279?t.slice(1):t}import{AsyncLocalStorage as Vu}from"node:async_hooks";import{performance as dn}from"node:perf_hooks";var Xu=0,Qu=0,Zu=new Vu;function hs(t=0){Xu+=1,Qu+=t;let e=Zu.getStore();e&&(e.gitCommands+=1,e.gitDurationMs+=t)}function gs(t){let e=dn.now();try{return t()}finally{hs(dn.now()-e)}}async function mn(t){let e=dn.now();try{return await t()}finally{hs(dn.now()-e)}}import Vw from"node:path";import{promises as xl}from"fs";import I from"path";import{promises as ws}from"fs";async function Br(t){try{return await ws.access(t),!0}catch(e){if(ef(e))return!1;throw e}}async function Ur(t){try{return await ws.readdir(t)}catch(e){let n=e?.code;if(n==="ENOENT"||n==="ENOTDIR")return[];throw e}}function ef(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}_e();ot();Bo();X();var Vt=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},_l=".comet/config.yaml";function Pl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Rl(t){await q(t,_l,{label:_l,expected:"file"})}function Nl(t,e){let n=I.resolve(t),r=e==="docs"?I.join(n,"docs"):n,i=I.join(r,"openspec"),o=I.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:r,openSpecRoot:i,changesDir:I.join(i,"changes"),archiveDir:I.join(i,"changes","archive"),specsDir:I.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:I.join(o,"specs"),superpowersPlansDir:I.join(o,"plans"),superpowersReportsDir:I.join(o,"reports")}}async function mg(t){await Rl(t);let e=await Ht(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new Vt;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new Vt("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function pg(t,e){return Nl(t,e??await mg(t))}async function hg(t){try{return await xl.lstat(t),!0}catch(e){if(Pl(e))return!1;throw e}}async function gg(t,e){let n=await pg(t,e),r=n.artifactLayout==="legacy"?"docs":"legacy",i=Nl(t,r).openSpecRoot,[o,s]=await Promise.all([q(n.projectRoot,st(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),hg(i)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function wg(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let r=st(t.projectRoot,n);await q(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function Xt(t,e){let n=await gg(t,e);if(await wg(n.paths),!n.configuredRootExists){let r=st(n.paths.projectRoot,n.paths.openSpecRoot),i=st(n.paths.projectRoot,n.alternateRoot);throw new Vt(`Configured Classic OpenSpec root is missing: ${r} (alternate ${i} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function Ol(t){let e=I.resolve(t),n=null;try{(await xl.lstat(e)).isDirectory()||(e=I.dirname(e))}catch(r){if(!Pl(r))throw r}for(;;){I.basename(e)==="openspec"&&(n=I.dirname(e));let r=I.join(e,".comet","config.yaml"),i=!1;if(await Br(r))try{await Rl(e);let s=(await Ht(e))?.value;i=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(i||await Br(I.join(e,".git")))return e;let o=I.dirname(e);if(o===e)return n??I.resolve(t);e=o}}function st(t,e){return I.relative(I.resolve(t),e).replaceAll("\\","/")}import{execFile as Xw}from"child_process";import Ie from"path";import{promises as Sw}from"node:fs";import{AsyncLocalStorage as Ew}from"node:async_hooks";Mo();import{randomUUID as Tg}from"node:crypto";import{promises as Be}from"node:fs";import Kl from"node:os";import Ul from"node:path";import{promises as Wl}from"node:fs";import{execFile as Cg,execFileSync as Sg}from"node:child_process";import Zt from"node:path";import{existsSync as yg}from"node:fs";import Qt from"node:path";var vg=/[&|<>()^%"!\r\n]/u,Wb=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");function Al(t,e){let n=e.toLowerCase();return Object.entries(t).find(([r,i])=>r.toLowerCase()===n&&i!==void 0)?.[1]}function bg(t){let e=(Al(t,"PATHEXT")??".COM;.EXE;.BAT;.CMD").split(";").map(n=>n.trim().toLowerCase()).filter(Boolean);return[...new Set([...e,".ps1"])]}function kg(t,e,n){let i=Qt.win32.isAbsolute(t)||/[\\/]/u.test(t)?[""]:(Al(e,"PATH")??"").split(Qt.delimiter).map(a=>a.trim().replace(/^"(.*)"$/u,"$1")).filter(Boolean),s=Qt.win32.extname(t)?[t]:bg(e).map(a=>`${t}${a}`);return i.flatMap(a=>s.map(c=>a?Qt.join(a,c):Qt.resolve(n,c)))}function Uo(t,e,n){return kg(t,e,n).find(r=>yg(r))??t}function Ko(t){if(t.some(e=>vg.test(e)))throw new Error("Windows batch check arguments must not contain shell syntax")}var Il=6e4,Tl=8*1024*1024;async function Fe(t,e,n={}){let r=n.timeoutMs??Il,i=n.maxBufferBytes??Tl;if(!Number.isSafeInteger(r)||r<1||!Number.isSafeInteger(i)||i<1)throw new Error("External command limits must be positive integers");let o=Zt.resolve(n.cwd??process.cwd()),s=n.env??process.env,a=process.platform==="win32"?Uo(t,s,o):t,c=process.platform==="win32"&&/\.(?:bat|cmd)$/iu.test(a);c&&Ko(e);let l=()=>new Promise((u,f)=>{let d=!1,p=Cg(a,[...e],{cwd:o,env:s,encoding:"utf8",maxBuffer:i,windowsHide:!0,shell:c},(y,b,k)=>{d||(d=!0,clearTimeout(h),n.signal?.removeEventListener("abort",m),y?f(new Ae(t,e,k.trim(),{cause:y,timedOut:jl(y)})):u(b))}),g=y=>{d||(d=!0,clearTimeout(h),n.signal?.removeEventListener("abort",m),p.kill("SIGKILL"),p.stdin?.destroy(),p.stdout?.destroy(),p.stderr?.destroy(),p.unref(),f(new Ae(t,e,"",{timedOut:y})))},m=()=>g(!1),h=setTimeout(()=>g(!0),r);n.signal?.addEventListener("abort",m,{once:!0}),n.signal?.aborted&&m(),p.stdin?.end(n.input)});return/^(?:git|git\.exe)$/iu.test(Zt.win32.basename(t))?mn(l):l()}var Ae=class extends Error{constructor(n,r,i,o){super(`${n} ${r.join(" ")} failed${i?`: ${i}`:""}`,o);this.command=n;this.args=r;this.stderr=i;this.name="ExternalCommandError",this.timedOut=o?.timedOut===!0}command;args;stderr;timedOut};function jl(t){return t instanceof Error&&(t.code==="ETIMEDOUT"||t.killed===!0&&t.signal==="SIGTERM")}function Ll(t,e,n={}){let r=n.timeoutMs??Il,i=n.maxBufferBytes??Tl;if(!Number.isSafeInteger(r)||r<1)throw new Error("External command timeout must be a positive integer");if(!Number.isSafeInteger(i)||i<1)throw new Error("External command max buffer must be a positive integer");let o=Zt.resolve(n.cwd??process.cwd()),s=n.env??process.env,a=process.platform==="win32"?Uo(t,s,o):t,c=Zt.win32.extname(a).toLowerCase(),l=c===".bat"||c===".cmd";process.platform==="win32"&&l&&Ko(e);try{let u=()=>Sg(a,[...e],{cwd:o,env:s,...n.input!==void 0?{input:n.input}:{},encoding:"utf8",stdio:[n.input===void 0?"ignore":"pipe","pipe","pipe"],timeout:r,maxBuffer:i,windowsHide:!0,shell:process.platform==="win32"&&l});return/^(?:git|git\.exe)$/iu.test(Zt.win32.basename(t))?gs(u):u()}catch(u){let f=typeof u.stderr=="string"?u.stderr.trim():Buffer.isBuffer(u.stderr)?u.stderr.toString("utf8").trim():"";throw new Ae(t,e,f,{cause:u,timedOut:jl(u)})}}import{createHash as Jo,randomUUID as Eg}from"node:crypto";import{promises as J}from"node:fs";import _g from"node:os";import K from"node:path";var $l=`using System;
143
+ using System.Runtime.InteropServices;
144
+ class CometProcessIdentity {
145
+ [DllImport("kernel32.dll")] static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
146
+ [DllImport("kernel32.dll")] static extern bool GetProcessTimes(IntPtr process, out long creation, out long exit, out long kernel, out long user);
147
+ [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
148
+ static int Main(string[] args) {
149
+ int pid; if(args.Length != 1 || !int.TryParse(args[0], out pid) || pid <= 0) return 1;
150
+ IntPtr handle=OpenProcess(0x1000, false, pid); if(handle == IntPtr.Zero) return 1;
151
+ try { long creation, exit, kernel, user; if(!GetProcessTimes(handle,out creation,out exit,out kernel,out user)) return 1;
152
+ Console.WriteLine(DateTime.FromFileTimeUtc(creation).Ticks.ToString(System.Globalization.CultureInfo.InvariantCulture)); return 0;
153
+ } finally { CloseHandle(handle); }
154
+ }
155
+ }`,xg=Jo("sha256").update($l).digest("hex"),Pg=1e4,Cr=new Map;async function zo(t,e){let n=await J.lstat(t,{bigint:!0});if(!n.isFile()||n.isSymbolicLink()||n.size>BigInt(e))throw new Error("Invalid process probe cache");let r=await J.readFile(t),i=await J.lstat(t,{bigint:!0});if(n.ino!==i.ino||n.ctimeNs!==i.ctimeNs||n.size!==i.size)throw new Error("Process probe cache changed");return r}async function Ml(t){try{let e=JSON.parse((await zo(K.join(t,"probe.json"),4096)).toString("utf8"));if(!/^probe-[a-f0-9-]+\.exe$/u.test(e.file??""))return null;let n=K.join(t,e.file),r=await zo(n,65536);return Jo("sha256").update(r).digest("hex")===e.hash?n:null}catch{return null}}async function Rg(t,e){let n,r=Eg(),i=K.join(t,`probe-${r}.cs`),o=K.join(t,`probe-${r}.exe`),s=K.join(t,`probe-${r}.json`);try{if(await J.mkdir(t,{recursive:!0,mode:448}),(await J.lstat(t)).isSymbolicLink())return null;n=await J.open(K.join(t,"prepare.lock"),"wx",384);let a=await Ml(t);if(a)return a;await J.writeFile(i,$l,{flag:"wx",mode:384});let c;for(let u of["Framework64","Framework"]){let f=K.join(e,"Microsoft.NET",u,"v4.0.30319","csc.exe");try{await J.access(f),c=f;break}catch{}}if(!c)return null;await Fe(c,["/nologo","/target:exe","/platform:anycpu",`/out:${o}`,i],{timeoutMs:1500,maxBufferBytes:4096});let l=Jo("sha256").update(await zo(o,65536)).digest("hex");return await J.writeFile(s,JSON.stringify({file:K.basename(o),hash:l}),{flag:"wx",mode:384}),await J.rename(s,K.join(t,"probe.json")),o}catch{return null}finally{await J.unlink(i).catch(()=>{}),await J.unlink(s).catch(()=>{}),n&&(await n.close().catch(()=>{}),await J.unlink(K.join(t,"prepare.lock")).catch(()=>{}))}}async function ql(t,e,n){try{let r=await Fe(K.join(e,"System32","wbem","WMIC.exe"),["process","where",`processid=${t}`,"get","creationdate","/value"],{timeoutMs:300,maxBufferBytes:4096,signal:n}),i=/^CreationDate=(\S+)/mu.exec(r);if(i)return`win32-wmic:${i[1]}`}catch{}if(n.aborted)return null;try{let i=(await Fe(K.join(e,"System32","WindowsPowerShell","v1.0","powershell.exe"),["-NoLogo","-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${t} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks.ToString()`],{timeoutMs:1e3,maxBufferBytes:4096,signal:n})).trim();return/^\d+$/u.test(i)?`win32-ps:${i}`:null}catch{return null}}function Ng(t,e){let n=Cr.get(t);if(n&&performance.now()<n.retryAfter)return n.promise;let r={promise:Rg(t,e),retryAfter:1/0};return Cr.set(t,r),r.promise.then(i=>{Cr.get(t)===r&&(i?Cr.delete(t):r.retryAfter=performance.now()+Pg)}),r.promise}async function Dl(t,e={}){if(!Number.isSafeInteger(t)||t<=0)return null;let n=e.systemRoot??process.env.SystemRoot??"C:\\Windows",r=K.join(e.cacheRoot??K.join(_g.tmpdir(),"comet-process-identity"),xg),i=async l=>{if(!l)return null;try{let f=(await Fe(l,[String(t)],{timeoutMs:1e3,maxBufferBytes:4096})).trim();return/^\d+$/u.test(f)?`win32-ps:${f}`:null}catch{return null}},o=await Ml(r);if(o){let l=await i(o);return l||ql(t,n,new AbortController().signal)}let s=Ng(r,n),a=new AbortController,c=l=>{if(!l)throw new Error("Probe unavailable");return l};try{return await Promise.any([s.then(i).then(c),ql(t,n,a.signal).then(c)])}catch{return null}finally{a.abort()}}var Yo=null,Og=1e4,Ho=new Map,Sr=new Map;function Ag(t){let e=Ho.get(t);if(e){if(Date.now()-e.at>Og){Ho.delete(t);return}return e.value}}async function Go(t){if(t===process.pid&&Yo!==null)return Yo;let e=Ag(t);if(e!==void 0)return e;let n=Sr.get(t);n||(n=Ig(t),Sr.set(t,n));let r=await n;return Sr.get(t)===n&&Sr.delete(t),t===process.pid&&r!==null&&(Yo=r),r===null&&Ho.set(t,{value:null,at:Date.now()}),r}async function Ig(t){if(!Number.isSafeInteger(t)||t<=0)return null;try{if(process.platform==="linux"){let[e,n]=await Promise.all([Wl.readFile(`/proc/${t}/stat`,"utf8"),Wl.readFile("/proc/sys/kernel/random/boot_id","utf8")]),r=e.slice(e.lastIndexOf(")")+2).trim().split(/\s+/u)[19];return/^\d+$/u.test(r??"")?`linux:${n.trim()}:${r}`:null}if(process.platform==="win32")return await Dl(t);if(process.platform==="darwin"){let e=(await Fe("/bin/ps",["-p",String(t),"-o","lstart="],{timeoutMs:5e3,maxBufferBytes:4096,env:{...process.env,LC_ALL:"C",TZ:"UTC0"}})).trim();return e?`darwin:${e}`:null}}catch{}return null}var Fl=new Set(["win32-wmic","win32-ps"]);function Er(t){let e=t.indexOf(":");return e===-1?"":t.slice(0,e)}async function Bl(t,e){if(!Number.isSafeInteger(t)||t<=0)return"alive";try{process.kill(t,0)}catch(r){if(r.code==="ESRCH")return"dead"}if(!e)return"unknown";let n=await Go(t);return n===e?"alive":n===null||Er(n)!==Er(e)&&Fl.has(Er(n))&&Fl.has(Er(e))?"unknown":"dead"}var jg=3e4,Lg=20,qg=5*6e4,$g=1e4;async function zl(t,e,n={}){let r=Ul.resolve(t);await Be.mkdir(Ul.dirname(r),{recursive:!0});let i=Date.now(),o=n.timeoutMs??jg,s=n.retryMs??Lg,a=n.malformedLockStaleMs??qg,c=await Go(process.pid),l={pid:process.pid,nonce:Tg(),createdAt:Date.now(),hostname:Kl.hostname(),...c===null?{}:{processIdentity:c}},u=!1;for(;!u;){let f;try{f=await Be.open(r,"wx"),await f.writeFile(JSON.stringify(l),"utf8"),u=!0}catch(d){if(d.code!=="EEXIST")throw d;if(await Mg(r,a))continue;if(Date.now()-i>=o)throw new Error(`Timed out waiting for file lock: ${r}`,{cause:d});await new Promise(p=>setTimeout(p,s))}finally{await f?.close()}}try{return await e()}finally{await Dg(r,l.nonce)}}async function Mg(t,e){let n,r;try{[n,r]=await Promise.all([Be.readFile(t,"utf8"),Be.stat(t)])}catch(o){return o.code==="ENOENT"}let i=Jl(n);if(i!==null&&(i.hostname!==void 0&&i.hostname!==Kl.hostname()||await Bl(i.pid,i.processIdentity)!=="dead"))return!1;if(i===null){let o=n.trim().length===0?$g:e;if(Date.now()-Number(r.mtimeMs)<o)return!1}try{return await Be.readFile(t,"utf8")!==n?!1:(await Be.rm(t),!0)}catch(o){return o.code==="ENOENT"}}async function Dg(t,e){try{if(Jl(await Be.readFile(t,"utf8"))?.nonce!==e)return;await yr(t)}catch(n){let r=n.code;if(r==="ENOENT")return;process.stderr.write(`[comet] warning: could not remove lock file ${t} (${r??n}); it will be recovered automatically
156
+ `)}}function Jl(t){try{let e=JSON.parse(t);return Number.isSafeInteger(e.pid)&&Number(e.pid)>0&&typeof e.nonce=="string"&&e.nonce.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&(e.hostname===void 0||typeof e.hostname=="string"&&e.hostname.length>0)&&(e.processIdentity===void 0||typeof e.processIdentity=="string"&&e.processIdentity.length>0)?{pid:Number(e.pid),nonce:e.nonce,createdAt:e.createdAt,...e.hostname===void 0?{}:{hostname:e.hostname},...e.processIdentity===void 0?{}:{processIdentity:e.processIdentity}}:null}catch{return null}}X();var Ar=fn(Ut(),1);Oe();X();Rr();var fu=["full","hotfix","tweak"],du=1,ow=["open","design","build","verify","archive"],sw=["en","zh-CN"],aw=["off","beta"],cw=["subagent-driven-development","executing-plans","direct","autonomous"],lw=["plan-ready"],uw=["confirmed"],fw=["tdd","direct"],dw=["off","standard","thorough"],mw=["current","branch","worktree"],pw=["light","full"],hw=["pending","pass","fail"],gw=["pending","handled"],ww=["pending","confirmed"],Ue=["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","check_epoch","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],nn=["run_id"],yw=new Set([...Ue,...nn]),vw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Zo(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function lt(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 D(t,e,n,r=!0){let i=t[e];if(i==null||i===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!n.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${r?" or null":""}`);return i}function es(t,e,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function mu(t,e,n=0){let r=t[e];if(r==null||r==="")return n;if(typeof r!="number"||!Number.isSafeInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function Nr(t,e){let n=lt(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 bw(t,e){let n=lt(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 kw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==du)throw new Error(`Invalid Classic state: classic_migration must be ${du}`);return e}function Cw(t){if(!Ue.some(n=>Zo(t,n)))return null;for(let n of vw)if(!Zo(t,n))return null;return{workflow:D(t,"workflow",fu,!1),language:D(t,"language",sw),phase:D(t,"phase",ow,!1),contextCompression:D(t,"context_compression",aw),buildMode:D(t,"build_mode",cw),buildPause:D(t,"build_pause",lw),subagentDispatch:D(t,"subagent_dispatch",uw),tddMode:D(t,"tdd_mode",fw),reviewMode:D(t,"review_mode",dw),isolation:D(t,"isolation",mw),boundBranch:lt(t,"bound_branch"),verifyMode:D(t,"verify_mode",pw),autoTransition:es(t,"auto_transition"),baseRef:lt(t,"base_ref"),designDoc:Nr(t,"design_doc"),plan:Nr(t,"plan"),verifyResult:D(t,"verify_result",hw,!1),verifyFailures:mu(t,"verify_failures"),...Zo(t,"check_epoch")?{checkEpoch:mu(t,"check_epoch")}:{},verificationReport:Nr(t,"verification_report"),branchStatus:D(t,"branch_status",gw),createdAt:lt(t,"created_at"),verifiedAt:lt(t,"verified_at"),archiveConfirmation:D(t,"archive_confirmation",ww),archived:es(t,"archived",!1),directOverride:es(t,"direct_override"),handoffContext:Nr(t,"handoff_context"),handoffHash:bw(t,"handoff_hash"),classicProfile:D(t,"classic_profile",fu),classicMigration:kw(t)}}function ts(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=at(t)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:Cw(t),run:n,unknownKeys:Object.keys(t).filter(r=>!yw.has(r))}}Rr();var ns=new Ew,Or=".comet-state-transaction.json";async function _w(t,e){let n=Ie.resolve(t);return ns.getStore()===n?e():(await q(n,".comet-state.lock",{label:"Classic state lock",expected:"file"}),zl(Ie.join(n,".comet-state.lock"),()=>ns.run(n,async()=>(await Pw(n),e()))))}async function pu(t,e){try{return(await U(t,e,Number.MAX_SAFE_INTEGER,{label:"Classic state transaction"})).bytes.toString("utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}}function xw(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid Classic transaction Run");let e=t,n=at({run_id:e.runId,skill:e.skill,skill_version:e.skillVersion,skill_hash:e.skillHash,orchestration:e.orchestration,current_step:e.currentStep,iteration:e.iteration,pending:e.pending,pending_ref:e.pendingRef,trajectory_ref:e.trajectoryRef,context_ref:e.contextRef,artifacts_ref:e.artifactsRef,checkpoint_ref:e.checkpointRef,run_status:e.status,run_retries:e.retries});if(!n)throw new Error("Invalid Classic transaction Run identity");return n}async function Pw(t){let e=await pu(t,Or);if(e===null)return;let n=JSON.parse(e);if(!n||n.schema!=="comet.classic.state-transaction.v1"||n.beforeYaml!==null&&typeof n.beforeYaml!="string"||typeof n.afterYaml!="string")throw new Error("Invalid Classic state transaction");let r=await pu(t,".comet.yaml");if(r!==n.beforeYaml&&r!==n.afterYaml)throw new Error("Classic state transaction conflicts with current YAML; preserve files for recovery");let i=xw(r===n.afterYaml?n.afterRun:n.beforeRun);i?await Pr(t,i):await Qo(t),await Gt(Ie.join(t,Or),{containedRoot:t})}function rn(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 Rw(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 gu(t){let e;try{e=(await U(Ie.dirname(t),Ie.basename(t),Number.MAX_SAFE_INTEGER,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new Ar.Document({})}let n=(0,Ar.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return rn(n),n}async function rs(t,e={}){if(ns.getStore()!==Ie.resolve(t)){let n=await Ow(t);if(n!==null)return n}return _w(t,()=>Aw(t,e))}async function ut(t,e){let n=await q(t,e,{label:"Classic state snapshot",expected:"file"});if(!n.exists)return{stamp:"missing",comparable:!0};let r=await Sw.lstat(n.target,{bigint:!0});if(!r.isFile()||r.isSymbolicLink())throw new Error("Classic state file changed");return{stamp:[r.dev,r.ino,r.birthtimeNs,r.ctimeNs,r.mtimeNs,r.size].join(":"),comparable:r.dev!==0n&&r.ino!==0n&&r.ctimeNs>0n}}async function hu(t){if((await ut(t,".comet-state.lock")).stamp!=="missing"||(await ut(t,Or)).stamp!=="missing")return null;let r=await ut(t,".comet.yaml"),i=await ut(t,ct);return!r.comparable||!i.comparable?null:{yaml:r.stamp,run:i.stamp}}async function Ow(t){try{let e=await hu(t);if(e===null)return null;let n=await gu(Ie.join(t,".comet.yaml")),r=rn(n);if(n.has("build_command")||n.has("verify_command"))return null;let i=await xr(t);if(!i&&r.run_id&&r.skill)return null;let o=ts(r,i),s=await hu(t);return s===null||e.yaml!==s.yaml||e.run!==s.run||(await ut(t,Or)).stamp!=="missing"||(await ut(t,".comet-state.lock")).stamp!=="missing"?null:o}catch{return null}}async function Aw(t,e){let n=e.migrate!==!1,r=Ie.join(t,".comet.yaml"),i=await gu(r),o=rn(i),s=Nw(i);s&&(o=rn(i));let a=await xr(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Rr(),uu));a=c(o),a&&n&&(await Pr(t,a),Rw(i),s=!0)}return s&&n&&await te(r,i.toString(),{containedRoot:t}),ts(rn(i),a)}var Cu=fn(Ut(),1);import re from"node:path";import{createHash as jr,randomUUID as sS}from"node:crypto";var Iw=new Set(["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_GRAFT_FILE","GIT_SHALLOW_FILE","GIT_PREFIX","GIT_IMPLICIT_WORK_TREE","GIT_NO_REPLACE_OBJECTS","GIT_REPLACE_REF_BASE","GIT_CONFIG","GIT_CONFIG_PARAMETERS","GIT_CONFIG_COUNT"]);function Tw(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>{let n=e.toUpperCase();return!Iw.has(n)&&!/^GIT_CONFIG_(KEY|VALUE)_\d+$/u.test(n)}))}function wu(t){return{...Tw(t.environment),...t.authentication?{}:{GIT_CONFIG_GLOBAL:process.platform==="win32"?"NUL":"/dev/null",GIT_CONFIG_NOSYSTEM:"1"},GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",SSH_ASKPASS_REQUIRE:"never",GIT_NO_REPLACE_OBJECTS:"1",GH_PROMPT_DISABLED:"1"}}Oe();_e();X();import on from"path";var jw=Number.MAX_SAFE_INTEGER;function yu(t,e,n){let r=on.resolve(t),i=on.isAbsolute(e)?on.resolve(e):on.resolve(r,e),o=on.relative(r,i).replaceAll("\\","/");return{root:r,relative:rt(o,n),target:i}}async function fe(t,e,n){let r=yu(t,e,n.label);return q(r.root,r.relative,n)}async function de(t,e,n){return(await fe(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function Ke(t,e,n){return(await Lw(t,e,n)).toString("utf8")}async function Lw(t,e,n){let r=yu(t,e,n.label);return(await U(r.root,r.relative,n.maxBytes??jw,{label:n.label,hooks:n.hooks})).bytes}function ze(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Classic progress requires a JSON object");return t}function os(t,e){let n=Object.keys(t).filter(r=>!e.includes(r));if(n.length)throw new Error(`Unknown Classic progress field(s): ${n.join(", ")}; allowed fields: ${e.join(", ")}`)}function ne(t,e){if(typeof t!="string"||!t.trim()||t.length>4096||[...t].some(n=>n.charCodeAt(0)<32||n.charCodeAt(0)===127))throw new Error(`Invalid Classic progress ${e}`);return t}async function $w(t,e,n){let r=re.join(e,".comet",n);if(await de(t,r,{label:"Classic progress",expected:"file"}))return JSON.parse(await Ke(t,r,{label:"Classic progress"}))}function Mw(t,e){let n=jr("sha256").update(e).digest("hex");return re.join(t,".comet","runtime","classic-delivery",`${n}.json`)}async function Dw(t,e){let n=Mw(t,e);if(!await de(t,n,{label:"Classic delivery reauthorization",expected:"file"}))return null;let r=ze(JSON.parse(await Ke(t,n,{label:"Classic delivery reauthorization"})));if(os(r,["schemaVersion","changeIdentity","previousAuthorizationId","authorizationId","action","targetBranch","remote","authorizedRemoteUrl"]),r.schemaVersion!==1||r.changeIdentity!==e)throw new Error("Classic delivery reauthorization identity is invalid");let i=ss({action:r.action,targetBranch:r.targetBranch,...r.remote===void 0?{}:{remote:r.remote}},!0);if(i.commit!==void 0||i.prUrl!==void 0)throw new Error("Classic delivery reauthorization cannot change sealed commit or PR evidence");return{schemaVersion:1,changeIdentity:e,previousAuthorizationId:ne(r.previousAuthorizationId,"previousAuthorizationId"),authorizationId:ne(r.authorizationId,"authorizationId"),...i,...r.authorizedRemoteUrl===void 0?{}:{authorizedRemoteUrl:ne(r.authorizedRemoteUrl,"authorizedRemoteUrl")}}}function ss(t,e=!1){let n=ze(t);if(os(n,["action","targetBranch","remote","commit","prUrl",...e?["schemaVersion","changeIdentity","authorizedRemoteUrl","authorizationId"]:[]]),!["local","push","pr"].includes(n.action))throw new Error(`Invalid Classic delivery action '${String(n.action)}'; actions: local|push|pr`);let r=ne(n.targetBranch,"targetBranch");if(r.startsWith("-")||/[~^:?*[\\\s]/u.test(r)||r.includes("..")||r.includes("@{"))throw new Error("Invalid Classic delivery targetBranch");let i={action:n.action,targetBranch:r};if(n.remote!==void 0){let o=ne(n.remote,"remote");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/u.test(o))throw new Error("Classic delivery remote must be a name, not a URL");i.remote=o}if(n.commit!==void 0){let o=ne(n.commit,"commit");if(!/^(?:[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$/u.test(o))throw new Error("Classic delivery commit must be a full object ID");i.commit=o.toLowerCase()}if(n.prUrl!==void 0){let o=ne(n.prUrl,"prUrl"),s=new URL(o);if(s.protocol!=="https:"||s.username||s.password)throw new Error("Invalid Classic delivery prUrl");i.prUrl=o}return i}function Su(t){let e=(0,Cu.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length)throw new Error("Invalid Classic delivery change state");return ze(e.toJS())}function Eu(t,e){if(typeof t.run_id=="string"&&t.run_id)return`run:${t.run_id}`;let n=t.archived===!0?re.basename(e).replace(/^\d{4}-\d{2}-\d{2}-/u,""):re.basename(e);if(typeof t.created_at!="string"||typeof t.base_ref!="string")throw new Error("Classic delivery requires stable change identity");return`legacy:${jr("sha256").update(JSON.stringify([n,t.created_at,t.base_ref])).digest("hex")}`}async function Ww(t,e){return Su(await Ke(t,re.join(e,".comet.yaml"),{label:"Classic delivery state"}))}var Tr=class extends Error{constructor(e,n){super(`Classic delivery git command timed out: ${[e,...n].join(" ")}`)}};function is(t,e,n,r){return Ll(e,n,{cwd:t,timeoutMs:5e3,env:wu({authentication:r})}).trim()}function cn(t,e,n,r=!1){try{return is(t,e,n,r)}catch{return null}}function Fw(t,e,n,r=!1){try{return is(t,e,n,r)}catch(i){if(!(i instanceof Ae)||!i.timedOut)return null;try{return is(t,e,n,r)}catch(o){if(o instanceof Ae&&o.timedOut)throw new Tr(e,n);return null}}}function sn(t,e){return cn(t,"git",["-C",t,...e])}function an(t,e){return Fw(t,"git",["-C",t,...e])}function vu(t,e,n=!1){return cn(t,"git",["-C",t,"remote","get-url",...n?["--push"]:[],e],!0)}function Bw(t,e){let n=re.relative(t,e).replaceAll("\\","/");return[`:(literal)${n}`,...[".comet-state.lock",".comet-state-transaction.json"].map(r=>`:(exclude,literal)${n}/${r}`)]}function bu(t,e,n,r){let i=re.relative(t,e).replaceAll("\\","/"),o=Bw(t,e),s=an(t,["show",`${n}:${i}/.comet.yaml`]);if(!s)return!1;try{let a=Su(s);return a.archived===!0&&Eu(a,e)===r&&an(t,["merge-base","--is-ancestor",n,"HEAD"])!==null&&an(t,["diff","--quiet","--no-ext-diff","--no-textconv",n,"--",...o])!==null&&an(t,["ls-files","--others","--exclude-standard","--",...o])===""}catch(a){if(a instanceof Tr)throw a;return!1}}function Uw(t,e){let n=`${jr("sha256").update(e).digest("hex")}.json`,r=an(t,["rev-parse","--path-format=absolute","--git-common-dir"]);return[{root:t,file:re.join(t,".comet","classic-deliveries",n)},...r?[{root:r,file:re.join(r,"comet","classic-deliveries",n)}]:[]]}async function Kw(t,e){let n=null;for(let r of Uw(t,e)){if(!await de(r.root,r.file,{label:"Classic delivery receipt",expected:"file"}))continue;let i=ze(JSON.parse(await Ke(r.root,r.file,{label:"Classic delivery receipt"})));if(os(i,["schemaVersion","changeIdentity","authorizationId","invalidated","commit","prUrl"]),i.schemaVersion!==1||i.changeIdentity!==e)throw new Error("Invalid Classic delivery receipt schema or identity");if(i.invalidated!==void 0&&typeof i.invalidated!="boolean")throw new Error("Invalid Classic delivery receipt invalidation");let o=ss({action:"local",targetBranch:"main",...i.commit!==void 0?{commit:i.commit}:{},...i.prUrl!==void 0?{prUrl:i.prUrl}:{}}),s={schemaVersion:1,changeIdentity:e,authorizationId:ne(i.authorizationId,"authorizationId"),...i.invalidated===!0?{invalidated:!0}:{},...o.commit?{commit:o.commit}:{},...o.prUrl?{prUrl:o.prUrl}:{}};if(n&&JSON.stringify(n)!==JSON.stringify(s))throw new Error("Conflicting Classic delivery receipts");n=s}return n}function zw(t){return t.authorizationId===void 0?`legacy:${jr("sha256").update(JSON.stringify(t)).digest("hex")}`:ne(t.authorizationId,"authorizationId")}function ku(t,e,n){return e===n||sn(t,["merge-base","--is-ancestor",e,n])!==null}function Jw(t){let e=/^git@([^:/]+):([^/]+\/[^/]+)$/u.exec(t);try{let n=new URL(e?`ssh://git@${e[1]}/${e[2]}`:t);if(!["https:","ssh:"].includes(n.protocol)||n.password||n.search||n.hash||n.port||n.protocol==="https:"&&n.username)return null;let r=n.pathname.replace(/\.git\/?$/u,"").replace(/\/$/u,"").split("/").filter(Boolean);return r.length!==2||r.some(i=>!/^[a-zA-Z0-9_.-]+$/u.test(i))?null:`${n.hostname}/${r.join("/")}`.toLowerCase()}catch{return null}}function Ir(t,e){try{let n=new URL(t);if(n.protocol!=="https:"||n.username||n.password||n.port||n.search||n.hash)return null;let r=/^\/([^/]+)\/([^/]+)\/pull\/([1-9]\d*)\/?$/u.exec(n.pathname);return r&&`${n.hostname}/${r[1]}/${r[2]}`.toLowerCase()===e?`https://${n.hostname}/${r[1]}/${r[2]}/pull/${r[3]}`:null}catch{return null}}async function _u(t,e,n={}){let r=await $w(t,e,"delivery.json");if(r===void 0)return{delivery:null,verification:{status:"needsAuthorization"}};let i=ze(r);if(i.schemaVersion!==1)throw new Error("Unsupported Classic delivery schemaVersion");let o=ss(i,!0),s=await Ww(t,e),a=Eu(s,e);if(i.changeIdentity!==a)throw new Error("Classic delivery change identity mismatch");let c=zw(i),l=await Dw(t,a);if(l&&l.previousAuthorizationId!==c)throw new Error("Classic delivery reauthorization is stale for the sealed authorization");let u=l?{action:l.action,targetBranch:l.targetBranch,...l.remote===void 0?{}:{remote:l.remote}}:o,f=l?.authorizationId??c,d=await Kw(t,a),p=d?.authorizationId===f?d:null;if(p?.invalidated)return{delivery:null,verification:{status:"needsAuthorization",invalidated:!0}};for(let M of["commit","prUrl"]){if(M==="commit"&&p?.[M]&&u[M]&&p[M]!==u[M])throw new Error("Classic delivery receipt conflicts with authorization evidence");p?.[M]&&(u[M]=p[M])}let g=i.authorizedRemoteUrl===void 0?void 0:ne(i.authorizedRemoteUrl,"authorizedRemoteUrl"),m=l?.authorizedRemoteUrl??g,h={...u,schemaVersion:1,changeIdentity:a,authorizationId:f,...m?{authorizedRemoteUrl:m}:{}},y=sn(t,["symbolic-ref","--quiet","--short","HEAD"]),b=re.relative(t,e).replaceAll("\\","/"),k=null;!u.commit&&s.archived===!0&&(k=sn(t,["log","-20","--format=%H","HEAD","--",`:(literal)${b}/.comet.yaml`])?.split(/\r?\n/u).find(me=>/^[a-f0-9]{40,64}$/u.test(me)&&bu(t,e,me,a))??null);let C=u.commit??k,S=!!C&&sn(t,["cat-file","-t",C])==="commit",E=s.archived===!0&&S&&bu(t,e,C,a),P=y===u.targetBranch&&(!s.bound_branch||l!==null||s.bound_branch===y)&&E,v=!1,N=!1,H=null,ie=n.verifyRemote&&u.action!=="local"?"unavailable":"notChecked",R="notChecked";if(n.verifyRemote&&P&&u.action!=="local"&&u.remote&&m&&vu(t,u.remote)===m&&vu(t,u.remote,!0)===m){let M=`refs/heads/${u.targetBranch}`,me=cn(t,"git",["-C",t,"-c","protocol.allow=never","-c","protocol.https.allow=always","-c","protocol.ssh.allow=always","-c","protocol.file.allow=always","ls-remote","--refs",u.remote,M],!0),fs=me?.split(/\r?\n/u)??[],ds=fs.length===1?/^([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(fs[0]):null,dt=ds?.[2]===M?ds[1]:null;v=!!C&&!!dt&&ku(t,C,dt),ie=v?"verified":me===""?"missing":me===null||!dt||sn(t,["cat-file","-t",dt])!=="commit"?"unavailable":"missing";let oe=Jw(m),$r=oe&&u.prUrl?Ir(u.prUrl,oe):null,Mr=v||me==="",ms=z=>z.headRefName===u.targetBranch&&typeof z.headRefOid=="string"&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(z.headRefOid)&&(v?z.headRefOid===dt&&["OPEN","MERGED"].includes(z.state):me===""&&z.state==="MERGED"&&!!C&&ku(t,C,z.headRefOid));if(Mr&&u.action==="pr"&&(R="unavailable"),Mr&&u.action==="pr"&&$r&&oe){let z=cn(t,"gh",["pr","view",$r,"--repo",oe,"--json","url,headRefName,headRefOid,state"],!0);try{let se=z?ze(JSON.parse(z)):null;N=!!se&&typeof se.url=="string"&&Ir(se.url,oe)===$r&&ms(se),R=N?"verified":se?"missing":"unavailable"}catch{N=!1,R="unavailable"}}else if(Mr&&u.action==="pr"&&!u.prUrl&&oe){let z=cn(t,"gh",["pr","list","--repo",oe,"--head",u.targetBranch,"--state","all","--json","url,headRefName,headRefOid,state","--limit","100"],!0);try{let se=z===null?null:JSON.parse(z);if(!Array.isArray(se)||se.length>=100)throw new Error("Incomplete PR discovery");let Dr=se.map(ze).filter(Wr=>typeof Wr.url=="string"&&Ir(Wr.url,oe)&&ms(Wr));Dr.length===1?(H=Ir(Dr[0].url,oe),N=!0,R="verified"):R=Dr.length===0?"missing":"unavailable"}catch{R="unavailable"}}}return{delivery:h,verification:{status:P&&(u.action==="local"||(u.action==="push"?v:N))?"complete":"needsVerification",currentBranch:y,commitExists:S,archiveCommitted:E,observedCommit:k,observedPrUrl:H,remoteVerified:v,prVerified:N,remoteStatus:ie,prStatus:R}}}import xu from"path";function Lr(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}'
157
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function Yw(t){let e=Lr(t);if(e)throw new Error(e)}function Hw(t,e){return{label:st(t,e),directory:e}}async function Gw(t,e,n){let r=Hw(t,e);if(!(await fe(t,e,{label:n,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await fe(t,xu.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}async function Pu(t,e=process.cwd()){Yw(t);let n=await Xt(e),r=await Gw(n.projectRoot,xu.join(n.changesDir,t),`Classic active change ${t}`);return{...r.change,exists:r.exists,stateExists:r.stateExists}}var ft="comet.resume_probe.v1";function Ru(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Qw(t){if(!Ru(t))throw new Error("Invalid CometResumeProbeInput: input must be an object");if(t.schema_version!==ft)throw new Error(`Invalid CometResumeProbeInput: schema_version must be ${ft}`);if(typeof t.utterance!="string")throw new Error("Invalid CometResumeProbeInput: utterance must be a string");let e=Ru(t.agent_context)?t.agent_context:{};return{schema_version:ft,utterance:t.utterance,locale:typeof t.locale=="string"?t.locale:"unknown",agent_context:{non_trivial_work:e.non_trivial_work===!0,already_in_comet_flow:e.already_in_comet_flow===!0}}}function W(t,e,n,r,i=[]){return{schema_version:ft,action:t,changeName:e?.name??null,phase:e?.phase??null,nextCommand:t==="auto_resume"||t==="ask_user"?e?.nextCommand??null:null,confidence:n,reason:r,evidence:i}}async function Zw(t,e,n){return await de(t,e,{label:n,expected:"file"})?Ke(t,e,{label:n}):""}async function cs(t,e,n){let r=["proposal.md","design.md","tasks.md"],i=[n.name,n.workflow,n.phase];for(let o of r)i.push(await Zw(t,`${e}/${o}`,`Classic change ${n.name} ${o}`));return i.join(`
158
+ `).toLowerCase()}function ey(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}function Ou(t,e,n){let r=n.classic,i=n.unknownKeys.filter(o=>o!=="run_id");return r?i.length>0?{name:e,valid:!1,workflow:r.workflow,phase:r.phase,currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:`unknown field(s): ${i.join(", ")}`}:{name:e,valid:!0,workflow:r.workflow,phase:r.phase,currentStep:null,nextCommand:ey(r.phase),runtimeMode:"engine-projection",runtimeEval:null,evidence:[]}:{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:`${t} does not contain valid Comet state`}}async function ty(t,e){return await de(t,`${e}/proposal.md`,{label:"Classic proposal",expected:"file"})||await de(t,`${e}/design.md`,{label:"Classic design",expected:"file"})||await de(t,`${e}/tasks.md`,{label:"Classic tasks",expected:"file"})}async function ny(t){let e=(await Xt(t)).changesDir;if(!(await fe(t,e,{label:"Classic changes directory",expected:"directory"})).exists)return[];let r=await Ur(e),i=[];for(let o of r){if(o==="archive"||Lr(o))continue;let s=await Pu(o,t);if(!s.exists)continue;let a=s.directory;if(!s.stateExists){if(!await ty(t,a))continue;let h={name:o,workflow:"unknown",phase:"invalid",nextCommand:null,diagnostic:{name:o,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:"missing Comet state"},buildPause:null,hasClassicProjection:!1,verifyResult:null,archived:!1,text:"",missingCometState:!0};h.text=await cs(t,a,h),i.push(h);continue}let l=await rs(a,{migrate:!1}),u=l.classic,f=Ou(a,o,l),d=!!u,p=u?.phase??f.phase,g=u?.workflow??f.workflow;if(p==="archive"||u?.archived)continue;let m={name:o,workflow:g,phase:p,nextCommand:f.nextCommand,diagnostic:f,buildPause:u?.buildPause??null,hasClassicProjection:d,verifyResult:u?.verifyResult??null,archived:u?.archived??!1,text:"",missingCometState:!1};m.text=await cs(t,a,m),i.push(m)}return i}function ry(t){let e=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(t)?.[1]??t;return Lr(e)===null?e:null}async function iy(t){let e=await Xt(t);if(!(await fe(t,e.archiveDir,{label:"Classic archive directory",expected:"directory"})).exists)return[];let r=[];for(let i of await Ur(e.archiveDir)){let o=ry(i);if(!o)continue;let s=Vw.join(e.archiveDir,i),a=await fe(t,s,{label:`Classic archived change ${i}`,expected:"directory"});if(!a.exists)continue;let c=await rs(a.target,{migrate:!1}),l=c.classic;if(!l?.archived||l.phase!=="archive")continue;let u=await _u(t,a.target);if(["complete","local-verified"].includes(u.verification.status))continue;let f=Ou(a.target,o,c),d={name:o,workflow:l.workflow,phase:"archive",nextCommand:"/comet-archive",diagnostic:f,buildPause:null,hasClassicProjection:!0,verifyResult:l.verifyResult,archived:!0,text:"",missingCometState:!1};d.text=await cs(t,a.target,d),r.push(d)}return r}var oy=["continue","resume","carry on","finish","run it","commit","verify","archive","继续","接着","恢复","跑完","提交","验证","归档","修刚才"],sy=["what","why","how","explain","summarize","reliable","靠谱吗","是什么","为什么","解释","总结","取名","命名"],ay=new Set(["add","build","cache","change","code","design","docs","file","fix","implement","plan","readme","task","test","update","修改","更新","修复","添加","文档","任务","计划","实现"]),cy=["do not resume","don't resume","without comet","skip comet","不要恢复","不走 comet","不要走 comet","直接解释","只回答"];function as(t,e){return e.some(n=>t.includes(n))}function Nu(t){return t.missingCometState||!t.hasClassicProjection||!t.diagnostic.valid||t.phase==="archive"||t.verifyResult==="fail"||t.diagnostic.runtimeEval&&!t.diagnostic.runtimeEval.passed?!0:t.phase!=="build"?!1:t.buildPause==="plan-ready"}function ly(t,e){let n=t.toLowerCase(),r=[];n.includes(e.name.toLowerCase())&&r.push({source:"user",quote:e.name});let i=e.text.split(/[^a-zA-Z0-9_\-\u4e00-\u9fff/]+/u).map(s=>s.trim().toLowerCase()).filter(s=>s.length>=4&&!ay.has(s)),o=[...new Set(i.filter(s=>n.includes(s)))].slice(0,3);for(let s of o)r.push({source:"repo",quote:s});return r}async function uy(t){return mn(()=>new Promise(e=>{Xw("git",["status","--short","--untracked-files=all"],{cwd:t,timeout:3e3,maxBuffer:2*1024*1024,windowsHide:!0},(n,r)=>{if(n||typeof r!="string"){e([]);return}e(r.split(/\r?\n/u).map(i=>i.trim()).filter(Boolean))})}))}async function Au(t,e){let n=Qw(e),r=n.utterance.trim(),i=r.toLowerCase();if(n.agent_context.already_in_comet_flow)return W("out_of_scope",null,"low","already in Comet flow");if(as(i,cy))return W("out_of_scope",null,"low","user opted out of Comet resume",[{source:"user",quote:r}]);let o=await ny(t),s=new Set(o.map(({name:g})=>g)),a=(await iy(t)).filter(({name:g})=>!s.has(g)),c=[...o,...a];if(c.length===0)return W("none",null,"none","no active Comet changes");let l=await uy(t);if(c.length>1){let g=c.find(m=>i.includes(m.name.toLowerCase()));return g?l.length>0?W("ask_user",g,"low","uncommitted worktree changes require attribution",[{source:"repo",quote:`${l.length} dirty file(s)`}]):Nu(g)?W("ask_user",g,"low","active change is at a decision point"):W("auto_resume",g,"high","request names an active change",[{source:"user",quote:g.name}]):W("ask_user",null,"low","multiple active changes require a change name")}let[u]=c;if(l.length>0)return W("ask_user",u,"low","uncommitted worktree changes require attribution",[{source:"repo",quote:`${l.length} dirty file(s)`}]);if(Nu(u))return u.archived?W("ask_user",u,"low","archived change has pending delivery",[{source:"state",quote:"archived: true"},{source:"state",quote:"delivery is not complete"}]):u.missingCometState?W("ask_user",u,"low","active OpenSpec change is missing Comet state"):W("ask_user",u,"low","active change is at a decision point",[{source:"state",quote:`phase: ${u.phase}`}]);let f=as(i,oy);if(!n.agent_context.non_trivial_work&&as(i,sy)&&!f)return W("out_of_scope",u,"low","user asked a question without workflow work");let p=ly(r,u);return f||p.length>0?W("auto_resume",u,"high","single active change and request is related",[{source:"state",quote:`phase: ${u.phase}`},...p]):n.agent_context.non_trivial_work?W("ask_user",u,"low","single active change exists but request looks unrelated"):W("out_of_scope",u,"low","request is not workflow work")}import{AsyncLocalStorage as fy}from"async_hooks";import{promises as Iu}from"fs";import ln from"path";var ls=new fy;function dy(t,e){let n=ln.relative(t,e);return n===""||!ln.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${ln.sep}`)}async function my(t){let e=ln.resolve(t.invocationCwd??process.cwd()),n=ln.resolve(t.projectRoot??await Ol(e)),[r,i]=await Promise.all([Iu.realpath(e),Iu.realpath(n)]);if(!dy(i,r))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n,observations:new Map}}async function py(t,e){let n=ls.getStore();if(n)return e(n);let r=await my(t);return ls.run(r,()=>e(r))}function Tu(){let t=ls.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function ju(t){return(e,n)=>py(n,()=>t(e,n))}function qr(t,e,n){return{exitCode:t,...e===void 0?{}:{stdout:e},...n===void 0?{}:{stderr:n}}}function Lu(){return qr(64,void 0,`Usage: comet-resume-probe.mjs probe <input-json>
159
+ Usage: comet-resume-probe.mjs probe --stdin`)}async function hy(){let t=[];for await(let e of process.stdin)t.push(Buffer.isBuffer(e)?e:Buffer.from(String(e)));return ps(Buffer.concat(t).toString("utf8"))}function gy(t){return{schema_version:ft,utterance:t,locale:"unknown",agent_context:{non_trivial_work:!0,already_in_comet_flow:!1}}}function wy(t){try{return JSON.parse(t)}catch{return gy(t)}}var qu=ju(async t=>{let[e,n]=t;if(e!=="probe")return Lu();let r=n==="--stdin",i=r?await hy():n;if(!i)return Lu();try{let o=r?wy(i):JSON.parse(i),s=await Au(Tu(),o);return qr(0,`${JSON.stringify(s,null,2)}
160
+ `)}catch(o){return o instanceof SyntaxError?qr(1,void 0,`Invalid JSON: ${o.message}`):qr(1,void 0,o instanceof Error?o.message:String(o))}});var $u=["open-complete","design-complete","build-complete","verify-pass","verify-fail","archive-confirm","archive-reopen","archived","preset-escalate"];var yy=new Set([...nn,"archive_confirmation","verify_failures","check_epoch","classic_profile","classic_migration","bound_branch"]),Mu=new Set(Ue.filter(t=>!yy.has(t))),us={workflow:["full","hotfix","tweak"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct","autonomous"],build_pause:["null","plan-ready"],subagent_dispatch:["null","confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]};var vy=`
148
161
  Options: --json (machine-readable output), --help
149
162
  JSON: one object with command and exitCode; data, stdout, stderr, summary and next are optional.
150
163
  Use exitCode for success; do not parse human-readable stdout. Help text is in stdout in JSON mode.
151
- `;function vu(t,e){let n=e.indexOf("--"),r=n<0?e:e.slice(0,n);if(!r.includes("--help")&&!r.includes("-h"))return;let i={check:["comet check run <change> <build|verify> [--local] [--incremental] [--cwd <path>] [--timeout-ms <ms>] -- <program> [args...]","comet check rerun <change> <build|verify>","--local opts deterministic local checks into same-input reuse; other checks are single-use.","--incremental records phase-local evidence: guard previews accept it, --apply requires a full rerun.","Arguments after -- belong to the child. Windows batch arguments containing shell syntax are rejected.","","Executes a program for an active change and stores its log and input-bound evidence.","--local is not a location switch: all checks execute locally. It asserts deterministic inputs.","Use --local only when no network, external state or untracked ignored inputs affect the result.","Default evidence is single-use; reusable evidence requires matching inputs, environment and log.","--cwd: relative to the project root; default is the invocation directory; must stay inside the project.","Guard reuses evidence only when its cwd matches the guard invocation directory, or the command is declared with that cwd in a v2 check policy.","--timeout-ms: default 300000; integer range 1..3600000.","Place Comet options, including --json, before --. Child --help and --json after -- are forwarded.","","Result: data.scope, data.argv, data.cwd, data.exitCode, data.logRef, data.reusable; data.reused is optional.","Exit: 0 = success with stable inputs; child failures propagate; timeout = 124; invalid invocation/runtime error = 70.","A child exit of 0 with changed inputs returns exitCode 1. Use top-level exitCode, not data.exitCode.","On failure inspect data.logRef or stderr, fix the cause, then rerun. Recovery revalidates local evidence.","rerun repeats the latest Runtime-recorded argv, cwd, timeout and reuse tier without reconstructing shell syntax.","Optional .comet/check-policy.json binds declared deterministic commands by exact argv and cwd.",'A v1 single-command object stays valid; v2 {"commands":[...]} scopes each command separately.',"Editing one v2 command entry invalidates only that command's evidence; unmatched commands stay conservative.",'Default inputs are the working-tree files. Declare git: "all" for builds that read HEAD or the index,','env variable names whose values affect the result, and taskCheckboxes: "include" when completion marks matter.',"files accept literal paths and * ? ** globs; a new file matching a glob is checked without re-declaring.","Declare every real input; do not infer dependencies from the current diff.",'Policy example: {"version":2,"commands":[{"argv":["node","scripts/build.mjs"],"cwd":".","files":["src/**","package.json"],"git":"all"},{"argv":["node","--test"],"cwd":".","files":["src/**","test/**"],"taskCheckboxes":"ignore"}]}',"Build evidence does not substitute for verify evidence. A successful check does not advance the phase.","","Examples: (replace demo with your active change; these commands execute code)"," comet check run demo verify --json -- node --test"," comet check run demo build --local --cwd . -- npm run build"," comet check rerun demo build"],state:["comet state <command> [args]","init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","get <change-name> <field>","set <change-name> <field> <value> [<field> <value> ...]","complete-design <change-name> --design-doc <repo-relative-ref>","transition <change-name> <event>","check <change-name> <phase> [--recover] [--details]","scale <change-name>","artifacts <change-name>","record-check <change-name> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","task-checkoff <file> <task-text>","tasks <change-name> [--assign-ids]","task-complete <change-name> <task-id> --expect <revision>","sync-plan <change-name>","checkpoint <change-name> [--file <json>]","delivery <change-name> [--file <json> | --verify]","select <change-name> | rebind <change-name> | next <change-name>","current | clear-selection","","Start with current or next <change-name> to inspect workflow guidance.","Advanced writes: init, set, transition, task-checkoff, select, rebind, clear-selection.","Use comet state <command> --help for details. --recover is for cold recovery, not normal progression.","After explicit design confirmation, complete-design registers the reference, refreshes handoff, and applies the guard; interrupted retries retain completed work.","Use data.artifactRefs for state references and task-authority markers; absolute paths are for file operations."],guard:["comet guard <change-name> <open|design|build|verify|archive> [--apply]","Validates phase requirements; --apply advances the phase after all checks pass.","Without --apply the phase stays unchanged, but this is NOT a read-only preview:","Build validation may execute a detected build and write evidence/logs.","Preview does not consume single-use evidence. Successful phase advancement consumes it atomically.","Failed or repeated previews preserve evidence; changed inputs still require a new check.","Do not poll guard for status. Use comet state next <change-name> for guidance.","On failure follow the reported next action; do not blindly retry side-effecting checks.","","Examples:"," comet guard demo build --apply --json"," comet state next demo --json"],handoff:["comet handoff <change-name> design --write [--full]","comet handoff <change-name> --hash-only"],archive:["comet archive <change-name> [--dry-run]"],validate:["comet classic validate <change-name>"],workspace:["comet classic workspace prepare <change-name> --isolation <current|branch|worktree> [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]","comet classic workspace resolve <change-name>"]},o={current:["comet state current","Reports the selected Classic change. Does not advance the phase."],next:["comet state next <change-name>","Reports the next workflow action. Does not execute build or verification checks."],select:["comet state select <change-name>","Writes the current change selection used by workflow routing."],rebind:["comet state rebind <change-name>","Updates the change branch binding to the current Git branch after validation."],"clear-selection":["comet state clear-selection","Clears the current change selection; does not delete change artifacts."],init:["comet state init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","Creates Classic workflow state. Follow the Open workflow for required user decisions."],scale:["comet state scale <change-name>","Reports a verification recommendation without changing verify_mode.","JSON: data.recommendation, data.selected and data.metrics. Scale is not a risk assessment.","Preserve an existing selection; record a new decision explicitly with state set when needed."],artifacts:["comet state artifacts <change-name>","Inspects the OpenSpec apply dependency closure, including dependencies of already-complete artifacts.","JSON: data.source, required, skipped, designRequired, files and problems. This does not execute implementation or verification.","Optional design is omitted only when the active schema excludes it from the required closure.","Skipped specs require explicit skip_specs: true, upstream support and no conflicting spec files.","Legacy changes without .openspec.yaml retain the existing Classic artifact requirements."],"task-checkoff":["comet state task-checkoff <file> <task-text>","Checks that exactly one matching task is already checked. Does not write the task file or execute the task."],tasks:["comet state tasks <change-name> [--assign-ids]","Reads tasks.md as the task completion authority. Fenced examples are excluded.","--assign-ids persists IDs for legacy/new tasks in Open, Design or Build; existing IDs remain unchanged.","Assign IDs before generating the design handoff and plan. ID assignment changes task requirements.","JSON: data.authority, data.revision, data.needsIds, data.tasks and data.progress.","Each task has id, text, completed and line. Never use line/order as task identity.","Example: comet state tasks demo --assign-ids --json"],"task-complete":["comet state task-complete <change-name> <task-id> --expect <revision>","Records accepted task completion during Build; does not execute or independently verify work.","Use the revision returned by state tasks. Changed requirements reject the write; refresh and reassess the task.","Writes tasks.md under the state lock and synchronizes explicitly ID-mapped legacy plan checkboxes. Retries repair interrupted projection writes.","Reconcile code, checks and review evidence before recording completion; unchecked does not mean unimplemented.","Unmapped legacy items are preserved and reported as mapping-required; never match tasks by position or wording."],"sync-plan":["comet state sync-plan <change-name>","Synchronizes legacy plan checkboxes from tasks.md by explicit comet-task IDs; does not execute or accept work.","Rejects missing or unknown plan IDs. Reconcile extra requirements into tasks.md before mapping.","New plans should reference task IDs without a second completion checklist."],checkpoint:["comet state checkpoint <change-name> [--file <json>]","Reads a structured coordination checkpoint, or records an explicitly bounded work package during Build.","Input: taskIds, revision, stage, sessionId, evidence, unresolved, reviewRounds.","Include schemaVersion: 1. JSON state is .comet/coordination.json, separate from the Engine checkpoint.","Stages: implementing|task-review|checkoff|done|blocked. Evidence is a coordination record, not automatic acceptance.","Runtime checks task IDs and revision and renders subagent-progress.md. Do not maintain its projection manually."],delivery:["comet state delivery <change-name> [--file <json> | --verify]","Reads delivery authorization and observed progress, or records the user-authorized local|push|pr action.","Input: action, targetBranch, optional remote, commit and prUrl. Recording never performs remote writes.","First authorization requires Archive with passing verification before archival. Missing legacy authorization is never inferred.","Resume only authorized unfinished steps; supplied commit or PR text alone does not prove delivery.","--verify performs bounded read-only remote/PR verification; normal entry never contacts the network."],get:["comet state get <change-name> <field>","Reads one stored field. The field value is returned in stdout, including in JSON mode.",`Fields: ${[...De,...Xt].join(", ")}`,"Example: comet state get demo phase --json"],set:["comet state set <change-name> <field> <value> [<field> <value> ...]","Advanced: validates all fields, then commits one atomic state update and reconciles Runtime state.","Invalid values or duplicate fields reject the whole update. Do not bypass workflow confirmations.","JSON: data.change and data.updated contain the committed field values.","Writable fields (enum values shown where applicable):",...[...yu].map(c=>` ${c}${Vo[c]?`: ${Vo[c].join("|")}`:c==="language"?": en|zh-CN":""}`),"Other Runtime-owned fields cannot be set manually. Artifact paths must stay within the project.","Example: comet state set demo verify_mode full","Example: comet state set demo build_mode executing-plans tdd_mode direct review_mode standard --json"],check:["comet state check <change-name> <open|design|build|verify|archive> [--recover] [--details]","Checks phase entry requirements; this is not a build/test execution command.","--recover is for cold recovery after context loss, not normal phase progression.","Recovery revalidates reusable local evidence and invalidates stale, damaged or single-use evidence.","It preserves completed work; resume from the checkpoint and rerun required checks before progressing.","JSON entry data includes layout, configuration, configurationReadiness, nextAction, compact taskState, planMapping and checks.","--recover additionally revalidates evidence and includes checkpoint references; --details expands tasks and checkpoint content.","Reconcile existing implementation and acceptance before dispatching work; unchecked tasks are not proof of missing implementation.","Read fresh state after changing configuration or advancing phases; do not reuse an earlier entry snapshot.","","Examples:"," comet state check demo build --json"," comet state check demo build --recover --json"],"record-check":["comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","Advanced: writes a manual attestation; does not execute the command.","A manual attestation cannot satisfy Runtime build/verify evidence requirements, even with exit code 0.","Use comet check run to execute a check and obtain evidence that guard can validate.","--cwd: relative to project root, defaults to .; must stay inside the project.","","Examples:",' comet state record-check demo verify --command "external test run" --exit-code 1'," comet check run demo verify --json -- node --test"],transition:["comet state transition <change-name> <event>",`Events: ${wu.join(", ")}`,"Advanced: applies a state-machine event and writes workflow state. Required confirmations still apply.","This is not a substitute for the workflow Skill or phase guard. Use state next for the next action."]},s=r.find(c=>!c.startsWith("-")),a=t==="state"&&s&&o[s]||i[t];return a?`Usage: ${a.join(`
164
+ `;function Du(t,e){let n=e.indexOf("--"),r=n<0?e:e.slice(0,n);if(!r.includes("--help")&&!r.includes("-h"))return;let i={check:["comet check run <change> <build|verify> [--local] [--incremental] [--cwd <path>] [--timeout-ms <ms>] -- <program> [args...]","comet check rerun <change> <build|verify>","--local opts deterministic local checks into same-input reuse; other checks are single-use.","--incremental records phase-local evidence: guard previews accept it, --apply requires a full rerun.","Arguments after -- belong to the child. Windows batch arguments containing shell syntax are rejected.","","Executes a program for an active change and stores its log and input-bound evidence.","--local is not a location switch: all checks execute locally. It asserts deterministic inputs.","Use --local only when no network, external state or untracked ignored inputs affect the result.","Default evidence is single-use; reusable evidence requires matching inputs, environment and log.","--cwd: relative to the project root; default is the invocation directory; must stay inside the project.","Guard reuses evidence only when its cwd matches the guard invocation directory, or the command is declared with that cwd in a v2 check policy.","--timeout-ms: default 300000; integer range 1..3600000.","Place Comet options, including --json, before --. Child --help and --json after -- are forwarded.","","Result: data.scope, data.argv, data.cwd, data.exitCode, data.logRef, data.reusable; data.reused is optional.","Exit: 0 = success with stable inputs; child failures propagate; timeout = 124; invalid invocation/runtime error = 70.","A child exit of 0 with changed inputs returns exitCode 1. Use top-level exitCode, not data.exitCode.","On failure inspect data.logRef or stderr, fix the cause, then rerun. Recovery revalidates local evidence.","rerun repeats the latest Runtime-recorded argv, cwd, timeout and reuse tier without reconstructing shell syntax.","Optional .comet/check-policy.json binds declared deterministic commands by exact argv and cwd.",'A v1 single-command object stays valid; v2 {"commands":[...]} scopes each command separately.',"Editing one v2 command entry invalidates only that command's evidence; unmatched commands stay conservative.",'Default inputs are the working-tree files. Declare git: "all" for builds that read HEAD or the index,','env variable names whose values affect the result, and taskCheckboxes: "include" when completion marks matter.',"files accept literal paths and * ? ** globs; a new file matching a glob is checked without re-declaring.","Declare every real input; do not infer dependencies from the current diff.",'Policy example: {"version":2,"commands":[{"argv":["node","scripts/build.mjs"],"cwd":".","files":["src/**","package.json"],"git":"all"},{"argv":["node","--test"],"cwd":".","files":["src/**","test/**"],"taskCheckboxes":"ignore"}]}',"Build evidence does not substitute for verify evidence. A successful check does not advance the phase.","","Examples: (replace demo with your active change; these commands execute code)"," comet check run demo verify --json -- node --test"," comet check run demo build --local --cwd . -- npm run build"," comet check rerun demo build"],state:["comet state <command> [args]","init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","get <change-name> <field>","set <change-name> <field> <value> [<field> <value> ...]","complete-design <change-name> --design-doc <repo-relative-ref>","transition <change-name> <event>","check <change-name> <phase> [--recover] [--details]","scale <change-name>","artifacts <change-name>","record-check <change-name> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","task-checkoff <file> <task-text>","tasks <change-name> [--assign-ids]","task-complete <change-name> <task-id> --expect <revision>","sync-plan <change-name>","checkpoint <change-name> [--file <json>]","delivery <change-name> [--file <json> | --verify]","select <change-name> | rebind <change-name> | next <change-name>","current | clear-selection","","Start with current or next <change-name> to inspect workflow guidance.","Advanced writes: init, set, transition, task-checkoff, select, rebind, clear-selection.","Use comet state <command> --help for details. --recover is for cold recovery, not normal progression.","After explicit design confirmation, complete-design registers the reference, refreshes handoff, and applies the guard; interrupted retries retain completed work.","Use data.artifactRefs for state references and task-authority markers; absolute paths are for file operations."],guard:["comet guard <change-name> <open|design|build|verify|archive> [--apply]","Validates phase requirements; --apply advances the phase after all checks pass.","Without --apply the phase stays unchanged, but this is NOT a read-only preview:","Build validation may execute a detected build and write evidence/logs.","Preview does not consume single-use evidence. Successful phase advancement consumes it atomically.","Failed or repeated previews preserve evidence; changed inputs still require a new check.","Do not poll guard for status. Use comet state next <change-name> for guidance.","On failure follow the reported next action; do not blindly retry side-effecting checks.","","Examples:"," comet guard demo build --apply --json"," comet state next demo --json"],handoff:["comet handoff <change-name> design --write [--full]","comet handoff <change-name> --hash-only"],archive:["comet archive <change-name> [--dry-run]"],validate:["comet classic validate <change-name>"],workspace:["comet classic workspace prepare <change-name> --isolation <current|branch|worktree> [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]","comet classic workspace resolve <change-name>"]},o={current:["comet state current","Reports the selected Classic change. Does not advance the phase."],next:["comet state next <change-name>","Reports the next workflow action. Does not execute build or verification checks."],select:["comet state select <change-name>","Writes the current change selection used by workflow routing."],rebind:["comet state rebind <change-name>","Updates the change branch binding to the current Git branch after validation."],"clear-selection":["comet state clear-selection","Clears the current change selection; does not delete change artifacts."],init:["comet state init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","Creates Classic workflow state. Follow the Open workflow for required user decisions."],scale:["comet state scale <change-name>","Reports a verification recommendation without changing verify_mode.","JSON: data.recommendation, data.selected and data.metrics. Scale is not a risk assessment.","Preserve an existing selection; record a new decision explicitly with state set when needed."],artifacts:["comet state artifacts <change-name>","Inspects the OpenSpec apply dependency closure, including dependencies of already-complete artifacts.","JSON: data.source, required, skipped, designRequired, files and problems. This does not execute implementation or verification.","Optional design is omitted only when the active schema excludes it from the required closure.","Skipped specs require explicit skip_specs: true, upstream support and no conflicting spec files.","Legacy changes without .openspec.yaml retain the existing Classic artifact requirements."],"task-checkoff":["comet state task-checkoff <file> <task-text>","Checks that exactly one matching task is already checked. Does not write the task file or execute the task."],tasks:["comet state tasks <change-name> [--assign-ids]","Reads tasks.md as the task completion authority. Fenced examples are excluded.","--assign-ids persists IDs for legacy/new tasks in Open, Design or Build; existing IDs remain unchanged.","Assign IDs before generating the design handoff and plan. ID assignment changes task requirements.","JSON: data.authority, data.revision, data.needsIds, data.tasks and data.progress.","Each task has id, text, completed and line. Never use line/order as task identity.","Example: comet state tasks demo --assign-ids --json"],"task-complete":["comet state task-complete <change-name> <task-id> --expect <revision>","Records accepted task completion during Build; does not execute or independently verify work.","Use the revision returned by state tasks. Changed requirements reject the write; refresh and reassess the task.","Writes tasks.md under the state lock and synchronizes explicitly ID-mapped legacy plan checkboxes. Retries repair interrupted projection writes.","Reconcile code, checks and review evidence before recording completion; unchecked does not mean unimplemented.","Unmapped legacy items are preserved and reported as mapping-required; never match tasks by position or wording."],"sync-plan":["comet state sync-plan <change-name>","Synchronizes legacy plan checkboxes from tasks.md by explicit comet-task IDs; does not execute or accept work.","Rejects missing or unknown plan IDs. Reconcile extra requirements into tasks.md before mapping.","New plans should reference task IDs without a second completion checklist."],checkpoint:["comet state checkpoint <change-name> [--file <json>]","Reads a structured coordination checkpoint, or records an explicitly bounded work package during Build.","Input: taskIds, revision, stage, sessionId, evidence, unresolved, reviewRounds.","Include schemaVersion: 1. JSON state is .comet/coordination.json, separate from the Engine checkpoint.","Stages: implementing|task-review|checkoff|done|blocked. Evidence is a coordination record, not automatic acceptance.","Runtime checks task IDs and revision and renders subagent-progress.md. Do not maintain its projection manually."],delivery:["comet state delivery <change-name> [--file <json> | --verify]","Reads delivery authorization and observed progress, or records the user-authorized local|push|pr action.","Input: action, targetBranch, optional remote, commit and prUrl. Recording never performs remote writes.","First authorization requires Archive with passing verification before archival. Missing legacy authorization is never inferred.","Resume only authorized unfinished steps; supplied commit or PR text alone does not prove delivery.","--verify performs bounded read-only remote/PR verification; normal entry never contacts the network."],get:["comet state get <change-name> <field>","Reads one stored field. The field value is returned in stdout, including in JSON mode.",`Fields: ${[...Ue,...nn].join(", ")}`,"Example: comet state get demo phase --json"],set:["comet state set <change-name> <field> <value> [<field> <value> ...]","Advanced: validates all fields, then commits one atomic state update and reconciles Runtime state.","Invalid values or duplicate fields reject the whole update. Do not bypass workflow confirmations.","JSON: data.change and data.updated contain the committed field values.","Writable fields (enum values shown where applicable):",...[...Mu].map(c=>` ${c}${us[c]?`: ${us[c].join("|")}`:c==="language"?": en|zh-CN":""}`),"Other Runtime-owned fields cannot be set manually. Artifact paths must stay within the project.","Example: comet state set demo verify_mode full","Example: comet state set demo build_mode executing-plans tdd_mode direct review_mode standard --json"],check:["comet state check <change-name> <open|design|build|verify|archive> [--recover] [--details]","Checks phase entry requirements; this is not a build/test execution command.","--recover is for cold recovery after context loss, not normal phase progression.","Recovery revalidates reusable local evidence and invalidates stale, damaged or single-use evidence.","It preserves completed work; resume from the checkpoint and rerun required checks before progressing.","JSON entry data includes layout, configuration, configurationReadiness, nextAction, compact taskState, planMapping and checks.","--recover additionally revalidates evidence and includes checkpoint references; --details expands tasks and checkpoint content.","Reconcile existing implementation and acceptance before dispatching work; unchecked tasks are not proof of missing implementation.","Read fresh state after changing configuration or advancing phases; do not reuse an earlier entry snapshot.","","Examples:"," comet state check demo build --json"," comet state check demo build --recover --json"],"record-check":["comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","Advanced: writes a manual attestation; does not execute the command.","A manual attestation cannot satisfy Runtime build/verify evidence requirements, even with exit code 0.","Use comet check run to execute a check and obtain evidence that guard can validate.","--cwd: relative to project root, defaults to .; must stay inside the project.","","Examples:",' comet state record-check demo verify --command "external test run" --exit-code 1'," comet check run demo verify --json -- node --test"],transition:["comet state transition <change-name> <event>",`Events: ${$u.join(", ")}`,"Advanced: applies a state-machine event and writes workflow state. Required confirmations still apply.","This is not a substitute for the workflow Skill or phase guard. Use state next for the next action."]},s=r.find(c=>!c.startsWith("-")),a=t==="state"&&s&&o[s]||i[t];return a?`Usage: ${a.join(`
152
165
  `)}
153
- ${zw}Command placeholders must be replaced with actual values.
154
- `:void 0}function bu(t,e){let n=u=>u!==null&&typeof u=="object"&&!Array.isArray(u)?u:{},r=n(t),i=n(r.entry),o=n(r.state??i.state??r),s=n(r.preparation??r.workspace??i.workspace),a=n(r.continuation??i.continuation),c=typeof s.projectRoot=="string"&&s.projectRoot!=="."?s.projectRoot:e??null,l=o.stateVersion??o.state_version;return{phase:typeof o.phase=="string"?o.phase:null,status:typeof o.status=="string"?o.status:null,stateVersion:typeof l=="number"?l:null,workspace:{cwd:c},continuation:Object.keys(a).length?{...a,cwd:c}:null}}import{stripVTControlCharacters as Jw}from"node:util";function ku(t,e={}){return{code:"CLASSIC_COMMAND_FAILED",message:Jw(t instanceof Error?t.message:String(t)),...e}}function Yw(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,agent:bu(e.data),...e.data===void 0?{}:{data:e.data},...e.envelope===void 0?{}:{summary:e.envelope.summary,...e.envelope.next===void 0?{}:{next:e.envelope.next},...e.envelope.user_message===void 0?{}:{user_message:e.envelope.user_message}},...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
155
- `,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function Cu(t,e,n=process.argv.slice(2)){let r=n.indexOf("--"),i=l=>r<0||l<r,o=n.some((l,u)=>i(u)&&l==="--json"),s=n.filter((l,u)=>!i(u)||l!=="--json"),a;try{let l=vu(t,s);a=l?{exitCode:0,stdout:l}:await e(s,{json:o})}catch(l){a={exitCode:70,stderr:l instanceof Error?l.message:String(l),data:{issues:[ku(l)]}}}let c=o?Yw(t,a):a;return c.stdout&&process.stdout.write(c.stdout),c.stderr&&process.stderr.write(c.stderr+(c.stderr.endsWith(`
166
+ ${vy}Command placeholders must be replaced with actual values.
167
+ `:void 0}function Wu(t,e){let n=u=>u!==null&&typeof u=="object"&&!Array.isArray(u)?u:{},r=n(t),i=n(r.entry),o=n(r.state??i.state??r),s=n(r.preparation??r.workspace??i.workspace),a=n(r.continuation??i.continuation),c=typeof s.projectRoot=="string"&&s.projectRoot!=="."?s.projectRoot:e??null,l=o.stateVersion??o.state_version;return{phase:typeof o.phase=="string"?o.phase:null,status:typeof o.status=="string"?o.status:null,stateVersion:typeof l=="number"?l:null,workspace:{cwd:c},continuation:Object.keys(a).length?{...a,cwd:c}:null}}import{stripVTControlCharacters as by}from"node:util";function Fu(t,e={}){return{code:"CLASSIC_COMMAND_FAILED",message:by(t instanceof Error?t.message:String(t)),...e}}function ky(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,agent:Wu(e.data),...e.data===void 0?{}:{data:e.data},...e.envelope===void 0?{}:{summary:e.envelope.summary,...e.envelope.next===void 0?{}:{next:e.envelope.next},...e.envelope.user_message===void 0?{}:{user_message:e.envelope.user_message}},...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
168
+ `,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function Cy(t,e,n,r={}){let i=n.indexOf("--"),o=l=>i<0||l<i,s=n.some((l,u)=>o(u)&&l==="--json"),a=n.filter((l,u)=>!o(u)||l!=="--json"),c;try{let l=Du(t,a);c=l?{exitCode:0,stdout:l}:await e(a,{json:s,invocationCwd:r.invocationCwd??process.cwd(),...r.projectRoot?{projectRoot:r.projectRoot}:{}})}catch(l){c={exitCode:70,stderr:l instanceof Error?l.message:String(l),data:{issues:[Fu(l)]}}}return s?ky(t,c):c}async function Bu(t,e,n=process.argv.slice(2)){let r=await Cy(t,e,n);return r.stdout&&process.stdout.write(r.stdout),r.stderr&&process.stderr.write(r.stderr+(r.stderr.endsWith(`
156
169
  `)?"":`
157
- `)),c.exitCode}process.exitCode=await Cu("resume-probe",gu);
170
+ `)),r.exitCode}process.exitCode=await Bu("resume-probe",qu);