@rpamis/comet 0.4.0-beta.17 → 0.4.0-beta.18

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 (371) hide show
  1. package/README.md +49 -24
  2. package/assets/manifest.json +2 -1
  3. package/assets/skills/comet/scripts/comet-archive.mjs +128 -128
  4. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +78 -78
  5. package/assets/skills/comet/scripts/comet-guard.mjs +144 -144
  6. package/assets/skills/comet/scripts/comet-handoff.mjs +109 -109
  7. package/assets/skills/comet/scripts/comet-hook-guard.mjs +130 -130
  8. package/assets/skills/comet/scripts/comet-hook-router.mjs +115 -115
  9. package/assets/skills/comet/scripts/comet-resume-probe.mjs +85 -85
  10. package/assets/skills/comet/scripts/comet-runtime.mjs +188 -187
  11. package/assets/skills/comet/scripts/comet-state.mjs +117 -117
  12. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +71 -71
  13. package/assets/skills/comet-build/SKILL.md +15 -56
  14. package/assets/skills/comet-classic/SKILL.md +14 -8
  15. package/assets/skills/comet-classic/reference/comet-yaml-fields.md +1 -1
  16. package/assets/skills/comet-classic/reference/scripts.md +3 -1
  17. package/assets/skills/comet-classic/reference/workspace.md +23 -0
  18. package/assets/skills/comet-native/SKILL.md +13 -10
  19. package/assets/skills/comet-native/reference/artifacts.md +3 -2
  20. package/assets/skills/comet-native/reference/commands.md +1 -1
  21. package/assets/skills/comet-native/reference/recovery.md +1 -1
  22. package/assets/skills/comet-native/reference/workspace.md +4 -4
  23. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +97 -97
  24. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +146 -146
  25. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +100 -100
  26. package/assets/skills/comet-native/scripts/comet-native-init.mjs +85 -85
  27. package/assets/skills/comet-native/scripts/comet-native-new.mjs +115 -115
  28. package/assets/skills/comet-native/scripts/comet-native-next.mjs +118 -118
  29. package/assets/skills/comet-native/scripts/comet-native-root.mjs +107 -107
  30. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +154 -154
  31. package/assets/skills/comet-native/scripts/comet-native-select.mjs +133 -133
  32. package/assets/skills/comet-native/scripts/comet-native-show.mjs +109 -109
  33. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +87 -87
  34. package/assets/skills/comet-native/scripts/comet-native-status.mjs +109 -109
  35. package/assets/skills/comet-open/SKILL.md +24 -5
  36. package/assets/skills-zh/comet-build/SKILL.md +15 -56
  37. package/assets/skills-zh/comet-classic/SKILL.md +14 -8
  38. package/assets/skills-zh/comet-classic/reference/comet-yaml-fields.md +1 -1
  39. package/assets/skills-zh/comet-classic/reference/scripts.md +3 -1
  40. package/assets/skills-zh/comet-classic/reference/workspace.md +23 -0
  41. package/assets/skills-zh/comet-native/SKILL.md +13 -10
  42. package/assets/skills-zh/comet-native/reference/artifacts.md +3 -2
  43. package/assets/skills-zh/comet-native/reference/commands.md +1 -1
  44. package/assets/skills-zh/comet-native/reference/recovery.md +1 -1
  45. package/assets/skills-zh/comet-native/reference/workspace.md +4 -4
  46. package/assets/skills-zh/comet-open/SKILL.md +24 -5
  47. package/dist/app/cli/index.js +20 -1
  48. package/dist/app/cli/index.js.map +1 -1
  49. package/dist/app/commands/classic.d.ts.map +1 -1
  50. package/dist/app/commands/classic.js +2 -0
  51. package/dist/app/commands/classic.js.map +1 -1
  52. package/dist/app/commands/eval.d.ts +9 -2
  53. package/dist/app/commands/eval.d.ts.map +1 -1
  54. package/dist/app/commands/eval.js +293 -48
  55. package/dist/app/commands/eval.js.map +1 -1
  56. package/dist/app/commands/init.d.ts.map +1 -1
  57. package/dist/app/commands/init.js +2 -1
  58. package/dist/app/commands/init.js.map +1 -1
  59. package/dist/app/commands/update.d.ts.map +1 -1
  60. package/dist/app/commands/update.js +4 -1
  61. package/dist/app/commands/update.js.map +1 -1
  62. package/dist/domains/comet-classic/classic-cli.d.ts +1 -1
  63. package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
  64. package/dist/domains/comet-classic/classic-cli.js +3 -0
  65. package/dist/domains/comet-classic/classic-cli.js.map +1 -1
  66. package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
  67. package/dist/domains/comet-classic/classic-current-change.js +29 -3
  68. package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
  69. package/dist/domains/comet-classic/classic-guard.js +2 -2
  70. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  71. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  72. package/dist/domains/comet-classic/classic-hook-guard.js +14 -1
  73. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  74. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  75. package/dist/domains/comet-classic/classic-state-command.js +31 -8
  76. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  77. package/dist/domains/comet-classic/classic-workspace-command.d.ts +3 -0
  78. package/dist/domains/comet-classic/classic-workspace-command.d.ts.map +1 -0
  79. package/dist/domains/comet-classic/classic-workspace-command.js +45 -0
  80. package/dist/domains/comet-classic/classic-workspace-command.js.map +1 -0
  81. package/dist/domains/comet-classic/classic-workspace.d.ts +38 -0
  82. package/dist/domains/comet-classic/classic-workspace.d.ts.map +1 -0
  83. package/dist/domains/comet-classic/classic-workspace.js +315 -0
  84. package/dist/domains/comet-classic/classic-workspace.js.map +1 -0
  85. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  86. package/dist/domains/comet-entry/hook-adapter.js +1 -0
  87. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  88. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -0
  89. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  90. package/dist/domains/comet-entry/hook-router-entry.js +21 -1
  91. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  92. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  93. package/dist/domains/comet-entry/init-workflow.js +13 -5
  94. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  95. package/dist/domains/comet-native/index.d.ts +1 -0
  96. package/dist/domains/comet-native/index.d.ts.map +1 -1
  97. package/dist/domains/comet-native/index.js +1 -0
  98. package/dist/domains/comet-native/index.js.map +1 -1
  99. package/dist/domains/comet-native/native-children.d.ts +49 -0
  100. package/dist/domains/comet-native/native-children.d.ts.map +1 -0
  101. package/dist/domains/comet-native/native-children.js +388 -0
  102. package/dist/domains/comet-native/native-children.js.map +1 -0
  103. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
  104. package/dist/domains/comet-native/native-cli-help.js +3 -3
  105. package/dist/domains/comet-native/native-cli-help.js.map +1 -1
  106. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  107. package/dist/domains/comet-native/native-doctor-command.js +10 -5
  108. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  109. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  110. package/dist/domains/comet-native/native-hook-guard.js +41 -2
  111. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  112. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  113. package/dist/domains/comet-native/native-next-command.js +85 -5
  114. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  115. package/dist/domains/comet-native/native-portable-continuation.d.ts +3 -2
  116. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
  117. package/dist/domains/comet-native/native-portable-continuation.js +63 -1
  118. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
  119. package/dist/domains/comet-native/native-portable-runtime.d.ts +5 -0
  120. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-portable-runtime.js +110 -4
  122. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -1
  123. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
  124. package/dist/domains/comet-native/native-portable-state.js +13 -0
  125. package/dist/domains/comet-native/native-portable-state.js.map +1 -1
  126. package/dist/domains/comet-native/native-portable-status.d.ts +3 -0
  127. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -1
  128. package/dist/domains/comet-native/native-portable-status.js +9 -1
  129. package/dist/domains/comet-native/native-portable-status.js.map +1 -1
  130. package/dist/domains/comet-native/native-portable-types.d.ts +1 -0
  131. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
  132. package/dist/domains/comet-native/native-portable-types.js.map +1 -1
  133. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
  134. package/dist/domains/comet-native/native-show-command.js +2 -1
  135. package/dist/domains/comet-native/native-show-command.js.map +1 -1
  136. package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -1
  137. package/dist/domains/comet-native/native-workspace-preparation.js +192 -133
  138. package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -1
  139. package/dist/domains/dashboard/collector.d.ts +1 -1
  140. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  141. package/dist/domains/dashboard/collector.js +102 -87
  142. package/dist/domains/dashboard/collector.js.map +1 -1
  143. package/dist/domains/dashboard/native-adapter.d.ts +20 -0
  144. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  145. package/dist/domains/dashboard/native-adapter.js +11 -0
  146. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  147. package/dist/domains/dashboard/native-collector.d.ts +1 -0
  148. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  149. package/dist/domains/dashboard/native-collector.js +304 -55
  150. package/dist/domains/dashboard/native-collector.js.map +1 -1
  151. package/dist/domains/dashboard/native-legacy-adapter.d.ts +12 -5
  152. package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -1
  153. package/dist/domains/dashboard/native-legacy-adapter.js +12 -0
  154. package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -1
  155. package/dist/domains/dashboard/server.d.ts.map +1 -1
  156. package/dist/domains/dashboard/server.js +5 -3
  157. package/dist/domains/dashboard/server.js.map +1 -1
  158. package/dist/domains/dashboard/types.d.ts +5 -0
  159. package/dist/domains/dashboard/types.d.ts.map +1 -1
  160. package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-B5cFR6hS.js +1 -0
  161. package/dist/domains/dashboard/web/assets/arc-CVQDtMsu.js +1 -0
  162. package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-C0v0kULK.js +36 -0
  163. package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-DpHLuxu4.js +132 -0
  164. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-BL17BIb8.js → c4Diagram-5PPSVZJV-BHnFxUs1.js} +1 -1
  165. package/dist/domains/dashboard/web/assets/channel-eM0x3m1G.js +1 -0
  166. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-XWLMOyd4.js → chunk-2GRJ4B5K-CGC9gh5n.js} +1 -1
  167. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-4drjXzHQ.js → chunk-2Q5K7J3B-l4puLU_O.js} +1 -1
  168. package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-ls9jQHZc.js +231 -0
  169. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-CQXqBSqQ.js → chunk-5VM5RSS4-BVavmTEq.js} +1 -1
  170. package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-Dungt2g9.js +88 -0
  171. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-pMreYMW7.js → chunk-GF5L2VYU-BidXO_ZP.js} +5 -5
  172. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-vQyyh3eG.js → chunk-JWPE2WC7-57L5Up5X.js} +1 -1
  173. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-B_DDS2IK.js → chunk-KBJHAD2P-C5u5vbwr.js} +1 -1
  174. package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-CvLz21I2.js +1 -0
  175. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-Cug8J1Qa.js → chunk-XXDRQBXY-D5nJpckG.js} +1 -1
  176. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-CEFhao2K.js +1 -0
  177. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-CEFhao2K.js +1 -0
  178. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-IQKP-hgj.js → cose-bilkent-JH36ORCC-Dp0JAGyE.js} +1 -1
  179. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-CvvRO4J2.js → cynefin-VYW2F7L2-EjC54l1g.js} +2 -2
  180. package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-CpYrW3w3.js +62 -0
  181. package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-h5K39rCk.js +4 -0
  182. package/dist/domains/dashboard/web/assets/{demo-CeIDHUFJ.js → demo-BfLsKrIL.js} +26 -5
  183. package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-CKQj9O4H.js +30 -0
  184. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-CN_LYqvT.js → diagram-B4RE2ZJO-DXRIYcnW.js} +3 -3
  185. package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-wWutQYmv.js +24 -0
  186. package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-EgXLJQYi.js +24 -0
  187. package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-CsQRXDQZ.js +41 -0
  188. package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-gm328Eho.js +1 -0
  189. package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-BbbMVUx_.js +85 -0
  190. package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-1Y7scCns.js +156 -0
  191. package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-BAoBqczv.js +292 -0
  192. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-CaWEk3PM.js → gitGraphDiagram-DS77QQ5N-CMUAyEzl.js} +3 -3
  193. package/dist/domains/dashboard/web/assets/{graph--OzhPTMs.js → graph-DOmOIIwC.js} +1 -1
  194. package/dist/domains/dashboard/web/assets/{index-BNyOfAhu.js → index-CCApJ0Yr.js} +1 -1
  195. package/dist/domains/dashboard/web/assets/index-DWdm_XBi.js +257 -0
  196. package/dist/domains/dashboard/web/assets/{index-BFwKBVTJ.css → index-DhhbseFJ.css} +1 -1
  197. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-BK07mNG0.js → infoDiagram-6WML65LV-BaCdtYYC.js} +1 -1
  198. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-mWnmaWfZ.js → ishikawaDiagram-WSZJBQD7-DQQlNnjU.js} +4 -4
  199. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-BPy-P7xx.js → journeyDiagram-NVQOT4AX-DW9wUMqn.js} +1 -1
  200. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-3Jq9c_lo.js → kanban-definition-27J2QSJJ-C_ITaZ0q.js} +7 -7
  201. package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +1 -0
  202. package/dist/domains/dashboard/web/assets/{linear-kQyEW-4G.js → linear-DXOo6ZRT.js} +1 -1
  203. package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +1 -0
  204. package/dist/domains/dashboard/web/assets/mermaid.core-ol-0NI97.js +306 -0
  205. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CyyurUpv.js → mindmap-definition-FAOFIHXS-CHF_HOLV.js} +1 -1
  206. package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-wQEvkNF8.js +1 -0
  207. package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-C3H3kiIP.js +39 -0
  208. package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +3 -0
  209. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CpayUMjH.js → quadrantDiagram-CIZ2JOQS-S0FdVzJb.js} +4 -4
  210. package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-DCDXDaVg.js +1 -0
  211. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-Bi8YpfnA.js → requirementDiagram-LRYGKXZP-BW8J4gO_.js} +1 -1
  212. package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-DQQBmLoy.js +40 -0
  213. package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-2tDcli0Y.js +162 -0
  214. package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-4sEZLBKb.js +1 -0
  215. package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-OgPb8pyR.js +1 -0
  216. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-CiDNPr4P.js +1 -0
  217. package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-DR7lwtxd.js +2 -0
  218. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-DggHFP9q.js +8 -0
  219. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-aHrrtV-b.js → timeline-definition-Z64GVDOM-DNIJVlQV.js} +4 -4
  220. package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-CClhw4QZ.js +34 -0
  221. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-RVQbcySh.js → wardleyDiagram-T6FBY63Y-DzR3aFPS.js} +3 -3
  222. package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DZhq0ZRj.js +7 -0
  223. package/dist/domains/dashboard/web/index.html +2 -2
  224. package/dist/domains/dashboard/workspace.d.ts +24 -0
  225. package/dist/domains/dashboard/workspace.d.ts.map +1 -0
  226. package/dist/domains/dashboard/workspace.js +87 -0
  227. package/dist/domains/dashboard/workspace.js.map +1 -0
  228. package/dist/domains/eval/index.d.ts +3 -0
  229. package/dist/domains/eval/index.d.ts.map +1 -1
  230. package/dist/domains/eval/index.js +3 -0
  231. package/dist/domains/eval/index.js.map +1 -1
  232. package/dist/domains/eval/standalone-context.d.ts +19 -0
  233. package/dist/domains/eval/standalone-context.d.ts.map +1 -0
  234. package/dist/domains/eval/standalone-context.js +107 -0
  235. package/dist/domains/eval/standalone-context.js.map +1 -0
  236. package/dist/domains/eval/standalone-static-collect.d.ts +22 -0
  237. package/dist/domains/eval/standalone-static-collect.d.ts.map +1 -0
  238. package/dist/domains/eval/standalone-static-collect.js +779 -0
  239. package/dist/domains/eval/standalone-static-collect.js.map +1 -0
  240. package/dist/domains/eval/user-environment.d.ts +6 -0
  241. package/dist/domains/eval/user-environment.d.ts.map +1 -0
  242. package/dist/domains/eval/user-environment.js +73 -0
  243. package/dist/domains/eval/user-environment.js.map +1 -0
  244. package/dist/domains/integrations/openspec.d.ts +1 -1
  245. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  246. package/dist/domains/integrations/openspec.js +110 -26
  247. package/dist/domains/integrations/openspec.js.map +1 -1
  248. package/dist/domains/integrations/superpowers.d.ts +5 -1
  249. package/dist/domains/integrations/superpowers.d.ts.map +1 -1
  250. package/dist/domains/integrations/superpowers.js +21 -2
  251. package/dist/domains/integrations/superpowers.js.map +1 -1
  252. package/dist/domains/skill/platform-install.d.ts +1 -1
  253. package/dist/domains/skill/platform-install.js +1 -1
  254. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  255. package/dist/domains/skill/project-instructions.js +5 -3
  256. package/dist/domains/skill/project-instructions.js.map +1 -1
  257. package/dist/domains/workflow-contract/hook-write-policy.d.ts +9 -0
  258. package/dist/domains/workflow-contract/hook-write-policy.d.ts.map +1 -0
  259. package/dist/domains/workflow-contract/hook-write-policy.js +52 -0
  260. package/dist/domains/workflow-contract/hook-write-policy.js.map +1 -0
  261. package/dist/domains/workflow-contract/index.d.ts +2 -0
  262. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  263. package/dist/domains/workflow-contract/index.js +1 -0
  264. package/dist/domains/workflow-contract/index.js.map +1 -1
  265. package/dist/domains/workflow-contract/project-config.d.ts +2 -2
  266. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  267. package/dist/domains/workflow-contract/project-config.js +42 -2
  268. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  269. package/dist/domains/workflow-contract/protected-project-path.d.ts +13 -0
  270. package/dist/domains/workflow-contract/protected-project-path.d.ts.map +1 -1
  271. package/dist/domains/workflow-contract/protected-project-path.js +83 -0
  272. package/dist/domains/workflow-contract/protected-project-path.js.map +1 -1
  273. package/dist/domains/workflow-contract/types.d.ts +4 -0
  274. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  275. package/dist/platform/install/platforms.d.ts.map +1 -1
  276. package/dist/platform/install/platforms.js +13 -2
  277. package/dist/platform/install/platforms.js.map +1 -1
  278. package/dist/platform/paths/git-worktree.d.ts +7 -1
  279. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  280. package/dist/platform/paths/git-worktree.js +28 -7
  281. package/dist/platform/paths/git-worktree.js.map +1 -1
  282. package/eval/.env.example +115 -0
  283. package/eval/README.md +237 -14
  284. package/eval/langfuse/.env.example +9 -0
  285. package/eval/langfuse/tests/conftest.py +146 -0
  286. package/eval/langfuse/tests/tasks/test_tasks.py +109 -0
  287. package/eval/langfuse/tests/test_adapter.py +272 -0
  288. package/eval/langsmith/.env.example +16 -0
  289. package/eval/langsmith/tests/conftest.py +10 -1
  290. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +4 -2
  291. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -2
  292. package/eval/local/tests/conftest.py +701 -80
  293. package/eval/local/tests/scaffold/fixtures/custom-agent/adapter.yaml +19 -0
  294. package/eval/local/tests/scaffold/test_agents.py +76 -0
  295. package/eval/local/tests/scaffold/test_aligned_comparison.py +70 -0
  296. package/eval/local/tests/scaffold/test_auto_tasks.py +350 -0
  297. package/eval/local/tests/scaffold/test_conftest_helpers.py +267 -18
  298. package/eval/local/tests/scaffold/test_custom_agents.py +174 -0
  299. package/eval/local/tests/scaffold/test_eval_context.py +217 -0
  300. package/eval/local/tests/scaffold/test_execution.py +364 -0
  301. package/eval/local/tests/scaffold/test_inline_tasks.py +56 -0
  302. package/eval/local/tests/scaffold/test_langfuse_trajectory.py +263 -0
  303. package/eval/local/tests/scaffold/test_langsmith_conftest.py +63 -0
  304. package/eval/local/tests/scaffold/test_logging.py +162 -0
  305. package/eval/local/tests/scaffold/test_manifest_tasks.py +76 -0
  306. package/eval/local/tests/scaffold/test_manifests.py +396 -0
  307. package/eval/local/tests/scaffold/test_native_aligned_eval.py +17 -0
  308. package/eval/local/tests/scaffold/test_profiles.py +64 -6
  309. package/eval/local/tests/scaffold/test_task_resolution.py +212 -0
  310. package/eval/local/tests/scaffold/test_utils.py +480 -4
  311. package/eval/local/tests/tasks/test_tasks.py +216 -14
  312. package/eval/pyproject.toml +5 -0
  313. package/eval/scaffold/__init__.py +6 -0
  314. package/eval/scaffold/docker/agent-overlay.Dockerfile +41 -0
  315. package/eval/scaffold/python/__init__.py +128 -20
  316. package/eval/scaffold/python/agents.py +239 -0
  317. package/eval/scaffold/python/aligned_comparison.py +156 -27
  318. package/eval/scaffold/python/auto_tasks.py +700 -0
  319. package/eval/scaffold/python/custom_agents.py +172 -0
  320. package/eval/scaffold/python/eval_context.py +236 -0
  321. package/eval/scaffold/python/eval_schema.py +135 -0
  322. package/eval/scaffold/python/execution.py +544 -0
  323. package/eval/scaffold/python/generated_task_cache.py +230 -0
  324. package/eval/scaffold/python/generic_llm_judge.py +41 -14
  325. package/eval/scaffold/python/inline_tasks.py +118 -0
  326. package/eval/scaffold/python/judge_config.py +158 -37
  327. package/eval/scaffold/python/langfuse_adapter.py +1023 -0
  328. package/eval/scaffold/python/llm_judge.py +68 -11
  329. package/eval/scaffold/python/logging.py +157 -17
  330. package/eval/scaffold/python/manifest_tasks.py +69 -0
  331. package/eval/scaffold/python/manifests.py +443 -22
  332. package/eval/scaffold/python/paths.py +11 -1
  333. package/eval/scaffold/python/task_resolution.py +176 -0
  334. package/eval/scaffold/python/tasks.py +17 -4
  335. package/eval/scaffold/python/utils.py +167 -11
  336. package/eval/scaffold/python/validation/core.py +48 -2
  337. package/eval/scaffold/python/validation/generic_rubric.py +9 -0
  338. package/eval/scaffold/python/validation/native_workflow.py +6 -1
  339. package/eval/scaffold/python/validation/rubric.py +16 -1
  340. package/eval/scaffold/shell/agent-runtime-config.sh +88 -0
  341. package/eval/scaffold/shell/docker.sh +534 -33
  342. package/eval/scaffold/shell/run-agent-runtime.sh +49 -0
  343. package/eval/scaffold/shell/run-claude-loop.sh +153 -14
  344. package/eval/schemas/comet.eval/v1alpha1.schema.json +244 -0
  345. package/package.json +8 -3
  346. package/dist/domains/dashboard/web/assets/arc-CkuYweSh.js +0 -1
  347. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR--tTGrKam.js +0 -36
  348. package/dist/domains/dashboard/web/assets/blockDiagram-GPEHLZMM-DLKYOixs.js +0 -132
  349. package/dist/domains/dashboard/web/assets/channel-Cg__FSMr.js +0 -1
  350. package/dist/domains/dashboard/web/assets/chunk-AQP2D5EJ-BUkV_rb7.js +0 -231
  351. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CsC-pvu9.js +0 -1
  352. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CsC-pvu9.js +0 -1
  353. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-DeOQo7bP.js +0 -4
  354. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-IQd_jQwB.js +0 -43
  355. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-Dllkdt0m.js +0 -10
  356. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-DK36WkNN.js +0 -24
  357. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-iqUnMYEh.js +0 -24
  358. package/dist/domains/dashboard/web/assets/erDiagram-TEJ5UH35-Bc64lzy8.js +0 -85
  359. package/dist/domains/dashboard/web/assets/flowDiagram-I6XJVG4X-UfOqef9j.js +0 -162
  360. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-D-u6Aauc.js +0 -292
  361. package/dist/domains/dashboard/web/assets/index-COZ_03uK.js +0 -257
  362. package/dist/domains/dashboard/web/assets/layout-SsrduOYp.js +0 -1
  363. package/dist/domains/dashboard/web/assets/mermaid.core-COBBjtVH.js +0 -301
  364. package/dist/domains/dashboard/web/assets/pieDiagram-4H26LBE5-CJro_XKk.js +0 -30
  365. package/dist/domains/dashboard/web/assets/purify.es-VaSPOPhr.js +0 -3
  366. package/dist/domains/dashboard/web/assets/sankeyDiagram-5OEKKPKP-Wx60WwHe.js +0 -40
  367. package/dist/domains/dashboard/web/assets/sequenceDiagram-3UESZ5HK-BiMsRFbc.js +0 -162
  368. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-BrURMY0R.js +0 -1
  369. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-BpEE-yEg.js +0 -1
  370. package/dist/domains/dashboard/web/assets/vennDiagram-CIIHVFJN-DGB16bvR.js +0 -34
  371. package/dist/domains/dashboard/web/assets/xychartDiagram-2RQKCTM6-DMzzwDVX.js +0 -7
@@ -1,77 +1,77 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Ku=Object.create;var or=Object.defineProperty;var Yu=Object.getOwnPropertyDescriptor;var Uu=Object.getOwnPropertyNames;var Ju=Object.getPrototypeOf,Vu=Object.prototype.hasOwnProperty;var kn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var M=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Hu=(t,e)=>{for(var n in e)or(t,n,{get:e[n],enumerable:!0})},Gu=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Uu(e))!Vu.call(t,r)&&r!==n&&or(t,r,{get:()=>e[r],enumerable:!(i=Yu(e,r))||i.enumerable});return t};var nt=(t,e,n)=>(n=t!=null?Ku(Ju(t)):{},Gu(e||!t||!t.__esModule?or(n,"default",{value:t,enumerable:!0}):n,t));var _=v(W=>{"use strict";var ar=Symbol.for("yaml.alias"),Po=Symbol.for("yaml.document"),Sn=Symbol.for("yaml.map"),Ro=Symbol.for("yaml.pair"),cr=Symbol.for("yaml.scalar"),Cn=Symbol.for("yaml.seq"),he=Symbol.for("yaml.node.type"),Zu=t=>!!t&&typeof t=="object"&&t[he]===ar,ef=t=>!!t&&typeof t=="object"&&t[he]===Po,tf=t=>!!t&&typeof t=="object"&&t[he]===Sn,nf=t=>!!t&&typeof t=="object"&&t[he]===Ro,Oo=t=>!!t&&typeof t=="object"&&t[he]===cr,rf=t=>!!t&&typeof t=="object"&&t[he]===Cn;function Ao(t){if(t&&typeof t=="object")switch(t[he]){case Sn:case Cn:return!0}return!1}function sf(t){if(t&&typeof t=="object")switch(t[he]){case ar:case Sn:case cr:case Cn:return!0}return!1}var of=t=>(Oo(t)||Ao(t))&&!!t.anchor;W.ALIAS=ar;W.DOC=Po;W.MAP=Sn;W.NODE_TYPE=he;W.PAIR=Ro;W.SCALAR=cr;W.SEQ=Cn;W.hasAnchor=of;W.isAlias=Zu;W.isCollection=Ao;W.isDocument=ef;W.isMap=tf;W.isNode=sf;W.isPair=nf;W.isScalar=Oo;W.isSeq=rf});var St=v(lr=>{"use strict";var L=_(),J=Symbol("break visit"),No=Symbol("skip children"),ue=Symbol("remove node");function En(t,e){let n=To(e);L.isDocument(t)?it(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):it(null,t,n,Object.freeze([]))}En.BREAK=J;En.SKIP=No;En.REMOVE=ue;function it(t,e,n,i){let r=jo(t,e,n,i);if(L.isNode(r)||L.isPair(r))return Io(t,i,r),it(t,r,n,i);if(typeof r!="symbol"){if(L.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=it(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===J)return J;o===ue&&(e.items.splice(s,1),s-=1)}}}else if(L.isPair(e)){i=Object.freeze(i.concat(e));let s=it("key",e.key,n,i);if(s===J)return J;s===ue&&(e.key=null);let o=it("value",e.value,n,i);if(o===J)return J;o===ue&&(e.value=null)}}return r}async function xn(t,e){let n=To(e);L.isDocument(t)?await rt(null,t.contents,n,Object.freeze([t]))===ue&&(t.contents=null):await rt(null,t,n,Object.freeze([]))}xn.BREAK=J;xn.SKIP=No;xn.REMOVE=ue;async function rt(t,e,n,i){let r=await jo(t,e,n,i);if(L.isNode(r)||L.isPair(r))return Io(t,i,r),rt(t,r,n,i);if(typeof r!="symbol"){if(L.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await rt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===J)return J;o===ue&&(e.items.splice(s,1),s-=1)}}}else if(L.isPair(e)){i=Object.freeze(i.concat(e));let s=await rt("key",e.key,n,i);if(s===J)return J;s===ue&&(e.key=null);let o=await rt("value",e.value,n,i);if(o===J)return J;o===ue&&(e.value=null)}}return r}function To(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function jo(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(L.isMap(e))return n.Map?.(t,e,i);if(L.isSeq(e))return n.Seq?.(t,e,i);if(L.isPair(e))return n.Pair?.(t,e,i);if(L.isScalar(e))return n.Scalar?.(t,e,i);if(L.isAlias(e))return n.Alias?.(t,e,i)}function Io(t,e,n){let i=e[e.length-1];if(L.isCollection(i))i.items[t]=n;else if(L.isPair(i))t==="key"?i.key=n:i.value=n;else if(L.isDocument(i))i.contents=n;else{let r=L.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}lr.visit=En;lr.visitAsync=xn});var ur=v(qo=>{"use strict";var $o=_(),af=St(),cf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lf=t=>t.replace(/[!,[\]{}]/g,e=>cf[e]),Ct=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[s,o]=i;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=i;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let s=this.tags[i];if(s)try{return s+decodeURIComponent(r)}catch(o){return n(String(o)),null}return i==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,i]of Object.entries(this.tags))if(e.startsWith(i))return n+lf(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&$o.isNode(e.contents)){let s={};af.visit(e.contents,(o,a)=>{$o.isNode(a)&&a.tag&&(s[a.tag]=!0)}),r=Object.keys(s)}else r=[];for(let[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
5
- `)}};Ct.defaultYaml={explicit:!1,version:"1.2"};Ct.defaultTags={"!!":"tag:yaml.org,2002:"};qo.Directives=Ct});var _n=v(Et=>{"use strict";var Lo=_(),uf=St();function ff(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function Do(t){let e=new Set;return uf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Fo(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function df(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=Do(t));let o=Fo(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(Lo.isScalar(o.node)||Lo.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:i}}Et.anchorIsValid=ff;Et.anchorNames=Do;Et.createNodeAnchors=df;Et.findNewAnchor=Fo});var fr=v(Mo=>{"use strict";function xt(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r){let o=i[r],a=xt(t,i,String(r),o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let s=i.get(r),o=xt(t,i,r,s);o===void 0?i.delete(r):o!==s&&i.set(r,o)}else if(i instanceof Set)for(let r of Array.from(i)){let s=xt(t,i,r,r);s===void 0?i.delete(r):s!==r&&(i.delete(r),i.add(s))}else for(let[r,s]of Object.entries(i)){let o=xt(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}Mo.applyReviver=xt});var Ee=v(Bo=>{"use strict";var pf=_();function Wo(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Wo(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!pf.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=s=>{i.res=s,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}Bo.toJS=Wo});var Pn=v(Yo=>{"use strict";var mf=fr(),Ko=_(),hf=Ee(),dr=class{constructor(e){Object.defineProperty(this,Ko.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:s}={}){if(!Ko.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=hf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?mf.applyReviver(s,{"":a},"",a):a}};Yo.NodeBase=dr});var _t=v(Uo=>{"use strict";var gf=_n(),wf=St(),st=_(),yf=Pn(),vf=Ee(),pr=class extends yf.NodeBase{constructor(e){super(st.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],wf.visit(e,{Node:(s,o)=>{(st.isAlias(o)||st.hasAnchor(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let r;for(let s of i){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:s}=n,o=this.resolve(r,n);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(o);if(a||(vf.toJS(o,null,n),a=i.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Rn(r,o,i)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,i){let r=`*${this.source}`;if(e){if(gf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${r} `}return r}};function Rn(t,e,n){if(st.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(st.isCollection(e)){let i=0;for(let r of e.items){let s=Rn(t,r,n);s>i&&(i=s)}return i}else if(st.isPair(e)){let i=Rn(t,e.key,n),r=Rn(t,e.value,n);return Math.max(i,r)}return 1}Uo.Alias=pr});var j=v(mr=>{"use strict";var bf=_(),kf=Pn(),Sf=Ee(),Cf=t=>!t||typeof t!="function"&&typeof t!="object",xe=class extends kf.NodeBase{constructor(e){super(bf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Sf.toJS(this.value,e,n)}toString(){return String(this.value)}};xe.BLOCK_FOLDED="BLOCK_FOLDED";xe.BLOCK_LITERAL="BLOCK_LITERAL";xe.PLAIN="PLAIN";xe.QUOTE_DOUBLE="QUOTE_DOUBLE";xe.QUOTE_SINGLE="QUOTE_SINGLE";mr.Scalar=xe;mr.isScalarValue=Cf});var Pt=v(Vo=>{"use strict";var Ef=_t(),Ue=_(),Jo=j(),xf="tag:yaml.org,2002:";function _f(t,e,n){if(e){let i=n.filter(s=>s.tag===e),r=i.find(s=>!s.format)??i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(i=>i.identify?.(t)&&!i.format)}function Pf(t,e,n){if(Ue.isDocument(t)&&(t=t.contents),Ue.isNode(t))return t;if(Ue.isPair(t)){let u=n.schema[Ue.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:s,schema:o,sourceObjects:a}=n,c;if(i&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=r(t)),new Ef.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=xf+e.slice(2));let l=_f(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Jo.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Ue.MAP]:Symbol.iterator in Object(t)?o[Ue.SEQ]:o[Ue.MAP]}s&&(s(l),delete n.onTagObj);let f=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new Jo.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Vo.createNode=Pf});var An=v(On=>{"use strict";var Rf=Pt(),fe=_(),Of=Pn();function hr(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let s=e[r];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=i,i=o}else i=new Map([[s,i]])}return Rf.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Ho=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,gr=class extends Of.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(i=>fe.isNode(i)||fe.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Ho(e))this.add(n);else{let[i,...r]=e,s=this.get(i,!0);if(fe.isCollection(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,hr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(e){let[n,...i]=e;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(fe.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,s=this.get(i,!0);return r.length===0?!n&&fe.isScalar(s)?s.value:s:fe.isCollection(s)?s.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!fe.isPair(n))return!1;let i=n.value;return i==null||e&&fe.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[n,...i]=e;if(i.length===0)return this.has(n);let r=this.get(n,!0);return fe.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let s=this.get(i,!0);if(fe.isCollection(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,hr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};On.Collection=gr;On.collectionFromPath=hr;On.isEmptyPath=Ho});var Rt=v(Nn=>{"use strict";var Af=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function wr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Nf=(t,e,n)=>t.endsWith(`
6
- `)?wr(n,e):n.includes(`
4
+ var Ju=Object.create;var li=Object.defineProperty;var Hu=Object.getOwnPropertyDescriptor;var Gu=Object.getOwnPropertyNames;var Vu=Object.getPrototypeOf,zu=Object.prototype.hasOwnProperty;var br=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var q=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Qu=(t,e)=>{for(var r in e)li(t,r,{get:e[r],enumerable:!0})},Xu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Gu(e))!zu.call(t,i)&&i!==r&&li(t,i,{get:()=>e[i],enumerable:!(n=Hu(e,i))||n.enumerable});return t};var Je=(t,e,r)=>(r=t!=null?Ju(Vu(t)):{},Xu(e||!t||!t.__esModule?li(r,"default",{value:t,enumerable:!0}):r,t));var P=v(M=>{"use strict";var ui=Symbol.for("yaml.alias"),As=Symbol.for("yaml.document"),Sr=Symbol.for("yaml.map"),Ns=Symbol.for("yaml.pair"),fi=Symbol.for("yaml.scalar"),Cr=Symbol.for("yaml.seq"),he=Symbol.for("yaml.node.type"),rf=t=>!!t&&typeof t=="object"&&t[he]===ui,nf=t=>!!t&&typeof t=="object"&&t[he]===As,of=t=>!!t&&typeof t=="object"&&t[he]===Sr,sf=t=>!!t&&typeof t=="object"&&t[he]===Ns,Ts=t=>!!t&&typeof t=="object"&&t[he]===fi,af=t=>!!t&&typeof t=="object"&&t[he]===Cr;function js(t){if(t&&typeof t=="object")switch(t[he]){case Sr:case Cr:return!0}return!1}function cf(t){if(t&&typeof t=="object")switch(t[he]){case ui:case Sr:case fi:case Cr:return!0}return!1}var lf=t=>(Ts(t)||js(t))&&!!t.anchor;M.ALIAS=ui;M.DOC=As;M.MAP=Sr;M.NODE_TYPE=he;M.PAIR=Ns;M.SCALAR=fi;M.SEQ=Cr;M.hasAnchor=lf;M.isAlias=rf;M.isCollection=js;M.isDocument=nf;M.isMap=of;M.isNode=cf;M.isPair=sf;M.isScalar=Ts;M.isSeq=af});var Pt=v(di=>{"use strict";var W=P(),J=Symbol("break visit"),Is=Symbol("skip children"),ue=Symbol("remove node");function Er(t,e){let r=$s(e);W.isDocument(t)?nt(null,t.contents,r,Object.freeze([t]))===ue&&(t.contents=null):nt(null,t,r,Object.freeze([]))}Er.BREAK=J;Er.SKIP=Is;Er.REMOVE=ue;function nt(t,e,r,n){let i=Ls(t,e,r,n);if(W.isNode(i)||W.isPair(i))return qs(t,n,i),nt(t,i,r,n);if(typeof i!="symbol"){if(W.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let s=nt(o,e.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===J)return J;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(W.isPair(e)){n=Object.freeze(n.concat(e));let o=nt("key",e.key,r,n);if(o===J)return J;o===ue&&(e.key=null);let s=nt("value",e.value,r,n);if(s===J)return J;s===ue&&(e.value=null)}}return i}async function xr(t,e){let r=$s(e);W.isDocument(t)?await it(null,t.contents,r,Object.freeze([t]))===ue&&(t.contents=null):await it(null,t,r,Object.freeze([]))}xr.BREAK=J;xr.SKIP=Is;xr.REMOVE=ue;async function it(t,e,r,n){let i=await Ls(t,e,r,n);if(W.isNode(i)||W.isPair(i))return qs(t,n,i),it(t,i,r,n);if(typeof i!="symbol"){if(W.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let s=await it(o,e.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===J)return J;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(W.isPair(e)){n=Object.freeze(n.concat(e));let o=await it("key",e.key,r,n);if(o===J)return J;o===ue&&(e.key=null);let s=await it("value",e.value,r,n);if(s===J)return J;s===ue&&(e.value=null)}}return i}function $s(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 Ls(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(W.isMap(e))return r.Map?.(t,e,n);if(W.isSeq(e))return r.Seq?.(t,e,n);if(W.isPair(e))return r.Pair?.(t,e,n);if(W.isScalar(e))return r.Scalar?.(t,e,n);if(W.isAlias(e))return r.Alias?.(t,e,n)}function qs(t,e,r){let n=e[e.length-1];if(W.isCollection(n))n.items[t]=r;else if(W.isPair(n))t==="key"?n.key=r:n.value=r;else if(W.isDocument(n))n.contents=r;else{let i=W.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}di.visit=Er;di.visitAsync=xr});var pi=v(Ds=>{"use strict";var Ws=P(),uf=Pt(),ff={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},df=t=>t.replace(/[!,[\]{}]/g,e=>ff[e]),_t=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+df(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&Ws.isNode(e.contents)){let o={};uf.visit(e.contents,(s,a)=>{Ws.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(`
5
+ `)}};_t.defaultYaml={explicit:!1,version:"1.2"};_t.defaultTags={"!!":"tag:yaml.org,2002:"};Ds.Directives=_t});var Pr=v(Rt=>{"use strict";var Fs=P(),pf=Pt();function mf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function Ms(t){let e=new Set;return pf.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function Bs(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function hf(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Ms(t));let s=Bs(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.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:n}}Rt.anchorIsValid=mf;Rt.anchorNames=Ms;Rt.createNodeAnchors=hf;Rt.findNewAnchor=Bs});var mi=v(Ks=>{"use strict";function Ot(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i<o;++i){let s=n[i],a=Ot(t,n,String(i),s);a===void 0?delete n[i]:a!==s&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let o=n.get(i),s=Ot(t,n,i,o);s===void 0?n.delete(i):s!==o&&n.set(i,s)}else if(n instanceof Set)for(let i of Array.from(n)){let o=Ot(t,n,i,i);o===void 0?n.delete(i):o!==i&&(n.delete(i),n.add(o))}else for(let[i,o]of Object.entries(n)){let s=Ot(t,n,i,o);s===void 0?delete n[i]:s!==o&&(n[i]=s)}return t.call(e,r,n)}Ks.applyReviver=Ot});var xe=v(Ys=>{"use strict";var gf=P();function Us(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Us(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!gf.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}Ys.toJS=Us});var _r=v(Hs=>{"use strict";var wf=mi(),Js=P(),yf=xe(),hi=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:r,maxAliasCount:n,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:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=yf.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?wf.applyReviver(o,{"":a},"",a):a}};Hs.NodeBase=hi});var At=v(Gs=>{"use strict";var vf=Pr(),kf=Pt(),ot=P(),bf=_r(),Sf=xe(),gi=class extends bf.NodeBase{constructor(e){super(ot.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],kf.visit(e,{Node:(o,s)=>{(ot.isAlias(s)||ot.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(Sf.toJS(s,null,r),a=n.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=Rr(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(vf.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 Rr(t,e,r){if(ot.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(ot.isCollection(e)){let n=0;for(let i of e.items){let o=Rr(t,i,r);o>n&&(n=o)}return n}else if(ot.isPair(e)){let n=Rr(t,e.key,r),i=Rr(t,e.value,r);return Math.max(n,i)}return 1}Gs.Alias=gi});var j=v(wi=>{"use strict";var Cf=P(),Ef=_r(),xf=xe(),Pf=t=>!t||typeof t!="function"&&typeof t!="object",Pe=class extends Ef.NodeBase{constructor(e){super(Cf.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:xf.toJS(this.value,e,r)}toString(){return String(this.value)}};Pe.BLOCK_FOLDED="BLOCK_FOLDED";Pe.BLOCK_LITERAL="BLOCK_LITERAL";Pe.PLAIN="PLAIN";Pe.QUOTE_DOUBLE="QUOTE_DOUBLE";Pe.QUOTE_SINGLE="QUOTE_SINGLE";wi.Scalar=Pe;wi.isScalarValue=Pf});var Nt=v(zs=>{"use strict";var _f=At(),He=P(),Vs=j(),Rf="tag:yaml.org,2002:";function Of(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Af(t,e,r){if(He.isDocument(t)&&(t=t.contents),He.isNode(t))return t;if(He.isPair(t)){let u=r.schema[He.MAP].createNode?.(r.schema,null,r);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new _f.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Rf+e.slice(2));let l=Of(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Vs.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?s[He.MAP]:Symbol.iterator in Object(t)?s[He.SEQ]:s[He.MAP]}o&&(o(l),delete r.onTagObj);let f=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Vs.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}zs.createNode=Af});var Ar=v(Or=>{"use strict";var Nf=Nt(),fe=P(),Tf=_r();function yi(t,e,r){let n=r;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]=n,n=s}else n=new Map([[o,n]])}return Nf.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Qs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,vi=class extends Tf.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>fe.isNode(n)||fe.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Qs(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(fe.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,yi(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(fe.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&fe.isScalar(o)?o.value:o:fe.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!fe.isPair(r))return!1;let n=r.value;return n==null||e&&fe.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return fe.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(fe.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,yi(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Or.Collection=vi;Or.collectionFromPath=yi;Or.isEmptyPath=Qs});var Tt=v(Nr=>{"use strict";var jf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function ki(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var If=(t,e,r)=>t.endsWith(`
6
+ `)?ki(r,e):r.includes(`
7
7
  `)?`
8
- `+wr(n,e):(t.endsWith(" ")?"":" ")+n;Nn.indentComment=wr;Nn.lineComment=Nf;Nn.stringifyComment=Af});var zo=v(Ot=>{"use strict";var Tf="flow",yr="block",Tn="quoted";function jf(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return t;r<s&&(s=0);let c=Math.max(1+s,1+r-e.length);if(t.length<=c)return t;let l=[],f={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,s)?l.push(0):u=r-i);let d,h,g=!1,p=-1,m=-1,w=-1;n===yr&&(p=Go(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(n===Tn&&S==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(S===`
9
- `)n===yr&&(p=Go(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
10
- `&&h!==" "){let k=t[p+1];k&&k!==" "&&k!==`
11
- `&&k!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===Tn){for(;h===" "||h===" ";)h=S,S=t[p+=1],g=!0;let k=p>w+1?p-2:m-1;if(f[k])return t;l.push(k),f[k]=!0,u=k+c,d=void 0}else g=!0}h=S}if(g&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let k=l[S],C=l[S+1]||t.length;k===0?y=`
12
- ${e}${t.slice(0,C)}`:(n===Tn&&f[k]&&(y+=`${t[k]}\\`),y+=`
13
- ${e}${t.slice(k+1,C)}`)}return y}function Go(t,e,n){let i=e,r=e+1,s=t[r];for(;s===" "||s===" ";)if(e<r+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
14
- `);i=e,r=e+1,s=t[r]}return i}Ot.FOLD_BLOCK=yr;Ot.FOLD_FLOW=Tf;Ot.FOLD_QUOTED=Tn;Ot.foldFlowLines=jf});var Nt=v(Qo=>{"use strict";var se=j(),_e=zo(),In=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),$n=t=>/^(%|---|\.\.\.)/m.test(t);function If(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let s=0,o=0;s<r;++s)if(t[s]===`
15
- `){if(s-o>i)return!0;if(o=s+1,r-o<=i)return!1}return!0}function At(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||($n(t)?" ":""),o="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let f=n.substr(c+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||n[c+2]==='"'||n.length<r)c+=1;else{for(o+=n.slice(a,c)+`
8
+ `+ki(r,e):(t.endsWith(" ")?"":" ")+r;Nr.indentComment=ki;Nr.lineComment=If;Nr.stringifyComment=jf});var Zs=v(jt=>{"use strict";var $f="flow",bi="block",Tr="quoted";function Lf(t,e,r="flow",{indentAtStart:n,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=[],f={},u=i-e.length;typeof n=="number"&&(n>i-Math.max(2,o)?l.push(0):u=i-n);let d,h,g=!1,p=-1,m=-1,w=-1;r===bi&&(p=Xs(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(r===Tr&&S==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(S===`
9
+ `)r===bi&&(p=Xs(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
10
+ `&&h!==" "){let b=t[p+1];b&&b!==" "&&b!==`
11
+ `&&b!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(r===Tr){for(;h===" "||h===" ";)h=S,S=t[p+=1],g=!0;let b=p>w+1?p-2:m-1;if(f[b])return t;l.push(b),f[b]=!0,u=b+c,d=void 0}else g=!0}h=S}if(g&&a&&a(),l.length===0)return t;s&&s();let y=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let b=l[S],C=l[S+1]||t.length;b===0?y=`
12
+ ${e}${t.slice(0,C)}`:(r===Tr&&f[b]&&(y+=`${t[b]}\\`),y+=`
13
+ ${e}${t.slice(b+1,C)}`)}return y}function Xs(t,e,r){let n=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+r)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
+ `);n=e,i=e+1,o=t[i]}return n}jt.FOLD_BLOCK=bi;jt.FOLD_FLOW=$f;jt.FOLD_QUOTED=Tr;jt.foldFlowLines=Lf});var $t=v(ea=>{"use strict";var oe=j(),_e=Zs(),Ir=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),$r=t=>/^(%|---|\.\.\.)/m.test(t);function qf(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
15
+ `){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function It(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||($r(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let f=r.substr(c+2,4);switch(f){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:f.substr(0,2)==="00"?s+="\\x"+f.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<i)c+=1;else{for(s+=r.slice(a,c)+`
16
16
 
17
- `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
18
- `,c+=2;o+=s,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,i?o:_e.foldFlowLines(o,s,_e.FOLD_QUOTED,In(e,!1))}function vr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return At(t,e);let n=e.indent||($n(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?i:_e.foldFlowLines(i,n,_e.FOLD_FLOW,In(e,!1))}function ot(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=At;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=vr:s&&!r?i=At:i=n?vr:At}return i(t,e)}var br;try{br=new RegExp(`(^|(?<!
17
+ `;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)s+=`
18
+ `,c+=2;s+=o,r[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+r.slice(a):r,n?s:_e.foldFlowLines(s,o,_e.FOLD_QUOTED,Ir(e,!1))}function Si(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return It(t,e);let r=e.indent||($r(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${r}`)+"'";return e.implicitKey?n:_e.foldFlowLines(n,r,_e.FOLD_FLOW,Ir(e,!1))}function st(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=It;else{let i=t.includes('"'),o=t.includes("'");i&&!o?n=Si:o&&!i?n=It:n=r?Si:It}return n(t,e)}var Ci;try{Ci=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{br=/\n+(?!\n|$)/g}function jn({comment:t,type:e,value:n},i,r,s){let{blockQuote:o,commentString:a,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(n))return ot(n,i);let l=i.indent||(i.forceBlockIndent||$n(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===se.Scalar.BLOCK_FOLDED?!1:e===se.Scalar.BLOCK_LITERAL?!0:!If(n,c,l.length);if(!n)return f?`|
23
+ |$)`,"g")}catch{Ci=/\n+(?!\n|$)/g}function jr({comment:t,type:e,value:r},n,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=n.options;if(!s||/\n[\t ]+$/.test(r))return st(r,n);let l=n.indent||(n.forceBlockIndent||$r(r)?" ":""),f=s==="literal"?!0:s==="folded"||e===oe.Scalar.BLOCK_FOLDED?!1:e===oe.Scalar.BLOCK_LITERAL?!0:!qf(r,c,l.length);if(!r)return f?`|
24
24
  `:`>
25
- `;let u,d;for(d=n.length;d>0;--d){let C=n[d-1];if(C!==`
26
- `&&C!==" "&&C!==" ")break}let h=n.substring(d),g=h.indexOf(`
27
- `);g===-1?u="-":n===h||g!==h.length-1?(u="+",s&&s()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
28
- `&&(h=h.slice(0,-1)),h=h.replace(br,`$&${l}`));let p=!1,m,w=-1;for(m=0;m<n.length;++m){let C=n[m];if(C===" ")p=!0;else if(C===`
29
- `)w=m;else break}let y=n.substring(0,w<m?w+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let k=(p?l?"2":"1":"")+u;if(t&&(k+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!f){let C=n.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,R=In(i,!0);o!=="folded"&&e!==se.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{E=!0});let b=_e.foldFlowLines(`${y}${C}${h}`,l,_e.FOLD_BLOCK,R);if(!E)return`>${k}
31
- ${l}${b}`}return n=n.replace(/\n+/g,`$&${l}`),`|${k}
32
- ${l}${y}${n}${h}`}function $f(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&s.includes(`
33
- `)||f&&/[[\]{},]/.test(s))return ot(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(`
34
- `)?ot(s,e):jn(t,e,n,i);if(!a&&!f&&r!==se.Scalar.PLAIN&&s.includes(`
35
- `))return jn(t,e,n,i);if($n(s)){if(c==="")return e.forceBlockIndent=!0,jn(t,e,n,i);if(a&&c===l)return ot(s,e)}let u=s.replace(/\n+/g,`$&
36
- ${c}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return ot(s,e)}return a?u:_e.foldFlowLines(u,c,_e.FOLD_FLOW,In(e,!1))}function qf(t,e,n,i){let{implicitKey:r,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==se.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=se.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case se.Scalar.BLOCK_FOLDED:case se.Scalar.BLOCK_LITERAL:return r||s?ot(o.value,e):jn(o,e,n,i);case se.Scalar.QUOTE_DOUBLE:return At(o.value,e);case se.Scalar.QUOTE_SINGLE:return vr(o.value,e);case se.Scalar.PLAIN:return $f(o,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=r&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Qo.stringifyString=qf});var Tt=v(kr=>{"use strict";var Lf=_n(),Pe=_(),Df=Rt(),Ff=Nt();function Mf(t,e){let n=Object.assign({blockQuote:!0,commentString:Df.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function Wf(t,e){if(e.tag){let r=t.filter(s=>s.tag===e.tag);if(r.length>0)return r.find(s=>s.format===e.format)??r[0]}let n,i;if(Pe.isScalar(e)){i=e.value;let r=t.filter(s=>s.identify?.(i));if(r.length>1){let s=r.filter(o=>o.test);s.length>0&&(r=s)}n=r.find(s=>s.format===e.format)??r.find(s=>!s.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function Bf(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(Pe.isScalar(t)||Pe.isCollection(t))&&t.anchor;s&&Lf.anchorIsValid(s)&&(n.add(s),r.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(i.directives.tagString(o)),r.join(" ")}function Kf(t,e,n,i){if(Pe.isPair(t))return t.toString(e,n,i);if(Pe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,s=Pe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Wf(e.doc.schema.tags,s));let o=Bf(s,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(s,e,n,i):Pe.isScalar(s)?Ff.stringifyString(s,e,n,i):s.toString(e,n,i);return o?Pe.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
- ${e.indent}${a}`:a}kr.createStringifyContext=Mf;kr.stringify=Kf});var ta=v(ea=>{"use strict";var ge=_(),Xo=j(),Zo=Tt(),jt=Rt();function Yf({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=ge.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===Xo.Scalar.BLOCK_FOLDED||t.type===Xo.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!s),indent:a+c});let g=!1,p=!1,m=Zo.stringify(t,n,()=>g=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||e==null)return g&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(s&&!u||e==null&&h)return m=`? ${m}`,d&&!g?m+=jt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;g&&(d=null),h?(d&&(m+=jt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
- ${a}:`):(m=`${m}:`,d&&(m+=jt.lineComment(m,n.indent,l(d))));let w,y,S;ge.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(w=!1,y=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!d&&ge.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let k=!1,C=Zo.stringify(e,n,()=>k=!0,()=>p=!0),E=" ";if(d||w||y){if(E=w?`
25
+ `;let u,d;for(d=r.length;d>0;--d){let C=r[d-1];if(C!==`
26
+ `&&C!==" "&&C!==" ")break}let h=r.substring(d),g=h.indexOf(`
27
+ `);g===-1?u="-":r===h||g!==h.length-1?(u="+",o&&o()):u="",h&&(r=r.slice(0,-h.length),h[h.length-1]===`
28
+ `&&(h=h.slice(0,-1)),h=h.replace(Ci,`$&${l}`));let p=!1,m,w=-1;for(m=0;m<r.length;++m){let C=r[m];if(C===" ")p=!0;else if(C===`
29
+ `)w=m;else break}let y=r.substring(0,w<m?w+1:m);y&&(r=r.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let b=(p?l?"2":"1":"")+u;if(t&&(b+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){let C=r.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,R=Ir(n,!0);s!=="folded"&&e!==oe.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{E=!0});let k=_e.foldFlowLines(`${y}${C}${h}`,l,_e.FOLD_BLOCK,R);if(!E)return`>${b}
31
+ ${l}${k}`}return r=r.replace(/\n+/g,`$&${l}`),`|${b}
32
+ ${l}${y}${r}${h}`}function Wf(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&o.includes(`
33
+ `)||f&&/[[\]{},]/.test(o))return st(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||f||!o.includes(`
34
+ `)?st(o,e):jr(t,e,r,n);if(!a&&!f&&i!==oe.Scalar.PLAIN&&o.includes(`
35
+ `))return jr(t,e,r,n);if($r(o)){if(c==="")return e.forceBlockIndent=!0,jr(t,e,r,n);if(a&&c===l)return st(o,e)}let u=o.replace(/\n+/g,`$&
36
+ ${c}`);if(s){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return st(o,e)}return a?u:_e.foldFlowLines(u,c,_e.FOLD_FLOW,Ir(e,!1))}function Df(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==oe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=oe.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case oe.Scalar.BLOCK_FOLDED:case oe.Scalar.BLOCK_LITERAL:return i||o?st(s.value,e):jr(s,e,r,n);case oe.Scalar.QUOTE_DOUBLE:return It(s.value,e);case oe.Scalar.QUOTE_SINGLE:return Si(s.value,e);case oe.Scalar.PLAIN:return Wf(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=i&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}ea.stringifyString=Df});var Lt=v(Ei=>{"use strict";var Ff=Pr(),Re=P(),Mf=Tt(),Bf=$t();function Kf(t,e){let r=Object.assign({blockQuote:!0,commentString:Mf.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),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}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 r,n;if(Re.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function Yf(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Re.isScalar(t)||Re.isCollection(t))&&t.anchor;o&&Ff.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Jf(t,e,r,n){if(Re.isPair(t))return t.toString(e,r,n);if(Re.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=Re.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Uf(e.doc.schema.tags,o));let s=Yf(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Re.isScalar(o)?Bf.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Re.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
+ ${e.indent}${a}`:a}Ei.createStringifyContext=Kf;Ei.stringify=Jf});var ia=v(na=>{"use strict";var ge=P(),ta=j(),ra=Lt(),qt=Tt();function Hf({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=r,d=ge.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let h=!u&&(!t||d&&e==null&&!r.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===ta.Scalar.BLOCK_FOLDED||t.type===ta.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!h&&(u||!o),indent:a+c});let g=!1,p=!1,m=ra.stringify(t,r,()=>g=!0,()=>p=!0);if(!h&&!r.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(r.inFlow){if(o||e==null)return g&&n&&n(),m===""?"?":h?`? ${m}`:m}else if(o&&!u||e==null&&h)return m=`? ${m}`,d&&!g?m+=qt.lineComment(m,r.indent,l(d)):p&&i&&i(),m;g&&(d=null),h?(d&&(m+=qt.lineComment(m,r.indent,l(d))),m=`? ${m}
38
+ ${a}:`):(m=`${m}:`,d&&(m+=qt.lineComment(m,r.indent,l(d))));let w,y,S;ge.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(w=!1,y=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!h&&!d&&ge.isScalar(e)&&(r.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!r.inFlow&&!h&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let b=!1,C=ra.stringify(e,r,()=>b=!0,()=>p=!0),E=" ";if(d||w||y){if(E=w?`
39
39
  `:"",y){let R=l(y);E+=`
40
- ${jt.indentComment(R,n.indent)}`}C===""&&!n.inFlow?E===`
40
+ ${qt.indentComment(R,r.indent)}`}C===""&&!r.inFlow?E===`
41
41
  `&&S&&(E=`
42
42
 
43
43
  `):E+=`
44
- ${n.indent}`}else if(!h&&ge.isCollection(e)){let R=C[0],b=C.indexOf(`
45
- `),P=b!==-1,ie=n.inFlow??e.flow??e.items.length===0;if(P||!ie){let z=!1;if(P&&(R==="&"||R==="!")){let A=C.indexOf(" ");R==="&"&&A!==-1&&A<b&&C[A+1]==="!"&&(A=C.indexOf(" ",A+1)),(A===-1||b<A)&&(z=!0)}z||(E=`
46
- ${n.indent}`)}}else(C===""||C[0]===`
47
- `)&&(E="");return m+=E+C,n.inFlow?k&&i&&i():S&&!k?m+=jt.lineComment(m,n.indent,l(S)):p&&r&&r(),m}ea.stringifyPair=Yf});var Cr=v(Sr=>{"use strict";var na=kn("process");function Uf(t,...e){t==="debug"&&console.log(...e)}function Jf(t,e){(t==="debug"||t==="warn")&&(typeof na.emitWarning=="function"?na.emitWarning(e):console.warn(e))}Sr.debug=Uf;Sr.warn=Jf});var Mn=v(Fn=>{"use strict";var Dn=_(),ia=j(),qn="<<",Ln={identify:t=>t===qn||typeof t=="symbol"&&t.description===qn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ia.Scalar(Symbol(qn)),{addToJSMap:ra}),stringify:()=>qn},Vf=(t,e)=>(Ln.identify(e)||Dn.isScalar(e)&&(!e.type||e.type===ia.Scalar.PLAIN)&&Ln.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Ln.tag&&n.default);function ra(t,e,n){let i=sa(t,n);if(Dn.isSeq(i))for(let r of i.items)Er(t,e,r);else if(Array.isArray(i))for(let r of i)Er(t,e,r);else Er(t,e,i)}function Er(t,e,n){let i=sa(t,n);if(!Dn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[s,o]of r)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function sa(t,e){return t&&Dn.isAlias(e)?e.resolve(t.doc,t):e}Fn.addMergeToJSMap=ra;Fn.isMergeKey=Vf;Fn.merge=Ln});var _r=v(ca=>{"use strict";var Hf=Cr(),oa=Mn(),Gf=Tt(),aa=_(),xr=Ee();function zf(t,e,{key:n,value:i}){if(aa.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(oa.isMergeKey(t,n))oa.addMergeToJSMap(t,e,i);else{let r=xr.toJS(n,"",t);if(e instanceof Map)e.set(r,xr.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=Qf(n,r,t),o=xr.toJS(i,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function Qf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(aa.isNode(t)&&n?.doc){let i=Gf.createStringifyContext(n.doc,{});i.anchors=new Set;for(let s of n.anchors.keys())i.anchors.add(s.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let s=JSON.stringify(r);s.length>40&&(s=s.substring(0,36)+'..."'),Hf.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}ca.addPairToJSMap=zf});var Re=v(Pr=>{"use strict";var la=Pt(),Xf=ta(),Zf=_r(),Wn=_();function ed(t,e,n){let i=la.createNode(t,void 0,n),r=la.createNode(e,void 0,n);return new Bn(i,r)}var Bn=class t{constructor(e,n=null){Object.defineProperty(this,Wn.NODE_TYPE,{value:Wn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Wn.isNode(n)&&(n=n.clone(e)),Wn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return Zf.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?Xf.stringifyPair(this,e,n,i):JSON.stringify(this)}};Pr.Pair=Bn;Pr.createPair=ed});var Rr=v(fa=>{"use strict";var Je=_(),ua=Tt(),Kn=Rt();function td(t,e,n){return(e.inFlow??t.flow?id:nd)(t,e,n)}function nd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:s,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(Je.isNode(p))!u&&p.spaceBefore&&d.push(""),Yn(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Je.isPair(p)){let y=Je.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),Yn(n,d,y.commentBefore,u))}u=!1;let w=ua.stringify(p,f,()=>m=null,()=>u=!0);m&&(w+=Kn.lineComment(w,s,l(m))),u&&m&&(u=!1),d.push(i+w)}let h;if(d.length===0)h=r.start+r.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
44
+ ${r.indent}`}else if(!h&&ge.isCollection(e)){let R=C[0],k=C.indexOf(`
45
+ `),_=k!==-1,ne=r.inFlow??e.flow??e.items.length===0;if(_||!ne){let z=!1;if(_&&(R==="&"||R==="!")){let A=C.indexOf(" ");R==="&"&&A!==-1&&A<k&&C[A+1]==="!"&&(A=C.indexOf(" ",A+1)),(A===-1||k<A)&&(z=!0)}z||(E=`
46
+ ${r.indent}`)}}else(C===""||C[0]===`
47
+ `)&&(E="");return m+=E+C,r.inFlow?b&&n&&n():S&&!b?m+=qt.lineComment(m,r.indent,l(S)):p&&i&&i(),m}na.stringifyPair=Hf});var Pi=v(xi=>{"use strict";var oa=br("process");function Gf(t,...e){t==="debug"&&console.log(...e)}function Vf(t,e){(t==="debug"||t==="warn")&&(typeof oa.emitWarning=="function"?oa.emitWarning(e):console.warn(e))}xi.debug=Gf;xi.warn=Vf});var Fr=v(Dr=>{"use strict";var Wr=P(),sa=j(),Lr="<<",qr={identify:t=>t===Lr||typeof t=="symbol"&&t.description===Lr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new sa.Scalar(Symbol(Lr)),{addToJSMap:aa}),stringify:()=>Lr},zf=(t,e)=>(qr.identify(e)||Wr.isScalar(e)&&(!e.type||e.type===sa.Scalar.PLAIN)&&qr.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===qr.tag&&r.default);function aa(t,e,r){let n=ca(t,r);if(Wr.isSeq(n))for(let i of n.items)_i(t,e,i);else if(Array.isArray(n))for(let i of n)_i(t,e,i);else _i(t,e,n)}function _i(t,e,r){let n=ca(t,r);if(!Wr.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.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 ca(t,e){return t&&Wr.isAlias(e)?e.resolve(t.doc,t):e}Dr.addMergeToJSMap=aa;Dr.isMergeKey=zf;Dr.merge=qr});var Oi=v(fa=>{"use strict";var Qf=Pi(),la=Fr(),Xf=Lt(),ua=P(),Ri=xe();function Zf(t,e,{key:r,value:n}){if(ua.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(la.isMergeKey(t,r))la.addMergeToJSMap(t,e,n);else{let i=Ri.toJS(r,"",t);if(e instanceof Map)e.set(i,Ri.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=ed(r,i,t),s=Ri.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function ed(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(ua.isNode(t)&&r?.doc){let n=Xf.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Qf.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}fa.addPairToJSMap=Zf});var Oe=v(Ai=>{"use strict";var da=Nt(),td=ia(),rd=Oi(),Mr=P();function nd(t,e,r){let n=da.createNode(t,void 0,r),i=da.createNode(e,void 0,r);return new Br(n,i)}var Br=class t{constructor(e,r=null){Object.defineProperty(this,Mr.NODE_TYPE,{value:Mr.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Mr.isNode(r)&&(r=r.clone(e)),Mr.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return rd.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?td.stringifyPair(this,e,r,n):JSON.stringify(this)}};Ai.Pair=Br;Ai.createPair=nd});var Ni=v(ma=>{"use strict";var Ge=P(),pa=Lt(),Kr=Tt();function id(t,e,r){return(e.inFlow??t.flow?sd:od)(t,e,r)}function od({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,f=Object.assign({},r,{indent:o,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(Ge.isNode(p))!u&&p.spaceBefore&&d.push(""),Ur(r,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Ge.isPair(p)){let y=Ge.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),Ur(r,d,y.commentBefore,u))}u=!1;let w=pa.stringify(p,f,()=>m=null,()=>u=!0);m&&(w+=Kr.lineComment(w,o,l(m))),u&&m&&(u=!1),d.push(n+w)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
48
48
  ${c}${p}`:`
49
49
  `}}return t?(h+=`
50
- `+Kn.indentComment(l(t),c),a&&a()):u&&o&&o(),h}function id({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;i+=s;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],m=null;if(Je.isNode(p))p.spaceBefore&&u.push(""),Yn(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Je.isPair(p)){let y=Je.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),Yn(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=Je.isNode(p.value)?p.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=ua.stringify(p,c,()=>m=null);l||(l=u.length>f||w.includes(`
51
- `)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(w.length+2)>e.options.lineWidth)),l&&(w+=",")),m&&(w+=Kn.lineComment(w,i,a(m))),u.push(w),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let g=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
52
- ${s}${r}${p}`:`
50
+ `+Kr.indentComment(l(t),c),a&&a()):u&&s&&s(),h}function sd({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],m=null;if(Ge.isNode(p))p.spaceBefore&&u.push(""),Ur(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ge.isPair(p)){let y=Ge.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),Ur(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=Ge.isNode(p.value)?p.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=pa.stringify(p,c,()=>m=null);l||(l=u.length>f||w.includes(`
51
+ `)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(w.length+2)>e.options.lineWidth)),l&&(w+=",")),m&&(w+=Kr.lineComment(w,n,a(m))),u.push(w),f=u.length}let{start:d,end:h}=r;if(u.length===0)return d+h;if(!l){let g=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
52
+ ${o}${i}${p}`:`
53
53
  `;return`${g}
54
- ${r}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function Yn({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=Kn.indentComment(e(i),t);n.push(s.trimStart())}}fa.stringifyCollection=td});var Ae=v(Ar=>{"use strict";var rd=Rr(),sd=_r(),od=An(),Oe=_(),Un=Re(),ad=j();function It(t,e){let n=Oe.isScalar(e)?e.value:e;for(let i of t)if(Oe.isPair(i)&&(i.key===e||i.key===n||Oe.isScalar(i.key)&&i.key.value===n))return i}var Or=class extends od.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Oe.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:s}=i,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||r)&&o.items.push(Un.createPair(c,l,i))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let i;Oe.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new Un.Pair(e,e?.value):i=new Un.Pair(e.key,e.value);let r=It(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Oe.isScalar(r.value)&&ad.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(s){let o=this.items.findIndex(a=>s(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let n=It(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=It(this.items,e)?.value;return(!n&&Oe.isScalar(r)?r.value:r)??void 0}has(e){return!!It(this.items,e)}set(e,n){this.add(new Un.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let s of this.items)sd.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Oe.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),rd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Ar.YAMLMap=Or;Ar.findPair=It});var at=v(pa=>{"use strict";var cd=_(),da=Ae(),ld={collection:"map",default:!0,nodeClass:da.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return cd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>da.YAMLMap.from(t,e,n)};pa.map=ld});var Ne=v(ma=>{"use strict";var ud=Pt(),fd=Rr(),dd=An(),Vn=_(),pd=j(),md=Ee(),Nr=class extends dd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Vn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Jn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=Jn(e);if(typeof i!="number")return;let r=this.items[i];return!n&&Vn.isScalar(r)?r.value:r}has(e){let n=Jn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=Jn(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];Vn.isScalar(r)&&pd.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(e,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let s of this.items)i.push(md.toJS(s,String(r++),n));return i}toString(e,n,i){return e?fd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(o++);a=r.call(n,c,a)}s.items.push(ud.createNode(a,void 0,i))}}return s}};function Jn(t){let e=Vn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ma.YAMLSeq=Nr});var ct=v(ga=>{"use strict";var hd=_(),ha=Ne(),gd={collection:"seq",default:!0,nodeClass:ha.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return hd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>ha.YAMLSeq.from(t,e,n)};ga.seq=gd});var $t=v(wa=>{"use strict";var wd=Nt(),yd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,i){return e=Object.assign({actualString:!0},e),wd.stringifyString(t,e,n,i)}};wa.string=yd});var Hn=v(ba=>{"use strict";var ya=j(),va={identify:t=>t==null,createNode:()=>new ya.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ya.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&va.test.test(t)?t:e.options.nullStr};ba.nullTag=va});var Tr=v(Sa=>{"use strict";var vd=j(),ka={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ka.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Sa.boolTag=ka});var lt=v(Ca=>{"use strict";function bd({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}Ca.stringifyNumber=bd});var Ir=v(Gn=>{"use strict";var kd=j(),jr=lt(),Sd={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:jr.stringifyNumber},Cd={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():jr.stringifyNumber(t)}},Ed={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new kd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:jr.stringifyNumber};Gn.float=Ed;Gn.floatExp=Cd;Gn.floatNaN=Sd});var qr=v(Qn=>{"use strict";var Ea=lt(),zn=t=>typeof t=="bigint"||Number.isInteger(t),$r=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function xa(t,e,n){let{value:i}=t;return zn(i)&&i>=0?n+i.toString(e):Ea.stringifyNumber(t)}var xd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>$r(t,2,8,n),stringify:t=>xa(t,8,"0o")},_d={identify:zn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>$r(t,0,10,n),stringify:Ea.stringifyNumber},Pd={identify:t=>zn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>$r(t,2,16,n),stringify:t=>xa(t,16,"0x")};Qn.int=_d;Qn.intHex=Pd;Qn.intOct=xd});var Pa=v(_a=>{"use strict";var Rd=at(),Od=Hn(),Ad=ct(),Nd=$t(),Td=Tr(),Lr=Ir(),Dr=qr(),jd=[Rd.map,Ad.seq,Nd.string,Od.nullTag,Td.boolTag,Dr.intOct,Dr.int,Dr.intHex,Lr.floatNaN,Lr.floatExp,Lr.float];_a.schema=jd});var Aa=v(Oa=>{"use strict";var Id=j(),$d=at(),qd=ct();function Ra(t){return typeof t=="bigint"||Number.isInteger(t)}var Xn=({value:t})=>JSON.stringify(t),Ld=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xn},{identify:t=>t==null,createNode:()=>new Id.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Xn},{identify:Ra,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ra(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Xn}],Dd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Fd=[$d.map,qd.seq].concat(Ld,Dd);Oa.schema=Fd});var Mr=v(Na=>{"use strict";var qt=kn("buffer"),Fr=j(),Md=Nt(),Wd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof qt.Buffer=="function")return qt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},i,r,s){if(!n)return"";let o=n,a;if(typeof qt.Buffer=="function")a=o instanceof qt.Buffer?o.toString("base64"):qt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Fr.Scalar.BLOCK_LITERAL),e!==Fr.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=a.substr(d,c);a=f.join(e===Fr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return Md.stringifyString({comment:t,type:e,value:a},i,r,s)}};Na.binary=Wd});var ti=v(ei=>{"use strict";var Zn=_(),Wr=Re(),Bd=j(),Kd=Ne();function Ta(t,e){if(Zn.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!Zn.isPair(i)){if(Zn.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new Wr.Pair(new Bd.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
- ${r.key.commentBefore}`:i.commentBefore),i.comment){let s=r.value??r.key;s.comment=s.comment?`${i.comment}
57
- ${s.comment}`:i.comment}i=r}t.items[n]=Zn.isPair(i)?i:new Wr.Pair(i)}}else e("Expected a sequence for this tag");return t}function ja(t,e,n){let{replacer:i}=n,r=new Kd.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;r.items.push(Wr.createPair(a,c,n))}return r}var Yd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ta,createNode:ja};ei.createPairs=ja;ei.pairs=Yd;ei.resolvePairs=Ta});var Yr=v(Kr=>{"use strict";var Ia=_(),Br=Ee(),Lt=Ae(),Ud=Ne(),$a=ti(),Ve=class t extends Ud.YAMLSeq{constructor(){super(),this.add=Lt.YAMLMap.prototype.add.bind(this),this.delete=Lt.YAMLMap.prototype.delete.bind(this),this.get=Lt.YAMLMap.prototype.get.bind(this),this.has=Lt.YAMLMap.prototype.has.bind(this),this.set=Lt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let s,o;if(Ia.isPair(r)?(s=Br.toJS(r.key,"",n),o=Br.toJS(r.value,s,n)):s=Br.toJS(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(e,n,i){let r=$a.createPairs(e,n,i),s=new this;return s.items=r.items,s}};Ve.tag="tag:yaml.org,2002:omap";var Jd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=$a.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Ia.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Ve,n)},createNode:(t,e,n)=>Ve.from(t,e,n)};Kr.YAMLOMap=Ve;Kr.omap=Jd});var Ma=v(Ur=>{"use strict";var qa=j();function La({value:t,source:e},n){return e&&(t?Da:Fa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Da={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new qa.Scalar(!0),stringify:La},Fa={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new qa.Scalar(!1),stringify:La};Ur.falseTag=Fa;Ur.trueTag=Da});var Wa=v(ni=>{"use strict";var Vd=j(),Jr=lt(),Hd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Jr.stringifyNumber},Gd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Jr.stringifyNumber(t)}},zd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Vd.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:Jr.stringifyNumber};ni.float=zd;ni.floatExp=Gd;ni.floatNaN=Hd});var Ka=v(Ft=>{"use strict";var Ba=lt(),Dt=t=>typeof t=="bigint"||Number.isInteger(t);function ii(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let s=parseInt(t,n);return r==="-"?-1*s:s}function Vr(t,e,n){let{value:i}=t;if(Dt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return Ba.stringifyNumber(t)}var Qd={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>ii(t,2,2,n),stringify:t=>Vr(t,2,"0b")},Xd={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>ii(t,1,8,n),stringify:t=>Vr(t,8,"0")},Zd={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>ii(t,0,10,n),stringify:Ba.stringifyNumber},ep={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>ii(t,2,16,n),stringify:t=>Vr(t,16,"0x")};Ft.int=Zd;Ft.intBin=Qd;Ft.intHex=ep;Ft.intOct=Xd});var Gr=v(Hr=>{"use strict";var oi=_(),ri=Re(),si=Ae(),He=class t extends si.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;oi.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new ri.Pair(e.key,null):n=new ri.Pair(e,null),si.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=si.findPair(this.items,e);return!n&&oi.isPair(i)?oi.isScalar(i.key)?i.key.value:i.key:i}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=si.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new ri.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(ri.createPair(o,null,i));return s}};He.tag="tag:yaml.org,2002:set";var tp={collection:"map",identify:t=>t instanceof Set,nodeClass:He,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>He.from(t,e,n),resolve(t,e){if(oi.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new He,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Hr.YAMLSet=He;Hr.set=tp});var Qr=v(ai=>{"use strict";var np=lt();function zr(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*s:s}function Ya(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return np.stringifyNumber(t);let i="";e<0&&(i="-",e*=n(-1));let r=n(60),s=[e%r];return e<60?s.unshift(0):(e=(e-s[0])/r,s.unshift(e%r),e>=60&&(e=(e-s[0])/r,s.unshift(e))),i+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ip={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>zr(t,n),stringify:Ya},rp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>zr(t,!1),stringify:Ya},Ua={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Ua.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,s||0,o||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=zr(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ai.floatTime=rp;ai.intTime=ip;ai.timestamp=Ua});var Ha=v(Va=>{"use strict";var sp=at(),op=Hn(),ap=ct(),cp=$t(),lp=Mr(),Ja=Ma(),Xr=Wa(),ci=Ka(),up=Mn(),fp=Yr(),dp=ti(),pp=Gr(),Zr=Qr(),mp=[sp.map,ap.seq,cp.string,op.nullTag,Ja.trueTag,Ja.falseTag,ci.intBin,ci.intOct,ci.int,ci.intHex,Xr.floatNaN,Xr.floatExp,Xr.float,lp.binary,up.merge,fp.omap,dp.pairs,pp.set,Zr.intTime,Zr.floatTime,Zr.timestamp];Va.schema=mp});var rc=v(ns=>{"use strict";var Xa=at(),hp=Hn(),Za=ct(),gp=$t(),wp=Tr(),es=Ir(),ts=qr(),yp=Pa(),vp=Aa(),ec=Mr(),Mt=Mn(),tc=Yr(),nc=ti(),Ga=Ha(),ic=Gr(),li=Qr(),za=new Map([["core",yp.schema],["failsafe",[Xa.map,Za.seq,gp.string]],["json",vp.schema],["yaml11",Ga.schema],["yaml-1.1",Ga.schema]]),Qa={binary:ec.binary,bool:wp.boolTag,float:es.float,floatExp:es.floatExp,floatNaN:es.floatNaN,floatTime:li.floatTime,int:ts.int,intHex:ts.intHex,intOct:ts.intOct,intTime:li.intTime,map:Xa.map,merge:Mt.merge,null:hp.nullTag,omap:tc.omap,pairs:nc.pairs,seq:Za.seq,set:ic.set,timestamp:li.timestamp},bp={"tag:yaml.org,2002:binary":ec.binary,"tag:yaml.org,2002:merge":Mt.merge,"tag:yaml.org,2002:omap":tc.omap,"tag:yaml.org,2002:pairs":nc.pairs,"tag:yaml.org,2002:set":ic.set,"tag:yaml.org,2002:timestamp":li.timestamp};function kp(t,e,n){let i=za.get(e);if(i&&!t)return n&&!i.includes(Mt.merge)?i.concat(Mt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(za.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)r=r.concat(s);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Mt.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?Qa[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(Qa).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}ns.coreKnownTags=bp;ns.getTags=kp});var ss=v(sc=>{"use strict";var is=_(),Sp=at(),Cp=ct(),Ep=$t(),ui=rc(),xp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,rs=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ui.getTags(e,"compat"):e?ui.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?ui.coreKnownTags:{},this.tags=ui.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,is.MAP,{value:Sp.map}),Object.defineProperty(this,is.SCALAR,{value:Ep.string}),Object.defineProperty(this,is.SEQ,{value:Cp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?xp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};sc.Schema=rs});var ac=v(oc=>{"use strict";var _p=_(),os=Tt(),Wt=Rt();function Pp(t,e){let n=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&n.push("---");let r=os.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Wt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(_p.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=s(t.contents.commentBefore);n.push(Wt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=os.stringify(t.contents,r,()=>a=null,c);a&&(l+=Wt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(os.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
- `)?(n.push("..."),n.push(Wt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Wt.indentComment(s(c),"")))}return n.join(`
54
+ ${i}${h}`}else return`${d}${s}${u.join(" ")}${s}${h}`}function Ur({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Kr.indentComment(e(n),t);r.push(o.trimStart())}}ma.stringifyCollection=id});var Ne=v(ji=>{"use strict";var ad=Ni(),cd=Oi(),ld=Ar(),Ae=P(),Yr=Oe(),ud=j();function Wt(t,e){let r=Ae.isScalar(e)?e.value:e;for(let n of t)if(Ae.isPair(n)&&(n.key===e||n.key===r||Ae.isScalar(n.key)&&n.key.value===r))return n}var Ti=class extends ld.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ae.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Yr.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Ae.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yr.Pair(e,e?.value):n=new Yr.Pair(e.key,e.value);let i=Wt(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Ae.isScalar(i.value)&&ud.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=Wt(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Wt(this.items,e)?.value;return(!r&&Ae.isScalar(i)?i.value:i)??void 0}has(e){return!!Wt(this.items,e)}set(e,r){this.add(new Yr.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)cd.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ae.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})),ad.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};ji.YAMLMap=Ti;ji.findPair=Wt});var at=v(ga=>{"use strict";var fd=P(),ha=Ne(),dd={collection:"map",default:!0,nodeClass:ha.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return fd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>ha.YAMLMap.from(t,e,r)};ga.map=dd});var Te=v(wa=>{"use strict";var pd=Nt(),md=Ni(),hd=Ar(),Hr=P(),gd=j(),wd=xe(),Ii=class extends hd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Hr.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Jr(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Jr(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Hr.isScalar(i)?i.value:i}has(e){let r=Jr(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=Jr(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];Hr.isScalar(i)&&gd.isScalarValue(r)?i.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let i=0;for(let o of this.items)n.push(wd.toJS(o,String(i++),r));return n}toString(e,r,n){return e?md.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r)){let s=0;for(let a of r){if(typeof i=="function"){let c=r instanceof Set?a:String(s++);a=i.call(r,c,a)}o.items.push(pd.createNode(a,void 0,n))}}return o}};function Jr(t){let e=Hr.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}wa.YAMLSeq=Ii});var ct=v(va=>{"use strict";var yd=P(),ya=Te(),vd={collection:"seq",default:!0,nodeClass:ya.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return yd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>ya.YAMLSeq.from(t,e,r)};va.seq=vd});var Dt=v(ka=>{"use strict";var kd=$t(),bd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),kd.stringifyString(t,e,r,n)}};ka.string=bd});var Gr=v(Ca=>{"use strict";var ba=j(),Sa={identify:t=>t==null,createNode:()=>new ba.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ba.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Sa.test.test(t)?t:e.options.nullStr};Ca.nullTag=Sa});var $i=v(xa=>{"use strict";var Sd=j(),Ea={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Sd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&Ea.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};xa.boolTag=Ea});var lt=v(Pa=>{"use strict";function Cd({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="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 qi=v(Vr=>{"use strict";var Ed=j(),Li=lt(),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:Li.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),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Li.stringifyNumber(t)}},_d={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)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:Li.stringifyNumber};Vr.float=_d;Vr.floatExp=Pd;Vr.floatNaN=xd});var Di=v(Qr=>{"use strict";var _a=lt(),zr=t=>typeof t=="bigint"||Number.isInteger(t),Wi=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function Ra(t,e,r){let{value:n}=t;return zr(n)&&n>=0?r+n.toString(e):_a.stringifyNumber(t)}var Rd={identify:t=>zr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>Wi(t,2,8,r),stringify:t=>Ra(t,8,"0o")},Od={identify:zr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>Wi(t,0,10,r),stringify:_a.stringifyNumber},Ad={identify:t=>zr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>Wi(t,2,16,r),stringify:t=>Ra(t,16,"0x")};Qr.int=Od;Qr.intHex=Ad;Qr.intOct=Rd});var Aa=v(Oa=>{"use strict";var Nd=at(),Td=Gr(),jd=ct(),Id=Dt(),$d=$i(),Fi=qi(),Mi=Di(),Ld=[Nd.map,jd.seq,Id.string,Td.nullTag,$d.boolTag,Mi.intOct,Mi.int,Mi.intHex,Fi.floatNaN,Fi.floatExp,Fi.float];Oa.schema=Ld});var ja=v(Ta=>{"use strict";var qd=j(),Wd=at(),Dd=ct();function Na(t){return typeof t=="bigint"||Number.isInteger(t)}var Xr=({value:t})=>JSON.stringify(t),Fd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xr},{identify:t=>t==null,createNode:()=>new qd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xr},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Xr},{identify:Na,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>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:Xr}],Md={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Bd=[Wd.map,Dd.seq].concat(Fd,Md);Ta.schema=Bd});var Ki=v(Ia=>{"use strict";var Ft=br("buffer"),Bi=j(),Kd=$t(),Ud={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ft.Buffer=="function")return Ft.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,i,o){if(!r)return"";let s=r,a;if(typeof Ft.Buffer=="function")a=s instanceof Ft.Buffer?s.toString("base64"):Ft.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=Bi.Scalar.BLOCK_LITERAL),e!==Bi.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=a.substr(d,c);a=f.join(e===Bi.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Kd.stringifyString({comment:t,type:e,value:a},n,i,o)}};Ia.binary=Ud});var tn=v(en=>{"use strict";var Zr=P(),Ui=Oe(),Yd=j(),Jd=Te();function $a(t,e){if(Zr.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!Zr.isPair(n)){if(Zr.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new Ui.Pair(new Yd.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
56
+ ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment}
57
+ ${o.comment}`:n.comment}n=i}t.items[r]=Zr.isPair(n)?n:new Ui.Pair(n)}}else e("Expected a sequence for this tag");return t}function La(t,e,r){let{replacer:n}=r,i=new Jd.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 n=="function"&&(s=n.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(Ui.createPair(a,c,r))}return i}var Hd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:$a,createNode:La};en.createPairs=La;en.pairs=Hd;en.resolvePairs=$a});var Hi=v(Ji=>{"use strict";var qa=P(),Yi=xe(),Mt=Ne(),Gd=Te(),Wa=tn(),Ve=class t extends Gd.YAMLSeq{constructor(){super(),this.add=Mt.YAMLMap.prototype.add.bind(this),this.delete=Mt.YAMLMap.prototype.delete.bind(this),this.get=Mt.YAMLMap.prototype.get.bind(this),this.has=Mt.YAMLMap.prototype.has.bind(this),this.set=Mt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(qa.isPair(i)?(o=Yi.toJS(i.key,"",r),s=Yi.toJS(i.value,o,r)):o=Yi.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=Wa.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Ve.tag="tag:yaml.org,2002:omap";var Vd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Wa.resolvePairs(t,e),n=[];for(let{key:i}of r.items)qa.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ve,r)},createNode:(t,e,r)=>Ve.from(t,e,r)};Ji.YAMLOMap=Ve;Ji.omap=Vd});var Ka=v(Gi=>{"use strict";var Da=j();function Fa({value:t,source:e},r){return e&&(t?Ma:Ba).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var Ma={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 Da.Scalar(!0),stringify:Fa},Ba={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 Da.Scalar(!1),stringify:Fa};Gi.falseTag=Ba;Gi.trueTag=Ma});var Ua=v(rn=>{"use strict";var zd=j(),Vi=lt(),Qd={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},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():Vi.stringifyNumber(t)}},Zd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new zd.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Vi.stringifyNumber};rn.float=Zd;rn.floatExp=Xd;rn.floatNaN=Qd});var Ja=v(Kt=>{"use strict";var Ya=lt(),Bt=t=>typeof t=="bigint"||Number.isInteger(t);function nn(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){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,r);return i==="-"?-1*o:o}function zi(t,e,r){let{value:n}=t;if(Bt(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return Ya.stringifyNumber(t)}var ep={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>nn(t,2,2,r),stringify:t=>zi(t,2,"0b")},tp={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>nn(t,1,8,r),stringify:t=>zi(t,8,"0")},rp={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>nn(t,0,10,r),stringify:Ya.stringifyNumber},np={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>nn(t,2,16,r),stringify:t=>zi(t,16,"0x")};Kt.int=rp;Kt.intBin=ep;Kt.intHex=np;Kt.intOct=tp});var Xi=v(Qi=>{"use strict";var an=P(),on=Oe(),sn=Ne(),ze=class t extends sn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;an.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new on.Pair(e.key,null):r=new on.Pair(e,null),sn.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=sn.findPair(this.items,e);return!r&&an.isPair(n)?an.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=sn.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new on.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(on.createPair(s,null,n));return o}};ze.tag="tag:yaml.org,2002:set";var ip={collection:"map",identify:t=>t instanceof Set,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ze.from(t,e,r),resolve(t,e){if(an.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ze,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Qi.YAMLSet=ze;Qi.set=ip});var eo=v(cn=>{"use strict";var op=lt();function Zi(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function Ha(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return op.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(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))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var sp={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>Zi(t,r),stringify:Ha},ap={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Zi(t,!1),stringify:Ha},Ga={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(Ga.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=Zi(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};cn.floatTime=ap;cn.intTime=sp;cn.timestamp=Ga});var Qa=v(za=>{"use strict";var cp=at(),lp=Gr(),up=ct(),fp=Dt(),dp=Ki(),Va=Ka(),to=Ua(),ln=Ja(),pp=Fr(),mp=Hi(),hp=tn(),gp=Xi(),ro=eo(),wp=[cp.map,up.seq,fp.string,lp.nullTag,Va.trueTag,Va.falseTag,ln.intBin,ln.intOct,ln.int,ln.intHex,to.floatNaN,to.floatExp,to.float,dp.binary,pp.merge,mp.omap,hp.pairs,gp.set,ro.intTime,ro.floatTime,ro.timestamp];za.schema=wp});var ac=v(oo=>{"use strict";var tc=at(),yp=Gr(),rc=ct(),vp=Dt(),kp=$i(),no=qi(),io=Di(),bp=Aa(),Sp=ja(),nc=Ki(),Ut=Fr(),ic=Hi(),oc=tn(),Xa=Qa(),sc=Xi(),un=eo(),Za=new Map([["core",bp.schema],["failsafe",[tc.map,rc.seq,vp.string]],["json",Sp.schema],["yaml11",Xa.schema],["yaml-1.1",Xa.schema]]),ec={binary:nc.binary,bool:kp.boolTag,float:no.float,floatExp:no.floatExp,floatNaN:no.floatNaN,floatTime:un.floatTime,int:io.int,intHex:io.intHex,intOct:io.intOct,intTime:un.intTime,map:tc.map,merge:Ut.merge,null:yp.nullTag,omap:ic.omap,pairs:oc.pairs,seq:rc.seq,set:sc.set,timestamp:un.timestamp},Cp={"tag:yaml.org,2002:binary":nc.binary,"tag:yaml.org,2002:merge":Ut.merge,"tag:yaml.org,2002:omap":ic.omap,"tag:yaml.org,2002:pairs":oc.pairs,"tag:yaml.org,2002:set":sc.set,"tag:yaml.org,2002:timestamp":un.timestamp};function Ep(t,e,r){let n=Za.get(e);if(n&&!t)return r&&!n.includes(Ut.merge)?n.concat(Ut.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Za.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 r&&(i=i.concat(Ut.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?ec[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(ec).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}oo.coreKnownTags=Cp;oo.getTags=Ep});var co=v(cc=>{"use strict";var so=P(),xp=at(),Pp=ct(),_p=Dt(),fn=ac(),Rp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ao=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?fn.getTags(e,"compat"):e?fn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?fn.coreKnownTags:{},this.tags=fn.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,so.MAP,{value:xp.map}),Object.defineProperty(this,so.SCALAR,{value:_p.string}),Object.defineProperty(this,so.SEQ,{value:Pp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Rp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};cc.Schema=ao});var uc=v(lc=>{"use strict";var Op=P(),lo=Lt(),Yt=Tt();function Ap(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=lo.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Yt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Op.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);r.push(Yt.indentComment(f,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=lo.stringify(t.contents,i,()=>a=null,c);a&&(l+=Yt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(lo.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
+ `)?(r.push("..."),r.push(Yt.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Yt.indentComment(o(c),"")))}return r.join(`
59
59
  `)+`
60
- `}oc.stringifyDocument=Pp});var Bt=v(cc=>{"use strict";var Rp=_t(),ut=An(),Z=_(),Op=Re(),Ap=Ee(),Np=ss(),Tp=ac(),as=_n(),jp=fr(),Ip=Pt(),cs=ur(),ls=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Z.NODE_TYPE,{value:Z.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new cs.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[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){ft(this.contents)&&this.contents.add(e)}addIn(e,n){ft(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=as.anchorNames(this);e.anchor=!n||i.has(n)?as.findNewAnchor(n||"a",i):n}return new Rp.Alias(e.anchor)}createNode(e,n,i){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=n.filter(m).map(String);w.length>0&&(n=n.concat(w)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=as.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=Ip.createNode(e,f,g);return a&&Z.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),s=this.createNode(n,null,i);return new Op.Pair(r,s)}delete(e){return ft(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ut.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ft(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Z.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return ut.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 ut.isEmptyPath(e)?this.contents!==void 0:Z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=ut.collectionFromPath(this.schema,[e],n):ft(this.contents)&&this.contents.set(e,n)}setIn(e,n){ut.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=ut.collectionFromPath(this.schema,Array.from(e),n):ft(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new cs.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new cs.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new Np.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Ap.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:f}of a.anchors.values())s(f,l);return typeof o=="function"?jp.applyReviver(o,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Tp.stringifyDocument(this,e)}};function ft(t){if(Z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}cc.Document=ls});var Ut=v(Yt=>{"use strict";var Kt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},us=class extends Kt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},fs=class extends Kt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},$p=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let s=r-1,o=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="…"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`…
61
- `),o=a+o}if(/[^ ]/.test(o)){let a=1,c=n.linePos[1];c?.line===i&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-s)));let l=" ".repeat(s)+"^".repeat(a);n.message+=`:
60
+ `}lc.stringifyDocument=Ap});var Jt=v(fc=>{"use strict";var Np=At(),ut=Ar(),Z=P(),Tp=Oe(),jp=xe(),Ip=co(),$p=uc(),uo=Pr(),Lp=mi(),qp=Nt(),fo=pi(),po=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Z.NODE_TYPE,{value:Z.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new fo.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}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){ft(this.contents)&&this.contents.add(e)}addIn(e,r){ft(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=uo.anchorNames(this);e.anchor=!r||n.has(r)?uo.findNewAnchor(r||"a",n):r}return new Np.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=r.filter(m).map(String);w.length>0&&(r=r.concat(w)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:f}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=uo.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:h},p=qp.createNode(e,f,g);return a&&Z.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Tp.Pair(i,o)}delete(e){return ft(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ut.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ft(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Z.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return ut.isEmptyPath(e)?!r&&Z.isScalar(this.contents)?this.contents.value:this.contents:Z.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Z.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ut.isEmptyPath(e)?this.contents!==void 0:Z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=ut.collectionFromPath(this.schema,[e],r):ft(this.contents)&&this.contents.set(e,r)}setIn(e,r){ut.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=ut.collectionFromPath(this.schema,Array.from(e),r):ft(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new fo.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new fo.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=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(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Ip.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=jp.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:f}of a.anchors.values())o(f,l);return typeof s=="function"?Lp.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return $p.stringifyDocument(this,e)}};function ft(t){if(Z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}fc.Document=po});var Vt=v(Gt=>{"use strict";var Ht=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},mo=class extends Ht{constructor(e,r,n){super("YAMLParseError",e,r,n)}},ho=class extends Ht{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Wp=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).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)+"…"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`…
61
+ `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`:
62
62
 
63
- ${o}
63
+ ${s}
64
64
  ${l}
65
- `}};Yt.YAMLError=Kt;Yt.YAMLParseError=us;Yt.YAMLWarning=fs;Yt.prettifyError=$p});var Jt=v(lc=>{"use strict";function qp(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,g=!1,p=null,m=null,w=null,y=null,S=null,k=null,C=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&s(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),f=!0;break;case"comment":{f||s(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let P=b.source.substring(1)||" ";u?u+=d+P:u=P,d="",l=!1;break}case"newline":l?u?u+=b.source:(!k||n!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,h=!0,(m||w)&&(y=b),f=!0;break;case"anchor":m&&s(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&s(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,C??(C=b.offset),l=!1,f=!1,g=!0;break;case"tag":{w&&s(b,"MULTIPLE_TAGS","A node can have at most one tag"),w=b,C??(C=b.offset),l=!1,f=!1,g=!0;break}case n:(m||w)&&s(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),k&&s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),k=b,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&s(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=b,l=!1,f=!1;break}default:s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,f=!1}let E=t[t.length-1],R=E?E.offset+E.source.length:r;return g&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&s(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:k,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:w,newlineAfterProp:y,end:R,start:C??R}}lc.resolveProps=qp});var fi=v(uc=>{"use strict";function ds(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(ds(e.key)||ds(e.value))return!0}return!1;default:return!0}}uc.containsNewline=ds});var ps=v(fc=>{"use strict";var Lp=fi();function Dp(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&Lp.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}fc.flowIndentCheck=Dp});var ms=v(pc=>{"use strict";var dc=_();function Fp(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||dc.isScalar(s)&&dc.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}pc.mapIncludes=Fp});var vc=v(yc=>{"use strict";var mc=Re(),Mp=Ae(),hc=Jt(),Wp=fi(),gc=ps(),Bp=ms(),wc="All mapping items must start at the same column";function Kp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Mp.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let f of i.items){let{start:u,key:d,sep:h,value:g}=f,p=hc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(c,"BAD_INDENT",wc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Wp.containsNewline(d))&&r(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",wc);n.atKey=!0;let w=p.end,y=d?t(n,d,p,r):e(n,w,u,null,p,r);n.schema.compat&&gc.flowIndentCheck(i.indent,d,r),n.atKey=!1,Bp.mapIncludes(n,a.items,y)&&r(w,"DUPLICATE_KEY","Map keys must be unique");let S=hc.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){m&&(g?.type==="block-map"&&!S.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<S.found.offset-1024&&r(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=g?t(n,g,S,r):e(n,c,h,null,S,r);n.schema.compat&&gc.flowIndentCheck(i.indent,g,r),c=k.range[2];let C=new mc.Pair(y,k);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
- `+S.comment:y.comment=S.comment);let k=new mc.Pair(y);n.options.keepSourceTokens&&(k.srcToken=f),a.items.push(k)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}yc.resolveBlockMap=Kp});var kc=v(bc=>{"use strict";var Yp=Ne(),Up=Jt(),Jp=ps();function Vp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Yp.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,l=null;for(let{start:f,value:u}of i.items){let d=Up.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?t(n,u,d,r):e(n,d.end,f,null,d,r);n.schema.compat&&Jp.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}bc.resolveBlockSeq=Vp});var dt=v(Sc=>{"use strict";function Hp(t,e,n,i){let r="";if(t){let s=!1,o="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{n&&!s&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";r?r+=o+f:r=f,o="";break}case"newline":r&&(o+=c),s=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}Sc.resolveEnd=Hp});var _c=v(xc=>{"use strict";var Gp=_(),zp=Re(),Cc=Ae(),Qp=Ne(),Xp=dt(),Ec=Jt(),Zp=fi(),em=ms(),hs="Block collections are not allowed within flow collections",gs=t=>t&&(t.type==="block-map"||t.type==="block-seq");function tm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?Cc.YAMLMap:Qp.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let w=i.items[m],{start:y,key:S,sep:k,value:C}=w,E=Ec.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??k?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!C){m===0&&E.comma?r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
- `+E.comment:l.comment=E.comment),u=E.end;continue}!o&&n.options.strict&&Zp.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||r(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let R="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":R=b.source.substring(1);break e;default:break e}if(R){let b=l.items[l.items.length-1];Gp.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
- `+R:b.comment=R,E.comment=E.comment.substring(R.length+1)}}if(!o&&!k&&!E.found){let R=C?t(n,C,E,r):e(n,E.end,k,null,E,r);l.items.push(R),u=R.range[2],gs(C)&&r(R.range,"BLOCK_IN_FLOW",hs)}else{n.atKey=!0;let R=E.end,b=S?t(n,S,E,r):e(n,R,y,null,E,r);gs(S)&&r(b.range,"BLOCK_IN_FLOW",hs),n.atKey=!1;let P=Ec.resolveProps(k??[],{flow:a,indicator:"map-value-ind",next:C,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(P.found){if(!o&&!E.found&&n.options.strict){if(k)for(let A of k){if(A===P.found)break;if(A.type==="newline"){r(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<P.found.offset-1024&&r(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?r(C,"MISSING_CHAR",`Missing space after : in ${a}`):r(P.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ie=C?t(n,C,P,r):P.found?e(n,P.end,k,null,P,r):null;ie?gs(C)&&r(ie.range,"BLOCK_IN_FLOW",hs):P.comment&&(b.comment?b.comment+=`
71
- `+P.comment:b.comment=P.comment);let z=new zp.Pair(b,ie);if(n.options.keepSourceTokens&&(z.srcToken=w),o){let A=l;em.mapIncludes(n,A.items,b)&&r(R,"DUPLICATE_KEY","Map keys must be unique"),A.items.push(z)}else{let A=new Cc.YAMLMap(n.schema);A.flow=!0,A.items.push(z);let re=(ie??b).range;A.range=[b.range[0],re[1],re[2]],l.items.push(A)}u=ie?ie.range[2]:P.end}}let d=o?"}":"]",[h,...g]=i.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let m=Xp.resolveEnd(g,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}xc.resolveFlowCollection=tm});var Rc=v(Pc=>{"use strict";var nm=_(),im=j(),rm=Ae(),sm=Ne(),om=vc(),am=kc(),cm=_c();function ws(t,e,n,i,r,s){let o=n.type==="block-map"?om.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?am.resolveBlockSeq(t,e,n,i,s):cm.resolveFlowCollection(t,e,n,i,s),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function lm(t,e,n,i,r){let s=i.tag,o=s?e.directives.tagName(s.source,d=>r(s,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=i,g=d&&s?d.offset>s.offset?d:s:d??s;g&&(!h||h.offset<g.offset)&&r(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===rm.YAMLMap.tagName&&a==="map"||o===sm.YAMLSeq.tagName&&a==="seq")return ws(t,e,n,r,o);let c=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!c){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(s,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ws(t,e,n,r,o)}let l=ws(t,e,n,r,o,c),f=c.resolve?.(l,d=>r(s,"TAG_RESOLVE_FAILED",d),e.options)??l,u=nm.isNode(f)?f:new im.Scalar(f);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Pc.composeCollection=lm});var vs=v(Oc=>{"use strict";var ys=j();function um(t,e,n){let i=e.offset,r=fm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?ys.Scalar.BLOCK_FOLDED:ys.Scalar.BLOCK_LITERAL,o=e.source?dm(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",m=i+r.length;return e.source&&(m+=e.source.length),{value:p,type:s,comment:r.comment,range:[i,m,m]}}let c=e.indent+r.indent,l=e.offset+r.length,f=0;for(let p=0;p<a;++p){let[m,w]=o[p];if(w===""||w==="\r")r.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&n(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=m.length),f=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(c)+`
74
- `;for(let p=f;p<a;++p){let[m,w]=o[p];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}s===ys.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+w,d=`
65
+ `}};Gt.YAMLError=Ht;Gt.YAMLParseError=mo;Gt.YAMLWarning=ho;Gt.prettifyError=Wp});var zt=v(dc=>{"use strict";function Dp(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,g=!1,p=null,m=null,w=null,y=null,S=null,b=null,C=null;for(let k of t)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&o(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&k.type!=="comment"&&k.type!=="newline"&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),f=!0;break;case"comment":{f||o(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let _=k.source.substring(1)||" ";u?u+=d+_:u=_,d="",l=!1;break}case"newline":l?u?u+=k.source:(!b||r!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,h=!0,(m||w)&&(y=k),f=!0;break;case"anchor":m&&o(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&o(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=k,C??(C=k.offset),l=!1,f=!1,g=!0;break;case"tag":{w&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),w=k,C??(C=k.offset),l=!1,f=!1,g=!0;break}case r:(m||w)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),b&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),b=k,l=r==="seq-item-ind"||r==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,l=!1,f=!1;break}default:o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,f=!1}let E=t[t.length-1],R=E?E.offset+E.source.length:i;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:b,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:w,newlineAfterProp:y,end:R,start:C??R}}dc.resolveProps=Dp});var dn=v(pc=>{"use strict";function go(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(go(e.key)||go(e.value))return!0}return!1;default:return!0}}pc.containsNewline=go});var wo=v(mc=>{"use strict";var Fp=dn();function Mp(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Fp.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}mc.flowIndentCheck=Mp});var yo=v(gc=>{"use strict";var hc=P();function Bp(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||hc.isScalar(o)&&hc.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}gc.mapIncludes=Bp});var Sc=v(bc=>{"use strict";var wc=Oe(),Kp=Ne(),yc=zt(),Up=dn(),vc=wo(),Yp=yo(),kc="All mapping items must start at the same column";function Jp({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Kp.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let f of n.items){let{start:u,key:d,sep:h,value:g}=f,p=yc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),m=!p.found;if(m){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!==n.indent&&i(c,"BAD_INDENT",kc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Up.containsNewline(d))&&i(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==n.indent&&i(c,"BAD_INDENT",kc);r.atKey=!0;let w=p.end,y=d?t(r,d,p,i):e(r,w,u,null,p,i);r.schema.compat&&vc.flowIndentCheck(n.indent,d,i),r.atKey=!1,Yp.mapIncludes(r,a.items,y)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let S=yc.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){m&&(g?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&p.start<S.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=g?t(r,g,S,i):e(r,c,h,null,S,i);r.schema.compat&&vc.flowIndentCheck(n.indent,g,i),c=b.range[2];let C=new wc.Pair(y,b);r.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}else{m&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
+ `+S.comment:y.comment=S.comment);let b=new wc.Pair(y);r.options.keepSourceTokens&&(b.srcToken=f),a.items.push(b)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,c,l??c],a}bc.resolveBlockMap=Jp});var Ec=v(Cc=>{"use strict";var Hp=Te(),Gp=zt(),Vp=wo();function zp({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Hp.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:f,value:u}of n.items){let d=Gp.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.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 h=u?t(r,u,d,i):e(r,d.end,f,null,d,i);r.schema.compat&&Vp.flowIndentCheck(n.indent,u,i),c=h.range[2],a.items.push(h)}return a.range=[n.offset,c,l??c],a}Cc.resolveBlockSeq=zp});var dt=v(xc=>{"use strict";function Qp(t,e,r,n){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":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";i?i+=s+f:i=f,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}xc.resolveEnd=Qp});var Oc=v(Rc=>{"use strict";var Xp=P(),Zp=Oe(),Pc=Ne(),em=Te(),tm=dt(),_c=zt(),rm=dn(),nm=yo(),vo="Block collections are not allowed within flow collections",ko=t=>t&&(t.type==="block-map"||t.type==="block-seq");function im({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Pc.YAMLMap:em.YAMLSeq),l=new c(r.schema);l.flow=!0;let f=r.atRoot;f&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let u=n.offset+n.start.source.length;for(let m=0;m<n.items.length;++m){let w=n.items[m],{start:y,key:S,sep:b,value:C}=w,E=_c.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??b?.[0],offset:u,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!b&&!C){m===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<n.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),u=E.end;continue}!s&&r.options.strict&&rm.containsNewline(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===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 R="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":R=k.source.substring(1);break e;default:break e}if(R){let k=l.items[l.items.length-1];Xp.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
+ `+R:k.comment=R,E.comment=E.comment.substring(R.length+1)}}if(!s&&!b&&!E.found){let R=C?t(r,C,E,i):e(r,E.end,b,null,E,i);l.items.push(R),u=R.range[2],ko(C)&&i(R.range,"BLOCK_IN_FLOW",vo)}else{r.atKey=!0;let R=E.end,k=S?t(r,S,E,i):e(r,R,y,null,E,i);ko(S)&&i(k.range,"BLOCK_IN_FLOW",vo),r.atKey=!1;let _=_c.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:C,offset:k.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(_.found){if(!s&&!E.found&&r.options.strict){if(b)for(let A of b){if(A===_.found)break;if(A.type==="newline"){i(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<_.found.offset-1024&&i(_.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?i(C,"MISSING_CHAR",`Missing space after : in ${a}`):i(_.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ne=C?t(r,C,_,i):_.found?e(r,_.end,b,null,_,i):null;ne?ko(C)&&i(ne.range,"BLOCK_IN_FLOW",vo):_.comment&&(k.comment?k.comment+=`
71
+ `+_.comment:k.comment=_.comment);let z=new Zp.Pair(k,ne);if(r.options.keepSourceTokens&&(z.srcToken=w),s){let A=l;nm.mapIncludes(r,A.items,k)&&i(R,"DUPLICATE_KEY","Map keys must be unique"),A.items.push(z)}else{let A=new Pc.YAMLMap(r.schema);A.flow=!0,A.items.push(z);let ie=(ne??k).range;A.range=[k.range[0],ie[1],ie[2]],l.items.push(A)}u=ne?ne.range[2]:_.end}}let d=s?"}":"]",[h,...g]=n.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let m=tm.resolveEnd(g,p,r.options.strict,i);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[n.offset,p,m.offset]}else l.range=[n.offset,p,p];return l}Rc.resolveFlowCollection=im});var Nc=v(Ac=>{"use strict";var om=P(),sm=j(),am=Ne(),cm=Te(),lm=Sc(),um=Ec(),fm=Oc();function bo(t,e,r,n,i,o){let s=r.type==="block-map"?lm.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?um.resolveBlockSeq(t,e,r,n,o):fm.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function dm(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(r.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=n,g=d&&o?d.offset>o.offset?d:o:d??o;g&&(!h||h.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===am.YAMLMap.tagName&&a==="map"||s===cm.YAMLSeq.tagName&&a==="seq")return bo(t,e,r,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),bo(t,e,r,i,s)}let l=bo(t,e,r,i,s,c),f=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=om.isNode(f)?f:new sm.Scalar(f);return u.range=l.range,u.tag=s,c?.format&&(u.format=c.format),u}Ac.composeCollection=dm});var Co=v(Tc=>{"use strict";var So=j();function pm(t,e,r){let n=e.offset,i=mm(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?So.Scalar.BLOCK_FOLDED:So.Scalar.BLOCK_LITERAL,s=e.source?hm(e.source):[],a=s.length;for(let p=s.length-1;p>=0;--p){let m=s[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=i.chomp==="+"&&s.length>0?`
73
+ `.repeat(Math.max(1,s.length-1)):"",m=n+i.length;return e.source&&(m+=e.source.length),{value:p,type:o,comment:i.comment,range:[n,m,m]}}let c=e.indent+i.indent,l=e.offset+i.length,f=0;for(let p=0;p<a;++p){let[m,w]=s[p];if(w===""||w==="\r")i.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&r(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=m.length),f=p,c===0&&!t.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let p=s.length-1;p>=a;--p)s[p][0].length>c&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=s[p][0].slice(c)+`
74
+ `;for(let p=f;p<a;++p){let[m,w]=s[p];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let b=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(l-w.length-(y?2:1),"BAD_INDENT",b),m=""}o===So.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+w,d=`
75
75
  `):m.length>c||w[0]===" "?(d===" "?d=`
76
76
  `:!h&&d===`
77
77
  `&&(d=`
@@ -80,87 +80,87 @@ ${l}
80
80
  `,h=!0):w===""?d===`
81
81
  `?u+=`
82
82
  `:d=`
83
- `:(u+=d+w,d=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)u+=`
84
- `+o[p][0].slice(c);u[u.length-1]!==`
83
+ `:(u+=d+w,d=" ",h=!1)}switch(i.chomp){case"-":break;case"+":for(let p=a;p<s.length;++p)u+=`
84
+ `+s[p][0].slice(c);u[u.length-1]!==`
85
85
  `&&(u+=`
86
86
  `);break;default:u+=`
87
- `}let g=i+r.length+e.source.length;return{value:u,type:s,comment:r.comment,range:[i,g,g]}}function fm({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],s=r[0],o=0,a="",c=-1;for(let d=1;d<r.length;++d){let h=r[d];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!o&&g?o=g:c===-1&&(c=t+d)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,f="",u=r.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:s,indent:o,chomp:a,comment:f,length:u}}function dm(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),s=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}Oc.resolveBlockScalar=um});var ks=v(Nc=>{"use strict";var bs=j(),pm=dt();function mm(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(d,h,g)=>n(i+d,h,g);switch(r){case"scalar":a=bs.Scalar.PLAIN,c=hm(s,l);break;case"single-quoted-scalar":a=bs.Scalar.QUOTE_SINGLE,c=gm(s,l);break;case"double-quoted-scalar":a=bs.Scalar.QUOTE_DOUBLE,c=wm(s,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+s.length,i+s.length]}}let f=i+s.length,u=pm.resolveEnd(o,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function hm(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Ac(t)}function gm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Ac(t.slice(1,-1)).replace(/''/g,"'")}function Ac(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
- `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(t);if(!i)return t;let r=i[1],s=" ",o=e.lastIndex;for(n.lastIndex=o;i=n.exec(t);)i[1]===""?s===`
90
- `?r+=s:s=`
91
- `:(r+=s+i[1],s=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(t),r+s+(i?.[1]??"")}function wm(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
- `))if(r===`
93
- `){let{fold:s,offset:o}=ym(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=vm[s];if(o)n+=o;else if(s===`
94
- `)for(s=t[i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="\r"&&t[i+1]===`
95
- `)for(s=t[++i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;n+=bm(t,i+1,a,e),i+=a}else{let a=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let s=i,o=t[i+1];for(;o===" "||o===" ";)o=t[++i+1];o!==`
96
- `&&!(o==="\r"&&t[i+2]===`
97
- `)&&(n+=i>s?t.slice(s,i+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function ym(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
- `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
- `);)i===`
100
- `&&(n+=`
101
- `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var vm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function bm(t,e,n,i){let r=t.substr(e,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Nc.resolveFlowScalar=mm});var Ic=v(jc=>{"use strict";var Ge=_(),Tc=j(),km=vs(),Sm=ks();function Cm(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?km.resolveBlockScalar(t,e,i):Sm.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Ge.SCALAR]:c?l=Em(t.schema,r,c,n,i):e.type==="scalar"?l=xm(t,r,e,i):l=t.schema[Ge.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=Ge.isScalar(u)?u:new Tc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Tc.Scalar(r)}return f.range=a,f.source=r,s&&(f.type=s),c&&(f.tag=c),l.format&&(f.format=l.format),o&&(f.comment=o),f}function Em(t,e,n,i,r){if(n==="!")return t[Ge.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Ge.SCALAR])}function xm({atKey:t,directives:e,schema:n},i,r,s){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||n[Ge.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[Ge.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",f,!0)}}return o}jc.composeScalar=Cm});var qc=v($c=>{"use strict";function _m(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}$c.emptyScalarPosition=_m});var Fc=v(Cs=>{"use strict";var Pm=_t(),Rm=_(),Om=Rc(),Lc=Ic(),Am=dt(),Nm=qc(),Tm={composeNode:Dc,composeEmptyNode:Ss};function Dc(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=jm(t,e,i),(a||c)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Lc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Om.composeCollection(Tm,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=Ss(t,e.offset,void 0,null,n,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!Rm.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&f&&(l.srcToken=e),l}function Ss(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let f={type:"scalar",offset:Nm.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Lc.composeScalar(t,f,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),s&&(u.comment=s,u.range[2]=c),u}function jm({options:t},{offset:e,source:n,end:i},r){let s=new Pm.Alias(n.substring(1));s.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=Am.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Cs.composeEmptyNode=Ss;Cs.composeNode=Dc});var Bc=v(Wc=>{"use strict";var Im=Bt(),Mc=Fc(),$m=dt(),qm=Jt();function Lm(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new Im.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=qm.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Mc.composeNode(l,r,f,o):Mc.composeEmptyNode(l,f.end,i,null,f,o);let u=c.contents.range[2],d=$m.resolveEnd(s,u,!1,o);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Wc.composeDoc=Lm});var xs=v(Uc=>{"use strict";var Dm=kn("process"),Fm=ur(),Mm=Bt(),Vt=Ut(),Kc=_(),Wm=Bc(),Bm=dt();function Ht(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Yc(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let s=t[r];switch(s[0]){case"#":e+=(e===""?"":i?`
87
+ `}let g=n+i.length+e.source.length;return{value:u,type:o,comment:i.comment,range:[n,g,g]}}function mm({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(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 h=i[d];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!s&&g?s=g:c===-1&&(c=t+d)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,f="",u=i.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":r&&!l&&n(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":n(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;n(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:o,indent:s,chomp:a,comment:f,length:u}}function hm(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}Tc.resolveBlockScalar=pm});var xo=v(Ic=>{"use strict";var Eo=j(),gm=dt();function wm(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(d,h,g)=>r(n+d,h,g);switch(i){case"scalar":a=Eo.Scalar.PLAIN,c=ym(o,l);break;case"single-quoted-scalar":a=Eo.Scalar.QUOTE_SINGLE,c=vm(o,l);break;case"double-quoted-scalar":a=Eo.Scalar.QUOTE_DOUBLE,c=km(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let f=n+o.length,u=gm.resolveEnd(s,f,e,r);return{value:c,type:a,comment:u.comment,range:[n,f,u.offset]}}function ym(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),jc(t)}function vm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),jc(t.slice(1,-1)).replace(/''/g,"'")}function jc(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
+ `,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let i=n[1],o=" ",s=e.lastIndex;for(r.lastIndex=s;n=r.exec(t);)n[1]===""?o===`
90
+ `?i+=o:o=`
91
+ `:(i+=o+n[1],o=" "),s=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,n=a.exec(t),i+o+(n?.[1]??"")}function km(t,e){let r="";for(let n=1;n<t.length-1;++n){let i=t[n];if(!(i==="\r"&&t[n+1]===`
92
+ `))if(i===`
93
+ `){let{fold:o,offset:s}=bm(t,n);r+=o,n=s}else if(i==="\\"){let o=t[++n],s=Sm[o];if(s)r+=s;else if(o===`
94
+ `)for(o=t[n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="\r"&&t[n+1]===`
95
+ `)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=Cm(t,n+1,a,e),n+=a}else{let a=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(i===" "||i===" "){let o=n,s=t[n+1];for(;s===" "||s===" ";)s=t[++n+1];s!==`
96
+ `&&!(s==="\r"&&t[n+2]===`
97
+ `)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function bm(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===`
98
+ `||n==="\r")&&!(n==="\r"&&t[e+2]!==`
99
+ `);)n===`
100
+ `&&(r+=`
101
+ `),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var Sm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Cm(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Ic.resolveFlowScalar=wm});var qc=v(Lc=>{"use strict";var Qe=P(),$c=j(),Em=Co(),xm=xo();function Pm(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Em.resolveBlockScalar(t,e,n):xm.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,u=>n(r,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Qe.SCALAR]:c?l=_m(t.schema,i,c,r,n):e.type==="scalar"?l=Rm(t,i,e,n):l=t.schema[Qe.SCALAR];let f;try{let u=l.resolve(i,d=>n(r??e,"TAG_RESOLVE_FAILED",d),t.options);f=Qe.isScalar(u)?u:new $c.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);n(r??e,"TAG_RESOLVE_FAILED",d),f=new $c.Scalar(i)}return f.range=a,f.source=i,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),s&&(f.comment=s),f}function _m(t,e,r,n,i){if(r==="!")return t[Qe.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)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[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Qe.SCALAR])}function Rm({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[Qe.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[Qe.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",f,!0)}}return s}Lc.composeScalar=Pm});var Dc=v(Wc=>{"use strict";function Om(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}Wc.emptyScalarPosition=Om});var Bc=v(_o=>{"use strict";var Am=At(),Nm=P(),Tm=Nc(),Fc=qc(),jm=dt(),Im=Dc(),$m={composeNode:Mc,composeEmptyNode:Po};function Mc(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,f=!0;switch(e.type){case"alias":l=Lm(t,e,n),(a||c)&&n(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,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Tm.composeCollection($m,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=Po(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Nm.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(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&&f&&(l.srcToken=e),l}function Po(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let f={type:"scalar",offset:Im.emptyScalarPosition(e,r,n),indent:-1,source:""},u=Fc.composeScalar(t,f,a,l);return s&&(u.anchor=s.source.substring(1),u.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function Lm({options:t},{offset:e,source:r,end:n},i){let o=new Am.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=jm.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}_o.composeEmptyNode=Po;_o.composeNode=Mc});var Yc=v(Uc=>{"use strict";var qm=Jt(),Kc=Bc(),Wm=dt(),Dm=zt();function Fm(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new qm.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Dm.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&s(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Kc.composeNode(l,i,f,s):Kc.composeEmptyNode(l,f.end,n,null,f,s);let u=c.contents.range[2],d=Wm.resolveEnd(o,u,!1,s);return d.comment&&(c.comment=d.comment),c.range=[r,u,d.offset],c}Uc.composeDoc=Fm});var Oo=v(Gc=>{"use strict";var Mm=br("process"),Bm=pi(),Km=Jt(),Qt=Vt(),Jc=P(),Um=Yc(),Ym=dt();function Xt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function Hc(t){let e="",r=!1,n=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":n?`
103
103
 
104
104
  `:`
105
- `)+(s.substring(1)||" "),n=!0,i=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}var Es=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=Ht(n);s?this.warnings.push(new Vt.YAMLWarning(o,i,r)):this.errors.push(new Vt.YAMLParseError(o,i,r))},this.directives=new Fm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=Yc(this.prelude);if(i){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
- ${i}`:i;else if(r||e.directives.docStart||!s)e.commentBefore=i;else if(Kc.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];Kc.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
107
- ${a}`:i}else{let o=s.commentBefore;s.commentBefore=o?`${i}
108
- ${o}`:i}}if(n){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Yc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(Dm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=Ht(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Wm.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new Vt.YAMLParseError(Ht(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Vt.YAMLParseError(Ht(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=Bm.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Vt.YAMLParseError(Ht(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),r=new Mm.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};Uc.Composer=Es});var Hc=v(di=>{"use strict";var Km=vs(),Ym=ks(),Um=Ut(),Jc=Nt();function Jm(t,e=!0,n){if(t){let i=(r,s,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,s,o);else throw new Um.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ym.resolveFlowScalar(t,e,i);case"block-scalar":return Km.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Vm(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=Jc.stringifyString({type:o,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
105
+ `)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var Ro=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Xt(r);o?this.warnings.push(new Qt.YAMLWarning(s,n,i)):this.errors.push(new Qt.YAMLParseError(s,n,i))},this.directives=new Bm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=Hc(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment}
106
+ ${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;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?`${n}
107
+ ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n}
108
+ ${s}`:n}}if(r){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:Hc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(r,n)}*next(e){switch(Mm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(r,n,i)=>{let o=Xt(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Um.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Qt.YAMLParseError(Xt(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Qt.YAMLParseError(Xt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ym.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
109
+ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Qt.YAMLParseError(Xt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Km.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};Gc.Composer=Ro});var Qc=v(pn=>{"use strict";var Jm=Co(),Hm=xo(),Gm=Vt(),Vc=$t();function Vm(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new Gm.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Hm.resolveFlowScalar(t,e,n);case"block-scalar":return Jm.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function zm(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=Vc.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
110
110
  `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
111
  `),f=a.substring(0,l),u=a.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:s,indent:i,source:f}];return Vc(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
- `}),{type:"block-scalar",offset:s,indent:i,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:s,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:i,source:a,end:c};default:return{type:"scalar",offset:s,indent:i,source:a,end:c}}}function Hm(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Jc.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Gm(t,c);break;case'"':_s(t,c,"double-quoted-scalar");break;case"'":_s(t,c,"single-quoted-scalar");break;default:_s(t,c,"scalar")}}function Gm(t,e){let n=e.indexOf(`
114
- `),i=e.substring(0,n),r=e.substring(n+1)+`
115
- `;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=i,t.source=r}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:i}];Vc(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:r})}}function Vc(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function _s(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let s of i)s.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:i,source:e,end:r})}}}di.createScalarToken=Vm;di.resolveAsScalar=Jm;di.setScalarValue=Hm});var zc=v(Gc=>{"use strict";var zm=t=>"type"in t?mi(t):pi(t);function mi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=mi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=pi(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=pi(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=pi(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function pi({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=mi(e)),n)for(let s of n)r+=s.source;return i&&(r+=mi(i)),r}Gc.stringify=zm});var el=v(Zc=>{"use strict";var Ps=Symbol("break visit"),Qm=Symbol("skip children"),Qc=Symbol("remove item");function ze(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Xc(Object.freeze([]),t,e)}ze.BREAK=Ps;ze.SKIP=Qm;ze.REMOVE=Qc;ze.itemAtPath=(t,e)=>{let n=t;for(let[i,r]of e){let s=n?.[i];if(s&&"items"in s)n=s.items[r];else return}return n};ze.parentCollection=(t,e)=>{let n=ze.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Xc(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let s=e[r];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=Xc(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Ps)return Ps;a===Qc&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}Zc.visit=ze});var hi=v(V=>{"use strict";var Rs=Hc(),Xm=zc(),Zm=el(),Os="\uFEFF",As="",Ns="",Ts="",eh=t=>!!t&&"items"in t,th=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function nh(t){switch(t){case Os:return"<BOM>";case As:return"<DOC>";case Ns:return"<FLOW_END>";case Ts:return"<SCALAR>";default:return JSON.stringify(t)}}function ih(t){switch(t){case Os:return"byte-order-mark";case As:return"doc-mode";case Ns:return"flow-error-end";case Ts:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
112
+ `,d=[{type:"block-scalar-header",offset:o,indent:n,source:f}];return zc(d,c)||d.push({type:"newline",offset:-1,indent:n,source:`
113
+ `}),{type:"block-scalar",offset:o,indent:n,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Qm(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&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=Vc.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">":Xm(t,c);break;case'"':Ao(t,c,"double-quoted-scalar");break;case"'":Ao(t,c,"single-quoted-scalar");break;default:Ao(t,c,"scalar")}}function Xm(t,e){let r=e.indexOf(`
114
+ `),n=e.substring(0,r),i=e.substring(r+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=n,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:n}];zc(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 zc(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function Ao(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});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:r,source:e,end:[i]});break}default:{let n="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:r,indent:n,source:e,end:i})}}}pn.createScalarToken=zm;pn.resolveAsScalar=Vm;pn.setScalarValue=Qm});var Zc=v(Xc=>{"use strict";var Zm=t=>"type"in t?hn(t):mn(t);function hn(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=hn(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=mn(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=mn(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=mn(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function mn({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=hn(e)),r)for(let o of r)i+=o.source;return n&&(i+=hn(n)),i}Xc.stringify=Zm});var nl=v(rl=>{"use strict";var No=Symbol("break visit"),eh=Symbol("skip children"),el=Symbol("remove item");function Xe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),tl(Object.freeze([]),t,e)}Xe.BREAK=No;Xe.SKIP=eh;Xe.REMOVE=el;Xe.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Xe.parentCollection=(t,e)=>{let r=Xe.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function tl(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;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=tl(Object.freeze(t.concat([[i,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===No)return No;a===el&&(o.items.splice(s,1),s-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}rl.visit=Xe});var gn=v(H=>{"use strict";var To=Qc(),th=Zc(),rh=nl(),jo="\uFEFF",Io="",$o="",Lo="",nh=t=>!!t&&"items"in t,ih=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function oh(t){switch(t){case jo:return"<BOM>";case Io:return"<DOC>";case $o:return"<FLOW_END>";case Lo:return"<SCALAR>";default:return JSON.stringify(t)}}function sh(t){switch(t){case jo:return"byte-order-mark";case Io:return"doc-mode";case $o:return"flow-error-end";case Lo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}V.createScalarToken=Rs.createScalarToken;V.resolveAsScalar=Rs.resolveAsScalar;V.setScalarValue=Rs.setScalarValue;V.stringify=Xm.stringify;V.visit=Zm.visit;V.BOM=Os;V.DOCUMENT=As;V.FLOW_END=Ns;V.SCALAR=Ts;V.isCollection=eh;V.isScalar=th;V.prettyToken=nh;V.tokenType=ih});var $s=v(nl=>{"use strict";var Gt=hi();function oe(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var tl=new Set("0123456789ABCDEFabcdef"),rh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),gi=new Set(",[]{}"),sh=new Set(` ,[]{}
121
- \r `),js=t=>!t||sh.has(t),Is=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
122
- `?!0:n==="\r"?this.buffer[e+1]===`
123
- `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+e];if(n==="\r"){let r=this.buffer[i+e+1];if(r===`
124
- `||!r&&!this.atEnd)return e+i+1}return n===`
125
- `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&oe(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Gt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let s=e[i-1];if(s===" "||s===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield Gt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&oe(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&&!oe(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===":")&&oe(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(js),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&oe(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Gt.FLOW_END,yield*this.parseLineStart();let s=0;for(;r[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),r[s]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(js),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||oe(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
127
- `,this.pos);if(r!==-1){for(;r!==-1;){let s=this.continueScalar(r+1);if(s===-1)break;r=i.indexOf(`
128
- `,s)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>oe(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let s=this.pos;i=this.buffer[s];++s)switch(i){case" ":n+=1;break;case`
129
- `:e=s,n=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
- `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
131
- `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
- `;)i=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
133
- `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield Gt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let s=this.buffer[i+1];if(oe(s)||e&&gi.has(s))break;n=i}else if(oe(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
134
- `?(i+=1,r=`
135
- `,s=this.buffer[i+1]):n=i),s==="#"||e&&gi.has(s))break;if(r===`
136
- `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&gi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Gt.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(js),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(oe(i)||n&&gi.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!oe(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(rh.has(n))n=this.buffer[++e];else if(n==="%"&&tl.has(this.buffer[e+1])&&tl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
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}H.createScalarToken=To.createScalarToken;H.resolveAsScalar=To.resolveAsScalar;H.setScalarValue=To.setScalarValue;H.stringify=th.stringify;H.visit=rh.visit;H.BOM=jo;H.DOCUMENT=Io;H.FLOW_END=$o;H.SCALAR=Lo;H.isCollection=nh;H.isScalar=ih;H.prettyToken=oh;H.tokenType=sh});var Do=v(ol=>{"use strict";var Zt=gn();function se(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var il=new Set("0123456789ABCDEFabcdef"),ah=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),wn=new Set(",[]{}"),ch=new Set(` ,[]{}
121
+ \r `),qo=t=>!t||ch.has(t),Wo=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===`
122
+ `?!0:r==="\r"?this.buffer[e+1]===`
123
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===`
124
+ `||!i&&!this.atEnd)return e+n+1}return r===`
125
+ `||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&se(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Zt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let o=e[n-1];if(o===" "||o===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let o=e[r-1];if(o===" "||o===" ")r-=1;else break}let i=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield Zt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&se(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!se(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&se(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(qo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&se(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Zt.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(qo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||se(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),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),i=n.indexOf(`
127
+ `,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=n.indexOf(`
128
+ `,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>se(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case`
129
+ `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
130
+ `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
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(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
132
+ `;)n=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+r>a)e=o;else break}while(!0);return yield Zt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(se(o)||e&&wn.has(o))break;r=n}else if(se(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===`
134
+ `?(n+=1,i=`
135
+ `,o=this.buffer[n+1]):r=n),o==="#"||e&&wn.has(o))break;if(i===`
136
+ `){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&wn.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Zt.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(qo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(se(n)||r&&wn.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!se(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(ah.has(r))r=this.buffer[++e];else if(r==="%"&&il.has(this.buffer[e+1])&&il.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
137
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};nl.Lexer=Is});var Ls=v(il=>{"use strict";var qs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let s=n+i>>1;this.lineStarts[s]<e?n=s+1:i=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};il.LineCounter=qs});var Fs=v(cl=>{"use strict";var oh=kn("process"),rl=hi(),ah=$s();function Te(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function sl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function al(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function wi(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function pt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function yi(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function ol(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Te(e.start,"explicit-key-ind")&&!Te(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,al(e.value)?e.value.end?yi(e.value.end,e.sep):e.value.end=e.sep:yi(e.start,e.sep),delete e.sep)}var Ds=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 ah.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,n))yield*this.next(i);n||(yield*this.end())}*next(e){if(this.source=e,oh.env.LOG_TOKENS&&console.log("|",rl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=rl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&ol(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&sl(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{sl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=wi(this.peek(2)),i=pt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
139
- `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
140
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){yi(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Te(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(al(n.key)&&!Te(n.sep,"newline")){let o=pt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(Te(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=pt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?e.items.push({start:s,key:null,sep:[this.sourceToken]}):Te(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Te(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){yi(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Te(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=wi(i),s=pt(r);ol(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
141
- `)+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=wi(e),i=pt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=wi(e),i=pt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};cl.Parser=Ds});var pl=v(Qt=>{"use strict";var ll=xs(),ch=Bt(),zt=Ut(),lh=Cr(),uh=_(),fh=Ls(),ul=Fs();function fl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fh.LineCounter||null,prettyErrors:e}}function dh(t,e={}){let{lineCounter:n,prettyErrors:i}=fl(e),r=new ul.Parser(n?.addNewLine),s=new ll.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(zt.prettifyError(t,n)),a.warnings.forEach(zt.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function dl(t,e={}){let{lineCounter:n,prettyErrors:i}=fl(e),r=new ul.Parser(n?.addNewLine),s=new ll.Composer(e),o=null;for(let a of s.compose(r.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new zt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(zt.prettifyError(t,n)),o.warnings.forEach(zt.prettifyError(t,n))),o}function ph(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=dl(t,n);if(!r)return null;if(r.warnings.forEach(s=>lh.warn(r.options.logLevel,s)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function mh(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=n??e??{};if(!r)return}return uh.isDocument(t)&&!i?t.toString(n):new ch.Document(t,i,n).toString(n)}Qt.parse=ph;Qt.parseAllDocuments=dh;Qt.parseDocument=dl;Qt.stringify=mh});var Qe=v(O=>{"use strict";var hh=xs(),gh=Bt(),wh=ss(),Ms=Ut(),yh=_t(),je=_(),vh=Re(),bh=j(),kh=Ae(),Sh=Ne(),Ch=hi(),Eh=$s(),xh=Ls(),_h=Fs(),vi=pl(),ml=St();O.Composer=hh.Composer;O.Document=gh.Document;O.Schema=wh.Schema;O.YAMLError=Ms.YAMLError;O.YAMLParseError=Ms.YAMLParseError;O.YAMLWarning=Ms.YAMLWarning;O.Alias=yh.Alias;O.isAlias=je.isAlias;O.isCollection=je.isCollection;O.isDocument=je.isDocument;O.isMap=je.isMap;O.isNode=je.isNode;O.isPair=je.isPair;O.isScalar=je.isScalar;O.isSeq=je.isSeq;O.Pair=vh.Pair;O.Scalar=bh.Scalar;O.YAMLMap=kh.YAMLMap;O.YAMLSeq=Sh.YAMLSeq;O.CST=Ch;O.Lexer=Eh.Lexer;O.LineCounter=xh.LineCounter;O.Parser=_h.Parser;O.parse=vi.parse;O.parseAllDocuments=vi.parseAllDocuments;O.parseDocument=vi.parseDocument;O.stringify=vi.stringify;O.visit=ml.visit;O.visitAsync=ml.visitAsync});import bi from"path";function Nh(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||bi.posix.isAbsolute(n)||bi.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function ki(t){let e=Nh(t,"native.artifact_root");return e.length===0?".":e.join("/")}function gl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function Ie(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||bi.posix.isAbsolute(i)||bi.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(s=>s===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(s=>s===""||s==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function Xt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function wl(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function yl(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Bs)throw new Error(`${e} exceeds ${Bs} characters`);let n=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?n+=1:t[i]==="*"&&(n+=1,t[i+1]==="*"&&(i+=1));if(n>Ks)throw new Error(`${e} contains more than ${Ks} wildcard tokens`);return t}function hl(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(i=>yl(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function Ws(t,e,n){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${n} must be a positive integer`);return i}function Th(t){if(t===void 0)return{...we,include:[...we.include],exclude:[...we.exclude]};let e=Xt(t,"native.snapshot");return{include:hl(e.include,"native.snapshot.include",we.include),exclude:hl(e.exclude,"native.snapshot.exclude",we.exclude),max_files:Ws(e.max_files,we.max_files,"native.snapshot.max_files"),max_total_bytes:Ws(e.max_total_bytes,we.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Ws(e.max_duration_ms,we.max_duration_ms,"native.snapshot.max_duration_ms")}}function jh(t){if(t===void 0)return;let e=Xt(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=e.to_artifact_root,s=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(s!=="copying"&&s!=="ready"&&s!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let a=Xt(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,f=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:ki(i),toArtifactRoot:ki(r),stage:s,...o?{cleanup:o}:{}}}function Ih(t,e={}){let n=Xt(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"batch";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let s=n.archive_confirmation??"automatic";if(s!=="automatic"&&s!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=n.max_verify_failures??Ph;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let a=jh(n.pending_root_move);return{artifact_root:ki(i),language:wl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:s,max_verify_failures:o,snapshot:Th(n.snapshot),...a?{pending_root_move:a}:{}}}function $h(t){let e=Xt(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:gl(e.artifact_layout),language:wl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function qh(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Lh(t,e,n,i,r){let s=t.schema!==void 0;if(!(s||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!s)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let a=t.workflows??[t.default_workflow];if(!Array.isArray(a)||a.length===0||a.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(a)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:i,...e?{native:e}:{},...n?{classic:n}:{}}}function mt(t,e={}){let n=(0,Ys.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let i=n.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=i,s=qh(r.ambient_resume),o=r.native===void 0?void 0:Ih(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),a=r.classic===void 0?void 0:$h(r.classic),c=Lh(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}var Ys,Zt,Bs,Ks,Ph,Rh,Oh,Ah,we,ye=M(()=>{"use strict";Ys=nt(Qe(),1),Zt=64*1024,Bs=1024,Ks=64,Ph=5,Rh=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Oh=["**/.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"],Ah=[...Rh,...Oh].sort((t,e)=>t.localeCompare(e,"en")),we={include:["**/*"],exclude:[...Ah],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function $e(t){return t!==0&&t!==0n&&t!=="0"}function Si(t,e){return $e(t.dev)&&$e(e.dev)&&$e(t.ino)&&$e(e.ino)}function ve(t,e){let n=$e(t.dev)&&$e(e.dev);if(n&&t.dev!==e.dev)return!1;let i=$e(t.ino)&&$e(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var Ci=M(()=>{"use strict"});import{constants as Ei,promises as Xe}from"fs";function Us(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function vl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function en(t){return{dev:t.dev,ino:t.ino,birthtime:Us(t)}}function xi(t,e){let n=en(t),i=en(e);return Si(n,i)?ve(n,i):ve(n,i)&&Us(t)===Us(e)&&vl(t)===vl(e)&&t.size===e.size}async function _i(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,s=await Xe.lstat(t,{bigint:r});if(!s.isFile()||s.isSymbolicLink())throw new qe("not-regular-file",`${i} must be a regular file`);if(BigInt(s.size)>BigInt(e))throw new qe("too-large",`${i} exceeds ${e} bytes`);let o=await Xe.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:en(s)});let a=process.platform==="win32"?Ei.O_RDONLY:Ei.O_RDONLY|Ei.O_NOFOLLOW|Ei.O_NONBLOCK,c;try{c=await Xe.open(t,a)}catch(l){throw l.code==="ELOOP"?new qe("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:r}),Xe.lstat(t,{bigint:r}),Xe.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==o||!xi(s,l)||!xi(s,f))throw new qe("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:en(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(h+=S,h>e)throw new qe("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat({bigint:r}),Xe.lstat(t,{bigint:r}),Xe.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!xi(s,p)||!xi(s,m))throw new qe("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:en(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:w}}finally{await c.close()}}var qe,Js=M(()=>{"use strict";Ci();qe=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Le}from"fs";import ae from"path";function bl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Pi(t,e){let n=ae.relative(t,e);return n===""||!ae.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${ae.sep}`)}async function Vs(t,e){let n=ae.resolve(t),i=await Le.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Le.realpath(n)}async function Hs(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=ae.join(r,n[s]);let o;try{o=await Le.lstat(r)}catch(f){if(bl(f))return{exists:!1,kind:"missing"};throw f}let a=ae.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=s===n.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Le.realpath(r);if(!Pi(e,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function N(t,e,n){let i=Ie(e,n.label),r=ae.resolve(t),s=await Vs(r,n.label),o=i.split("/"),a=ae.resolve(r,...o);if(!Pi(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Hs(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Gs(t,e,n){let i=Ie(e,n.label),r=ae.resolve(t),s=await Vs(r,n.label),o=i.split("/"),a=r;for(let c of o){a=ae.join(a,c);let l;try{l=await Le.lstat(a)}catch(d){if(!bl(d))throw d;try{await Le.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await Le.lstat(a)}let f=ae.relative(r,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${f} must be a real directory`);let u=await Le.realpath(a);if(!Pi(s,u))throw new Error(`${n.label} resolves outside the project root`)}return await Hs(r,s,o,{label:n.label,expected:"directory"}),a}async function Ri(t,e,n){return(await N(t,e,{...n,expected:"file"})).exists}async function D(t,e,n,i){let r=await N(t,e,{label:i.label,expected:"file"});if(!r.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let s=await Vs(r.projectRoot,i.label);return _i(r.target,n,{...i,verify:async(o,a)=>{if(!Pi(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Hs(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var Q=M(()=>{"use strict";Js();ye()});import{createHash as Dh}from"crypto";function Fh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Oi(t,e={}){return(await Ai(t,e)).document}async function Mh(t){try{return(await D(t,tn,Zt,{label:tn})).bytes}catch(e){if(Fh(e))return null;throw e}}function Wh(t){return t?{exists:!0,sha256:Dh("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ai(t,e={}){let n=await Mh(t);return{document:n?mt(n.toString("utf8"),e):null,identity:Wh(n)}}var tn,nn=M(()=>{"use strict";ye();Q();tn=".comet/config.yaml"});import{randomUUID as Bh}from"crypto";import{constants as Kh,promises as I}from"fs";import B from"path";async function zs(t,e){try{return await I.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await I.copyFile(t,e,Kh.COPYFILE_EXCL),{linked:!1}}function ht(t,e){let n=B.relative(t,e);return n===""||!B.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${B.sep}`)}function Ti(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Yh(t,e){return ve(t,Ti(e))}function Ni(t,e){let n=Ti(t),i=Ti(e);return Si(n,i)?ve(n,i):ve(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function ji(t){let e=await I.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 I.realpath(t),...Ti(e)}}async function De(t){for(let e of t){let n=await I.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Yh(e,n)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Uh(t,e){let n=B.resolve(t),i=B.resolve(e);if(!ht(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await ji(n)],s=B.relative(n,i).split(B.sep).filter(Boolean),o=n;for(let a of s){await De(r),o=B.join(o,a);try{await I.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await ji(o);if(!ht(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await De(r),r}async function Jh(t,e){let n=B.resolve(t),i=B.resolve(e);if(!ht(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await ji(n)],s=B.relative(n,i).split(B.sep).filter(Boolean),o=n;for(let a of s){o=B.join(o,a);try{let c=await ji(o);if(!ht(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${o}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await De(r),r}async function kl(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function Vh(t,e,n){let i=B.dirname(t),r=await Uh(n.containedRoot,i),s=B.join(i,`.${B.basename(t)}.${Bh()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await I.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([I.lstat(s),I.realpath(s)]);if(await De(r),!c.isFile()||c.isSymbolicLink()||!Ni(a,c)||!ht(r[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),!Ni(a,await o.stat()))throw new Error("Contained atomic write temporary file changed while writing");await o.close(),o=void 0,await n.beforeCommit?.(),await De(r);let f=await I.lstat(s);if(!f.isFile()||f.isSymbolicLink()||!Ni(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await zs(s,t),await I.unlink(s)):await I.rename(s,t),await kl(i)}catch(c){await o?.close();try{await De(r),await I.rm(s,{force:!0})}catch{}throw c}}async function ee(t,e,n){await Vh(t,e,n)}async function Qs(t,e){let n=B.dirname(t),i=await Jh(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await I.lstat(t),s=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!ht(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await De(i);let[o,a]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Ni(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await I.unlink(t),await De(i),await kl(n),!0}var Fe=M(()=>{"use strict";Ci()});var rb,Xs=M(()=>{"use strict";Fe();nn();Q();rb=16*1024});var eo=M(()=>{"use strict";Fe();ye();nn();Q();Xs()});var Mi=M(()=>{"use strict"});var $l=M(()=>{"use strict"});var ro=M(()=>{"use strict";Mi()});var ql=M(()=>{"use strict";Mi();ro()});var Og,Ll=M(()=>{"use strict";Og=nt(Qe(),1);Fe();ye();Q()});var pk,Dl=M(()=>{"use strict";Fe();Q();pk=4*1024*1024});var Fl=M(()=>{"use strict";Mi();Fe();$l();ql();ye();Ll();Q();nn();eo();Dl();Xs();ro()});import{TextDecoder as Ag}from"util";function Ml(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Ng(t,e){try{return new Ag("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function so(t,e,n,i,r={}){try{let s=await D(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:Ng(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function We(t,e,n,i,r={}){return(await so(t,e,n,i,r))?.text??null}async function Be(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await so(t,e,i,r),a=await N(t,e,{label:r,expected:"file"});await ee(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await so(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ve(Ml(o.result.stat),Ml(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Wi(t,e,n,i,r,s={}){let o=await We(t,e,i,r);await Be(t,e,`${o??""}${n}`,i,r,s)}async function Bi(t,e,n,i={}){let r=await N(t,e,{label:n,expected:"file"});return r.exists?Qs(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Ki=M(()=>{"use strict";Fl();Ci()});var Kl={};Hu(Kl,{RUN_STATE_FILE:()=>Ui,applyRunStateToDocument:()=>oo,readRunState:()=>ao,removeRunState:()=>co,runStateFromDocument:()=>Yi,writeRunState:()=>Ji});import Tg from"path";function gn(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function hn(t,e){let n=gn(t,e);if(Tg.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 jg(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Yi(t){if(!t.run_id)return null;let e=gn(t,"run_id"),n=gn(t,"skill"),i=gn(t,"skill_version"),r=gn(t,"skill_hash"),s=hn(t,"pending_ref"),o=hn(t,"trajectory_ref"),a=hn(t,"context_ref"),c=hn(t,"artifacts_ref"),l=hn(t,"checkpoint_ref"),f=Number(t.iteration);if(!Number.isInteger(f)||f<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:i,skillHash:r,orchestration:t.orchestration,currentStep:Wl(t,"current_step"),iteration:f,pending:Wl(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:jg(t)}}function oo(t,e){e?t.run_id=e.runId:delete t.run_id}function Ig(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 $g(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 Yi(e)}async function ao(t,e={}){let n=await We(t,Ui,Bl,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return $g(i)}async function Ji(t,e,n={}){await Be(t,Ui,JSON.stringify(Ig(e),null,2),Bl,"Run state",n)}async function co(t,e={}){await Bi(t,Ui,"Run state",e)}var Wl,Ui,Bl,Vi=M(()=>{"use strict";Ki();Wl=(t,e)=>{let n=t[e];return n==null?null:String(n)};Ui=".comet/run-state.json",Bl=256*1024});import{createHash as Zw}from"crypto";import{promises as ey}from"fs";import me from"path";import{spawnSync as sg}from"child_process";function zu(t){return t.length>0&&/^[A-Za-z0-9@+=:,./\\_-]+$/.test(t)?t:`"${t.replace(/"/g,'""')}"`}function _o(t){return t.map(e=>zu(e))}import{promises as xl}from"fs";import T from"path";import{promises as Qu}from"fs";async function kt(t){try{return await Qu.access(t),!0}catch(e){if(Xu(e))return!1;throw e}}function Xu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ye();nn();eo();Q();var rn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},El=".comet/config.yaml";function _l(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Pl(t){await N(t,El,{label:El,expected:"file"})}function Ii(t,e){let n=T.resolve(t),i=e==="docs"?T.join(n,"docs"):n,r=T.join(i,"openspec"),s=T.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:T.join(r,"changes"),archiveDir:T.join(r,"changes","archive"),specsDir:T.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:T.join(s,"specs"),superpowersPlansDir:T.join(s,"plans"),superpowersReportsDir:T.join(s,"reports")}}async function Xh(t){await Pl(t);let e=await Oi(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new rn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new rn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Zh(t,e){return Ii(t,e??await Xh(t))}async function eg(t){try{return await xl.lstat(t),!0}catch(e){if(_l(e))return!1;throw e}}async function tg(t,e){let n=await Zh(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=Ii(t,i).openSpecRoot,[s,o]=await Promise.all([N(n.projectRoot,$(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),eg(r)]),a=s.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:o,dualRoots:a&&o}}async function ng(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 i=$(t.projectRoot,n);await N(t.projectRoot,i,{label:`Classic managed physical path ${i}`,expected:"directory"})}}async function ce(t,e){let n=await tg(t,e);if(await ng(n.paths),!n.configuredRootExists){let i=$(n.paths.projectRoot,n.paths.openSpecRoot),r=$(n.paths.projectRoot,n.alternateRoot);throw new rn(`Configured Classic OpenSpec root is missing: ${i} (alternate ${r} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function sn(t,e){let n=T.join(T.resolve(t),".comet","classic-root-move.json");if(await kt(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let i=await ce(t,e);if(!await kt(i.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${$(i.projectRoot,i.openSpecRoot)}`);return i}async function be(t){let e=T.resolve(t),n=null;try{(await xl.lstat(e)).isDirectory()||(e=T.dirname(e))}catch(i){if(!_l(i))throw i}for(;;){T.basename(e)==="openspec"&&(n=T.dirname(e));let i=T.join(e,".comet","config.yaml"),r=!1;if(await kt(i))try{await Pl(e);let o=(await Oi(e))?.value;r=!!o&&typeof o=="object"&&!Array.isArray(o)&&(o.schema==="comet.project.v1"||o.default_workflow!==void 0||o.native!==void 0)}catch{}if(r||await kt(T.join(e,".git")))return e;let s=T.dirname(e);if(s===e)return n??T.resolve(t);e=s}}function $(t,e){return T.relative(T.resolve(t),e).replaceAll("\\","/")}var Rl=nt(Qe(),1);Q();import ig from"path";var rg=1024*1024;async function Ol(t,e){let n=e??await ce(t),i=ig.join(n.openSpecRoot,"config.yaml"),r=$(n.projectRoot,i),s;try{s=(await D(n.projectRoot,r,rg,{label:"Classic OpenSpec project config",bigint:!0})).bytes.toString("utf8")}catch(l){throw l.code==="ENOENT"?new Error(`Classic OpenSpec root is unhealthy: ${r} is missing; rerun OpenSpec initialization for the configured Classic layout`,{cause:l}):new Error(`Classic OpenSpec root is unhealthy: ${l instanceof Error?l.message:String(l)}`,{cause:l})}let o=(0,Rl.parseDocument)(s,{uniqueKeys:!0});if(o.errors.length>0)throw new Error(`Classic OpenSpec root is unhealthy: ${r} is invalid YAML (${o.errors[0].message})`);let a=o.toJS();if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Classic OpenSpec root is unhealthy: ${r} must contain a mapping`);let c=a.schema;if(typeof c!="string"||c.trim()==="")throw new Error(`Classic OpenSpec root is unhealthy: ${r} must declare a non-empty schema`);return{layout:n,configPath:r,schema:c}}function og(t){return t[0]==="--"?t.slice(1):[...t]}async function Al(t,e=process.cwd()){let n=og(t);if(n.length===0)return{exitCode:64,stderr:"Usage: comet classic openspec -- <openspec-args...>"};let i=await be(e),r=await sn(i);await Ol(i,r);let s=process.env.COMET_OPENSPEC||"openspec",o=process.platform==="win32",a=sg(s,o?_o(n):n,{cwd:r.openSpecBase,encoding:"utf8",shell:o,windowsHide:!0});if(a.error){let c=a.error.code;return{exitCode:c==="ENOENT"?127:70,stdout:a.stdout||void 0,stderr:a.stderr||(c==="ENOENT"?`OpenSpec CLI not found: ${s}`:a.error.message)}}return{exitCode:a.status??1,stdout:a.stdout||void 0,stderr:a.stderr||void 0}}import{promises as lg}from"fs";import ln from"path";Fe();ye();Q();import on from"path";var ag=2*1024*1024;function $i(t,e,n){let i=on.resolve(t),r=on.isAbsolute(e)?on.resolve(e):on.resolve(i,e),s=on.relative(i,r).replaceAll("\\","/");return{root:i,relative:Ie(s,n),target:r}}async function Me(t,e,n){let i=$i(t,e,n.label);return N(i.root,i.relative,n)}async function an(t,e,n){return(await Me(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function cn(t,e,n){return(await cg(t,e,n)).toString("utf8")}async function cg(t,e,n){let i=$i(t,e,n.label);return(await D(i.root,i.relative,n.maxBytes??ag,{label:n.label,hooks:n.hooks})).bytes}async function to(t,e,n){let i=$i(t,e,n);return Gs(i.root,i.relative,{label:n})}async function Nl(t,e,n,i){let r=$i(t,e,i.label);await N(r.root,r.relative,{label:i.label,expected:"file"}),await ee(r.target,n,{containedRoot:r.root,beforeTemporaryOpen:i.beforeTemporaryOpen,beforeCommit:i.beforeCommit,exclusive:i.exclusive})}function no(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
143
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function un(t){let e=no(t);if(e)throw new Error(e)}function ug(t,e){return{label:$(t,e),directory:e}}async function qi(t,e,n){let i=ug(t,e);if(!(await Me(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Me(t,ln.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Tl(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function fg(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await qi(t,ln.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Me(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await lg.readdir(e,{withFileTypes:!0})){if(!Tl(o.name,n))continue;let a=await qi(t,ln.join(e,o.name),`Classic archived change ${o.name}`);a.exists&&a.stateExists&&s.push(a.change)}return s.sort((o,a)=>a.directory.localeCompare(o.directory))[0]??null}async function io(t,e=process.cwd()){un(t);let n=await ce(e),i=await qi(n.projectRoot,ln.join(n.changesDir,t),`Classic active change ${t}`);return{...i.change,exists:i.exists,stateExists:i.stateExists}}async function Li(t,e=process.cwd(),n={}){un(t);let i=await ce(e);if(n.preferredArchiveName!==void 0){let r=n.preferredArchiveName;if(r!==t&&!Tl(r,t))throw new Error(`Classic preferred archive name '${r}' does not belong to change '${t}'`);let s=await qi(i.projectRoot,ln.join(i.archiveDir,r),`Classic preferred archived change ${r}`);return s.exists&&s.stateExists?s.change:null}return fg(i.projectRoot,i.archiveDir,t,n)}import{promises as Cu}from"fs";import X from"path";import{fileURLToPath as Eu}from"url";import{promises as pg}from"fs";import ke from"path";Q();ye();import fn from"path";function dg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function jl(t,e,n,i){let r=Ie(n,"Classic handoff artifact pointer");if((await N(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await ce(t),a=`${$(t,o.changesDir)}/`,l=(o.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>r.startsWith(y));if(!l)return null;let f=r.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];un(u);let d=f.slice(2),h=fn.resolve(e);if(fn.dirname(h)!==fn.resolve(o.archiveDir))return null;let g=fn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await N(t,$(t,h),{label:"Classic archived change directory",expected:"directory"});let m=fn.join(h,".comet",...d),w=$(t,m);try{return await D(t,w,i,{label:"Historical Classic archived handoff artifact"}),w}catch(y){if(dg(y))return null;throw y}}Q();var Il=2*1024*1024;function dn(t,e){return ke.relative(t,e).split(ke.sep).join("/")}async function pn(t,e,n,i,r){if(!n)return{code:e,satisfied:!1};let s=n.replaceAll("\\","/");if(r)return{code:e,satisfied:!1,source:s,detail:`Classic layout is unsafe or unavailable: ${r instanceof Error?r.message:String(r)}`};try{if(i){let a=i.artifactLayout==="legacy"?"docs":"legacy",c=$(t,Ii(t,a).openSpecRoot);if((s===c||s.startsWith(`${c}/`))&&(await N(t,s,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:s,detail:"standalone OpenSpec root is not a Comet artifact root"}}let o=await Ri(t,s,{label:`${e} artifact`});return{code:e,satisfied:o,source:s,...o?{resolvedSource:s}:{}}}catch(o){return{code:e,satisfied:!1,source:s,detail:`unsafe artifact pointer outside the project or through a special path: ${o instanceof Error?o.message:String(o)}`}}}async function mg(t,e,n,i){try{i??=await ce(t)}catch(s){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${s instanceof Error?s.message:String(s)}`}}let r=await pn(t,"design.handoff",n,i);if(!n||r.satisfied||r.detail)return r;try{let s=await jl(t,e,n,Il);return s?{...r,satisfied:!0,resolvedSource:s,detail:`resolved historical legacy pointer from archived change: ${s}`}:r}catch(s){return{...r,satisfied:!1,detail:`unsafe archived handoff fallback: ${s instanceof Error?s.message:String(s)}`}}}async function Di(t,e,n){return pn(t,e,dn(t,n))}async function hg(t,e){let n=ke.join(e,"specs"),i;try{let o=dn(t,n);if(!(await N(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await pg.readdir(n)}catch(o){return o.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${o instanceof Error?o.message:String(o)}`}}let r=i.map(o=>ke.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Ri(t,dn(t,o),{label:"OpenSpec delta spec"})?o:null}catch{return null}}))).filter(o=>o!==null);return{code:"openspec.delta-spec",satisfied:s.length>0,source:s[0]?dn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function gg(t,e){let n,i=dn(t,e);try{n=(await D(t,i,Il,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(o){return o.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:i,detail:`unsafe tasks artifact: ${o instanceof Error?o.message:String(o)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],s=r.filter(o=>o[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&s===r.length,source:i,detail:`${s} of ${r.length} tasks complete`}}function mn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function gt(t,e){let n=await be(t),i=e.classic,r=ke.join(t,"proposal.md"),s=ke.join(t,"design.md"),o=ke.join(t,"tasks.md"),a=e.run?ke.resolve(t,e.run.checkpointRef):ke.join(t,".comet","checkpoint.json"),c,l;try{c=await ce(n)}catch(d){l=d}let f=await Promise.all([Di(n,"openspec.proposal",r),Di(n,"openspec.design",s),Di(n,"openspec.tasks",o),hg(n,t),pn(n,"design.document",i?.designDoc??null,c,l),pn(n,"build.plan",i?.plan??null,c,l),gg(n,o),pn(n,"verification.report",i?.verificationReport??null,c,l),mg(n,t,i?.handoffContext??null,c),Di(n,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!i?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),f}import{createHash as Rw,randomUUID as Ow}from"crypto";import{promises as wo}from"fs";import Ce from"path";function wg(t){return t.classicProfile??t.workflow}function yg(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function vg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function bg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!mn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!yg(e))return"full.build.configure"}else if(!vg(e))throw new Error(`${t} build configuration is incomplete`);return mn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function kg(t,e,n){return e.verifyResult!=="pass"||!mn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Sg(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Fi(t,e){let n=wg(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return mn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return bg(n,t,e);case"verify":return kg(n,t,e);case"archive":return Sg(n,t)}}var Qi=nt(Qe(),1);Fe();Q();import zi from"path";Vi();var Yl=["full","hotfix","tweak"],Ze=1,qg=["open","design","build","verify","archive"],Lg=["en","zh-CN"],Dg=["off","beta"],Fg=["subagent-driven-development","executing-plans","direct"],Mg=["plan-ready"],Wg=["confirmed"],Bg=["tdd","direct"],Kg=["off","standard","thorough"],Yg=["current","branch","worktree"],Ug=["light","full"],Jg=["pending","pass","fail"],Vg=["pending","handled"],Hg=["pending","confirmed"],Gi=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],Gg=["run_id"],zg=new Set([...Gi,...Gg]),Qg=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Ul(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function wt(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function Y(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function lo(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function Xg(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function Hi(t,e){let n=wt(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function Zg(t,e){let n=wt(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function ew(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==Ze)throw new Error(`Invalid Classic state: classic_migration must be ${Ze}`);return e}function tw(t){if(!Gi.some(n=>Ul(t,n)))return null;for(let n of Qg)if(!Ul(t,n))return null;return{workflow:Y(t,"workflow",Yl,!1),language:Y(t,"language",Lg),phase:Y(t,"phase",qg,!1),contextCompression:Y(t,"context_compression",Dg),buildMode:Y(t,"build_mode",Fg),buildPause:Y(t,"build_pause",Mg),subagentDispatch:Y(t,"subagent_dispatch",Wg),tddMode:Y(t,"tdd_mode",Bg),reviewMode:Y(t,"review_mode",Kg),isolation:Y(t,"isolation",Yg),boundBranch:wt(t,"bound_branch"),verifyMode:Y(t,"verify_mode",Ug),autoTransition:lo(t,"auto_transition"),baseRef:wt(t,"base_ref"),designDoc:Hi(t,"design_doc"),plan:Hi(t,"plan"),verifyResult:Y(t,"verify_result",Jg,!1),verifyFailures:Xg(t,"verify_failures"),verificationReport:Hi(t,"verification_report"),branchStatus:Y(t,"branch_status",Vg),createdAt:wt(t,"created_at"),verifiedAt:wt(t,"verified_at"),archiveConfirmation:Y(t,"archive_confirmation",Hg),archived:lo(t,"archived",!1),directOverride:lo(t,"direct_override"),handoffContext:Hi(t,"handoff_context"),handoffHash:Zg(t,"handoff_hash"),classicProfile:Y(t,"classic_profile",Yl),classicMigration:ew(t)}}function uo(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Yi(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:tw(t),run:n,unknownKeys:Object.keys(t).filter(i=>!zg.has(i))}}function Jl(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}Vi();var nw=2*1024*1024;function wn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function Vl(t,e,n){t.get(e)!==n&&t.set(e,n)}function iw(t,e){if(e.classic)for(let[n,i]of Object.entries(Jl(e.classic)))Vl(t,n,i);else for(let n of Gi)t.delete(n);oo(t.toJS(),e.run),e.run?Vl(t,"run_id",e.run.runId):t.delete("run_id")}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 sw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function Hl(t){let e;try{e=(await D(zi.dirname(t),zi.basename(t),nw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new Qi.Document({})}let n=(0,Qi.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return wn(n),n}async function de(t,e={}){let n=e.migrate!==!1,i=zi.join(t,".comet.yaml"),r=await Hl(i),s=wn(r),o=sw(r);o&&(s=wn(r));let a=await ao(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Vi(),Kl));a=c(s),a&&n&&(await Ji(t,a),rw(r),o=!0)}return o&&n&&await ee(i,r.toString(),{containedRoot:t}),uo(wn(r),a)}async function et(t,e,n={}){let i=zi.join(t,".comet.yaml"),r=await Hl(i);iw(r,{...e,unknownKeys:e.unknownKeys??[]}),uo(wn(r),e.run??null),await ee(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await Ji(t,e.run):await co(t)}function Gl(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}Ki();import Xi from"path";var Se={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pe(t,e){if(Xi.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Xi.resolve(t),i=Xi.resolve(n,e);if(i!==n&&!i.startsWith(n+Xi.sep))throw new Error("Run path must stay inside the change directory")}async function yt(t,e,n,i={}){pe(t,e),await Wi(t,e,`${JSON.stringify(n)}
144
- `,Se.trajectory,"Run trajectory",i)}async function yn(t,e,n={}){pe(t,e);let i=await We(t,e,Se.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,s)=>({line:r,number:s+1})).filter(({line:r})=>r.length>0).map(({line:r,number:s})=>{try{return JSON.parse(r)}catch(o){throw new Error(`Invalid Trajectory event at line ${s}`,{cause:o})}})}async function fo(t,e,n={}){pe(t,e);let i=await We(t,e,Se.artifacts,"Run artifacts",n);return i===null?{}:JSON.parse(i)}async function Zi(t,e,n,i={}){pe(t,e),await Be(t,e,JSON.stringify(n,null,2)+`
145
- `,Se.artifacts,"Run artifacts",i)}async function zl(t,e,n,i={}){pe(t,e),await Be(t,e,n,Se.context,"Run context",i)}async function Ql(t,e,n={}){return pe(t,e),We(t,e,Se.context,"Run context",n)}async function Xl(t,e,n,i={}){pe(t,e),await Be(t,e,JSON.stringify(n,null,2)+`
146
- `,Se.pendingAction,"Run pending action",i)}async function Zl(t,e,n={}){pe(t,e);let i=await We(t,e,Se.pendingAction,"Run pending action",n);return i===null?null:JSON.parse(i)}async function eu(t,e,n={}){pe(t,e),await Bi(t,e,"Run pending action",n)}async function er(t,e,n,i={}){pe(t,e),await Be(t,e,JSON.stringify(n,null,2)+`
147
- `,Se.checkpoint,"Run checkpoint",i)}import{createHash as mu,randomUUID as Cw}from"crypto";import{promises as F}from"fs";import q from"path";var iu=nt(Qe(),1);import{promises as po}from"fs";import te from"path";var ow=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],aw=["deterministic","adaptive"],cw=["function","mcp","script","agent"],lw=["none","read","write","external"],uw=["progress","step","completion"],fw=["artifact_exists","state_equals"];function tt(t,e,n){return new Error(`${t}: ${e} ${n}`)}function H(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw tt(e,n,"must be an object")}function Ke(t,e,n){if(!Array.isArray(t))throw tt(e,n,"must be an array")}function U(t,e,n){if(typeof t!="string")throw tt(e,n,"must be a string")}function le(t,e,n,i){e in t&&U(t[e],n,`${i}.${e}`)}function ru(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw tt(n,`${i}.${e}`,"must be a boolean")}function Ye(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw tt(n,i,`must be one of ${e.join(", ")}`)}function tr(t,e,n){Ke(t,e,n),t.forEach((i,r)=>{U(i,e,`${n}[${r}]`)})}function tu(t,e,n){H(t,e,n),U(t.name,e,`${n}.name`),U(t.description,e,`${n}.description`),ru(t,"required",e,n)}function dw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),le(t,"source",e,n),le(t,"version",e,n)}function pw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),U(t.role,e,`${n}.role`),le(t,"instructions",e,n)}function mw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),Ye(t.kind,cw,e,`${n}.kind`),U(t.source,e,`${n}.source`),Ye(t.sideEffect,lw,e,`${n}.sideEffect`),ru(t,"requiresConfirmation",e,n)}function hw(t,e,n){H(t,e,n),Ye(t.type,ow,e,`${n}.type`),le(t,"ref",e,n),le(t,"prompt",e,n),le(t,"question",e,n),"options"in t&&tr(t.options,e,`${n}.options`)}function gw(t,e,n){H(t,e,n),U(t.id,e,`${n}.id`),hw(t.action,e,`${n}.action`),le(t,"next",e,n),"completionEvals"in t&&tr(t.completionEvals,e,`${n}.completionEvals`)}function ww(t,e){let n="goal";H(t,e,n),U(t.statement,e,`${n}.statement`),Ke(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{tu(i,e,`${n}.inputs[${r}]`)}),Ke(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{tu(i,e,`${n}.outputs[${r}]`)}),tr(t.success,e,`${n}.success`)}function yw(t,e){let n="orchestration";H(t,e,n),Ye(t.mode,aw,e,`${n}.mode`),le(t,"entry",e,n),"steps"in t&&(Ke(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{gw(i,e,`${n}.steps[${r}]`)}))}function su(t,e){return H(t,e),Ye(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ye(t.kind,["Skill"],e,"kind"),H(t.metadata,e,"metadata"),U(t.metadata.name,e,"metadata.name"),U(t.metadata.version,e,"metadata.version"),U(t.metadata.description,e,"metadata.description"),ww(t.goal,e),yw(t.orchestration,e),Ke(t.skills,e,"skills"),t.skills.forEach((n,i)=>{dw(n,e,`skills[${i}]`)}),Ke(t.agents,e,"agents"),t.agents.forEach((n,i)=>{pw(n,e,`agents[${i}]`)}),Ke(t.tools,e,"tools"),t.tools.forEach((n,i)=>{mw(n,e,`tools[${i}]`)}),t}function ou(t,e){H(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&tr(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw tt(e,n,"must be a finite number");return t}function vw(t,e){return H(t,e),"runtime"in t&&au(t.runtime,e,"runtime"),t}function au(t,e,n){return Ke(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;H(i,e,s),U(i.id,e,`${s}.id`),Ye(i.scope,uw,e,`${s}.scope`),Ye(i.type,fw,e,`${s}.type`),le(i,"artifact",e,s),le(i,"field",e,s),le(i,"equals",e,s)}),t}async function mo(t){let e=await po.readFile(t,"utf8");try{return(0,iu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw tt(t,"document",i)}}async function bw(t){try{return await mo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function nu(t){try{return await po.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function kw(t){let e=te.join(t,"checks.yaml"),n=te.join(t,"evals.yaml"),[i,r]=await Promise.all([nu(e),nu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:vw(await mo(e),e)}:{document:null}}async function cu(t){let e=te.resolve(t.root),n=te.resolve(t.controlRoot);t.requireSkillMarkdown&&await po.access(te.join(e,"SKILL.md"));let i=te.join(n,"skill.yaml"),r=te.join(n,"guardrails.yaml"),s=su(await mo(i),i),o=await bw(r),a=o===null?null:ou(o,r),c=await kw(n),l={allowedSkills:s.skills.map(f=>f.id),allowedAgents:s.agents.map(f=>f.id),allowedTools:s.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function lu(t){let e=te.resolve(t);return cu({root:e,controlRoot:te.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function uu(t){let e=te.resolve(t);return cu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function fu(t,e,n=te.join(e,"package.json")){H(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=su(t.definition,n),s=ou(t.guardrails,n),o=au(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:te.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import du from"path";function Sw(t,e,n,i){t.type==="invoke_skill"&&!e.definition.skills.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${i} ask_user action requires question`)}function pu(t){let e=[],{definition:n,guardrails:i,evals:r}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),i.maxIterations<1&&e.push("maxIterations must be at least 1"),i.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let s=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||s.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let o=new Set;for(let a of s)o.has(a.id)&&e.push(`duplicate step id: ${a.id}`),o.add(a.id),Sw(a.action,t,e,a.id);(!n.orchestration.entry||!o.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of s){a.next&&!o.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])r.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let o of n.tools){if(o.kind!=="script")continue;let a=du.posix.normalize(o.source.replaceAll("\\","/"));(du.isAbsolute(o.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${o.id} must reference a relative path inside the Skill package`)}for(let o of i.allowedSkills)n.skills.some(a=>a.id===o)||e.push(`guardrails allow undeclared skill: ${o}`);for(let o of i.allowedAgents)n.agents.some(a=>a.id===o)||e.push(`guardrails allow undeclared agent: ${o}`);for(let o of i.allowedTools)n.tools.some(a=>a.id===o)||e.push(`guardrails allow undeclared tool: ${o}`);return e}function nr(t){return Array.isArray(t)?t.map(nr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,nr(n)])):t}function Ew(t){return nr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function xw(t){return q.posix.normalize(t.replaceAll("\\","/"))}function vt(t,e,n){let i=q.relative(t,e);if(!(i===""||!q.isAbsolute(i)&&!i.startsWith(`..${q.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function hu(t,e,n){let i=xw(e);if(q.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=q.resolve(t,...i.split("/"));vt(t,r,n);let s;try{s=await F.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(vt(t,s,n),!(await F.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await F.readFile(s)}}async function _w(t){let e=await F.realpath(t.root),n=t.packageKind==="runtime"?[]:[await hu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await hu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function Pw(t,e){let n=e.map(i=>({path:i.path,sha256:mu("sha256").update(i.content).digest("hex")}));return mu("sha256").update(JSON.stringify(nr({package:t,files:n}))).digest("hex")}function yu(t){return JSON.stringify(t,null,2)+`
148
- `}async function vu(t){let e=Ew(t),n=await _w(t);return{document:e,files:n,hash:Pw(e,n)}}async function ir(t){return(await vu(t)).hash}async function gu(t){try{return await F.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function wu(t,e){try{if((await F.readFile(q.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await F.readFile(q.join(t,"package.json"),"utf8")!==yu(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await F.readFile(q.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function ho(t,e){let n=await vu(t),i=q.resolve(e,".comet","skill-snapshots"),r=q.join(i,n.hash);if(await F.mkdir(i,{recursive:!0}),await gu(r))return await wu(r,n),{hash:n.hash,snapshotDir:r};let s=q.join(i,`.tmp-${Cw()}`);vt(i,s,"Temporary snapshot"),vt(i,r,"Published snapshot");try{await F.mkdir(s);for(let o of n.files){let a=q.join(s,...o.path.split("/"));vt(s,a,`Snapshot file ${o.path}`),await F.mkdir(q.dirname(a),{recursive:!0}),await F.writeFile(a,o.content)}await F.writeFile(q.join(s,"package.json"),yu(n.document)),await F.writeFile(q.join(s,"sha256"),n.hash+`
149
- `),await F.rename(s,r)}catch(o){if(await gu(r)){try{await wu(r,n)}finally{await F.rm(s,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await F.rm(s,{recursive:!0,force:!0}),o}return{hash:n.hash,snapshotDir:r}}async function go(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=q.resolve(t,".comet","skill-snapshots"),i=q.join(n,e);vt(n,i,"Skill snapshot");try{let r=(await F.readFile(q.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=q.join(i,"package.json"),o=JSON.parse(await F.readFile(s,"utf8")),a=fu(o,i,s),c=pu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
- `));let l=await ir(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(r){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:r})}}async function bu(t){try{return await wo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function ku(t){return Rw("sha256").update(t).digest("hex")}function Aw(t){return ku(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Nw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Tw(t,e){let n=await be(t),i=Object.fromEntries(e.filter(o=>o.satisfied&&o.source).map(o=>[Nw(o.code),o.source])),r=Ce.join(t,"subagent-progress.md");await bu(r)&&(i.subagent_progress=Ce.relative(n,r).split(Ce.sep).join("/"));let s=e.find(o=>o.code==="design.handoff"&&o.satisfied);return s?.source&&(i.handoff_context=s.source),i}function jw(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:Ze,profile:e,source:"pre-migration"}}]}async function Iw(t){await Promise.all(t.map(e=>wo.rm(e,{recursive:!0,force:!0})))}async function Su(t,e){let n=await de(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==Ze)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await ir(e.skillPackage)!==n.run.skillHash)return await go(t,n.run.skillHash),{classic:i,run:n.run,evidence:await gt(t,n),migrated:!1,snapshotDir:Ce.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await ho(e.skillPackage,t);return{classic:i,run:n.run,evidence:await gt(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let s=await gt(t,n),o=Fi(i,s);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===o))throw new Error(`Classic Skill package does not define resolved step: ${o}`);let a=await ir(e.skillPackage),c=Ce.join(t,".comet","skill-snapshots",a),l=await bu(c),f=[];try{let u=await ho(e.skillPackage,t),d=Gl(e.skillPackage,e.runId?.()??Ow(),u.hash);d.currentStep=o,o==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:Ze},g=await Tw(t,s),p=await be(t),m=s.find(k=>k.code==="design.handoff"&&k.satisfied),w=null;m?.source&&(w=await cn(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await zl(t,d.contextRef,w),f.push(Ce.resolve(t,d.contextRef))),await Zi(t,d.artifactsRef,g),f.push(Ce.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),S={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:ku(w),artifactsHash:Aw(g),createdAt:y};await er(t,d.checkpointRef,S),f.push(Ce.resolve(t,d.checkpointRef)),f.push(Ce.resolve(t,d.trajectoryRef));for(let k of jw(d,r,y))await yt(t,d.trajectoryRef,k);return await et(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:s,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await Iw(f),l||await wo.rm(c,{recursive:!0,force:!0}),u}}async function $w(t){try{return(await Cu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function rr(t){try{return(await Cu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function qw(t){return await $w(t)?await rr(X.join(t,"skill.yaml"))?!0:await rr(X.join(t,"SKILL.md"))&&await rr(X.join(t,"comet","skill.yaml")):!1}function Lw(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function Dw(){let t=X.dirname(Eu(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,X.resolve(t,"..","runtime","classic"),X.resolve(t,"..","..","comet","runtime","classic"),X.resolve(t,"..","..","assets","skills","comet","runtime","classic"),X.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,X.resolve(t,"..","..","comet-classic"),X.resolve(t,"..","..","assets","skills","comet-classic"),X.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await qw(n))return n;return null}async function Fw(t){return await rr(X.join(t,"skill.yaml"))?uu(t):lu(t)}async function xu(t){let e=await Dw();return Su(t,{skillPackage:e?await Fw(e):Lw(X.dirname(Eu(import.meta.url)))})}async function _u(t,e,n,i){let r=await de(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await gt(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Fi(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await et(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await yn(t,a.trajectoryRef);return await yt(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:o,...i}}),a}Ki();import Mw from"path";var Ww=Mw.join(".comet","state-events.jsonl"),Bw=8*1024*1024;async function Pu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Wi(t,Ww,`${JSON.stringify(n)}
151
- `,Bw,"Classic state event log"),n}var Kw={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}};function Yw(t){return t.toISOString().slice(0,10)}function x(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function Ru(t,e,n={}){let i=Kw[e];if(t.phase!==i.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${i.from}'`);let r={...t},s=[],o=n.now??new Date;if(e==="open-complete")x(r,s,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")x(r,s,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";x(r,s,"phase","verify"),x(r,s,"verifyResult","pending"),x(r,s,"branchStatus","pending"),a||x(r,s,"verificationReport",null)}else if(e==="verify-pass")x(r,s,"verifyResult","pass"),x(r,s,"verifyFailures",0),x(r,s,"phase","archive"),x(r,s,"verifiedAt",Yw(o)),x(r,s,"archiveConfirmation","pending"),x(r,s,"branchStatus","pending");else if(e==="verify-fail")x(r,s,"verifyResult","fail"),x(r,s,"verifyFailures",r.verifyFailures+1),x(r,s,"phase","build"),x(r,s,"branchStatus","pending");else if(e==="preset-escalate"){if(r.workflow!=="hotfix"&&r.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${r.workflow}'`);x(r,s,"workflow","full"),x(r,s,"classicProfile","full"),x(r,s,"phase","design"),x(r,s,"designDoc",null),x(r,s,"buildPause",null),x(r,s,"buildMode",null),x(r,s,"subagentDispatch",null),x(r,s,"tddMode",null),x(r,s,"reviewMode",null),x(r,s,"isolation",null),x(r,s,"boundBranch",null),x(r,s,"verifyMode",null),x(r,s,"directOverride",null)}else if(e==="archive-confirm"){if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);x(r,s,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);x(r,s,"verifyResult","pending"),x(r,s,"verifyFailures",0),x(r,s,"phase","verify"),x(r,s,"verifiedAt",null),x(r,s,"archiveConfirmation",null),x(r,s,"branchStatus","pending")}else{if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);x(r,s,"archived",!0)}return{classic:r,effects:s,definition:i}}Js();import{promises as Uw}from"fs";import Jw from"path";var yo="comet.selection.v2",Vw=16*1024;function vo(t){return Jw.join(t,".comet","current-change.json")}function Hw(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Ou(t){return t===null||typeof t=="string"}function Gw(t){let e;try{e=JSON.parse(t)}catch(n){throw new Error(`current change selection contains invalid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(!Hw(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Ou(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:yo,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==yo)throw new Error(`current change selection schema must be ${yo}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Ou(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function bo(t){let e;try{let i=vo(t),{bytes:r}=await _i(i,Vw,{label:"current change selection"});e=r.toString("utf8")}catch(i){if(i.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${i instanceof Error?i.message:String(i)}`,{cause:i})}return{status:"selected",...Gw(e)}}async function Au(t){await Uw.rm(vo(t),{force:!0})}async function Nu(t,e,n){let i=await bo(t);return i.status!=="selected"||i.selection.workflow!==e||i.selection.change!==n?!1:(await Au(t),!0)}var Tu=null;function ju(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Iu(t,e){return(...n)=>{let i=Tu;if(i===null)return e(...n);let r=ju(`async:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n).catch(a=>{throw i.entries.delete(r),a});return i.entries.set(r,{value:o}),o}}function ko(t,e){return(...n)=>{let i=Tu;if(i===null)return e(...n);let r=ju(`sync:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n);return i.entries.set(r,{value:o}),o}}import{execFileSync as $u}from"child_process";var zw=nt(Qe(),1);function Qw(t){try{let e=$u("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var yC=ko("liveGitBranch",t=>Qw(t));function Xw(t){try{return $u("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var vC=ko("isGitWorkTree",t=>Xw(t));var AC=Iu("readCometCurrentSelection",t=>bo(t));async function qu(t,e){return Nu(t,"classic",e)}var ty="\x1B[32m",ny="\x1B[31m",iy="\x1B[33m",Co="\x1B[0m";function ne(t){return`${ty}${t}${Co}`}function G(t){return`${ny}${t}${Co}`}function vn(t){return`${iy}${t}${Co}`}var K=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},So=class{stderr=[];openSpecStdout=[];openSpecStderr=[];stepsOk=0;stepsTotal=0;captureOpenSpec(e){e.stdout&&this.openSpecStdout.push(e.stdout),e.stderr&&this.openSpecStderr.push(e.stderr)}toResult(e=0){let n=this.stderr.length>0?this.stderr.join(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};ol.Lexer=Wo});var Mo=v(sl=>{"use strict";var Fo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r<n;){let o=r+n>>1;this.lineStarts[o]<e?r=o+1:n=o}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let i=this.lineStarts[r-1];return{line:r,col:e-i+1}}}};sl.LineCounter=Fo});var Ko=v(fl=>{"use strict";var lh=br("process"),al=gn(),uh=Do();function je(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function cl(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 ul(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 yn(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function pt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function vn(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r<e.length;++r)t.push(e[r])}function ll(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ul(e.value)?e.value.end?vn(e.value.end,e.sep):e.value.end=e.sep:vn(e.start,e.sep),delete e.sep)}var Bo=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 uh.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,lh.env.LOG_TOKENS&&console.log("|",al.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=al.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&ll(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&cl(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{cl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let r=yn(this.peek(2)),n=pt(r),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:n,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 r=this.source.indexOf(`
139
+ `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
140
+ `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){vn(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;a<r.sep.length;++a){let c=r.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=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.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(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(je(r.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(ul(r.key)&&!je(r.sep,"newline")){let s=pt(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(je(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=pt(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):je(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!je(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){vn(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||je(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=yn(n),o=pt(i);ll(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 r=this.source.indexOf(`
141
+ `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
142
+ `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=yn(e),n=pt(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=yn(e),n=pt(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.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())}}};fl.Parser=Bo});var gl=v(tr=>{"use strict";var dl=Oo(),fh=Jt(),er=Vt(),dh=Pi(),ph=P(),mh=Mo(),pl=Ko();function ml(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new mh.LineCounter||null,prettyErrors:e}}function hh(t,e={}){let{lineCounter:r,prettyErrors:n}=ml(e),i=new pl.Parser(r?.addNewLine),o=new dl.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(er.prettifyError(t,r)),a.warnings.forEach(er.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function hl(t,e={}){let{lineCounter:r,prettyErrors:n}=ml(e),i=new pl.Parser(r?.addNewLine),o=new dl.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 er.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(er.prettifyError(t,r)),s.warnings.forEach(er.prettifyError(t,r))),s}function gh(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=hl(t,r);if(!i)return null;if(i.warnings.forEach(o=>dh.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:n},r))}function wh(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return ph.isDocument(t)&&!n?t.toString(r):new fh.Document(t,n,r).toString(r)}tr.parse=gh;tr.parseAllDocuments=hh;tr.parseDocument=hl;tr.stringify=wh});var $e=v(O=>{"use strict";var yh=Oo(),vh=Jt(),kh=co(),Uo=Vt(),bh=At(),Ie=P(),Sh=Oe(),Ch=j(),Eh=Ne(),xh=Te(),Ph=gn(),_h=Do(),Rh=Mo(),Oh=Ko(),kn=gl(),wl=Pt();O.Composer=yh.Composer;O.Document=vh.Document;O.Schema=kh.Schema;O.YAMLError=Uo.YAMLError;O.YAMLParseError=Uo.YAMLParseError;O.YAMLWarning=Uo.YAMLWarning;O.Alias=bh.Alias;O.isAlias=Ie.isAlias;O.isCollection=Ie.isCollection;O.isDocument=Ie.isDocument;O.isMap=Ie.isMap;O.isNode=Ie.isNode;O.isPair=Ie.isPair;O.isScalar=Ie.isScalar;O.isSeq=Ie.isSeq;O.Pair=Sh.Pair;O.Scalar=Ch.Scalar;O.YAMLMap=Eh.YAMLMap;O.YAMLSeq=xh.YAMLSeq;O.CST=Ph;O.Lexer=_h.Lexer;O.LineCounter=Rh.LineCounter;O.Parser=Oh.Parser;O.parse=kn.parse;O.parseAllDocuments=kn.parseAllDocuments;O.parseDocument=kn.parseDocument;O.stringify=kn.stringify;O.visit=wl.visit;O.visitAsync=wl.visitAsync});import bn from"path";function Ih(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||bn.posix.isAbsolute(r)||bn.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be a project-relative path`);if(r===".")return[];let n=r.replaceAll("\\","/").split("/");if(n.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function Sn(t){let e=Ih(t,"native.artifact_root");return e.length===0?".":e.join("/")}function vl(t,e="docs"){let r=t??e;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function ye(t,e,r=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||bn.posix.isAbsolute(n)||bn.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let i=n.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(!r&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function mt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function kl(t,e,r){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return n}function bl(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>Jo)throw new Error(`${e} exceeds ${Jo} characters`);let r=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?r+=1:t[n]==="*"&&(r+=1,t[n+1]==="*"&&(n+=1));if(r>Ho)throw new Error(`${e} contains more than ${Ho} wildcard tokens`);return t}function yl(t,e,r){if(t===void 0)return[...r];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>bl(n,e)))].sort((n,i)=>n.localeCompare(i,"en"))}function Yo(t,e,r){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${r} must be a positive integer`);return n}function $h(t){if(t===void 0)return{...we,include:[...we.include],exclude:[...we.exclude]};let e=mt(t,"native.snapshot");return{include:yl(e.include,"native.snapshot.include",we.include),exclude:yl(e.exclude,"native.snapshot.exclude",we.exclude),max_files:Yo(e.max_files,we.max_files,"native.snapshot.max_files"),max_total_bytes:Yo(e.max_total_bytes,we.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Yo(e.max_duration_ms,we.max_duration_ms,"native.snapshot.max_duration_ms")}}function Lh(t){if(t===void 0)return;let e=mt(t,"native.pending_root_move"),r=e.id,n=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="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=mt(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,f=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:f}}return{id:r,fromArtifactRoot:Sn(n),toArtifactRoot:Sn(i),stage:o,...s?{cleanup:s}:{}}}function qh(t,e={}){let r=mt(t,"native"),n=r.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let i=r.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=r.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=r.max_verify_failures??Ah;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Lh(r.pending_root_move);return{artifact_root:Sn(n),language:kl(r.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,snapshot:$h(r.snapshot),...a?{pending_root_move:a}:{}}}function Wh(t){let e=mt(t,"classic"),r=e.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="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");return{artifact_layout:vl(e.artifact_layout),language:kl(e.language,"zh-CN","classic.language"),context_compression:r,review_mode:n,auto_transition:i}}function Dh(t){let r=mt(t,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((n,i)=>ye(n,`hook.allow_paths[${i}]`)))]}}function Fh(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Mh(t,e,r,n,i,o){let s=t.schema!==void 0;if(!(s||t.default_workflow!==void 0||t.workflows!==void 0||!o.allowPartialProject&&t.native!==void 0)||o.allowPartialProject&&!s)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let c=t.workflows??[t.default_workflow];if(!Array.isArray(c)||c.length===0||c.some(f=>f!=="native"&&f!=="classic"))throw new Error("workflows must contain native and/or classic");let l=[...new Set(c)];if(!l.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(l.includes("native")&&!r)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:l,ambient_resume:i,...e?{hook:e}:{},...r?{native:r}:{},...n?{classic:n}:{}}}function ht(t,e={}){let r=(0,Go.parseDocument)(t,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let n=r.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=n,o=Fh(i.ambient_resume),s=i.hook===void 0?void 0:Dh(i.hook),a=i.native===void 0?void 0:qh(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),c=i.classic===void 0?void 0:Wh(i.classic),l=Mh(i,s,a,c,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:l,ambient_resume:o,...s?{hook:s}:{},...a?{native:a}:{},...c?{classic:c}:{}}}var Go,rr,Jo,Ho,Ah,Nh,Th,jh,we,ve=q(()=>{"use strict";Go=Je($e(),1),rr=64*1024,Jo=1024,Ho=64,Ah=5,Nh=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],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=[...Nh,...Th].sort((t,e)=>t.localeCompare(e,"en")),we={include:["**/*"],exclude:[...jh],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function Le(t){return t!==0&&t!==0n&&t!=="0"}function Cn(t,e){return Le(t.dev)&&Le(e.dev)&&Le(t.ino)&&Le(e.ino)}function ke(t,e){let r=Le(t.dev)&&Le(e.dev);if(r&&t.dev!==e.dev)return!1;let n=Le(t.ino)&&Le(e.ino);return n&&t.ino!==e.ino?!1:r&&n?!0:t.birthtime===e.birthtime}var En=q(()=>{"use strict"});import{constants as xn,promises as Ze}from"fs";function Vo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Sl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function nr(t){return{dev:t.dev,ino:t.ino,birthtime:Vo(t)}}function Pn(t,e){let r=nr(t),n=nr(e);return Cn(r,n)?ke(r,n):ke(r,n)&&Vo(t)===Vo(e)&&Sl(t)===Sl(e)&&t.size===e.size}async function _n(t,e,r={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=r.label??"file",i=r.bigint===!0,o=await Ze.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new qe("not-regular-file",`${n} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new qe("too-large",`${n} exceeds ${e} bytes`);let s=await Ze.realpath(t);await r.verify?.("pre-open",{realPath:s,identity:nr(o)});let a=process.platform==="win32"?xn.O_RDONLY:xn.O_RDONLY|xn.O_NOFOLLOW|xn.O_NONBLOCK,c;try{c=await Ze.open(t,a)}catch(l){throw l.code==="ELOOP"?new qe("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:i}),Ze.lstat(t,{bigint:i}),Ze.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==s||!Pn(o,l)||!Pn(o,f))throw new qe("changed",`${n} changed while opening`);await r.verify?.("post-open",{realPath:u,identity:nr(l)}),await r.hooks?.afterOpen?.();let d=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(h+=S,h>e)throw new qe("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await r.hooks?.beforeFinalCheck?.();let[p,m,w]=await Promise.all([c.stat({bigint:i}),Ze.lstat(t,{bigint:i}),Ze.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||w!==s||!Pn(o,p)||!Pn(o,m))throw new qe("changed",`${n} changed while reading`);return await r.verify?.("post-read",{realPath:w,identity:nr(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:w}}finally{await c.close()}}var qe,zo=q(()=>{"use strict";En();qe=class extends Error{reason;constructor(e,r,n){super(r,n),this.name="RaceSafeReadError",this.reason=e}}});import{promises as We}from"fs";import ae from"path";function Cl(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Rn(t,e){let r=ae.relative(t,e);return r===""||!ae.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${ae.sep}`)}async function Qo(t,e){let r=ae.resolve(t),n=await We.lstat(r);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return We.realpath(r)}async function Xo(t,e,r,n){let i=t;for(let o=0;o<r.length;o++){i=ae.join(i,r[o]);let s;try{s=await We.lstat(i)}catch(f){if(Cl(f))return{exists:!1,kind:"missing"};throw f}let a=ae.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${a}`);let c=o===r.length-1;if(!c&&!s.isDirectory())throw new Error(`${n.label} ancestor ${a} must be a real directory`);if(c&&(n.expected==="file"&&!s.isFile()||n.expected==="directory"&&!s.isDirectory()||n.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await We.realpath(i);if(!Rn(e,l))throw new Error(`${n.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 N(t,e,r){let n=ye(e,r.label),i=ae.resolve(t),o=await Qo(i,r.label),s=n.split("/"),a=ae.resolve(i,...s);if(!Rn(i,a))throw new Error(`${r.label} must stay inside the project root`);let c=await Xo(i,o,s,r);return{projectRoot:i,target:a,relative:n,exists:c.exists,kind:c.kind}}async function Zo(t,e,r){let n=ye(e,r.label),i=ae.resolve(t),o=await Qo(i,r.label),s=n.split("/"),a=i;for(let c of s){a=ae.join(a,c);let l;try{l=await We.lstat(a)}catch(d){if(!Cl(d))throw d;try{await We.mkdir(a)}catch(h){if(h.code!=="EEXIST")throw h}l=await We.lstat(a)}let f=ae.relative(i,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${r.label} directory ${f} must be a real directory`);let u=await We.realpath(a);if(!Rn(o,u))throw new Error(`${r.label} resolves outside the project root`)}return await Xo(i,o,s,{label:r.label,expected:"directory"}),a}async function On(t,e,r){return(await N(t,e,{...r,expected:"file"})).exists}async function D(t,e,r,n){let i=await N(t,e,{label:n.label,expected:"file"});if(!i.exists){let s=new Error(`${n.label} does not exist`);throw s.code="ENOENT",s}let o=await Qo(i.projectRoot,n.label);return _n(i.target,r,{...n,verify:async(s,a)=>{if(!Rn(o,a.realPath))throw new Error(`${n.label} resolves outside the project root`);await Xo(i.projectRoot,o,i.relative.split("/"),{label:n.label,expected:"file"})}})}var Q=q(()=>{"use strict";zo();ve()});import{createHash as Bh}from"crypto";function Kh(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function or(t,e={}){return(await An(t,e)).document}async function Uh(t){try{return(await D(t,ir,rr,{label:ir})).bytes}catch(e){if(Kh(e))return null;throw e}}function Yh(t){return t?{exists:!0,sha256:Bh("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function An(t,e={}){let r=await Uh(t);return{document:r?ht(r.toString("utf8"),e):null,identity:Yh(r)}}async function es(t){return(await or(t))?.config??null}var ir,gt=q(()=>{"use strict";ve();Q();ir=".comet/config.yaml"});import{randomUUID as Jh}from"crypto";import{constants as Hh,promises as I}from"fs";import B from"path";async function ts(t,e){try{return await I.link(t,e),{linked:!0}}catch(r){let n=r.code;if(n!=="ENOTSUP"&&n!=="EOPNOTSUPP")throw r}return await I.copyFile(t,e,Hh.COPYFILE_EXCL),{linked:!1}}function wt(t,e){let r=B.relative(t,e);return r===""||!B.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${B.sep}`)}function Tn(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Gh(t,e){return ke(t,Tn(e))}function Nn(t,e){let r=Tn(t),n=Tn(e);return Cn(r,n)?ke(r,n):ke(r,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function jn(t){let e=await I.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 I.realpath(t),...Tn(e)}}async function De(t){for(let e of t){let r=await I.lstat(e.path);if(!r.isDirectory()||r.isSymbolicLink()||!Gh(e,r)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Vh(t,e){let r=B.resolve(t),n=B.resolve(e);if(!wt(r,n))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await jn(r)],o=B.relative(r,n).split(B.sep).filter(Boolean),s=r;for(let a of o){await De(i),s=B.join(s,a);try{await I.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await jn(s);if(!wt(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await De(i),i}async function zh(t,e){let r=B.resolve(t),n=B.resolve(e);if(!wt(r,n))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await jn(r)],o=B.relative(r,n).split(B.sep).filter(Boolean),s=r;for(let a of o){s=B.join(s,a);try{let c=await jn(s);if(!wt(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 De(i),i}async function El(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(r){let n=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw r}finally{await e?.close()}}async function Qh(t,e,r){let n=B.dirname(t),i=await Vh(r.containedRoot,n),o=B.join(n,`.${B.basename(t)}.${Jh()}.tmp`),s,a;try{await r.beforeTemporaryOpen?.(),s=await I.open(o,"wx"),a=await s.stat();let[c,l]=await Promise.all([I.lstat(o),I.realpath(o)]);if(await De(i),!c.isFile()||c.isSymbolicLink()||!Nn(a,c)||!wt(i[0].realPath,l))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(),!Nn(a,await s.stat()))throw new Error("Contained atomic write temporary file changed while writing");await s.close(),s=void 0,await r.beforeCommit?.(),await De(i);let f=await I.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!Nn(f,a))throw new Error("Contained atomic write temporary file changed before commit");r.exclusive?(await ts(o,t),await I.unlink(o)):await I.rename(o,t),await El(n)}catch(c){await s?.close();try{await De(i),await I.rm(o,{force:!0})}catch{}throw c}}async function ee(t,e,r){await Qh(t,e,r)}async function rs(t,e){let r=B.dirname(t),n=await zh(e.containedRoot,r);if(!n)return!1;let i,o;try{i=await I.lstat(t),o=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!wt(n[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await De(n);let[s,a]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Nn(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await I.unlink(t),await De(n),await El(r),!0}var Fe=q(()=>{"use strict";En()});var lk,ns=q(()=>{"use strict";Fe();gt();Q();lk=16*1024});var os=q(()=>{"use strict";Fe();ve();gt();Q();ns()});var Mn=q(()=>{"use strict"});var Wl=q(()=>{"use strict"});var cs=q(()=>{"use strict";Mn()});var Dl=q(()=>{"use strict";Mn();cs()});var jg,Fl=q(()=>{"use strict";jg=Je($e(),1);Fe();ve();Q()});var yb,Ml=q(()=>{"use strict";Fe();Q();yb=4*1024*1024});function Kl(t,e){let r=t;for(let n of e)r+="\0"+(typeof n=="string"?n:JSON.stringify(n));return r}function Bn(t,e){return(...r)=>{let n=Bl;if(n===null)return e(...r);let i=Kl(`async:${t}`,r),o=n.entries.get(i);if(o)return o.value;let s=e(...r).catch(a=>{throw n.entries.delete(i),a});return n.entries.set(i,{value:s}),s}}function ls(t,e){return(...r)=>{let n=Bl;if(n===null)return e(...r);let i=Kl(`sync:${t}`,r),o=n.entries.get(i);if(o)return o.value;let s=e(...r);return n.entries.set(i,{value:s}),s}}var Bl,Kn=q(()=>{"use strict";Bl=null});var Cb,Ul=q(()=>{"use strict";Kn();gt();Cb=Bn("hookWritePolicy",async t=>(await es(t))?.hook??{allow_paths:[]})});var Yl=q(()=>{"use strict";Mn();Fe();Wl();Dl();ve();Fl();Q();gt();os();Ml();Ul();ns();cs()});import{TextDecoder as Ig}from"util";function Jl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function $g(t,e){try{return new Ig("utf-8",{fatal:!0}).decode(t.bytes)}catch(r){throw new Error(`${e} is not valid UTF-8`,{cause:r})}}async function us(t,e,r,n,i={}){try{let o=await D(t,e,r,{label:n,hooks:i.hooks});return{result:o,text:$g(o,n)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function Be(t,e,r,n,i={}){return(await us(t,e,r,n,i))?.text??null}async function Ke(t,e,r,n,i,o={}){if(Buffer.byteLength(r,"utf8")>n)throw new Error(`${i} exceeds ${n} bytes`);let s=await us(t,e,n,i),a=await N(t,e,{label:i,expected:"file"});await ee(a.target,r,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await us(t,e,n,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!ke(Jl(s.result.stat),Jl(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Un(t,e,r,n,i,o={}){let s=await Be(t,e,n,i);await Ke(t,e,`${s??""}${r}`,n,i,o)}async function Yn(t,e,r,n={}){let i=await N(t,e,{label:r,expected:"file"});return i.exists?rs(i.target,{containedRoot:i.projectRoot,beforeRemove:n.beforeRemove}):!1}var Jn=q(()=>{"use strict";Yl();En()});var Vl={};Qu(Vl,{RUN_STATE_FILE:()=>Gn,applyRunStateToDocument:()=>fs,readRunState:()=>ds,removeRunState:()=>ps,runStateFromDocument:()=>Hn,writeRunState:()=>Vn});import Lg from"path";function gr(t,e){let r=t[e];if(typeof r!="string"||r.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return r}function hr(t,e){let r=gr(t,e);if(Lg.isAbsolute(r)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return r}function qg(t){let e=t.run_retries??"{}",r;try{r=typeof e=="string"?JSON.parse(e):e}catch(n){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:n})}if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let n of Object.values(r))if(!Number.isInteger(n)||Number(n)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return r}function Hn(t){if(!t.run_id)return null;let e=gr(t,"run_id"),r=gr(t,"skill"),n=gr(t,"skill_version"),i=gr(t,"skill_hash"),o=hr(t,"pending_ref"),s=hr(t,"trajectory_ref"),a=hr(t,"context_ref"),c=hr(t,"artifacts_ref"),l=hr(t,"checkpoint_ref"),f=Number(t.iteration);if(!Number.isInteger(f)||f<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:r,skillVersion:n,skillHash:i,orchestration:t.orchestration,currentStep:Hl(t,"current_step"),iteration:f,pending:Hl(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:qg(t)}}function fs(t,e){e?t.run_id=e.runId:delete t.run_id}function Wg(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 Dg(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 Hn(e)}async function ds(t,e={}){let r=await Be(t,Gn,Gl,"Run state",e);if(r===null)return null;let n=JSON.parse(r);return Dg(n)}async function Vn(t,e,r={}){await Ke(t,Gn,JSON.stringify(Wg(e),null,2),Gl,"Run state",r)}async function ps(t,e={}){await Yn(t,Gn,"Run state",e)}var Hl,Gn,Gl,zn=q(()=>{"use strict";Jn();Hl=(t,e)=>{let r=t[e];return r==null?null:String(r)};Gn=".comet/run-state.json",Gl=256*1024});import{createHash as iy}from"crypto";import{promises as oy}from"fs";import me from"path";import{spawnSync as lg}from"child_process";function Zu(t){return t.length>0&&/^[A-Za-z0-9@+=:,./\\_-]+$/.test(t)?t:`"${t.replace(/"/g,'""')}"`}function Os(t){return t.map(e=>Zu(e))}import{promises as Rl}from"fs";import T from"path";import{promises as ef}from"fs";async function xt(t){try{return await ef.access(t),!0}catch(e){if(tf(e))return!1;throw e}}function tf(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ve();gt();os();Q();var yt=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 Ol(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Al(t){await N(t,_l,{label:_l,expected:"file"})}function In(t,e){let r=T.resolve(t),n=e==="docs"?T.join(r,"docs"):r,i=T.join(n,"openspec"),o=T.join(r,"docs","superpowers");return{projectRoot:r,artifactLayout:e,openSpecBase:n,openSpecRoot:i,changesDir:T.join(i,"changes"),archiveDir:T.join(i,"changes","archive"),specsDir:T.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:T.join(o,"specs"),superpowersPlansDir:T.join(o,"plans"),superpowersReportsDir:T.join(o,"reports")}}async function rg(t){await Al(t);let e=await or(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new yt;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new yt("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function ng(t,e){return In(t,e??await rg(t))}async function ig(t){try{return await Rl.lstat(t),!0}catch(e){if(Ol(e))return!1;throw e}}async function og(t,e){let r=await ng(t,e),n=r.artifactLayout==="legacy"?"docs":"legacy",i=In(t,n).openSpecRoot,[o,s]=await Promise.all([N(r.projectRoot,$(r.projectRoot,r.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),ig(i)]),a=o.exists;return{paths:r,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function sg(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let r of e){let n=$(t.projectRoot,r);await N(t.projectRoot,n,{label:`Classic managed physical path ${n}`,expected:"directory"})}}async function ce(t,e){let r=await og(t,e);if(await sg(r.paths),!r.configuredRootExists){let n=$(r.paths.projectRoot,r.paths.openSpecRoot),i=$(r.paths.projectRoot,r.alternateRoot);throw new yt(`Configured Classic OpenSpec root is missing: ${n} (alternate ${i} is ${r.alternateRootExists?"present":"missing"})`)}return r.paths}async function sr(t,e){let r=T.join(T.resolve(t),".comet","classic-root-move.json");if(await xt(r))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let n=await ce(t,e);if(!await xt(n.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${$(n.projectRoot,n.openSpecRoot)}`);return n}async function be(t){let e=T.resolve(t),r=null;try{(await Rl.lstat(e)).isDirectory()||(e=T.dirname(e))}catch(n){if(!Ol(n))throw n}for(;;){T.basename(e)==="openspec"&&(r=T.dirname(e));let n=T.join(e,".comet","config.yaml"),i=!1;if(await xt(n))try{await Al(e);let s=(await or(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 xt(T.join(e,".git")))return e;let o=T.dirname(e);if(o===e)return r??T.resolve(t);e=o}}function $(t,e){return T.relative(T.resolve(t),e).replaceAll("\\","/")}var Nl=Je($e(),1);Q();import ag from"path";var cg=1024*1024;async function Tl(t,e){let r=e??await ce(t),n=ag.join(r.openSpecRoot,"config.yaml"),i=$(r.projectRoot,n),o;try{o=(await D(r.projectRoot,i,cg,{label:"Classic OpenSpec project config",bigint:!0})).bytes.toString("utf8")}catch(l){throw l.code==="ENOENT"?new Error(`Classic OpenSpec root is unhealthy: ${i} is missing; rerun OpenSpec initialization for the configured Classic layout`,{cause:l}):new Error(`Classic OpenSpec root is unhealthy: ${l instanceof Error?l.message:String(l)}`,{cause:l})}let s=(0,Nl.parseDocument)(o,{uniqueKeys:!0});if(s.errors.length>0)throw new Error(`Classic OpenSpec root is unhealthy: ${i} is invalid YAML (${s.errors[0].message})`);let a=s.toJS();if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Classic OpenSpec root is unhealthy: ${i} must contain a mapping`);let c=a.schema;if(typeof c!="string"||c.trim()==="")throw new Error(`Classic OpenSpec root is unhealthy: ${i} must declare a non-empty schema`);return{layout:r,configPath:i,schema:c}}function ug(t){return t[0]==="--"?t.slice(1):[...t]}async function jl(t,e=process.cwd()){let r=ug(t);if(r.length===0)return{exitCode:64,stderr:"Usage: comet classic openspec -- <openspec-args...>"};let n=await be(e),i=await sr(n);await Tl(n,i);let o=process.env.COMET_OPENSPEC||"openspec",s=process.platform==="win32",a=lg(o,s?Os(r):r,{cwd:i.openSpecBase,encoding:"utf8",shell:s,windowsHide:!0});if(a.error){let c=a.error.code;return{exitCode:c==="ENOENT"?127:70,stdout:a.stdout||void 0,stderr:a.stderr||(c==="ENOENT"?`OpenSpec CLI not found: ${o}`:a.error.message)}}return{exitCode:a.status??1,stdout:a.stdout||void 0,stderr:a.stderr||void 0}}import{promises as pg}from"fs";import ur from"path";Fe();ve();Q();import ar from"path";var fg=2*1024*1024;function $n(t,e,r){let n=ar.resolve(t),i=ar.isAbsolute(e)?ar.resolve(e):ar.resolve(n,e),o=ar.relative(n,i).replaceAll("\\","/");return{root:n,relative:ye(o,r),target:i}}async function Me(t,e,r){let n=$n(t,e,r.label);return N(n.root,n.relative,r)}async function cr(t,e,r){return(await Me(t,e,{label:r.label,expected:r.expected??"any"})).exists}async function lr(t,e,r){return(await dg(t,e,r)).toString("utf8")}async function dg(t,e,r){let n=$n(t,e,r.label);return(await D(n.root,n.relative,r.maxBytes??fg,{label:r.label,hooks:r.hooks})).bytes}async function ss(t,e,r){let n=$n(t,e,r);return Zo(n.root,n.relative,{label:r})}async function Il(t,e,r,n){let i=$n(t,e,n.label);await N(i.root,i.relative,{label:n.label,expected:"file"}),await ee(i.target,r,{containedRoot:i.root,beforeTemporaryOpen:n.beforeTemporaryOpen,beforeCommit:n.beforeCommit,exclusive:n.exclusive})}function as(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
143
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function vt(t){let e=as(t);if(e)throw new Error(e)}function mg(t,e){return{label:$(t,e),directory:e}}async function Ln(t,e,r){let n=mg(t,e);if(!(await Me(t,e,{label:r,expected:"directory"})).exists)return{change:n,exists:!1,stateExists:!1};let o=await Me(t,ur.join(e,".comet.yaml"),{label:`${r} state`,expected:"file"});return{change:n,exists:!0,stateExists:o.exists}}function $l(t,e){let r=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${r}$`,"u").test(t)}async function hg(t,e,r,n={}){if(!n.skipExactCompatibility){let s=await Ln(t,ur.join(e,r),`Classic archived change ${r}`);if(s.exists)return s.change}if(!(await Me(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await pg.readdir(e,{withFileTypes:!0})){if(!$l(s.name,r))continue;let a=await Ln(t,ur.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function qn(t,e=process.cwd()){vt(t);let r=await ce(e),n=await Ln(r.projectRoot,ur.join(r.changesDir,t),`Classic active change ${t}`);return{...n.change,exists:n.exists,stateExists:n.stateExists}}async function Wn(t,e=process.cwd(),r={}){vt(t);let n=await ce(e);if(r.preferredArchiveName!==void 0){let i=r.preferredArchiveName;if(i!==t&&!$l(i,t))throw new Error(`Classic preferred archive name '${i}' does not belong to change '${t}'`);let o=await Ln(n.projectRoot,ur.join(n.archiveDir,i),`Classic preferred archived change ${i}`);return o.exists&&o.stateExists?o.change:null}return hg(n.projectRoot,n.archiveDir,t,r)}import{promises as Ou}from"fs";import X from"path";import{fileURLToPath as Au}from"url";import{promises as wg}from"fs";import Se from"path";Q();ve();import fr from"path";function gg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ll(t,e,r,n){let i=ye(r,"Classic handoff artifact pointer");if((await N(t,i,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await ce(t),a=`${$(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>i.startsWith(y));if(!l)return null;let f=i.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];vt(u);let d=f.slice(2),h=fr.resolve(e);if(fr.dirname(h)!==fr.resolve(s.archiveDir))return null;let g=fr.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await N(t,$(t,h),{label:"Classic archived change directory",expected:"directory"});let m=fr.join(h,".comet",...d),w=$(t,m);try{return await D(t,w,n,{label:"Historical Classic archived handoff artifact"}),w}catch(y){if(gg(y))return null;throw y}}Q();var ql=2*1024*1024;function dr(t,e){return Se.relative(t,e).split(Se.sep).join("/")}async function pr(t,e,r,n,i){if(!r)return{code:e,satisfied:!1};let o=r.replaceAll("\\","/");if(i)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${i instanceof Error?i.message:String(i)}`};try{if(n){let a=n.artifactLayout==="legacy"?"docs":"legacy",c=$(t,In(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await N(t,o,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:o,detail:"standalone OpenSpec root is not a Comet artifact root"}}let s=await On(t,o,{label:`${e} artifact`});return{code:e,satisfied:s,source:o,...s?{resolvedSource:o}:{}}}catch(s){return{code:e,satisfied:!1,source:o,detail:`unsafe artifact pointer outside the project or through a special path: ${s instanceof Error?s.message:String(s)}`}}}async function yg(t,e,r,n){try{n??=await ce(t)}catch(o){return{code:"design.handoff",satisfied:!1,...r?{source:r.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${o instanceof Error?o.message:String(o)}`}}let i=await pr(t,"design.handoff",r,n);if(!r||i.satisfied||i.detail)return i;try{let o=await Ll(t,e,r,ql);return o?{...i,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:i}catch(o){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Dn(t,e,r){return pr(t,e,dr(t,r))}async function vg(t,e){let r=Se.join(e,"specs"),n;try{let s=dr(t,r);if(!(await N(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};n=await wg.readdir(r)}catch(s){return s.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${s instanceof Error?s.message:String(s)}`}}let i=n.map(s=>Se.join(r,s,"spec.md")),o=(await Promise.all(i.map(async s=>{try{return await On(t,dr(t,s),{label:"OpenSpec delta spec"})?s:null}catch{return null}}))).filter(s=>s!==null);return{code:"openspec.delta-spec",satisfied:o.length>0,source:o[0]?dr(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function kg(t,e){let r,n=dr(t,e);try{r=(await D(t,n,ql,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(s){return s.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:n,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let i=[...r.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=i.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:i.length>0&&o===i.length,source:n,detail:`${o} of ${i.length} tasks complete`}}function mr(t,e){return t.some(r=>r.code===e&&r.satisfied)}async function kt(t,e){let r=await be(t),n=e.classic,i=Se.join(t,"proposal.md"),o=Se.join(t,"design.md"),s=Se.join(t,"tasks.md"),a=e.run?Se.resolve(t,e.run.checkpointRef):Se.join(t,".comet","checkpoint.json"),c,l;try{c=await ce(r)}catch(d){l=d}let f=await Promise.all([Dn(r,"openspec.proposal",i),Dn(r,"openspec.design",o),Dn(r,"openspec.tasks",s),vg(r,t),pr(r,"design.document",n?.designDoc??null,c,l),pr(r,"build.plan",n?.plan??null,c,l),kg(r,s),pr(r,"verification.report",n?.verificationReport??null,c,l),yg(r,t,n?.handoffContext??null,c),Dn(r,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!n?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:n?.archiveConfirmation==="confirmed"}),f}import{createHash as Tw,randomUUID as jw}from"crypto";import{promises as bs}from"fs";import Ee from"path";function bg(t){return t.classicProfile??t.workflow}function Sg(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function Cg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Eg(t,e,r){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!mr(r,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Sg(e))return"full.build.configure"}else if(!Cg(e))throw new Error(`${t} build configuration is incomplete`);return mr(r,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function xg(t,e,r){return e.verifyResult!=="pass"||!mr(r,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Pg(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Fn(t,e){let r=bg(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(r!=="full"&&t.phase==="design")throw new Error(`${r} workflow cannot enter design`);switch(t.phase){case"open":return`${r}.open`;case"design":return mr(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Eg(r,t,e);case"verify":return xg(r,t,e);case"archive":return Pg(r,t)}}var ei=Je($e(),1);Fe();Q();import Zn from"path";zn();var zl=["full","hotfix","tweak"],et=1,Fg=["open","design","build","verify","archive"],Mg=["en","zh-CN"],Bg=["off","beta"],Kg=["subagent-driven-development","executing-plans","direct"],Ug=["plan-ready"],Yg=["confirmed"],Jg=["tdd","direct"],Hg=["off","standard","thorough"],Gg=["current","branch","worktree"],Vg=["light","full"],zg=["pending","pass","fail"],Qg=["pending","handled"],Xg=["pending","confirmed"],Xn=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],Zg=["run_id"],ew=new Set([...Xn,...Zg]),tw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Ql(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function bt(t,e){let r=t[e];if(r==null||r==="")return null;if(typeof r!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return r}function U(t,e,r,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!r.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${r.join(", ")}${n?" or null":""}`);return i}function ms(t,e,r=!0){let n=t[e];if(n==null||n===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof n!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return n}function rw(t,e,r=0){let n=t[e];if(n==null||n==="")return r;if(typeof n!="number"||!Number.isInteger(n)||n<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return n}function Qn(t,e){let r=bt(t,e);if(r===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return r}function nw(t,e){let r=bt(t,e);if(r!==null&&!/^[a-f0-9]{64}$/u.test(r))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return r}function iw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==et)throw new Error(`Invalid Classic state: classic_migration must be ${et}`);return e}function ow(t){if(!Xn.some(r=>Ql(t,r)))return null;for(let r of tw)if(!Ql(t,r))return null;return{workflow:U(t,"workflow",zl,!1),language:U(t,"language",Mg),phase:U(t,"phase",Fg,!1),contextCompression:U(t,"context_compression",Bg),buildMode:U(t,"build_mode",Kg),buildPause:U(t,"build_pause",Ug),subagentDispatch:U(t,"subagent_dispatch",Yg),tddMode:U(t,"tdd_mode",Jg),reviewMode:U(t,"review_mode",Hg),isolation:U(t,"isolation",Gg),boundBranch:bt(t,"bound_branch"),verifyMode:U(t,"verify_mode",Vg),autoTransition:ms(t,"auto_transition"),baseRef:bt(t,"base_ref"),designDoc:Qn(t,"design_doc"),plan:Qn(t,"plan"),verifyResult:U(t,"verify_result",zg,!1),verifyFailures:rw(t,"verify_failures"),verificationReport:Qn(t,"verification_report"),branchStatus:U(t,"branch_status",Qg),createdAt:bt(t,"created_at"),verifiedAt:bt(t,"verified_at"),archiveConfirmation:U(t,"archive_confirmation",Xg),archived:ms(t,"archived",!1),directOverride:ms(t,"direct_override"),handoffContext:Qn(t,"handoff_context"),handoffHash:nw(t,"handoff_hash"),classicProfile:U(t,"classic_profile",zl),classicMigration:iw(t)}}function hs(t,e){let r=e??null;if(r===null&&e===void 0&&t.run_id&&t.skill)try{r=Hn(t)}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:n})}return{classic:ow(t),run:r,unknownKeys:Object.keys(t).filter(n=>!ew.has(n))}}function Xl(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}zn();var sw=2*1024*1024;function wr(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 Zl(t,e,r){t.get(e)!==r&&t.set(e,r)}function aw(t,e){if(e.classic)for(let[r,n]of Object.entries(Xl(e.classic)))Zl(t,r,n);else for(let r of Xn)t.delete(r);fs(t.toJS(),e.run),e.run?Zl(t,"run_id",e.run.runId):t.delete("run_id")}function cw(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 r of e)t.delete(r)}function lw(t){let e=!1;for(let r of["build_command","verify_command"])t.has(r)&&(t.delete(r),e=!0);return e}async function eu(t){let e;try{e=(await D(Zn.dirname(t),Zn.basename(t),sw,{label:"Classic state document"})).bytes.toString("utf8")}catch(n){if(n.code!=="ENOENT")throw n;return new ei.Document({})}let r=(0,ei.parseDocument)(e);if(r.errors.length>0)throw new Error(`Invalid Classic state document: ${r.errors[0].message}`);return wr(r),r}async function de(t,e={}){let r=e.migrate!==!1,n=Zn.join(t,".comet.yaml"),i=await eu(n),o=wr(i),s=lw(i);s&&(o=wr(i));let a=await ds(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(zn(),Vl));a=c(o),a&&r&&(await Vn(t,a),cw(i),s=!0)}return s&&r&&await ee(n,i.toString(),{containedRoot:t}),hs(wr(i),a)}async function tt(t,e,r={}){let n=Zn.join(t,".comet.yaml"),i=await eu(n);aw(i,{...e,unknownKeys:e.unknownKeys??[]}),hs(wr(i),e.run??null),await ee(n,i.toString(),{containedRoot:t,beforeCommit:r.beforeCommit}),e.run?await Vn(t,e.run):await ps(t)}function tu(t,e,r){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:r,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}Jn();import ti from"path";var Ce={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pe(t,e){if(ti.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let r=ti.resolve(t),n=ti.resolve(r,e);if(n!==r&&!n.startsWith(r+ti.sep))throw new Error("Run path must stay inside the change directory")}async function St(t,e,r,n={}){pe(t,e),await Un(t,e,`${JSON.stringify(r)}
144
+ `,Ce.trajectory,"Run trajectory",n)}async function yr(t,e,r={}){pe(t,e);let n=await Be(t,e,Ce.trajectory,"Run trajectory",r);return n===null?[]:n.split(/\r?\n/).map((i,o)=>({line:i,number:o+1})).filter(({line:i})=>i.length>0).map(({line:i,number:o})=>{try{return JSON.parse(i)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}async function gs(t,e,r={}){pe(t,e);let n=await Be(t,e,Ce.artifacts,"Run artifacts",r);return n===null?{}:JSON.parse(n)}async function ri(t,e,r,n={}){pe(t,e),await Ke(t,e,JSON.stringify(r,null,2)+`
145
+ `,Ce.artifacts,"Run artifacts",n)}async function ru(t,e,r,n={}){pe(t,e),await Ke(t,e,r,Ce.context,"Run context",n)}async function nu(t,e,r={}){return pe(t,e),Be(t,e,Ce.context,"Run context",r)}async function iu(t,e,r,n={}){pe(t,e),await Ke(t,e,JSON.stringify(r,null,2)+`
146
+ `,Ce.pendingAction,"Run pending action",n)}async function ou(t,e,r={}){pe(t,e);let n=await Be(t,e,Ce.pendingAction,"Run pending action",r);return n===null?null:JSON.parse(n)}async function su(t,e,r={}){pe(t,e),await Yn(t,e,"Run pending action",r)}async function ni(t,e,r,n={}){pe(t,e),await Ke(t,e,JSON.stringify(r,null,2)+`
147
+ `,Ce.checkpoint,"Run checkpoint",n)}import{createHash as ku,randomUUID as _w}from"crypto";import{promises as F}from"fs";import L from"path";var lu=Je($e(),1);import{promises as ws}from"fs";import te from"path";var uw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],fw=["deterministic","adaptive"],dw=["function","mcp","script","agent"],pw=["none","read","write","external"],mw=["progress","step","completion"],hw=["artifact_exists","state_equals"];function rt(t,e,r){return new Error(`${t}: ${e} ${r}`)}function G(t,e,r="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw rt(e,r,"must be an object")}function Ue(t,e,r){if(!Array.isArray(t))throw rt(e,r,"must be an array")}function Y(t,e,r){if(typeof t!="string")throw rt(e,r,"must be a string")}function le(t,e,r,n){e in t&&Y(t[e],r,`${n}.${e}`)}function uu(t,e,r,n){if(e in t&&typeof t[e]!="boolean")throw rt(r,`${n}.${e}`,"must be a boolean")}function Ye(t,e,r,n){if(typeof t!="string"||!e.includes(t))throw rt(r,n,`must be one of ${e.join(", ")}`)}function ii(t,e,r){Ue(t,e,r),t.forEach((n,i)=>{Y(n,e,`${r}[${i}]`)})}function au(t,e,r){G(t,e,r),Y(t.name,e,`${r}.name`),Y(t.description,e,`${r}.description`),uu(t,"required",e,r)}function gw(t,e,r){G(t,e,r),Y(t.id,e,`${r}.id`),le(t,"source",e,r),le(t,"version",e,r)}function ww(t,e,r){G(t,e,r),Y(t.id,e,`${r}.id`),Y(t.role,e,`${r}.role`),le(t,"instructions",e,r)}function yw(t,e,r){G(t,e,r),Y(t.id,e,`${r}.id`),Ye(t.kind,dw,e,`${r}.kind`),Y(t.source,e,`${r}.source`),Ye(t.sideEffect,pw,e,`${r}.sideEffect`),uu(t,"requiresConfirmation",e,r)}function vw(t,e,r){G(t,e,r),Ye(t.type,uw,e,`${r}.type`),le(t,"ref",e,r),le(t,"prompt",e,r),le(t,"question",e,r),"options"in t&&ii(t.options,e,`${r}.options`)}function kw(t,e,r){G(t,e,r),Y(t.id,e,`${r}.id`),vw(t.action,e,`${r}.action`),le(t,"next",e,r),"completionEvals"in t&&ii(t.completionEvals,e,`${r}.completionEvals`)}function bw(t,e){let r="goal";G(t,e,r),Y(t.statement,e,`${r}.statement`),Ue(t.inputs,e,`${r}.inputs`),t.inputs.forEach((n,i)=>{au(n,e,`${r}.inputs[${i}]`)}),Ue(t.outputs,e,`${r}.outputs`),t.outputs.forEach((n,i)=>{au(n,e,`${r}.outputs[${i}]`)}),ii(t.success,e,`${r}.success`)}function Sw(t,e){let r="orchestration";G(t,e,r),Ye(t.mode,fw,e,`${r}.mode`),le(t,"entry",e,r),"steps"in t&&(Ue(t.steps,e,`${r}.steps`),t.steps.forEach((n,i)=>{kw(n,e,`${r}.steps[${i}]`)}))}function fu(t,e){return G(t,e),Ye(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ye(t.kind,["Skill"],e,"kind"),G(t.metadata,e,"metadata"),Y(t.metadata.name,e,"metadata.name"),Y(t.metadata.version,e,"metadata.version"),Y(t.metadata.description,e,"metadata.description"),bw(t.goal,e),Sw(t.orchestration,e),Ue(t.skills,e,"skills"),t.skills.forEach((r,n)=>{gw(r,e,`skills[${n}]`)}),Ue(t.agents,e,"agents"),t.agents.forEach((r,n)=>{ww(r,e,`agents[${n}]`)}),Ue(t.tools,e,"tools"),t.tools.forEach((r,n)=>{yw(r,e,`tools[${n}]`)}),t}function du(t,e){G(t,e);for(let r of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])r in t&&ii(t[r],e,r);for(let r of["maxIterations","maxRetriesPerAction"])if(r in t&&(typeof t[r]!="number"||!Number.isFinite(t[r])))throw rt(e,r,"must be a finite number");return t}function Cw(t,e){return G(t,e),"runtime"in t&&pu(t.runtime,e,"runtime"),t}function pu(t,e,r){return Ue(t,e,r),t.forEach((n,i)=>{let o=`${r}[${i}]`;G(n,e,o),Y(n.id,e,`${o}.id`),Ye(n.scope,mw,e,`${o}.scope`),Ye(n.type,hw,e,`${o}.type`),le(n,"artifact",e,o),le(n,"field",e,o),le(n,"equals",e,o)}),t}async function ys(t){let e=await ws.readFile(t,"utf8");try{return(0,lu.parse)(e)}catch(r){let n=r instanceof Error?r.message:String(r);throw rt(t,"document",n)}}async function Ew(t){try{return await ys(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function cu(t){try{return await ws.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function xw(t){let e=te.join(t,"checks.yaml"),r=te.join(t,"evals.yaml"),[n,i]=await Promise.all([cu(e),cu(r)]);if(i)throw new Error(`${r}: evals.yaml is no longer supported; use checks.yaml`);return n?{document:Cw(await ys(e),e)}:{document:null}}async function mu(t){let e=te.resolve(t.root),r=te.resolve(t.controlRoot);t.requireSkillMarkdown&&await ws.access(te.join(e,"SKILL.md"));let n=te.join(r,"skill.yaml"),i=te.join(r,"guardrails.yaml"),o=fu(await ys(n),n),s=await Ew(i),a=s===null?null:du(s,i),c=await xw(r),l={allowedSkills:o.skills.map(f=>f.id),allowedAgents:o.agents.map(f=>f.id),allowedTools:o.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:o.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:o,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function hu(t){let e=te.resolve(t);return mu({root:e,controlRoot:te.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function gu(t){let e=te.resolve(t);return mu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function wu(t,e,r=te.join(e,"package.json")){G(t,r);let n=t.packageKind==="runtime"?"runtime":void 0,i=fu(t.definition,r),o=du(t.guardrails,r),s=pu(t.evals,r,"evals"),a={allowedSkills:i.skills.map(c=>c.id),allowedAgents:i.agents.map(c=>c.id),allowedTools:i.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:i.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:te.resolve(e),packageKind:n,definition:i,guardrails:{...a,...o},evals:s}}import yu from"path";function Pw(t,e,r,n){t.type==="invoke_skill"&&!e.definition.skills.some(i=>i.id===t.ref)&&r.push(`step ${n} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(i=>i.id===t.ref)&&r.push(`step ${n} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(i=>i.id===t.ref)&&r.push(`step ${n} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&r.push(`step ${n} ask_user action requires question`)}function vu(t){let e=[],{definition:r,guardrails:n,evals:i}=t;r.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),r.kind!=="Skill"&&e.push("kind must be Skill"),r.metadata.name||e.push("metadata.name is required"),r.goal.statement||e.push("goal.statement is required"),n.maxIterations<1&&e.push("maxIterations must be at least 1"),n.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let o=r.orchestration.steps??[];if(r.orchestration.mode==="adaptive")(r.orchestration.entry||o.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let s=new Set;for(let a of o)s.has(a.id)&&e.push(`duplicate step id: ${a.id}`),s.add(a.id),Pw(a.action,t,e,a.id);(!r.orchestration.entry||!s.has(r.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${r.orchestration.entry??"(missing)"}`);for(let a of o){a.next&&!s.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])i.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let s of r.tools){if(s.kind!=="script")continue;let a=yu.posix.normalize(s.source.replaceAll("\\","/"));(yu.isAbsolute(s.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${s.id} must reference a relative path inside the Skill package`)}for(let s of n.allowedSkills)r.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of n.allowedAgents)r.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of n.allowedTools)r.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function oi(t){return Array.isArray(t)?t.map(oi):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[r])=>e.localeCompare(r)).map(([e,r])=>[e,oi(r)])):t}function Rw(t){return oi({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Ow(t){return L.posix.normalize(t.replaceAll("\\","/"))}function Ct(t,e,r){let n=L.relative(t,e);if(!(n===""||!L.isAbsolute(n)&&!n.startsWith(`..${L.sep}`)))throw new Error(`${r} resolves outside the Skill package`)}async function bu(t,e,r){let n=Ow(e);if(L.posix.isAbsolute(n)||n===".."||n.startsWith("../"))throw new Error(`${r} resolves outside the Skill package`);let i=L.resolve(t,...n.split("/"));Ct(t,i,r);let o;try{o=await F.realpath(i)}catch(s){throw s.code==="ENOENT"?new Error(`${r} does not exist: ${e}`,{cause:s}):s}if(Ct(t,o,r),!(await F.stat(o)).isFile())throw new Error(`${r} is not a file: ${e}`);return{path:n,content:await F.readFile(o)}}async function Aw(t){let e=await F.realpath(t.root),r=t.packageKind==="runtime"?[]:[await bu(e,"SKILL.md","SKILL.md")];for(let n of t.definition.tools)n.kind==="script"&&r.push(await bu(e,n.source,`Script tool ${n.id}`));return r.sort((n,i)=>n.path.localeCompare(i.path))}function Nw(t,e){let r=e.map(n=>({path:n.path,sha256:ku("sha256").update(n.content).digest("hex")}));return ku("sha256").update(JSON.stringify(oi({package:t,files:r}))).digest("hex")}function Eu(t){return JSON.stringify(t,null,2)+`
148
+ `}async function xu(t){let e=Rw(t),r=await Aw(t);return{document:e,files:r,hash:Nw(e,r)}}async function si(t){return(await xu(t)).hash}async function Su(t){try{return await F.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Cu(t,e){try{if((await F.readFile(L.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await F.readFile(L.join(t,"package.json"),"utf8")!==Eu(e.document))throw new Error("package mismatch");for(let i of e.files)if(!(await F.readFile(L.join(t,...i.path.split("/")))).equals(i.content))throw new Error(`file mismatch: ${i.path}`)}catch(r){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:r})}}async function vs(t,e){let r=await xu(t),n=L.resolve(e,".comet","skill-snapshots"),i=L.join(n,r.hash);if(await F.mkdir(n,{recursive:!0}),await Su(i))return await Cu(i,r),{hash:r.hash,snapshotDir:i};let o=L.join(n,`.tmp-${_w()}`);Ct(n,o,"Temporary snapshot"),Ct(n,i,"Published snapshot");try{await F.mkdir(o);for(let s of r.files){let a=L.join(o,...s.path.split("/"));Ct(o,a,`Snapshot file ${s.path}`),await F.mkdir(L.dirname(a),{recursive:!0}),await F.writeFile(a,s.content)}await F.writeFile(L.join(o,"package.json"),Eu(r.document)),await F.writeFile(L.join(o,"sha256"),r.hash+`
149
+ `),await F.rename(o,i)}catch(s){if(await Su(i)){try{await Cu(i,r)}finally{await F.rm(o,{recursive:!0,force:!0})}return{hash:r.hash,snapshotDir:i}}throw await F.rm(o,{recursive:!0,force:!0}),s}return{hash:r.hash,snapshotDir:i}}async function ks(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let r=L.resolve(t,".comet","skill-snapshots"),n=L.join(r,e);Ct(r,n,"Skill snapshot");try{let i=(await F.readFile(L.join(n,"sha256"),"utf8")).trim();if(i!==e)throw new Error(`stored hash is ${i||"(empty)"}`);let o=L.join(n,"package.json"),s=JSON.parse(await F.readFile(o,"utf8")),a=wu(s,n,o),c=vu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
150
+ `));let l=await si(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(i){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:i})}}async function Pu(t){try{return await bs.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function _u(t){return Tw("sha256").update(t).digest("hex")}function Iw(t){return _u(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[r])=>e.localeCompare(r)))))}function $w(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Lw(t,e){let r=await be(t),n=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[$w(s.code),s.source])),i=Ee.join(t,"subagent-progress.md");await Pu(i)&&(n.subagent_progress=Ee.relative(r,i).split(Ee.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(n.handoff_context=o.source),n}function qw(t,e,r){return[{sequence:1,timestamp:r,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:r,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:et,profile:e,source:"pre-migration"}}]}async function Ww(t){await Promise.all(t.map(e=>bs.rm(e,{recursive:!0,force:!0})))}async function Ru(t,e){let r=await de(t);if(!r.classic)throw new Error("Classic migration requires a legacy state projection");let n=r.classic,i=n.classicProfile??n.workflow;if(r.run){if(n.classicMigration!==et)throw new Error("Classic Run exists without a supported classic_migration marker");if(r.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${r.run.skill}`);if(await si(e.skillPackage)!==r.run.skillHash)return await ks(t,r.run.skillHash),{classic:n,run:r.run,evidence:await kt(t,r),migrated:!1,snapshotDir:Ee.join(t,".comet","skill-snapshots",r.run.skillHash)};let d=await vs(e.skillPackage,t);return{classic:n,run:r.run,evidence:await kt(t,r),migrated:!1,snapshotDir:d.snapshotDir}}let o=await kt(t,r),s=Fn(n,o);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===s))throw new Error(`Classic Skill package does not define resolved step: ${s}`);let a=await si(e.skillPackage),c=Ee.join(t,".comet","skill-snapshots",a),l=await Pu(c),f=[];try{let u=await vs(e.skillPackage,t),d=tu(e.skillPackage,e.runId?.()??jw(),u.hash);d.currentStep=s,s==="completed"&&(d.status="completed");let h={...n,classicProfile:i,classicMigration:et},g=await Lw(t,o),p=await be(t),m=o.find(b=>b.code==="design.handoff"&&b.satisfied),w=null;m?.source&&(w=await lr(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await ru(t,d.contextRef,w),f.push(Ee.resolve(t,d.contextRef))),await ri(t,d.artifactsRef,g),f.push(Ee.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),S={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:_u(w),artifactsHash:Iw(g),createdAt:y};await ni(t,d.checkpointRef,S),f.push(Ee.resolve(t,d.checkpointRef)),f.push(Ee.resolve(t,d.trajectoryRef));for(let b of qw(d,i,y))await St(t,d.trajectoryRef,b);return await tt(t,{classic:h,run:d,unknownKeys:r.unknownKeys}),{classic:h,run:d,evidence:o,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await Ww(f),l||await bs.rm(c,{recursive:!0,force:!0}),u}}async function Dw(t){try{return(await Ou.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ai(t){try{return(await Ou.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Fw(t){return await Dw(t)?await ai(X.join(t,"skill.yaml"))?!0:await ai(X.join(t,"SKILL.md"))&&await ai(X.join(t,"comet","skill.yaml")):!1}function Mw(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function Bw(){let t=X.dirname(Au(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,X.resolve(t,"..","runtime","classic"),X.resolve(t,"..","..","comet","runtime","classic"),X.resolve(t,"..","..","assets","skills","comet","runtime","classic"),X.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,X.resolve(t,"..","..","comet-classic"),X.resolve(t,"..","..","assets","skills","comet-classic"),X.resolve("assets","skills","comet-classic")].filter(r=>!!r);for(let r of e)if(await Fw(r))return r;return null}async function Kw(t){return await ai(X.join(t,"skill.yaml"))?gu(t):hu(t)}async function Nu(t){let e=await Bw();return Ru(t,{skillPackage:e?await Kw(e):Mw(X.dirname(Au(import.meta.url)))})}async function Tu(t,e,r,n){let i=await de(t);if(!i.classic||!i.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await kt(t,{classic:e,run:r,unknownKeys:i.unknownKeys}),s=Fn(e,o),a={...r,currentStep:s,iteration:r.iteration+1,status:s==="completed"?"completed":"running"};await tt(t,{classic:e,run:a,unknownKeys:i.unknownKeys});let c=await yr(t,a.trajectoryRef);return await St(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:r.currentStep,toStep:s,...n}}),a}Jn();import Uw from"path";var Yw=Uw.join(".comet","state-events.jsonl"),Jw=8*1024*1024;async function ju(t,e){let r={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Un(t,Yw,`${JSON.stringify(r)}
151
+ `,Jw,"Classic state event log"),r}var Hw={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}};function Gw(t){return t.toISOString().slice(0,10)}function x(t,e,r,n){let i=t[r];t[r]=n,i!==n&&e.push({field:r,from:i,to:n})}function Iu(t,e,r={}){let n=Hw[e];if(t.phase!==n.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${n.from}'`);let i={...t},o=[],s=r.now??new Date;if(e==="open-complete")x(i,o,"phase",i.workflow==="full"?"design":"build");else if(e==="design-complete")x(i,o,"phase","build");else if(e==="build-complete"){let a=i.verifyResult==="fail";x(i,o,"phase","verify"),x(i,o,"verifyResult","pending"),x(i,o,"branchStatus","pending"),a||x(i,o,"verificationReport",null)}else if(e==="verify-pass")x(i,o,"verifyResult","pass"),x(i,o,"verifyFailures",0),x(i,o,"phase","archive"),x(i,o,"verifiedAt",Gw(s)),x(i,o,"archiveConfirmation","pending"),x(i,o,"branchStatus","pending");else if(e==="verify-fail")x(i,o,"verifyResult","fail"),x(i,o,"verifyFailures",i.verifyFailures+1),x(i,o,"phase","build"),x(i,o,"branchStatus","pending");else if(e==="preset-escalate"){if(i.workflow!=="hotfix"&&i.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${i.workflow}'`);x(i,o,"workflow","full"),x(i,o,"classicProfile","full"),x(i,o,"phase","design"),x(i,o,"designDoc",null),x(i,o,"buildPause",null),x(i,o,"buildMode",null),x(i,o,"subagentDispatch",null),x(i,o,"tddMode",null),x(i,o,"reviewMode",null),x(i,o,"isolation",null),x(i,o,"boundBranch",null),x(i,o,"verifyMode",null),x(i,o,"directOverride",null)}else if(e==="archive-confirm"){if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);x(i,o,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);x(i,o,"verifyResult","pending"),x(i,o,"verifyFailures",0),x(i,o,"phase","verify"),x(i,o,"verifiedAt",null),x(i,o,"archiveConfirmation",null),x(i,o,"branchStatus","pending")}else{if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);x(i,o,"archived",!0)}return{classic:i,effects:o,definition:n}}zo();import{promises as Vw}from"fs";import zw from"path";var Ss="comet.selection.v2",Qw=16*1024;function Cs(t){return zw.join(t,".comet","current-change.json")}function Xw(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function $u(t){return t===null||typeof t=="string"}function Zw(t){let e;try{e=JSON.parse(t)}catch(r){throw new Error(`current change selection contains invalid JSON: ${r instanceof Error?r.message:String(r)}`,{cause:r})}if(!Xw(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!$u(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Ss,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Ss)throw new Error(`current change selection schema must be ${Ss}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!$u(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function Es(t){let e;try{let n=Cs(t),{bytes:i}=await _n(n,Qw,{label:"current change selection"});e=i.toString("utf8")}catch(n){if(n.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${n instanceof Error?n.message:String(n)}`,{cause:n})}return{status:"selected",...Zw(e)}}async function Lu(t){await Vw.rm(Cs(t),{force:!0})}async function qu(t,e,r){let n=await Es(t);return n.status!=="selected"||n.selection.workflow!==e||n.selection.change!==r?!1:(await Lu(t),!0)}Kn();import{execFileSync as Wu}from"child_process";var ey=Je($e(),1);Kn();function ty(t){try{let e=Wu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var RC=ls("liveGitBranch",t=>ty(t));function ry(t){try{return Wu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var OC=ls("isGitWorkTree",t=>ry(t));var ny=Je($e(),1);var NC=8*1024*1024;var rE=Bn("readCometCurrentSelection",t=>Es(t));async function Du(t,e){return qu(t,"classic",e)}var sy="\x1B[32m",ay="\x1B[31m",cy="\x1B[33m",Ps="\x1B[0m";function re(t){return`${sy}${t}${Ps}`}function V(t){return`${ay}${t}${Ps}`}function vr(t){return`${cy}${t}${Ps}`}var K=class extends Error{constructor(r,n=1){super(r);this.exitCode=n}exitCode},xs=class{stderr=[];openSpecStdout=[];openSpecStderr=[];stepsOk=0;stepsTotal=0;captureOpenSpec(e){e.stdout&&this.openSpecStdout.push(e.stdout),e.stderr&&this.openSpecStderr.push(e.stderr)}toResult(e=0){let r=this.stderr.length>0?this.stderr.join(`
152
152
  `)+`
153
- `:"",i=this.openSpecStderr.join(""),r=i&&n&&!i.endsWith(`
153
+ `:"",n=this.openSpecStderr.join(""),i=n&&r&&!n.endsWith(`
154
154
  `)?`
155
- `:"";return{exitCode:e,...this.openSpecStdout.length>0?{stdout:this.openSpecStdout.join("")}:{},...i||n?{stderr:`${i}${r}${n}`}:{}}}};function ry(t){let e=no(t);if(e)throw new K(G(`FATAL: ${e}`))}function Du(t){return Zw("sha256").update(t).digest("hex")}function sy(t){return Du(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function oy(t,e){let n=me.relative(t,e);return n!==""&&!me.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${me.sep}`)}function bn(t,e,n,i){if(!i)return i;let r=me.resolve(t,i);return oy(e,r)?$(t,me.join(n,me.relative(e,r))):i}function ay(t,e,n,i){let r={...i};for(let s of["handoff_context","handoff_markdown"]){let o=r[s];o&&(r[s]=bn(t,e,n,o)??o)}return r}async function cy(t,e){let n=await de(e);if(!n.classic||!n.run||!n.classic.archived)throw new K(G(" [FAIL] Final archived state is incomplete"));let i=[["design_doc",n.classic.designDoc],["plan",n.classic.plan],["verification_report",n.classic.verificationReport],["handoff_context",n.classic.handoffContext]],r=await fo(e,n.run.artifactsRef),s=[["artifacts.handoff_context",r.handoff_context],["artifacts.handoff_markdown",r.handoff_markdown]];for(let[o,a]of[...i,...s])if(a&&!await an(t,me.resolve(t,a),{label:`Classic archived ${o}`,expected:"file"}))throw new K(G(` [FAIL] Final archived ${o} does not exist: ${a}`))}function Lu(t){return`${t.replace(/\n+$/u,"")}
156
- `}function ly(t,e,n){let i=t.replace(/\r\n/gu,`
157
- `),r=i.split(`
158
- `),s=r[0]==="---"?r.indexOf("---",1):-1,o=n.match(/^([^:\n]+):/u)?.[1]?.trim();if(s!==-1){let c=r.slice(1,s).filter(l=>{let f=l.match(/^([^:\n]+):/u)?.[1]?.trim();return f===void 0?!0:f!=="archived-with"&&f!==o});return c.push(`archived-with: ${e}`),n&&c.push(n),Lu(["---",...c,"---",...r.slice(s+1)].join(`
159
- `))}let a=["---",`archived-with: ${e}`];return n&&a.push(n),o!=="status"&&a.push("status: final"),a.push("---"),Lu([...a,i].join(`
160
- `))}async function uy(t,e,n){let i=await yn(t,e.trajectoryRef);i.some(r=>r.type==="recovery_reconciled"&&r.data.kind==="classic-archive"&&r.data.actionId===n)||await yt(t,e.trajectoryRef,{sequence:i.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-archive",actionId:n}})}async function sr(t,e,n,i,r,s){if(!await an(e,n,{label:"Classic archive annotation target",expected:"file"}))return;if(s){t.stderr.push(vn(` [DRY-RUN] Would annotate: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1;return}let o=await cn(e,n,{label:"Classic archive annotation target"}),a=ly(o,i,r);await Nl(e,n,a,{label:"Classic archive annotation target"}),t.stderr.push(ne(` [OK] Annotated: ${n}`)),t.stepsOk+=1,t.stepsTotal+=1}async function fy(t,e){if(!(await Me(t,e,{label:"Classic main specs directory",expected:"directory"})).exists)return;let i=!1,r=await ey.readdir(e,{withFileTypes:!0});for(let s of r){if(!s.isDirectory()&&!s.isSymbolicLink())continue;let o=`${e}/${s.name}/spec.md`,a=await(async()=>await an(t,o,{label:`Classic main spec ${s.name}`,expected:"file"})?cn(t,o,{label:`Classic main spec ${s.name}`}):null)();if(a===null)continue;let c=a.split(/\r?\n/u).map((l,f)=>({line:l,number:f+1})).filter(l=>/^## (ADDED|MODIFIED|REMOVED|RENAMED) Requirements$/u.test(l.line));if(c.length>0){i=!0,process.stderr.write(G(`FATAL: delta-only section heading leaked into main spec: ${o}`)+`
155
+ `:"";return{exitCode:e,...this.openSpecStdout.length>0?{stdout:this.openSpecStdout.join("")}:{},...n||r?{stderr:`${n}${i}${r}`}:{}}}};function ly(t){let e=as(t);if(e)throw new K(V(`FATAL: ${e}`))}function Mu(t){return iy("sha256").update(t).digest("hex")}function uy(t){return Mu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[r])=>e.localeCompare(r)))))}function fy(t,e){let r=me.relative(t,e);return r!==""&&!me.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${me.sep}`)}function kr(t,e,r,n){if(!n)return n;let i=me.resolve(t,n);return fy(e,i)?$(t,me.join(r,me.relative(e,i))):n}function dy(t,e,r,n){let i={...n};for(let o of["handoff_context","handoff_markdown"]){let s=i[o];s&&(i[o]=kr(t,e,r,s)??s)}return i}async function py(t,e){let r=await de(e);if(!r.classic||!r.run||!r.classic.archived)throw new K(V(" [FAIL] Final archived state is incomplete"));let n=[["design_doc",r.classic.designDoc],["plan",r.classic.plan],["verification_report",r.classic.verificationReport],["handoff_context",r.classic.handoffContext]],i=await gs(e,r.run.artifactsRef),o=[["artifacts.handoff_context",i.handoff_context],["artifacts.handoff_markdown",i.handoff_markdown]];for(let[s,a]of[...n,...o])if(a&&!await cr(t,me.resolve(t,a),{label:`Classic archived ${s}`,expected:"file"}))throw new K(V(` [FAIL] Final archived ${s} does not exist: ${a}`))}function Fu(t){return`${t.replace(/\n+$/u,"")}
156
+ `}function my(t,e,r){let n=t.replace(/\r\n/gu,`
157
+ `),i=n.split(`
158
+ `),o=i[0]==="---"?i.indexOf("---",1):-1,s=r.match(/^([^:\n]+):/u)?.[1]?.trim();if(o!==-1){let c=i.slice(1,o).filter(l=>{let f=l.match(/^([^:\n]+):/u)?.[1]?.trim();return f===void 0?!0:f!=="archived-with"&&f!==s});return c.push(`archived-with: ${e}`),r&&c.push(r),Fu(["---",...c,"---",...i.slice(o+1)].join(`
159
+ `))}let a=["---",`archived-with: ${e}`];return r&&a.push(r),s!=="status"&&a.push("status: final"),a.push("---"),Fu([...a,n].join(`
160
+ `))}async function hy(t,e,r){let n=await yr(t,e.trajectoryRef);n.some(i=>i.type==="recovery_reconciled"&&i.data.kind==="classic-archive"&&i.data.actionId===r)||await St(t,e.trajectoryRef,{sequence:n.length+1,timestamp:new Date().toISOString(),type:"recovery_reconciled",runId:e.runId,data:{kind:"classic-archive",actionId:r}})}async function ci(t,e,r,n,i,o){if(!await cr(e,r,{label:"Classic archive annotation target",expected:"file"}))return;if(o){t.stderr.push(vr(` [DRY-RUN] Would annotate: ${r}`)),t.stepsOk+=1,t.stepsTotal+=1;return}let s=await lr(e,r,{label:"Classic archive annotation target"}),a=my(s,n,i);await Il(e,r,a,{label:"Classic archive annotation target"}),t.stderr.push(re(` [OK] Annotated: ${r}`)),t.stepsOk+=1,t.stepsTotal+=1}async function gy(t,e){if(!(await Me(t,e,{label:"Classic main specs directory",expected:"directory"})).exists)return;let n=!1,i=await oy.readdir(e,{withFileTypes:!0});for(let o of i){if(!o.isDirectory()&&!o.isSymbolicLink())continue;let s=`${e}/${o.name}/spec.md`,a=await(async()=>await cr(t,s,{label:`Classic main spec ${o.name}`,expected:"file"})?lr(t,s,{label:`Classic main spec ${o.name}`}):null)();if(a===null)continue;let c=a.split(/\r?\n/u).map((l,f)=>({line:l,number:f+1})).filter(l=>/^## (ADDED|MODIFIED|REMOVED|RENAMED) Requirements$/u.test(l.line));if(c.length>0){n=!0,process.stderr.write(V(`FATAL: delta-only section heading leaked into main spec: ${s}`)+`
161
161
  `);for(let l of c)process.stderr.write(`${l.number}:${l.line}
162
- `)}}if(i)throw new K("")}var Fu=async t=>{let e=new So,n=t[0],i=t[1]==="--dry-run";try{ry(n);let r=await be(process.cwd()),s=await sn(r),o=await io(n,s.projectRoot),a=o.directory,c=$(s.projectRoot,a),f=`${new Date().toISOString().slice(0,10)}-${n}`,u=me.join(s.archiveDir,f);e.stderr.push(`=== Comet Archive: ${n} ===`);let d=o.stateExists,h=d?null:await Li(n,s.projectRoot),g=d?a:h?.directory;if(!g||!await an(s.projectRoot,`${g}/.comet.yaml`,{label:`Classic change ${n} state`,expected:"file"}))throw new K(G(`FATAL: .comet.yaml not found in ${c}/`));h&&(u=h.directory,f=me.basename(h.directory));let p=await de(g);if(!p.classic)throw new K(G("FATAL: archive requires Classic state"));let m=p.classic,w=m.designDoc,y=m.plan;if(m.phase!=="archive")throw new K(G(`FATAL: phase is '${m.phase}', expected 'archive'`));if(m.verifyResult!=="pass")throw new K(G(`FATAL: verify_result is '${m.verifyResult}', expected 'pass'. Run comet-verify first.`));e.stderr.push(ne(" [OK] Entry state verified")),e.stepsOk+=1,e.stepsTotal+=1;let S=await Me(s.projectRoot,u,{label:`Classic archive target ${f}`,expected:"directory"});if(d&&S.exists)throw new K(G(`FATAL: archive target already exists: ${u}`));if(e.stderr.push(ne(" [OK] Archive target available")),e.stepsOk+=1,e.stepsTotal+=1,i)e.stderr.push(vn(` [DRY-RUN] Would run OpenSpec archive: ${n}`)),e.stepsOk+=1,e.stepsTotal+=1;else if(!m.archived||p.run?.pending){await to(s.projectRoot,`${g}/.comet`,"Classic change runtime directory");let k=await xu(g),C=`classic-archive:${n}`,E=await Zl(g,k.run.pendingRef),R=!!h||E?.id===C&&E.type==="checkpoint"&&E.ref===n;if(k.run.pending&&k.run.pending!==C)throw new K(G(`FATAL: another action is pending: ${k.run.pending}`));if(!R&&!m.archived&&m.archiveConfirmation!=="confirmed")throw new K(G(`FATAL: archive_confirmation is '${m.archiveConfirmation??"null"}', expected 'confirmed'. Run final archive confirmation first.`));if(!R){let bt={id:C,stepId:k.run.currentStep,type:"checkpoint",ref:n};await Xl(g,k.run.pendingRef,bt),await et(g,{classic:k.classic,run:{...k.run,pending:C,status:"waiting"},unknownKeys:(await de(g)).unknownKeys})}if(!h){let bt=await Al(["archive",n,"--yes"],s.projectRoot);if(e.captureOpenSpec(bt),bt.exitCode!==0)throw new K("",bt.exitCode)}let b=await Li(n,s.projectRoot,{preferredArchiveName:f});if(!b&&!h&&(b=await Li(n,s.projectRoot,{skipExactCompatibility:!0})),!b)return e.stderr.push(G(" [FAIL] OpenSpec archive output not found")),e.stepsTotal+=1,e.stderr.push(""),e.stderr.push(ne(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(1);u=b.directory,f=me.basename(b.directory),e.stderr.push(ne(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,await fy(s.projectRoot,s.specsDir),e.stderr.push(ne(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,w&&await sr(e,s.projectRoot,w,f,"status: final",!1),y&&await sr(e,s.projectRoot,y,f,"",!1);let P=await de(u);if(!P.classic||!P.run)throw new K(G(" [FAIL] archived state projection is incomplete"));let ie={...ay(s.projectRoot,a,u,await fo(u,P.run.artifactsRef)),archive_directory:$(s.projectRoot,u)};await Zi(u,P.run.artifactsRef,ie);let z=Ru(R&&P.classic.archiveConfirmation!=="confirmed"?{...P.classic,archiveConfirmation:"confirmed"}:P.classic,"archived"),A={...z.classic,designDoc:bn(s.projectRoot,a,u,z.classic.designDoc),plan:bn(s.projectRoot,a,u,z.classic.plan),verificationReport:bn(s.projectRoot,a,u,z.classic.verificationReport),handoffContext:bn(s.projectRoot,a,u,z.classic.handoffContext)},re=P.run;(P.run.currentStep!=="completed"||P.run.status!=="completed")&&(re=await _u(u,A,P.run,{actionId:C,archiveDirectory:$(s.projectRoot,u),event:"archived",source:"comet-archive"})),R&&await uy(u,re,C);let Wu=await yn(u,re.trajectoryRef),Eo=await Ql(u,re.contextRef),Bu={runId:re.runId,stateVersion:re.iteration,trajectoryOffset:Wu.length,contextHash:Eo===null?null:Du(Eo),artifactsHash:sy(ie),createdAt:new Date().toISOString()};await er(u,re.checkpointRef,Bu);let xo={...re,pending:null,status:"completed"};await et(u,{classic:A,run:xo,unknownKeys:P.unknownKeys}),await Pu(u,{change:f,event:"archived",source:"comet-archive",from:P.classic,to:A,effects:z.effects}),await eu(u,xo.pendingRef),e.stderr.push(ne(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}else{if(!p.run)throw new K(G("FATAL: archived Classic state is missing its Run projection"));e.stderr.push(ne(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ne(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(ne(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}return i?(w&&await sr(e,s.projectRoot,w,f,"status: final",!0),y&&await sr(e,s.projectRoot,y,f,"",!0),e.stderr.push(vn(` [DRY-RUN] Would set archived: true in ${u}/.comet.yaml`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(vn(" [DRY-RUN] Would verify final archive integrity")),e.stepsOk+=1,e.stepsTotal+=1):(await cy(s.projectRoot,u),e.stderr.push(ne(" [OK] Final archive integrity verified")),e.stepsOk+=1,e.stepsTotal+=1),i||await qu(s.projectRoot,n),e.stderr.push(""),e.stderr.push(i?vn(`Dry run complete. ${e.stepsOk}/${e.stepsTotal} steps would succeed.`):ne(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(e.stepsOk<e.stepsTotal?1:0)}catch(r){if(r instanceof K){if(r.message)for(let s of r.message.split(`
163
- `))e.stderr.push(s);return e.toResult(r.exitCode)}throw r}};function dy(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
164
- `}}async function Mu(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),s;try{s=await e(r,{json:i})}catch(a){s={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let o=i?dy(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
162
+ `)}}if(n)throw new K("")}var Bu=async t=>{let e=new xs,r=t[0],n=t[1]==="--dry-run";try{ly(r);let i=await be(process.cwd()),o=await sr(i),s=await qn(r,o.projectRoot),a=s.directory,c=$(o.projectRoot,a),f=`${new Date().toISOString().slice(0,10)}-${r}`,u=me.join(o.archiveDir,f);e.stderr.push(`=== Comet Archive: ${r} ===`);let d=s.stateExists,h=d?null:await Wn(r,o.projectRoot),g=d?a:h?.directory;if(!g||!await cr(o.projectRoot,`${g}/.comet.yaml`,{label:`Classic change ${r} state`,expected:"file"}))throw new K(V(`FATAL: .comet.yaml not found in ${c}/`));h&&(u=h.directory,f=me.basename(h.directory));let p=await de(g);if(!p.classic)throw new K(V("FATAL: archive requires Classic state"));let m=p.classic,w=m.designDoc,y=m.plan;if(m.phase!=="archive")throw new K(V(`FATAL: phase is '${m.phase}', expected 'archive'`));if(m.verifyResult!=="pass")throw new K(V(`FATAL: verify_result is '${m.verifyResult}', expected 'pass'. Run comet-verify first.`));e.stderr.push(re(" [OK] Entry state verified")),e.stepsOk+=1,e.stepsTotal+=1;let S=await Me(o.projectRoot,u,{label:`Classic archive target ${f}`,expected:"directory"});if(d&&S.exists)throw new K(V(`FATAL: archive target already exists: ${u}`));if(e.stderr.push(re(" [OK] Archive target available")),e.stepsOk+=1,e.stepsTotal+=1,n)e.stderr.push(vr(` [DRY-RUN] Would run OpenSpec archive: ${r}`)),e.stepsOk+=1,e.stepsTotal+=1;else if(!m.archived||p.run?.pending){await ss(o.projectRoot,`${g}/.comet`,"Classic change runtime directory");let b=await Nu(g),C=`classic-archive:${r}`,E=await ou(g,b.run.pendingRef),R=!!h||E?.id===C&&E.type==="checkpoint"&&E.ref===r;if(b.run.pending&&b.run.pending!==C)throw new K(V(`FATAL: another action is pending: ${b.run.pending}`));if(!R&&!m.archived&&m.archiveConfirmation!=="confirmed")throw new K(V(`FATAL: archive_confirmation is '${m.archiveConfirmation??"null"}', expected 'confirmed'. Run final archive confirmation first.`));if(!R){let Et={id:C,stepId:b.run.currentStep,type:"checkpoint",ref:r};await iu(g,b.run.pendingRef,Et),await tt(g,{classic:b.classic,run:{...b.run,pending:C,status:"waiting"},unknownKeys:(await de(g)).unknownKeys})}if(!h){let Et=await jl(["archive",r,"--yes"],o.projectRoot);if(e.captureOpenSpec(Et),Et.exitCode!==0)throw new K("",Et.exitCode)}let k=await Wn(r,o.projectRoot,{preferredArchiveName:f});if(!k&&!h&&(k=await Wn(r,o.projectRoot,{skipExactCompatibility:!0})),!k)return e.stderr.push(V(" [FAIL] OpenSpec archive output not found")),e.stepsTotal+=1,e.stderr.push(""),e.stderr.push(re(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(1);u=k.directory,f=me.basename(k.directory),e.stderr.push(re(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,await gy(o.projectRoot,o.specsDir),e.stderr.push(re(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,w&&await ci(e,o.projectRoot,w,f,"status: final",!1),y&&await ci(e,o.projectRoot,y,f,"",!1);let _=await de(u);if(!_.classic||!_.run)throw new K(V(" [FAIL] archived state projection is incomplete"));let ne={...dy(o.projectRoot,a,u,await gs(u,_.run.artifactsRef)),archive_directory:$(o.projectRoot,u)};await ri(u,_.run.artifactsRef,ne);let z=Iu(R&&_.classic.archiveConfirmation!=="confirmed"?{..._.classic,archiveConfirmation:"confirmed"}:_.classic,"archived"),A={...z.classic,designDoc:kr(o.projectRoot,a,u,z.classic.designDoc),plan:kr(o.projectRoot,a,u,z.classic.plan),verificationReport:kr(o.projectRoot,a,u,z.classic.verificationReport),handoffContext:kr(o.projectRoot,a,u,z.classic.handoffContext)},ie=_.run;(_.run.currentStep!=="completed"||_.run.status!=="completed")&&(ie=await Tu(u,A,_.run,{actionId:C,archiveDirectory:$(o.projectRoot,u),event:"archived",source:"comet-archive"})),R&&await hy(u,ie,C);let Uu=await yr(u,ie.trajectoryRef),_s=await nu(u,ie.contextRef),Yu={runId:ie.runId,stateVersion:ie.iteration,trajectoryOffset:Uu.length,contextHash:_s===null?null:Mu(_s),artifactsHash:uy(ne),createdAt:new Date().toISOString()};await ni(u,ie.checkpointRef,Yu);let Rs={...ie,pending:null,status:"completed"};await tt(u,{classic:A,run:Rs,unknownKeys:_.unknownKeys}),await ju(u,{change:f,event:"archived",source:"comet-archive",from:_.classic,to:A,effects:z.effects}),await su(u,Rs.pendingRef),e.stderr.push(re(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}else{if(!p.run)throw new K(V("FATAL: archived Classic state is missing its Run projection"));e.stderr.push(re(` [OK] OpenSpec archive completed: ${u}`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(re(" [OK] Main specs verified clean")),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(re(" [OK] archived: true")),e.stepsOk+=1,e.stepsTotal+=1}return n?(w&&await ci(e,o.projectRoot,w,f,"status: final",!0),y&&await ci(e,o.projectRoot,y,f,"",!0),e.stderr.push(vr(` [DRY-RUN] Would set archived: true in ${u}/.comet.yaml`)),e.stepsOk+=1,e.stepsTotal+=1,e.stderr.push(vr(" [DRY-RUN] Would verify final archive integrity")),e.stepsOk+=1,e.stepsTotal+=1):(await py(o.projectRoot,u),e.stderr.push(re(" [OK] Final archive integrity verified")),e.stepsOk+=1,e.stepsTotal+=1),n||await Du(o.projectRoot,r),e.stderr.push(""),e.stderr.push(n?vr(`Dry run complete. ${e.stepsOk}/${e.stepsTotal} steps would succeed.`):re(`Archive complete. ${e.stepsOk}/${e.stepsTotal} steps succeeded.`)),e.toResult(e.stepsOk<e.stepsTotal?1:0)}catch(i){if(i instanceof K){if(i.message)for(let o of i.message.split(`
163
+ `))e.stderr.push(o);return e.toResult(i.exitCode)}throw i}};function wy(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
164
+ `}}async function Ku(t,e,r=process.argv.slice(2)){let n=r.includes("--json"),i=r.filter(a=>a!=="--json"),o;try{o=await e(i,{json:n})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=n?wy(t,o):o;return s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr+(s.stderr.endsWith(`
165
165
  `)?"":`
166
- `)),o.exitCode}process.exitCode=await Mu("archive",Fu);
166
+ `)),s.exitCode}process.exitCode=await Ku("archive",Bu);