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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +13 -1
  3. package/assets/manifest.json +1 -1
  4. package/assets/skills/comet/SKILL.md +6 -5
  5. package/assets/skills/comet/reference/subagent-dispatch.md +2 -4
  6. package/assets/skills/comet/rules/comet-phase-guard.en.md +4 -3
  7. package/assets/skills/comet/rules/comet-phase-guard.md +4 -3
  8. package/assets/skills/comet/rules/comet-workflow-guard.en.md +1 -1
  9. package/assets/skills/comet/rules/comet-workflow-guard.md +1 -1
  10. package/assets/skills/comet/scripts/comet-archive.mjs +85 -85
  11. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +1 -1
  12. package/assets/skills/comet/scripts/comet-guard.mjs +111 -111
  13. package/assets/skills/comet/scripts/comet-handoff.mjs +85 -85
  14. package/assets/skills/comet/scripts/comet-hook-guard.mjs +91 -89
  15. package/assets/skills/comet/scripts/comet-hook-router.mjs +124 -116
  16. package/assets/skills/comet/scripts/comet-resume-probe.mjs +77 -77
  17. package/assets/skills/comet/scripts/comet-runtime.mjs +188 -185
  18. package/assets/skills/comet/scripts/comet-state.mjs +108 -107
  19. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +95 -95
  20. package/assets/skills/comet-any/SKILL.md +1 -1
  21. package/assets/skills/comet-any/reference/authoring-subagents.md +3 -11
  22. package/assets/skills/comet-any/reference/subagents/pause-points-author.md +1 -4
  23. package/assets/skills/comet-any/reference/subagents/reference-author.md +1 -4
  24. package/assets/skills/comet-any/reference/subagents/script-author.md +1 -4
  25. package/assets/skills/comet-any/reference/subagents/skill-core-author.md +1 -4
  26. package/assets/skills/comet-any/reference/subagents/skill-reviewer.md +1 -4
  27. package/assets/skills/comet-any/reference/subagents/workflow-entry-author.md +1 -4
  28. package/assets/skills/comet-build/SKILL.md +2 -2
  29. package/assets/skills/comet-native/SKILL.md +85 -11
  30. package/assets/skills/comet-native/reference/artifacts.md +3 -1
  31. package/assets/skills/comet-native/reference/commands.md +15 -6
  32. package/assets/skills/comet-native/reference/recovery.md +12 -1
  33. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +124 -118
  34. package/assets/skills/comet-native/scripts/comet-native-check.mjs +116 -110
  35. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +110 -110
  36. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +121 -121
  37. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +83 -83
  38. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +88 -82
  39. package/assets/skills/comet-native/scripts/comet-native-init.mjs +85 -85
  40. package/assets/skills/comet-native/scripts/comet-native-new.mjs +114 -114
  41. package/assets/skills/comet-native/scripts/comet-native-next.mjs +122 -122
  42. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +124 -116
  43. package/assets/skills/comet-native/scripts/comet-native-root.mjs +110 -110
  44. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +154 -152
  45. package/assets/skills/comet-native/scripts/comet-native-select.mjs +110 -110
  46. package/assets/skills/comet-native/scripts/comet-native-show.mjs +80 -80
  47. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +112 -112
  48. package/assets/skills/comet-native/scripts/comet-native-status.mjs +107 -107
  49. package/assets/skills-zh/comet/SKILL.md +3 -3
  50. package/assets/skills-zh/comet/reference/subagent-dispatch.md +2 -4
  51. package/assets/skills-zh/comet-any/SKILL.md +1 -1
  52. package/assets/skills-zh/comet-any/reference/authoring-subagents.md +3 -14
  53. package/assets/skills-zh/comet-any/reference/subagents/pause-points-author.md +1 -4
  54. package/assets/skills-zh/comet-any/reference/subagents/reference-author.md +1 -4
  55. package/assets/skills-zh/comet-any/reference/subagents/script-author.md +1 -4
  56. package/assets/skills-zh/comet-any/reference/subagents/skill-core-author.md +1 -4
  57. package/assets/skills-zh/comet-any/reference/subagents/skill-reviewer.md +1 -4
  58. package/assets/skills-zh/comet-any/reference/subagents/workflow-entry-author.md +1 -4
  59. package/assets/skills-zh/comet-build/SKILL.md +2 -2
  60. package/assets/skills-zh/comet-native/SKILL.md +86 -12
  61. package/assets/skills-zh/comet-native/reference/artifacts.md +3 -1
  62. package/assets/skills-zh/comet-native/reference/commands.md +17 -8
  63. package/assets/skills-zh/comet-native/reference/recovery.md +14 -3
  64. package/bin/fast-runtime-router.js +1 -0
  65. package/dist/app/cli/index.js +1 -0
  66. package/dist/app/cli/index.js.map +1 -1
  67. package/dist/app/commands/doctor.d.ts.map +1 -1
  68. package/dist/app/commands/doctor.js +138 -37
  69. package/dist/app/commands/doctor.js.map +1 -1
  70. package/dist/app/commands/i18n.d.ts +1 -1
  71. package/dist/app/commands/i18n.d.ts.map +1 -1
  72. package/dist/app/commands/i18n.js +90 -0
  73. package/dist/app/commands/i18n.js.map +1 -1
  74. package/dist/app/commands/init.d.ts.map +1 -1
  75. package/dist/app/commands/init.js +45 -12
  76. package/dist/app/commands/init.js.map +1 -1
  77. package/dist/app/commands/project-scope-selection.d.ts +2 -1
  78. package/dist/app/commands/project-scope-selection.d.ts.map +1 -1
  79. package/dist/app/commands/project-scope-selection.js +5 -7
  80. package/dist/app/commands/project-scope-selection.js.map +1 -1
  81. package/dist/app/commands/uninstall.d.ts +6 -0
  82. package/dist/app/commands/uninstall.d.ts.map +1 -1
  83. package/dist/app/commands/uninstall.js +197 -110
  84. package/dist/app/commands/uninstall.js.map +1 -1
  85. package/dist/app/commands/update.d.ts.map +1 -1
  86. package/dist/app/commands/update.js +81 -10
  87. package/dist/app/commands/update.js.map +1 -1
  88. package/dist/app/commands/workflow.d.ts +1 -0
  89. package/dist/app/commands/workflow.d.ts.map +1 -1
  90. package/dist/app/commands/workflow.js +9 -2
  91. package/dist/app/commands/workflow.js.map +1 -1
  92. package/dist/domains/comet-classic/classic-hook-guard.d.ts +5 -1
  93. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  94. package/dist/domains/comet-classic/classic-hook-guard.js +104 -20
  95. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  96. package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
  97. package/dist/domains/comet-classic/classic-layout-initialization.js +8 -4
  98. package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
  99. package/dist/domains/comet-classic/classic-layout.d.ts.map +1 -1
  100. package/dist/domains/comet-classic/classic-layout.js +1 -0
  101. package/dist/domains/comet-classic/classic-layout.js.map +1 -1
  102. package/dist/domains/comet-classic/classic-plan-readiness.d.ts +12 -0
  103. package/dist/domains/comet-classic/classic-plan-readiness.d.ts.map +1 -0
  104. package/dist/domains/comet-classic/classic-plan-readiness.js +26 -0
  105. package/dist/domains/comet-classic/classic-plan-readiness.js.map +1 -0
  106. package/dist/domains/comet-classic/classic-project-config.d.ts +1 -0
  107. package/dist/domains/comet-classic/classic-project-config.d.ts.map +1 -1
  108. package/dist/domains/comet-classic/classic-project-config.js +13 -7
  109. package/dist/domains/comet-classic/classic-project-config.js.map +1 -1
  110. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  111. package/dist/domains/comet-classic/classic-state-command.js +58 -7
  112. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  113. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  114. package/dist/domains/comet-entry/hook-adapter.js +15 -2
  115. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  116. package/dist/domains/comet-entry/hook-project-root.d.ts +3 -0
  117. package/dist/domains/comet-entry/hook-project-root.d.ts.map +1 -0
  118. package/dist/domains/comet-entry/hook-project-root.js +62 -0
  119. package/dist/domains/comet-entry/hook-project-root.js.map +1 -0
  120. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -1
  121. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  122. package/dist/domains/comet-entry/hook-router-entry.js +6 -4
  123. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  124. package/dist/domains/comet-entry/hook-router.d.ts +2 -0
  125. package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
  126. package/dist/domains/comet-entry/hook-router.js +45 -9
  127. package/dist/domains/comet-entry/hook-router.js.map +1 -1
  128. package/dist/domains/comet-entry/hook-types.d.ts +1 -0
  129. package/dist/domains/comet-entry/hook-types.d.ts.map +1 -1
  130. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  131. package/dist/domains/comet-entry/init-workflow.js +2 -3
  132. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  133. package/dist/domains/comet-entry/project-activation.d.ts +12 -0
  134. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -0
  135. package/dist/domains/comet-entry/project-activation.js +109 -0
  136. package/dist/domains/comet-entry/project-activation.js.map +1 -0
  137. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  138. package/dist/domains/comet-entry/resume-probe.js +47 -26
  139. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  140. package/dist/domains/comet-entry/types.d.ts +1 -1
  141. package/dist/domains/comet-entry/types.d.ts.map +1 -1
  142. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  143. package/dist/domains/comet-native/native-archive-command.js +43 -1
  144. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  145. package/dist/domains/comet-native/native-archive-inspection.d.ts.map +1 -1
  146. package/dist/domains/comet-native/native-archive-inspection.js +11 -0
  147. package/dist/domains/comet-native/native-archive-inspection.js.map +1 -1
  148. package/dist/domains/comet-native/native-archive-preflight.d.ts +10 -0
  149. package/dist/domains/comet-native/native-archive-preflight.d.ts.map +1 -1
  150. package/dist/domains/comet-native/native-archive-preflight.js +44 -0
  151. package/dist/domains/comet-native/native-archive-preflight.js.map +1 -1
  152. package/dist/domains/comet-native/native-change.d.ts +18 -1
  153. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  154. package/dist/domains/comet-native/native-change.js +72 -3
  155. package/dist/domains/comet-native/native-change.js.map +1 -1
  156. package/dist/domains/comet-native/native-check.d.ts.map +1 -1
  157. package/dist/domains/comet-native/native-check.js +13 -1
  158. package/dist/domains/comet-native/native-check.js.map +1 -1
  159. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  160. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  161. package/dist/domains/comet-native/native-cli-shared.js +24 -3
  162. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  163. package/dist/domains/comet-native/native-conflict-inspection.d.ts +3 -1
  164. package/dist/domains/comet-native/native-conflict-inspection.d.ts.map +1 -1
  165. package/dist/domains/comet-native/native-conflict-inspection.js +20 -10
  166. package/dist/domains/comet-native/native-conflict-inspection.js.map +1 -1
  167. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  168. package/dist/domains/comet-native/native-continuation.js +16 -0
  169. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  170. package/dist/domains/comet-native/native-diagnostics.d.ts +2 -0
  171. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  172. package/dist/domains/comet-native/native-diagnostics.js +43 -32
  173. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  174. package/dist/domains/comet-native/native-evidence-storage.d.ts +6 -0
  175. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-evidence-storage.js +24 -0
  177. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  178. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  179. package/dist/domains/comet-native/native-findings.js +36 -0
  180. package/dist/domains/comet-native/native-findings.js.map +1 -1
  181. package/dist/domains/comet-native/native-hook-guard.js +2 -2
  182. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  183. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  184. package/dist/domains/comet-native/native-new-command.js +22 -7
  185. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  186. package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -1
  187. package/dist/domains/comet-native/native-receipt-command.js +14 -1
  188. package/dist/domains/comet-native/native-receipt-command.js.map +1 -1
  189. package/dist/domains/comet-native/native-receipt-errors.d.ts +23 -0
  190. package/dist/domains/comet-native/native-receipt-errors.d.ts.map +1 -0
  191. package/dist/domains/comet-native/native-receipt-errors.js +9 -0
  192. package/dist/domains/comet-native/native-receipt-errors.js.map +1 -0
  193. package/dist/domains/comet-native/native-receipt-refresh.d.ts +3 -0
  194. package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -1
  195. package/dist/domains/comet-native/native-receipt-refresh.js +13 -2
  196. package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -1
  197. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  198. package/dist/domains/comet-native/native-root-move.js +54 -1
  199. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  200. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  201. package/dist/domains/comet-native/native-snapshot.js +71 -14
  202. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  203. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  204. package/dist/domains/comet-native/native-transitions.js +74 -42
  205. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  206. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +37 -4
  207. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  208. package/dist/domains/comet-native/native-verification-receipt-runtime.js +192 -4
  209. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  210. package/dist/domains/comet-native/native-verification-runtime.d.ts +27 -1
  211. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  212. package/dist/domains/comet-native/native-verification-runtime.js +29 -6
  213. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  214. package/dist/domains/comet-native/native-workspace.d.ts +39 -3
  215. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  216. package/dist/domains/comet-native/native-workspace.js +200 -8
  217. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  218. package/dist/domains/dashboard/collector.d.ts +26 -1
  219. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  220. package/dist/domains/dashboard/collector.js +381 -1
  221. package/dist/domains/dashboard/collector.js.map +1 -1
  222. package/dist/domains/dashboard/native-adapter.d.ts +15 -0
  223. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  224. package/dist/domains/dashboard/native-adapter.js +1 -1
  225. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  226. package/dist/domains/dashboard/native-collector.d.ts +26 -1
  227. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  228. package/dist/domains/dashboard/native-collector.js +284 -5
  229. package/dist/domains/dashboard/native-collector.js.map +1 -1
  230. package/dist/domains/dashboard/server.d.ts.map +1 -1
  231. package/dist/domains/dashboard/server.js +92 -3
  232. package/dist/domains/dashboard/server.js.map +1 -1
  233. package/dist/domains/dashboard/types.d.ts +41 -1
  234. package/dist/domains/dashboard/types.d.ts.map +1 -1
  235. package/dist/domains/dashboard/verify-parser.d.ts +1 -0
  236. package/dist/domains/dashboard/verify-parser.d.ts.map +1 -1
  237. package/dist/domains/dashboard/verify-parser.js +8 -4
  238. package/dist/domains/dashboard/verify-parser.js.map +1 -1
  239. package/dist/domains/dashboard/web/assets/{arc-mNt_SS1l.js → arc-ClrSujVb.js} +1 -1
  240. package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-Bc5akVD6.js → architectureDiagram-3BPJPVTR-B4A_t84A.js} +1 -1
  241. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-C43zhVBe.js → blockDiagram-GPEHLZMM-D72u2953.js} +1 -1
  242. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-dToETarK.js → c4Diagram-AAUBKEIU-Ca5zba3N.js} +1 -1
  243. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +1 -0
  244. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-C0oO137R.js → chunk-2J33WTMH-CCVPBm0J.js} +1 -1
  245. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-CGms1fgI.js → chunk-4BX2VUAB-JYluRsP-.js} +1 -1
  246. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-Bugl8v6f.js → chunk-55IACEB6-DfYm7pN7.js} +1 -1
  247. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-8ATNMlBG.js → chunk-727SXJPM-CwghIMO9.js} +1 -1
  248. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-BNYjSSqU.js → chunk-AQP2D5EJ-BA_zgMXZ.js} +1 -1
  249. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-_nJAqSbe.js → chunk-FMBD7UC4-BAJLB5V6.js} +1 -1
  250. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-lyxYm5NX.js → chunk-ND2GUHAM-Bj6HWRwi.js} +1 -1
  251. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-PUMVeWpd.js → chunk-QZHKN3VN-B1kXfg5N.js} +1 -1
  252. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +1 -0
  253. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +1 -0
  254. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-DzMqjexn.js → cose-bilkent-S5V4N54A-BBrkuiAU.js} +1 -1
  255. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-B67ET0eq.js → cynefin-VYW2F7L2-DlFhgQHt.js} +1 -1
  256. package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-CQPMvRLK.js → dagre-BM42HDAG-B0Bk5oiP.js} +1 -1
  257. package/dist/domains/dashboard/web/assets/{demo-BuVau32v.js → demo-DZYPLZpF.js} +2 -2
  258. package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-BRpLrFHM.js → diagram-2AECGRRQ-tvTUiBA2.js} +1 -1
  259. package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-CPGWuGrE.js → diagram-5GNKFQAL-BZfcK29q.js} +1 -1
  260. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-D2wpX2iO.js → diagram-KO2AKTUF-BQahyP-C.js} +1 -1
  261. package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-D54mAbDu.js → diagram-LMA3HP47-D5bJnW2C.js} +1 -1
  262. package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-ZGQDpSs_.js → diagram-OG6HWLK6-DTwWdzWJ.js} +1 -1
  263. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-C3qDo7sd.js → erDiagram-TEJ5UH35-BbvrdCp9.js} +1 -1
  264. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-B7hStPd9.js → flowDiagram-I6XJVG4X-DgbR7Tcc.js} +1 -1
  265. package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-IqcLFbTK.js → ganttDiagram-6RSMTGT7-wWMOA7F4.js} +1 -1
  266. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-YrMZpzUu.js → gitGraphDiagram-PVQCEYII-DCxvMAUJ.js} +1 -1
  267. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +1 -0
  268. package/dist/domains/dashboard/web/assets/{index-icxk8_BP.js → index-Blit0P5Z.js} +1 -1
  269. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +257 -0
  270. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-CcIgGK_7.js → infoDiagram-5YYISTIA-9qXEkzDe.js} +1 -1
  271. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-1x3rNjGP.js → ishikawaDiagram-YF4QCWOH-Dkf5othW.js} +1 -1
  272. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-B2XiqMNP.js → journeyDiagram-JHISSGLW-C2_IkO4s.js} +1 -1
  273. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-x46cGuo3.js → kanban-definition-UN3LZRKU-BxWgu4DL.js} +1 -1
  274. package/dist/domains/dashboard/web/assets/{linear-DFLqGZWl.js → linear-Dkr6p-Ro.js} +1 -1
  275. package/dist/domains/dashboard/web/assets/{mermaid.core-g3J6BACc.js → mermaid.core-DZUcsoG4.js} +4 -4
  276. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CTdeKmcX.js → mindmap-definition-RKZ34NQL-C9xyxGfa.js} +1 -1
  277. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-C_obwjIf.js → pieDiagram-4H26LBE5-Dn67tdOF.js} +1 -1
  278. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-B6Gnfz9M.js → quadrantDiagram-W4KKPZXB-Cy6iOcxc.js} +1 -1
  279. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-nX4PObnB.js → requirementDiagram-4Y6WPE33-B_gZONhx.js} +1 -1
  280. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-QjDwwHgl.js → sankeyDiagram-5OEKKPKP-C3u-4dOk.js} +1 -1
  281. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-BEEe0j6B.js → sequenceDiagram-3UESZ5HK-Xd3ByTVF.js} +1 -1
  282. package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CXfAaBgM.js → stateDiagram-AJRCARHV-CJGHL7Up.js} +1 -1
  283. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +1 -0
  284. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-BOzX2EnD.js → timeline-definition-PNZ67QCA-DvONX2YQ.js} +1 -1
  285. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-C40vhXRq.js → vennDiagram-CIIHVFJN-B-L4qWy4.js} +1 -1
  286. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-B1rm89JH.js → wardleyDiagram-YWT4CUSO-cf39WX2o.js} +1 -1
  287. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-BlMr59qK.js → xychartDiagram-2RQKCTM6-Dk1vcm3u.js} +1 -1
  288. package/dist/domains/dashboard/web/index.html +16 -16
  289. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  290. package/dist/domains/integrations/openspec.js +5 -2
  291. package/dist/domains/integrations/openspec.js.map +1 -1
  292. package/dist/domains/skill/hook-lifecycle.d.ts +9 -0
  293. package/dist/domains/skill/hook-lifecycle.d.ts.map +1 -0
  294. package/dist/domains/skill/hook-lifecycle.js +48 -0
  295. package/dist/domains/skill/hook-lifecycle.js.map +1 -0
  296. package/dist/domains/skill/platform-inspect.d.ts +2 -0
  297. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  298. package/dist/domains/skill/platform-inspect.js +170 -32
  299. package/dist/domains/skill/platform-inspect.js.map +1 -1
  300. package/dist/domains/skill/platform-install.d.ts +21 -1
  301. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  302. package/dist/domains/skill/platform-install.js +174 -31
  303. package/dist/domains/skill/platform-install.js.map +1 -1
  304. package/dist/domains/skill/project-hook-projection.d.ts +14 -0
  305. package/dist/domains/skill/project-hook-projection.d.ts.map +1 -0
  306. package/dist/domains/skill/project-hook-projection.js +41 -0
  307. package/dist/domains/skill/project-hook-projection.js.map +1 -0
  308. package/dist/domains/skill/project-instructions.d.ts +3 -0
  309. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  310. package/dist/domains/skill/project-instructions.js +8 -0
  311. package/dist/domains/skill/project-instructions.js.map +1 -1
  312. package/dist/domains/skill/uninstall.d.ts +6 -2
  313. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  314. package/dist/domains/skill/uninstall.js +192 -29
  315. package/dist/domains/skill/uninstall.js.map +1 -1
  316. package/dist/domains/workflow-contract/contained-atomic-write.d.ts +3 -0
  317. package/dist/domains/workflow-contract/contained-atomic-write.d.ts.map +1 -1
  318. package/dist/domains/workflow-contract/contained-atomic-write.js +15 -2
  319. package/dist/domains/workflow-contract/contained-atomic-write.js.map +1 -1
  320. package/dist/domains/workflow-contract/global-config.d.ts +10 -0
  321. package/dist/domains/workflow-contract/global-config.d.ts.map +1 -0
  322. package/dist/domains/workflow-contract/global-config.js +117 -0
  323. package/dist/domains/workflow-contract/global-config.js.map +1 -0
  324. package/dist/domains/workflow-contract/hook-target-scope.d.ts +6 -0
  325. package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -0
  326. package/dist/domains/workflow-contract/hook-target-scope.js +51 -0
  327. package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -0
  328. package/dist/domains/workflow-contract/index.d.ts +2 -1
  329. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  330. package/dist/domains/workflow-contract/index.js +2 -1
  331. package/dist/domains/workflow-contract/index.js.map +1 -1
  332. package/dist/domains/workflow-contract/project-config-reader.d.ts +2 -0
  333. package/dist/domains/workflow-contract/project-config-reader.d.ts.map +1 -1
  334. package/dist/domains/workflow-contract/project-config-reader.js.map +1 -1
  335. package/dist/domains/workflow-contract/project-config-writer.d.ts.map +1 -1
  336. package/dist/domains/workflow-contract/project-config-writer.js +3 -2
  337. package/dist/domains/workflow-contract/project-config-writer.js.map +1 -1
  338. package/dist/domains/workflow-contract/project-config.d.ts +1 -0
  339. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  340. package/dist/domains/workflow-contract/project-config.js +9 -4
  341. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  342. package/dist/domains/workflow-contract/types.d.ts +3 -0
  343. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  344. package/dist/platform/install/platforms.d.ts +2 -0
  345. package/dist/platform/install/platforms.d.ts.map +1 -1
  346. package/dist/platform/install/platforms.js +1 -0
  347. package/dist/platform/install/platforms.js.map +1 -1
  348. package/dist/platform/paths/git-worktree.d.ts +4 -1
  349. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  350. package/dist/platform/paths/git-worktree.js +34 -1
  351. package/dist/platform/paths/git-worktree.js.map +1 -1
  352. package/eval/local/tests/scaffold/test_utils.py +74 -0
  353. package/eval/pyproject.toml +4 -4
  354. package/eval/scaffold/shell/docker.sh +5 -0
  355. package/package.json +1 -1
  356. package/dist/domains/dashboard/web/assets/channel-b2wWDG4F.js +0 -1
  357. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-B9SWZywo.js +0 -1
  358. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-B9SWZywo.js +0 -1
  359. package/dist/domains/dashboard/web/assets/index-DhtBssCt.js +0 -257
  360. package/dist/domains/dashboard/web/assets/index-pr3axVDI.css +0 -1
  361. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-CD3nS4cC.js +0 -1
@@ -1,158 +1,166 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var of=Object.create;var ur=Object.defineProperty;var af=Object.getOwnPropertyDescriptor;var sf=Object.getOwnPropertyNames;var cf=Object.getPrototypeOf,lf=Object.prototype.hasOwnProperty;var Ci=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var B=(t,e,i)=>()=>{if(i)throw i[0];try{return t&&(e=t(t=0)),e}catch(n){throw i=[n],n}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}},uf=(t,e)=>{for(var i in e)ur(t,i,{get:e[i],enumerable:!0})},ff=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of sf(e))!lf.call(t,r)&&r!==i&&ur(t,r,{get:()=>e[r],enumerable:!(n=af(e,r))||n.enumerable});return t};var Pi=(t,e,i)=>(i=t!=null?of(cf(t)):{},ff(e||!t||!t.__esModule?ur(i,"default",{value:t,enumerable:!0}):i,t));var C=v($=>{"use strict";var fr=Symbol.for("yaml.alias"),Oa=Symbol.for("yaml.document"),xi=Symbol.for("yaml.map"),Ia=Symbol.for("yaml.pair"),dr=Symbol.for("yaml.scalar"),Ri=Symbol.for("yaml.seq"),le=Symbol.for("yaml.node.type"),df=t=>!!t&&typeof t=="object"&&t[le]===fr,hf=t=>!!t&&typeof t=="object"&&t[le]===Oa,mf=t=>!!t&&typeof t=="object"&&t[le]===xi,pf=t=>!!t&&typeof t=="object"&&t[le]===Ia,ja=t=>!!t&&typeof t=="object"&&t[le]===dr,gf=t=>!!t&&typeof t=="object"&&t[le]===Ri;function La(t){if(t&&typeof t=="object")switch(t[le]){case xi:case Ri:return!0}return!1}function wf(t){if(t&&typeof t=="object")switch(t[le]){case fr:case xi:case dr:case Ri:return!0}return!1}var vf=t=>(ja(t)||La(t))&&!!t.anchor;$.ALIAS=fr;$.DOC=Oa;$.MAP=xi;$.NODE_TYPE=le;$.PAIR=Ia;$.SCALAR=dr;$.SEQ=Ri;$.hasAnchor=vf;$.isAlias=df;$.isCollection=La;$.isDocument=hf;$.isMap=mf;$.isNode=wf;$.isPair=pf;$.isScalar=ja;$.isSeq=gf});var yt=v(hr=>{"use strict";var j=C(),F=Symbol("break visit"),$a=Symbol("skip children"),ie=Symbol("remove node");function _i(t,e){let i=Da(e);j.isDocument(t)?Xe(null,t.contents,i,Object.freeze([t]))===ie&&(t.contents=null):Xe(null,t,i,Object.freeze([]))}_i.BREAK=F;_i.SKIP=$a;_i.REMOVE=ie;function Xe(t,e,i,n){let r=Ma(t,e,i,n);if(j.isNode(r)||j.isPair(r))return Ba(t,n,r),Xe(t,r,i,n);if(typeof r!="symbol"){if(j.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let a=Xe(o,e.items[o],i,n);if(typeof a=="number")o=a-1;else{if(a===F)return F;a===ie&&(e.items.splice(o,1),o-=1)}}}else if(j.isPair(e)){n=Object.freeze(n.concat(e));let o=Xe("key",e.key,i,n);if(o===F)return F;o===ie&&(e.key=null);let a=Xe("value",e.value,i,n);if(a===F)return F;a===ie&&(e.value=null)}}return r}async function Ai(t,e){let i=Da(e);j.isDocument(t)?await Qe(null,t.contents,i,Object.freeze([t]))===ie&&(t.contents=null):await Qe(null,t,i,Object.freeze([]))}Ai.BREAK=F;Ai.SKIP=$a;Ai.REMOVE=ie;async function Qe(t,e,i,n){let r=await Ma(t,e,i,n);if(j.isNode(r)||j.isPair(r))return Ba(t,n,r),Qe(t,r,i,n);if(typeof r!="symbol"){if(j.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let a=await Qe(o,e.items[o],i,n);if(typeof a=="number")o=a-1;else{if(a===F)return F;a===ie&&(e.items.splice(o,1),o-=1)}}}else if(j.isPair(e)){n=Object.freeze(n.concat(e));let o=await Qe("key",e.key,i,n);if(o===F)return F;o===ie&&(e.key=null);let a=await Qe("value",e.value,i,n);if(a===F)return F;a===ie&&(e.value=null)}}return r}function Da(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 Ma(t,e,i,n){if(typeof i=="function")return i(t,e,n);if(j.isMap(e))return i.Map?.(t,e,n);if(j.isSeq(e))return i.Seq?.(t,e,n);if(j.isPair(e))return i.Pair?.(t,e,n);if(j.isScalar(e))return i.Scalar?.(t,e,n);if(j.isAlias(e))return i.Alias?.(t,e,n)}function Ba(t,e,i){let n=e[e.length-1];if(j.isCollection(n))n.items[t]=i;else if(j.isPair(n))t==="key"?n.key=i:n.value=i;else if(j.isDocument(n))n.contents=i;else{let r=j.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}hr.visit=_i;hr.visitAsync=Ai});var mr=v(Fa=>{"use strict";var qa=C(),yf=yt(),bf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Nf=t=>t.replace(/[!,[\]{}]/g,e=>bf[e]),bt=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}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,i){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]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,a]=n;return this.tags[o]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return i(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 a=/^\d+\.\d+$/.test(o);return i(6,`Unsupported YAML version ${o}`,a),!1}}default:return i(0,`Unknown directive ${r}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let a=e.slice(2,-1);return a==="!"||a==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),a)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||i(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(r)}catch(a){return i(String(a)),null}return n==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,n]of Object.entries(this.tags))if(e.startsWith(n))return i+Nf(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&qa.isNode(e.contents)){let o={};yf.visit(e.contents,(a,s)=>{qa.isNode(s)&&s.tag&&(o[s.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,a]of n)o==="!!"&&a==="tag:yaml.org,2002:"||(!e||r.some(s=>s.startsWith(a)))&&i.push(`%TAG ${o} ${a}`);return i.join(`
5
- `)}};bt.defaultYaml={explicit:!1,version:"1.2"};bt.defaultTags={"!!":"tag:yaml.org,2002:"};Fa.Directives=bt});var Ti=v(Nt=>{"use strict";var Wa=C(),Sf=yt();function kf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function Ha(t){let e=new Set;return Sf.visit(t,{Value(i,n){n.anchor&&e.add(n.anchor)}}),e}function za(t,e){for(let i=1;;++i){let n=`${t}${i}`;if(!e.has(n))return n}}function Ef(t,e){let i=[],n=new Map,r=null;return{onAnchor:o=>{i.push(o),r??(r=Ha(t));let a=za(e,r);return r.add(a),a},setAnchors:()=>{for(let o of i){let a=n.get(o);if(typeof a=="object"&&a.anchor&&(Wa.isScalar(a.node)||Wa.isCollection(a.node)))a.node.anchor=a.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=o,s}}},sourceObjects:n}}Nt.anchorIsValid=kf;Nt.anchorNames=Ha;Nt.createNodeAnchors=Ef;Nt.findNewAnchor=za});var pr=v(Ga=>{"use strict";function St(t,e,i,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,o=n.length;r<o;++r){let a=n[r],s=St(t,n,String(r),a);s===void 0?delete n[r]:s!==a&&(n[r]=s)}else if(n instanceof Map)for(let r of Array.from(n.keys())){let o=n.get(r),a=St(t,n,r,o);a===void 0?n.delete(r):a!==o&&n.set(r,a)}else if(n instanceof Set)for(let r of Array.from(n)){let o=St(t,n,r,r);o===void 0?n.delete(r):o!==r&&(n.delete(r),n.add(o))}else for(let[r,o]of Object.entries(n)){let a=St(t,n,r,o);a===void 0?delete n[r]:a!==o&&(n[r]=a)}return t.call(e,i,n)}Ga.applyReviver=St});var me=v(Ja=>{"use strict";var Cf=C();function Va(t,e,i){if(Array.isArray(t))return t.map((n,r)=>Va(n,String(r),i));if(t&&typeof t.toJSON=="function"){if(!i||!Cf.hasAnchor(t))return t.toJSON(e,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(t,n),i.onCreate=o=>{n.res=o,delete i.onCreate};let r=t.toJSON(e,i);return i.onCreate&&i.onCreate(r),r}return typeof t=="bigint"&&!i?.keep?Number(t):t}Ja.toJS=Va});var Oi=v(Ua=>{"use strict";var Pf=pr(),Ka=C(),xf=me(),gr=class{constructor(e){Object.defineProperty(this,Ka.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:i,maxAliasCount:n,onAnchor:r,reviver:o}={}){if(!Ka.isDocument(e))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=xf.toJS(this,"",a);if(typeof r=="function")for(let{count:c,res:l}of a.anchors.values())r(l,c);return typeof o=="function"?Pf.applyReviver(o,{"":s},"",s):s}};Ua.NodeBase=gr});var kt=v(Ya=>{"use strict";var Rf=Ti(),_f=yt(),Ze=C(),Af=Oi(),Tf=me(),wr=class extends Af.NodeBase{constructor(e){super(Ze.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;i?.aliasResolveCache?n=i.aliasResolveCache:(n=[],_f.visit(e,{Node:(o,a)=>{(Ze.isAlias(a)||Ze.hasAnchor(a))&&n.push(a)}}),i&&(i.aliasResolveCache=n));let r;for(let o of n){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(e,i){if(!i)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:o}=i,a=this.resolve(r,i);if(!a){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=n.get(a);if(s||(Tf.toJS(a,null,i),s=n.get(a)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=Ii(r,a,n)),s.count*s.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,n){let r=`*${this.source}`;if(e){if(Rf.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`${r} `}return r}};function Ii(t,e,i){if(Ze.isAlias(e)){let n=e.resolve(t),r=i&&n&&i.get(n);return r?r.count*r.aliasCount:0}else if(Ze.isCollection(e)){let n=0;for(let r of e.items){let o=Ii(t,r,i);o>n&&(n=o)}return n}else if(Ze.isPair(e)){let n=Ii(t,e.key,i),r=Ii(t,e.value,i);return Math.max(n,r)}return 1}Ya.Alias=wr});var O=v(vr=>{"use strict";var Of=C(),If=Oi(),jf=me(),Lf=t=>!t||typeof t!="function"&&typeof t!="object",pe=class extends If.NodeBase{constructor(e){super(Of.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:jf.toJS(this.value,e,i)}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";vr.Scalar=pe;vr.isScalarValue=Lf});var Et=v(Qa=>{"use strict";var $f=kt(),Te=C(),Xa=O(),Df="tag:yaml.org,2002:";function Mf(t,e,i){if(e){let n=i.filter(o=>o.tag===e),r=n.find(o=>!o.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return i.find(n=>n.identify?.(t)&&!n.format)}function Bf(t,e,i){if(Te.isDocument(t)&&(t=t.contents),Te.isNode(t))return t;if(Te.isPair(t)){let u=i.schema[Te.MAP].createNode?.(i.schema,null,i);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:r,onTagObj:o,schema:a,sourceObjects:s}=i,c;if(n&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=r(t)),new $f.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=Df+e.slice(2));let l=Mf(t,e,a.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Xa.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?a[Te.MAP]:Symbol.iterator in Object(t)?a[Te.SEQ]:a[Te.MAP]}o&&(o(l),delete i.onTagObj);let f=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new Xa.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Qa.createNode=Bf});var Li=v(ji=>{"use strict";var qf=Et(),ne=C(),Ff=Oi();function yr(t,e,i){let n=i;for(let r=e.length-1;r>=0;--r){let o=e[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let a=[];a[o]=n,n=a}else n=new Map([[o,n]])}return qf.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 Za=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,br=class extends Ff.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(n=>ne.isNode(n)||ne.isPair(n)?n.clone(e):n),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(Za(e))this.add(i);else{let[n,...r]=e,o=this.get(n,!0);if(ne.isCollection(o))o.addIn(r,i);else if(o===void 0&&this.schema)this.set(n,yr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[i,...n]=e;if(n.length===0)return this.delete(i);let r=this.get(i,!0);if(ne.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}getIn(e,i){let[n,...r]=e,o=this.get(n,!0);return r.length===0?!i&&ne.isScalar(o)?o.value:o:ne.isCollection(o)?o.getIn(r,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!ne.isPair(i))return!1;let n=i.value;return n==null||e&&ne.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[i,...n]=e;if(n.length===0)return this.has(i);let r=this.get(i,!0);return ne.isCollection(r)?r.hasIn(n):!1}setIn(e,i){let[n,...r]=e;if(r.length===0)this.set(n,i);else{let o=this.get(n,!0);if(ne.isCollection(o))o.setIn(r,i);else if(o===void 0&&this.schema)this.set(n,yr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};ji.Collection=br;ji.collectionFromPath=yr;ji.isEmptyPath=Za});var Ct=v($i=>{"use strict";var Wf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Nr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Hf=(t,e,i)=>t.endsWith(`
6
- `)?Nr(i,e):i.includes(`
4
+ var Wf=Object.create;var kn=Object.defineProperty;var qf=Object.getOwnPropertyDescriptor;var Hf=Object.getOwnPropertyNames;var Gf=Object.getPrototypeOf,zf=Object.prototype.hasOwnProperty;var ji=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):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,i)=>()=>{if(i)throw i[0];try{return t&&(e=t(t=0)),e}catch(r){throw i=[r],r}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}},Vf=(t,e)=>{for(var i in e)kn(t,i,{get:e[i],enumerable:!0})},Kf=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Hf(e))!zf.call(t,n)&&n!==i&&kn(t,n,{get:()=>e[n],enumerable:!(r=qf(e,n))||r.enumerable});return t};var xt=(t,e,i)=>(i=t!=null?Wf(Gf(t)):{},Kf(e||!t||!t.__esModule?kn(i,"default",{value:t,enumerable:!0}):i,t));var C=v(D=>{"use strict";var Sn=Symbol.for("yaml.alias"),Ja=Symbol.for("yaml.document"),Li=Symbol.for("yaml.map"),Ua=Symbol.for("yaml.pair"),En=Symbol.for("yaml.scalar"),$i=Symbol.for("yaml.seq"),he=Symbol.for("yaml.node.type"),Jf=t=>!!t&&typeof t=="object"&&t[he]===Sn,Uf=t=>!!t&&typeof t=="object"&&t[he]===Ja,Yf=t=>!!t&&typeof t=="object"&&t[he]===Li,Xf=t=>!!t&&typeof t=="object"&&t[he]===Ua,Ya=t=>!!t&&typeof t=="object"&&t[he]===En,Qf=t=>!!t&&typeof t=="object"&&t[he]===$i;function Xa(t){if(t&&typeof t=="object")switch(t[he]){case Li:case $i:return!0}return!1}function Zf(t){if(t&&typeof t=="object")switch(t[he]){case Sn:case Li:case En:case $i:return!0}return!1}var ed=t=>(Ya(t)||Xa(t))&&!!t.anchor;D.ALIAS=Sn;D.DOC=Ja;D.MAP=Li;D.NODE_TYPE=he;D.PAIR=Ua;D.SCALAR=En;D.SEQ=$i;D.hasAnchor=ed;D.isAlias=Jf;D.isCollection=Xa;D.isDocument=Uf;D.isMap=Yf;D.isNode=Zf;D.isPair=Xf;D.isScalar=Ya;D.isSeq=Qf});var Rt=v(Cn=>{"use strict";var L=C(),W=Symbol("break visit"),Qa=Symbol("skip children"),se=Symbol("remove node");function Di(t,e){let i=Za(e);L.isDocument(t)?rt(null,t.contents,i,Object.freeze([t]))===se&&(t.contents=null):rt(null,t,i,Object.freeze([]))}Di.BREAK=W;Di.SKIP=Qa;Di.REMOVE=se;function rt(t,e,i,r){let n=es(t,e,i,r);if(L.isNode(n)||L.isPair(n))return ts(t,r,n),rt(t,n,i,r);if(typeof n!="symbol"){if(L.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let a=rt(o,e.items[o],i,r);if(typeof a=="number")o=a-1;else{if(a===W)return W;a===se&&(e.items.splice(o,1),o-=1)}}}else if(L.isPair(e)){r=Object.freeze(r.concat(e));let o=rt("key",e.key,i,r);if(o===W)return W;o===se&&(e.key=null);let a=rt("value",e.value,i,r);if(a===W)return W;a===se&&(e.value=null)}}return n}async function Bi(t,e){let i=Za(e);L.isDocument(t)?await nt(null,t.contents,i,Object.freeze([t]))===se&&(t.contents=null):await nt(null,t,i,Object.freeze([]))}Bi.BREAK=W;Bi.SKIP=Qa;Bi.REMOVE=se;async function nt(t,e,i,r){let n=await es(t,e,i,r);if(L.isNode(n)||L.isPair(n))return ts(t,r,n),nt(t,n,i,r);if(typeof n!="symbol"){if(L.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let a=await nt(o,e.items[o],i,r);if(typeof a=="number")o=a-1;else{if(a===W)return W;a===se&&(e.items.splice(o,1),o-=1)}}}else if(L.isPair(e)){r=Object.freeze(r.concat(e));let o=await nt("key",e.key,i,r);if(o===W)return W;o===se&&(e.key=null);let a=await nt("value",e.value,i,r);if(a===W)return W;a===se&&(e.value=null)}}return n}function Za(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function es(t,e,i,r){if(typeof i=="function")return i(t,e,r);if(L.isMap(e))return i.Map?.(t,e,r);if(L.isSeq(e))return i.Seq?.(t,e,r);if(L.isPair(e))return i.Pair?.(t,e,r);if(L.isScalar(e))return i.Scalar?.(t,e,r);if(L.isAlias(e))return i.Alias?.(t,e,r)}function ts(t,e,i){let r=e[e.length-1];if(L.isCollection(r))r.items[t]=i;else if(L.isPair(r))t==="key"?r.key=i:r.value=i;else if(L.isDocument(r))r.contents=i;else{let n=L.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Cn.visit=Di;Cn.visitAsync=Bi});var Pn=v(rs=>{"use strict";var is=C(),td=Rt(),id={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},rd=t=>t.replace(/[!,[\]{}]/g,e=>id[e]),_t=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}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,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,a]=r;return this.tags[o]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let a=/^\d+\.\d+$/.test(o);return i(6,`Unsupported YAML version ${o}`,a),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let a=e.slice(2,-1);return a==="!"||a==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),a)}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);n||i(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(n)}catch(a){return i(String(a)),null}return r==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,r]of Object.entries(this.tags))if(e.startsWith(r))return i+rd(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&is.isNode(e.contents)){let o={};td.visit(e.contents,(a,s)=>{is.isNode(s)&&s.tag&&(o[s.tag]=!0)}),n=Object.keys(o)}else n=[];for(let[o,a]of r)o==="!!"&&a==="tag:yaml.org,2002:"||(!e||n.some(s=>s.startsWith(a)))&&i.push(`%TAG ${o} ${a}`);return i.join(`
5
+ `)}};_t.defaultYaml={explicit:!1,version:"1.2"};_t.defaultTags={"!!":"tag:yaml.org,2002:"};rs.Directives=_t});var Mi=v(At=>{"use strict";var ns=C(),nd=Rt();function od(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function os(t){let e=new Set;return nd.visit(t,{Value(i,r){r.anchor&&e.add(r.anchor)}}),e}function as(t,e){for(let i=1;;++i){let r=`${t}${i}`;if(!e.has(r))return r}}function ad(t,e){let i=[],r=new Map,n=null;return{onAnchor:o=>{i.push(o),n??(n=os(t));let a=as(e,n);return n.add(a),a},setAnchors:()=>{for(let o of i){let a=r.get(o);if(typeof a=="object"&&a.anchor&&(ns.isScalar(a.node)||ns.isCollection(a.node)))a.node.anchor=a.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=o,s}}},sourceObjects:r}}At.anchorIsValid=od;At.anchorNames=os;At.createNodeAnchors=ad;At.findNewAnchor=as});var xn=v(ss=>{"use strict";function Tt(t,e,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,o=r.length;n<o;++n){let a=r[n],s=Tt(t,r,String(n),a);s===void 0?delete r[n]:s!==a&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let o=r.get(n),a=Tt(t,r,n,o);a===void 0?r.delete(n):a!==o&&r.set(n,a)}else if(r instanceof Set)for(let n of Array.from(r)){let o=Tt(t,r,n,n);o===void 0?r.delete(n):o!==n&&(r.delete(n),r.add(o))}else for(let[n,o]of Object.entries(r)){let a=Tt(t,r,n,o);a===void 0?delete r[n]:a!==o&&(r[n]=a)}return t.call(e,i,r)}ss.applyReviver=Tt});var Ne=v(ls=>{"use strict";var sd=C();function cs(t,e,i){if(Array.isArray(t))return t.map((r,n)=>cs(r,String(n),i));if(t&&typeof t.toJSON=="function"){if(!i||!sd.hasAnchor(t))return t.toJSON(e,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(t,r),i.onCreate=o=>{r.res=o,delete i.onCreate};let n=t.toJSON(e,i);return i.onCreate&&i.onCreate(n),n}return typeof t=="bigint"&&!i?.keep?Number(t):t}ls.toJS=cs});var Fi=v(fs=>{"use strict";var cd=xn(),us=C(),ld=Ne(),Rn=class{constructor(e){Object.defineProperty(this,us.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:i,maxAliasCount:r,onAnchor:n,reviver:o}={}){if(!us.isDocument(e))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=ld.toJS(this,"",a);if(typeof n=="function")for(let{count:c,res:l}of a.anchors.values())n(l,c);return typeof o=="function"?cd.applyReviver(o,{"":s},"",s):s}};fs.NodeBase=Rn});var Ot=v(ds=>{"use strict";var ud=Mi(),fd=Rt(),ot=C(),dd=Fi(),hd=Ne(),_n=class extends dd.NodeBase{constructor(e){super(ot.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],fd.visit(e,{Node:(o,a)=>{(ot.isAlias(a)||ot.hasAnchor(a))&&r.push(a)}}),i&&(i.aliasResolveCache=r));let n;for(let o of r){if(o===this)break;o.anchor===this.source&&(n=o)}return n}toJSON(e,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:o}=i,a=this.resolve(n,i);if(!a){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(a);if(s||(hd.toJS(a,null,i),s=r.get(a)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=Wi(n,a,r)),s.count*s.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,r){let n=`*${this.source}`;if(e){if(ud.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`${n} `}return n}};function Wi(t,e,i){if(ot.isAlias(e)){let r=e.resolve(t),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(ot.isCollection(e)){let r=0;for(let n of e.items){let o=Wi(t,n,i);o>r&&(r=o)}return r}else if(ot.isPair(e)){let r=Wi(t,e.key,i),n=Wi(t,e.value,i);return Math.max(r,n)}return 1}ds.Alias=_n});var O=v(An=>{"use strict";var md=C(),pd=Fi(),gd=Ne(),wd=t=>!t||typeof t!="function"&&typeof t!="object",ke=class extends pd.NodeBase{constructor(e){super(md.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:gd.toJS(this.value,e,i)}toString(){return String(this.value)}};ke.BLOCK_FOLDED="BLOCK_FOLDED";ke.BLOCK_LITERAL="BLOCK_LITERAL";ke.PLAIN="PLAIN";ke.QUOTE_DOUBLE="QUOTE_DOUBLE";ke.QUOTE_SINGLE="QUOTE_SINGLE";An.Scalar=ke;An.isScalarValue=wd});var It=v(ms=>{"use strict";var vd=Ot(),Le=C(),hs=O(),yd="tag:yaml.org,2002:";function bd(t,e,i){if(e){let r=i.filter(o=>o.tag===e),n=r.find(o=>!o.format)??r[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return i.find(r=>r.identify?.(t)&&!r.format)}function Nd(t,e,i){if(Le.isDocument(t)&&(t=t.contents),Le.isNode(t))return t;if(Le.isPair(t)){let u=i.schema[Le.MAP].createNode?.(i.schema,null,i);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:r,onAnchor:n,onTagObj:o,schema:a,sourceObjects:s}=i,c;if(r&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=n(t)),new vd.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=yd+e.slice(2));let l=bd(t,e,a.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new hs.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?a[Le.MAP]:Symbol.iterator in Object(t)?a[Le.SEQ]:a[Le.MAP]}o&&(o(l),delete i.onTagObj);let f=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new hs.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}ms.createNode=Nd});var Hi=v(qi=>{"use strict";var kd=It(),ce=C(),Sd=Fi();function Tn(t,e,i){let r=i;for(let n=e.length-1;n>=0;--n){let o=e[n];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let a=[];a[o]=r,r=a}else r=new Map([[o,r]])}return kd.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var ps=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,On=class extends Sd.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(r=>ce.isNode(r)||ce.isPair(r)?r.clone(e):r),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(ps(e))this.add(i);else{let[r,...n]=e,o=this.get(r,!0);if(ce.isCollection(o))o.addIn(n,i);else if(o===void 0&&this.schema)this.set(r,Tn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[i,...r]=e;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(ce.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(e,i){let[r,...n]=e,o=this.get(r,!0);return n.length===0?!i&&ce.isScalar(o)?o.value:o:ce.isCollection(o)?o.getIn(n,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!ce.isPair(i))return!1;let r=i.value;return r==null||e&&ce.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[i,...r]=e;if(r.length===0)return this.has(i);let n=this.get(i,!0);return ce.isCollection(n)?n.hasIn(r):!1}setIn(e,i){let[r,...n]=e;if(n.length===0)this.set(r,i);else{let o=this.get(r,!0);if(ce.isCollection(o))o.setIn(n,i);else if(o===void 0&&this.schema)this.set(r,Tn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};qi.Collection=On;qi.collectionFromPath=Tn;qi.isEmptyPath=ps});var jt=v(Gi=>{"use strict";var Ed=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function In(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Cd=(t,e,i)=>t.endsWith(`
6
+ `)?In(i,e):i.includes(`
7
7
  `)?`
8
- `+Nr(i,e):(t.endsWith(" ")?"":" ")+i;$i.indentComment=Nr;$i.lineComment=Hf;$i.stringifyComment=Wf});var ts=v(Pt=>{"use strict";var zf="flow",Sr="block",Di="quoted";function Gf(t,e,i="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:o=20,onFold:a,onOverflow:s}={}){if(!r||r<0)return t;r<o&&(o=0);let c=Math.max(1+o,1+r-e.length);if(t.length<=c)return t;let l=[],f={},u=r-e.length;typeof n=="number"&&(n>r-Math.max(2,o)?l.push(0):u=r-n);let d,p,w=!1,h=-1,m=-1,y=-1;i===Sr&&(h=es(t,h,e.length),h!==-1&&(u=h+c));for(let S;S=t[h+=1];){if(i===Di&&S==="\\"){switch(m=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(S===`
9
- `)i===Sr&&(h=es(t,h,e.length)),u=h+e.length+c,d=void 0;else{if(S===" "&&p&&p!==" "&&p!==`
10
- `&&p!==" "){let k=t[h+1];k&&k!==" "&&k!==`
11
- `&&k!==" "&&(d=h)}if(h>=u)if(d)l.push(d),u=d+c,d=void 0;else if(i===Di){for(;p===" "||p===" ";)p=S,S=t[h+=1],w=!0;let k=h>y+1?h-2:m-1;if(f[k])return t;l.push(k),f[k]=!0,u=k+c,d=void 0}else w=!0}p=S}if(w&&s&&s(),l.length===0)return t;a&&a();let b=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let k=l[S],E=l[S+1]||t.length;k===0?b=`
12
- ${e}${t.slice(0,E)}`:(i===Di&&f[k]&&(b+=`${t[k]}\\`),b+=`
13
- ${e}${t.slice(k+1,E)}`)}return b}function es(t,e,i){let n=e,r=e+1,o=t[r];for(;o===" "||o===" ";)if(e<r+i)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
- `);n=e,r=e+1,o=t[r]}return n}Pt.FOLD_BLOCK=Sr;Pt.FOLD_FLOW=zf;Pt.FOLD_QUOTED=Di;Pt.foldFlowLines=Gf});var Rt=v(is=>{"use strict";var Y=O(),ge=ts(),Bi=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),qi=t=>/^(%|---|\.\.\.)/m.test(t);function Vf(t,e,i){if(!e||e<0)return!1;let n=e-i,r=t.length;if(r<=n)return!1;for(let o=0,a=0;o<r;++o)if(t[o]===`
15
- `){if(o-a>n)return!0;if(a=o+1,r-a<=n)return!1}return!0}function xt(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(qi(t)?" ":""),a="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(a+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{a+=i.slice(s,c);let f=i.substr(c+2,4);switch(f){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:f.substr(0,2)==="00"?a+="\\x"+f.substr(2):a+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(n||i[c+2]==='"'||i.length<r)c+=1;else{for(a+=i.slice(s,c)+`
8
+ `+In(i,e):(t.endsWith(" ")?"":" ")+i;Gi.indentComment=In;Gi.lineComment=Cd;Gi.stringifyComment=Ed});var ws=v(Lt=>{"use strict";var Pd="flow",jn="block",zi="quoted";function xd(t,e,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:o=20,onFold:a,onOverflow:s}={}){if(!n||n<0)return t;n<o&&(o=0);let c=Math.max(1+o,1+n-e.length);if(t.length<=c)return t;let l=[],f={},u=n-e.length;typeof r=="number"&&(r>n-Math.max(2,o)?l.push(0):u=n-r);let d,m,w=!1,h=-1,p=-1,y=-1;i===jn&&(h=gs(t,h,e.length),h!==-1&&(u=h+c));for(let k;k=t[h+=1];){if(i===zi&&k==="\\"){switch(p=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(k===`
9
+ `)i===jn&&(h=gs(t,h,e.length)),u=h+e.length+c,d=void 0;else{if(k===" "&&m&&m!==" "&&m!==`
10
+ `&&m!==" "){let S=t[h+1];S&&S!==" "&&S!==`
11
+ `&&S!==" "&&(d=h)}if(h>=u)if(d)l.push(d),u=d+c,d=void 0;else if(i===zi){for(;m===" "||m===" ";)m=k,k=t[h+=1],w=!0;let S=h>y+1?h-2:p-1;if(f[S])return t;l.push(S),f[S]=!0,u=S+c,d=void 0}else w=!0}m=k}if(w&&s&&s(),l.length===0)return t;a&&a();let b=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let S=l[k],E=l[k+1]||t.length;S===0?b=`
12
+ ${e}${t.slice(0,E)}`:(i===zi&&f[S]&&(b+=`${t[S]}\\`),b+=`
13
+ ${e}${t.slice(S+1,E)}`)}return b}function gs(t,e,i){let r=e,n=e+1,o=t[n];for(;o===" "||o===" ";)if(e<n+i)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
+ `);r=e,n=e+1,o=t[n]}return r}Lt.FOLD_BLOCK=jn;Lt.FOLD_FLOW=Pd;Lt.FOLD_QUOTED=zi;Lt.foldFlowLines=xd});var Dt=v(vs=>{"use strict";var Z=O(),Se=ws(),Ki=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ji=t=>/^(%|---|\.\.\.)/m.test(t);function Rd(t,e,i){if(!e||e<0)return!1;let r=e-i,n=t.length;if(n<=r)return!1;for(let o=0,a=0;o<n;++o)if(t[o]===`
15
+ `){if(o-a>r)return!0;if(a=o+1,n-a<=r)return!1}return!0}function $t(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=e,n=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ji(t)?" ":""),a="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(a+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{a+=i.slice(s,c);let f=i.substr(c+2,4);switch(f){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:f.substr(0,2)==="00"?a+="\\x"+f.substr(2):a+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(r||i[c+2]==='"'||i.length<n)c+=1;else{for(a+=i.slice(s,c)+`
16
16
 
17
17
  `;i[c+2]==="\\"&&i[c+3]==="n"&&i[c+4]!=='"';)a+=`
18
- `,c+=2;a+=o,i[c+2]===" "&&(a+="\\"),c+=1,s=c+1}break;default:c+=1}return a=s?a+i.slice(s):i,n?a:ge.foldFlowLines(a,o,ge.FOLD_QUOTED,Bi(e,!1))}function kr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return xt(t,e);let i=e.indent||(qi(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${i}`)+"'";return e.implicitKey?n:ge.foldFlowLines(n,i,ge.FOLD_FLOW,Bi(e,!1))}function et(t,e){let{singleQuote:i}=e.options,n;if(i===!1)n=xt;else{let r=t.includes('"'),o=t.includes("'");r&&!o?n=kr:o&&!r?n=xt:n=i?kr:xt}return n(t,e)}var Er;try{Er=new RegExp(`(^|(?<!
18
+ `,c+=2;a+=o,i[c+2]===" "&&(a+="\\"),c+=1,s=c+1}break;default:c+=1}return a=s?a+i.slice(s):i,r?a:Se.foldFlowLines(a,o,Se.FOLD_QUOTED,Ki(e,!1))}function Ln(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return $t(t,e);let i=e.indent||(Ji(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${i}`)+"'";return e.implicitKey?r:Se.foldFlowLines(r,i,Se.FOLD_FLOW,Ki(e,!1))}function at(t,e){let{singleQuote:i}=e.options,r;if(i===!1)r=$t;else{let n=t.includes('"'),o=t.includes("'");n&&!o?r=Ln:o&&!n?r=$t:r=i?Ln:$t}return r(t,e)}var $n;try{$n=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Er=/\n+(?!\n|$)/g}function Mi({comment:t,type:e,value:i},n,r,o){let{blockQuote:a,commentString:s,lineWidth:c}=n.options;if(!a||/\n[\t ]+$/.test(i))return et(i,n);let l=n.indent||(n.forceBlockIndent||qi(i)?" ":""),f=a==="literal"?!0:a==="folded"||e===Y.Scalar.BLOCK_FOLDED?!1:e===Y.Scalar.BLOCK_LITERAL?!0:!Vf(i,c,l.length);if(!i)return f?`|
23
+ |$)`,"g")}catch{$n=/\n+(?!\n|$)/g}function Vi({comment:t,type:e,value:i},r,n,o){let{blockQuote:a,commentString:s,lineWidth:c}=r.options;if(!a||/\n[\t ]+$/.test(i))return at(i,r);let l=r.indent||(r.forceBlockIndent||Ji(i)?" ":""),f=a==="literal"?!0:a==="folded"||e===Z.Scalar.BLOCK_FOLDED?!1:e===Z.Scalar.BLOCK_LITERAL?!0:!Rd(i,c,l.length);if(!i)return f?`|
24
24
  `:`>
25
25
  `;let u,d;for(d=i.length;d>0;--d){let E=i[d-1];if(E!==`
26
- `&&E!==" "&&E!==" ")break}let p=i.substring(d),w=p.indexOf(`
27
- `);w===-1?u="-":i===p||w!==p.length-1?(u="+",o&&o()):u="",p&&(i=i.slice(0,-p.length),p[p.length-1]===`
28
- `&&(p=p.slice(0,-1)),p=p.replace(Er,`$&${l}`));let h=!1,m,y=-1;for(m=0;m<i.length;++m){let E=i[m];if(E===" ")h=!0;else if(E===`
29
- `)y=m;else break}let b=i.substring(0,y<m?y+1:m);b&&(i=i.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+u;if(t&&(k+=" "+s(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!f){let E=i.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),g=!1,P=Bi(n,!0);a!=="folded"&&e!==Y.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{g=!0});let N=ge.foldFlowLines(`${b}${E}${p}`,l,ge.FOLD_BLOCK,P);if(!g)return`>${k}
31
- ${l}${N}`}return i=i.replace(/\n+/g,`$&${l}`),`|${k}
32
- ${l}${b}${i}${p}`}function Jf(t,e,i,n){let{type:r,value:o}=t,{actualString:a,implicitKey:s,indent:c,indentStep:l,inFlow:f}=e;if(s&&o.includes(`
33
- `)||f&&/[[\]{},]/.test(o))return et(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return s||f||!o.includes(`
34
- `)?et(o,e):Mi(t,e,i,n);if(!s&&!f&&r!==Y.Scalar.PLAIN&&o.includes(`
35
- `))return Mi(t,e,i,n);if(qi(o)){if(c==="")return e.forceBlockIndent=!0,Mi(t,e,i,n);if(s&&c===l)return et(o,e)}let u=o.replace(/\n+/g,`$&
36
- ${c}`);if(a){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:w}=e.doc.schema;if(w.some(d)||p?.some(d))return et(o,e)}return s?u:ge.foldFlowLines(u,c,ge.FOLD_FLOW,Bi(e,!1))}function Kf(t,e,i,n){let{implicitKey:r,inFlow:o}=e,a=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==Y.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(s=Y.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case Y.Scalar.BLOCK_FOLDED:case Y.Scalar.BLOCK_LITERAL:return r||o?et(a.value,e):Mi(a,e,i,n);case Y.Scalar.QUOTE_DOUBLE:return xt(a.value,e);case Y.Scalar.QUOTE_SINGLE:return kr(a.value,e);case Y.Scalar.PLAIN:return Jf(a,e,i,n);default:return null}},l=c(s);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}is.stringifyString=Kf});var _t=v(Cr=>{"use strict";var Uf=Ti(),we=C(),Yf=Ct(),Xf=Rt();function Qf(t,e){let i=Object.assign({blockQuote:!0,commentString:Yf.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(i.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:n,options:i}}function Zf(t,e){if(e.tag){let r=t.filter(o=>o.tag===e.tag);if(r.length>0)return r.find(o=>o.format===e.format)??r[0]}let i,n;if(we.isScalar(e)){n=e.value;let r=t.filter(o=>o.identify?.(n));if(r.length>1){let o=r.filter(a=>a.test);o.length>0&&(r=o)}i=r.find(o=>o.format===e.format)??r.find(o=>!o.format)}else n=e,i=t.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!i){let r=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${r} value`)}return i}function ed(t,e,{anchors:i,doc:n}){if(!n.directives)return"";let r=[],o=(we.isScalar(t)||we.isCollection(t))&&t.anchor;o&&Uf.anchorIsValid(o)&&(i.add(o),r.push(`&${o}`));let a=t.tag??(e.default?null:e.tag);return a&&r.push(n.directives.tagString(a)),r.join(" ")}function td(t,e,i,n){if(we.isPair(t))return t.toString(e,i,n);if(we.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,o=we.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Zf(e.doc.schema.tags,o));let a=ed(o,r,e);a.length>0&&(e.indentAtStart=(e.indentAtStart??0)+a.length+1);let s=typeof r.stringify=="function"?r.stringify(o,e,i,n):we.isScalar(o)?Xf.stringifyString(o,e,i,n):o.toString(e,i,n);return a?we.isScalar(o)||s[0]==="{"||s[0]==="["?`${a} ${s}`:`${a}
37
- ${e.indent}${s}`:s}Cr.createStringifyContext=Qf;Cr.stringify=td});var as=v(os=>{"use strict";var ue=C(),ns=O(),rs=_t(),At=Ct();function id({key:t,value:e},i,n,r){let{allNullValues:o,doc:a,indent:s,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=i,d=ue.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ue.isCollection(t)||!ue.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!u&&(!t||d&&e==null&&!i.inFlow||ue.isCollection(t)||(ue.isScalar(t)?t.type===ns.Scalar.BLOCK_FOLDED||t.type===ns.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(u||!o),indent:s+c});let w=!1,h=!1,m=rs.stringify(t,i,()=>w=!0,()=>h=!0);if(!p&&!i.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(o||e==null)return w&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(o&&!u||e==null&&p)return m=`? ${m}`,d&&!w?m+=At.lineComment(m,i.indent,l(d)):h&&r&&r(),m;w&&(d=null),p?(d&&(m+=At.lineComment(m,i.indent,l(d))),m=`? ${m}
38
- ${s}:`):(m=`${m}:`,d&&(m+=At.lineComment(m,i.indent,l(d))));let y,b,S;ue.isNode(e)?(y=!!e.spaceBefore,b=e.commentBefore,S=e.comment):(y=!1,b=null,S=null,e&&typeof e=="object"&&(e=a.createNode(e))),i.implicitKey=!1,!p&&!d&&ue.isScalar(e)&&(i.indentAtStart=m.length+1),h=!1,!f&&c.length>=2&&!i.inFlow&&!p&&ue.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let k=!1,E=rs.stringify(e,i,()=>k=!0,()=>h=!0),g=" ";if(d||y||b){if(g=y?`
26
+ `&&E!==" "&&E!==" ")break}let m=i.substring(d),w=m.indexOf(`
27
+ `);w===-1?u="-":i===m||w!==m.length-1?(u="+",o&&o()):u="",m&&(i=i.slice(0,-m.length),m[m.length-1]===`
28
+ `&&(m=m.slice(0,-1)),m=m.replace($n,`$&${l}`));let h=!1,p,y=-1;for(p=0;p<i.length;++p){let E=i[p];if(E===" ")h=!0;else if(E===`
29
+ `)y=p;else break}let b=i.substring(0,y<p?y+1:p);b&&(i=i.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let S=(h?l?"2":"1":"")+u;if(t&&(S+=" "+s(t.replace(/ ?[\r\n]+/g," ")),n&&n()),!f){let E=i.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),g=!1,P=Ki(r,!0);a!=="folded"&&e!==Z.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{g=!0});let N=Se.foldFlowLines(`${b}${E}${m}`,l,Se.FOLD_BLOCK,P);if(!g)return`>${S}
31
+ ${l}${N}`}return i=i.replace(/\n+/g,`$&${l}`),`|${S}
32
+ ${l}${b}${i}${m}`}function _d(t,e,i,r){let{type:n,value:o}=t,{actualString:a,implicitKey:s,indent:c,indentStep:l,inFlow:f}=e;if(s&&o.includes(`
33
+ `)||f&&/[[\]{},]/.test(o))return at(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return s||f||!o.includes(`
34
+ `)?at(o,e):Vi(t,e,i,r);if(!s&&!f&&n!==Z.Scalar.PLAIN&&o.includes(`
35
+ `))return Vi(t,e,i,r);if(Ji(o)){if(c==="")return e.forceBlockIndent=!0,Vi(t,e,i,r);if(s&&c===l)return at(o,e)}let u=o.replace(/\n+/g,`$&
36
+ ${c}`);if(a){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:m,tags:w}=e.doc.schema;if(w.some(d)||m?.some(d))return at(o,e)}return s?u:Se.foldFlowLines(u,c,Se.FOLD_FLOW,Ki(e,!1))}function Ad(t,e,i,r){let{implicitKey:n,inFlow:o}=e,a=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==Z.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(s=Z.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case Z.Scalar.BLOCK_FOLDED:case Z.Scalar.BLOCK_LITERAL:return n||o?at(a.value,e):Vi(a,e,i,r);case Z.Scalar.QUOTE_DOUBLE:return $t(a.value,e);case Z.Scalar.QUOTE_SINGLE:return Ln(a.value,e);case Z.Scalar.PLAIN:return _d(a,e,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=n&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}vs.stringifyString=Ad});var Bt=v(Dn=>{"use strict";var Td=Mi(),Ee=C(),Od=jt(),Id=Dt();function jd(t,e){let i=Object.assign({blockQuote:!0,commentString:Od.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function Ld(t,e){if(e.tag){let n=t.filter(o=>o.tag===e.tag);if(n.length>0)return n.find(o=>o.format===e.format)??n[0]}let i,r;if(Ee.isScalar(e)){r=e.value;let n=t.filter(o=>o.identify?.(r));if(n.length>1){let o=n.filter(a=>a.test);o.length>0&&(n=o)}i=n.find(o=>o.format===e.format)??n.find(o=>!o.format)}else r=e,i=t.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!i){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return i}function $d(t,e,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],o=(Ee.isScalar(t)||Ee.isCollection(t))&&t.anchor;o&&Td.anchorIsValid(o)&&(i.add(o),n.push(`&${o}`));let a=t.tag??(e.default?null:e.tag);return a&&n.push(r.directives.tagString(a)),n.join(" ")}function Dd(t,e,i,r){if(Ee.isPair(t))return t.toString(e,i,r);if(Ee.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let n,o=Ee.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>n=c});n??(n=Ld(e.doc.schema.tags,o));let a=$d(o,n,e);a.length>0&&(e.indentAtStart=(e.indentAtStart??0)+a.length+1);let s=typeof n.stringify=="function"?n.stringify(o,e,i,r):Ee.isScalar(o)?Id.stringifyString(o,e,i,r):o.toString(e,i,r);return a?Ee.isScalar(o)||s[0]==="{"||s[0]==="["?`${a} ${s}`:`${a}
37
+ ${e.indent}${s}`:s}Dn.createStringifyContext=jd;Dn.stringify=Dd});var ks=v(Ns=>{"use strict";var me=C(),ys=O(),bs=Bt(),Mt=jt();function Bd({key:t,value:e},i,r,n){let{allNullValues:o,doc:a,indent:s,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=i,d=me.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(me.isCollection(t)||!me.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let m=!u&&(!t||d&&e==null&&!i.inFlow||me.isCollection(t)||(me.isScalar(t)?t.type===ys.Scalar.BLOCK_FOLDED||t.type===ys.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(u||!o),indent:s+c});let w=!1,h=!1,p=bs.stringify(t,i,()=>w=!0,()=>h=!0);if(!m&&!i.inFlow&&p.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(i.inFlow){if(o||e==null)return w&&r&&r(),p===""?"?":m?`? ${p}`:p}else if(o&&!u||e==null&&m)return p=`? ${p}`,d&&!w?p+=Mt.lineComment(p,i.indent,l(d)):h&&n&&n(),p;w&&(d=null),m?(d&&(p+=Mt.lineComment(p,i.indent,l(d))),p=`? ${p}
38
+ ${s}:`):(p=`${p}:`,d&&(p+=Mt.lineComment(p,i.indent,l(d))));let y,b,k;me.isNode(e)?(y=!!e.spaceBefore,b=e.commentBefore,k=e.comment):(y=!1,b=null,k=null,e&&typeof e=="object"&&(e=a.createNode(e))),i.implicitKey=!1,!m&&!d&&me.isScalar(e)&&(i.indentAtStart=p.length+1),h=!1,!f&&c.length>=2&&!i.inFlow&&!m&&me.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=bs.stringify(e,i,()=>S=!0,()=>h=!0),g=" ";if(d||y||b){if(g=y?`
39
39
  `:"",b){let P=l(b);g+=`
40
- ${At.indentComment(P,i.indent)}`}E===""&&!i.inFlow?g===`
41
- `&&S&&(g=`
40
+ ${Mt.indentComment(P,i.indent)}`}E===""&&!i.inFlow?g===`
41
+ `&&k&&(g=`
42
42
 
43
43
  `):g+=`
44
- ${i.indent}`}else if(!p&&ue.isCollection(e)){let P=E[0],N=E.indexOf(`
45
- `),_=N!==-1,z=i.inFlow??e.flow??e.items.length===0;if(_||!z){let Ye=!1;if(_&&(P==="&"||P==="!")){let I=E.indexOf(" ");P==="&"&&I!==-1&&I<N&&E[I+1]==="!"&&(I=E.indexOf(" ",I+1)),(I===-1||N<I)&&(Ye=!0)}Ye||(g=`
44
+ ${i.indent}`}else if(!m&&me.isCollection(e)){let P=E[0],N=E.indexOf(`
45
+ `),_=N!==-1,G=i.inFlow??e.flow??e.items.length===0;if(_||!G){let it=!1;if(_&&(P==="&"||P==="!")){let j=E.indexOf(" ");P==="&"&&j!==-1&&j<N&&E[j+1]==="!"&&(j=E.indexOf(" ",j+1)),(j===-1||N<j)&&(it=!0)}it||(g=`
46
46
  ${i.indent}`)}}else(E===""||E[0]===`
47
- `)&&(g="");return m+=g+E,i.inFlow?k&&n&&n():S&&!k?m+=At.lineComment(m,i.indent,l(S)):h&&r&&r(),m}os.stringifyPair=id});var xr=v(Pr=>{"use strict";var ss=Ci("process");function nd(t,...e){t==="debug"&&console.log(...e)}function rd(t,e){(t==="debug"||t==="warn")&&(typeof ss.emitWarning=="function"?ss.emitWarning(e):console.warn(e))}Pr.debug=nd;Pr.warn=rd});var Gi=v(zi=>{"use strict";var Hi=C(),cs=O(),Fi="<<",Wi={identify:t=>t===Fi||typeof t=="symbol"&&t.description===Fi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new cs.Scalar(Symbol(Fi)),{addToJSMap:ls}),stringify:()=>Fi},od=(t,e)=>(Wi.identify(e)||Hi.isScalar(e)&&(!e.type||e.type===cs.Scalar.PLAIN)&&Wi.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Wi.tag&&i.default);function ls(t,e,i){let n=us(t,i);if(Hi.isSeq(n))for(let r of n.items)Rr(t,e,r);else if(Array.isArray(n))for(let r of n)Rr(t,e,r);else Rr(t,e,n)}function Rr(t,e,i){let n=us(t,i);if(!Hi.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,t,Map);for(let[o,a]of r)e instanceof Map?e.has(o)||e.set(o,a):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:a,writable:!0,enumerable:!0,configurable:!0});return e}function us(t,e){return t&&Hi.isAlias(e)?e.resolve(t.doc,t):e}zi.addMergeToJSMap=ls;zi.isMergeKey=od;zi.merge=Wi});var Ar=v(hs=>{"use strict";var ad=xr(),fs=Gi(),sd=_t(),ds=C(),_r=me();function cd(t,e,{key:i,value:n}){if(ds.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,n);else if(fs.isMergeKey(t,i))fs.addMergeToJSMap(t,e,n);else{let r=_r.toJS(i,"",t);if(e instanceof Map)e.set(r,_r.toJS(n,r,t));else if(e instanceof Set)e.add(r);else{let o=ld(i,r,t),a=_r.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:a,writable:!0,enumerable:!0,configurable:!0}):e[o]=a}}return e}function ld(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(ds.isNode(t)&&i?.doc){let n=sd.createStringifyContext(i.doc,{});n.anchors=new Set;for(let o of i.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let r=t.toString(n);if(!i.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),ad.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return r}return JSON.stringify(e)}hs.addPairToJSMap=cd});var ve=v(Tr=>{"use strict";var ms=Et(),ud=as(),fd=Ar(),Vi=C();function dd(t,e,i){let n=ms.createNode(t,void 0,i),r=ms.createNode(e,void 0,i);return new Ji(n,r)}var Ji=class t{constructor(e,i=null){Object.defineProperty(this,Vi.NODE_TYPE,{value:Vi.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:n}=this;return Vi.isNode(i)&&(i=i.clone(e)),Vi.isNode(n)&&(n=n.clone(e)),new t(i,n)}toJSON(e,i){let n=i?.mapAsMap?new Map:{};return fd.addPairToJSMap(i,n,this)}toString(e,i,n){return e?.doc?ud.stringifyPair(this,e,i,n):JSON.stringify(this)}};Tr.Pair=Ji;Tr.createPair=dd});var Or=v(gs=>{"use strict";var Oe=C(),ps=_t(),Ki=Ct();function hd(t,e,i){return(e.inFlow??t.flow?pd:md)(t,e,i)}function md({comment:t,items:e},i,{blockItemPrefix:n,flowChars:r,itemIndent:o,onChompKeep:a,onComment:s}){let{indent:c,options:{commentString:l}}=i,f=Object.assign({},i,{indent:o,type:null}),u=!1,d=[];for(let w=0;w<e.length;++w){let h=e[w],m=null;if(Oe.isNode(h))!u&&h.spaceBefore&&d.push(""),Ui(i,d,h.commentBefore,u),h.comment&&(m=h.comment);else if(Oe.isPair(h)){let b=Oe.isNode(h.key)?h.key:null;b&&(!u&&b.spaceBefore&&d.push(""),Ui(i,d,b.commentBefore,u))}u=!1;let y=ps.stringify(h,f,()=>m=null,()=>u=!0);m&&(y+=Ki.lineComment(y,o,l(m))),u&&m&&(u=!1),d.push(n+y)}let p;if(d.length===0)p=r.start+r.end;else{p=d[0];for(let w=1;w<d.length;++w){let h=d[w];p+=h?`
47
+ `)&&(g="");return p+=g+E,i.inFlow?S&&r&&r():k&&!S?p+=Mt.lineComment(p,i.indent,l(k)):h&&n&&n(),p}Ns.stringifyPair=Bd});var Mn=v(Bn=>{"use strict";var Ss=ji("process");function Md(t,...e){t==="debug"&&console.log(...e)}function Fd(t,e){(t==="debug"||t==="warn")&&(typeof Ss.emitWarning=="function"?Ss.emitWarning(e):console.warn(e))}Bn.debug=Md;Bn.warn=Fd});var Zi=v(Qi=>{"use strict";var Xi=C(),Es=O(),Ui="<<",Yi={identify:t=>t===Ui||typeof t=="symbol"&&t.description===Ui,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Es.Scalar(Symbol(Ui)),{addToJSMap:Cs}),stringify:()=>Ui},Wd=(t,e)=>(Yi.identify(e)||Xi.isScalar(e)&&(!e.type||e.type===Es.Scalar.PLAIN)&&Yi.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Yi.tag&&i.default);function Cs(t,e,i){let r=Ps(t,i);if(Xi.isSeq(r))for(let n of r.items)Fn(t,e,n);else if(Array.isArray(r))for(let n of r)Fn(t,e,n);else Fn(t,e,r)}function Fn(t,e,i){let r=Ps(t,i);if(!Xi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,t,Map);for(let[o,a]of n)e instanceof Map?e.has(o)||e.set(o,a):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:a,writable:!0,enumerable:!0,configurable:!0});return e}function Ps(t,e){return t&&Xi.isAlias(e)?e.resolve(t.doc,t):e}Qi.addMergeToJSMap=Cs;Qi.isMergeKey=Wd;Qi.merge=Yi});var qn=v(_s=>{"use strict";var qd=Mn(),xs=Zi(),Hd=Bt(),Rs=C(),Wn=Ne();function Gd(t,e,{key:i,value:r}){if(Rs.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,r);else if(xs.isMergeKey(t,i))xs.addMergeToJSMap(t,e,r);else{let n=Wn.toJS(i,"",t);if(e instanceof Map)e.set(n,Wn.toJS(r,n,t));else if(e instanceof Set)e.add(n);else{let o=zd(i,n,t),a=Wn.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:a,writable:!0,enumerable:!0,configurable:!0}):e[o]=a}}return e}function zd(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(Rs.isNode(t)&&i?.doc){let r=Hd.createStringifyContext(i.doc,{});r.anchors=new Set;for(let o of i.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=t.toString(r);if(!i.mapKeyWarned){let o=JSON.stringify(n);o.length>40&&(o=o.substring(0,36)+'..."'),qd.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(e)}_s.addPairToJSMap=Gd});var Ce=v(Hn=>{"use strict";var As=It(),Vd=ks(),Kd=qn(),er=C();function Jd(t,e,i){let r=As.createNode(t,void 0,i),n=As.createNode(e,void 0,i);return new tr(r,n)}var tr=class t{constructor(e,i=null){Object.defineProperty(this,er.NODE_TYPE,{value:er.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:r}=this;return er.isNode(i)&&(i=i.clone(e)),er.isNode(r)&&(r=r.clone(e)),new t(i,r)}toJSON(e,i){let r=i?.mapAsMap?new Map:{};return Kd.addPairToJSMap(i,r,this)}toString(e,i,r){return e?.doc?Vd.stringifyPair(this,e,i,r):JSON.stringify(this)}};Hn.Pair=tr;Hn.createPair=Jd});var Gn=v(Os=>{"use strict";var $e=C(),Ts=Bt(),ir=jt();function Ud(t,e,i){return(e.inFlow??t.flow?Xd:Yd)(t,e,i)}function Yd({comment:t,items:e},i,{blockItemPrefix:r,flowChars:n,itemIndent:o,onChompKeep:a,onComment:s}){let{indent:c,options:{commentString:l}}=i,f=Object.assign({},i,{indent:o,type:null}),u=!1,d=[];for(let w=0;w<e.length;++w){let h=e[w],p=null;if($e.isNode(h))!u&&h.spaceBefore&&d.push(""),rr(i,d,h.commentBefore,u),h.comment&&(p=h.comment);else if($e.isPair(h)){let b=$e.isNode(h.key)?h.key:null;b&&(!u&&b.spaceBefore&&d.push(""),rr(i,d,b.commentBefore,u))}u=!1;let y=Ts.stringify(h,f,()=>p=null,()=>u=!0);p&&(y+=ir.lineComment(y,o,l(p))),u&&p&&(u=!1),d.push(r+y)}let m;if(d.length===0)m=n.start+n.end;else{m=d[0];for(let w=1;w<d.length;++w){let h=d[w];m+=h?`
48
48
  ${c}${h}`:`
49
- `}}return t?(p+=`
50
- `+Ki.indentComment(l(t),c),s&&s()):u&&a&&a(),p}function pd({items:t},e,{flowChars:i,itemIndent:n}){let{indent:r,indentStep:o,flowCollectionPadding:a,options:{commentString:s}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let w=0;w<t.length;++w){let h=t[w],m=null;if(Oe.isNode(h))h.spaceBefore&&u.push(""),Ui(e,u,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Oe.isPair(h)){let b=Oe.isNode(h.key)?h.key:null;b&&(b.spaceBefore&&u.push(""),Ui(e,u,b.commentBefore,!1),b.comment&&(l=!0));let S=Oe.isNode(h.value)?h.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(l=!0)):h.value==null&&b?.comment&&(m=b.comment)}m&&(l=!0);let y=ps.stringify(h,c,()=>m=null);l||(l=u.length>f||y.includes(`
51
- `)),w<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((b,S)=>b+S.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),m&&(y+=Ki.lineComment(y,n,s(m))),u.push(y),f=u.length}let{start:d,end:p}=i;if(u.length===0)return d+p;if(!l){let w=u.reduce((h,m)=>h+m.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=d;for(let h of u)w+=h?`
52
- ${o}${r}${h}`:`
49
+ `}}return t?(m+=`
50
+ `+ir.indentComment(l(t),c),s&&s()):u&&a&&a(),m}function Xd({items:t},e,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:o,flowCollectionPadding:a,options:{commentString:s}}=e;r+=o;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let w=0;w<t.length;++w){let h=t[w],p=null;if($e.isNode(h))h.spaceBefore&&u.push(""),rr(e,u,h.commentBefore,!1),h.comment&&(p=h.comment);else if($e.isPair(h)){let b=$e.isNode(h.key)?h.key:null;b&&(b.spaceBefore&&u.push(""),rr(e,u,b.commentBefore,!1),b.comment&&(l=!0));let k=$e.isNode(h.value)?h.value:null;k?(k.comment&&(p=k.comment),k.commentBefore&&(l=!0)):h.value==null&&b?.comment&&(p=b.comment)}p&&(l=!0);let y=Ts.stringify(h,c,()=>p=null);l||(l=u.length>f||y.includes(`
51
+ `)),w<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((b,k)=>b+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),p&&(y+=ir.lineComment(y,r,s(p))),u.push(y),f=u.length}let{start:d,end:m}=i;if(u.length===0)return d+m;if(!l){let w=u.reduce((h,p)=>h+p.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=d;for(let h of u)w+=h?`
52
+ ${o}${n}${h}`:`
53
53
  `;return`${w}
54
- ${r}${p}`}else return`${d}${a}${u.join(" ")}${a}${p}`}function Ui({indent:t,options:{commentString:e}},i,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let o=Ki.indentComment(e(n),t);i.push(o.trimStart())}}gs.stringifyCollection=hd});var be=v(jr=>{"use strict";var gd=Or(),wd=Ar(),vd=Li(),ye=C(),Yi=ve(),yd=O();function Tt(t,e){let i=ye.isScalar(e)?e.value:e;for(let n of t)if(ye.isPair(n)&&(n.key===e||n.key===i||ye.isScalar(n.key)&&n.key.value===i))return n}var Ir=class extends vd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ye.MAP,e),this.items=[]}static from(e,i,n){let{keepUndefined:r,replacer:o}=n,a=new this(e),s=(c,l)=>{if(typeof o=="function")l=o.call(i,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||r)&&a.items.push(Yi.createPair(c,l,n))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&a.items.sort(e.sortMapEntries),a}add(e,i){let n;ye.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yi.Pair(e,e?.value):n=new Yi.Pair(e.key,e.value);let r=Tt(this.items,n.key),o=this.schema?.sortMapEntries;if(r){if(!i)throw new Error(`Key ${n.key} already set`);ye.isScalar(r.value)&&yd.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(o){let a=this.items.findIndex(s=>o(n,s)<0);a===-1?this.items.push(n):this.items.splice(a,0,n)}else this.items.push(n)}delete(e){let i=Tt(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let r=Tt(this.items,e)?.value;return(!i&&ye.isScalar(r)?r.value:r)??void 0}has(e){return!!Tt(this.items,e)}set(e,i){this.add(new Yi.Pair(e,i),!0)}toJSON(e,i,n){let r=n?new n:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(r);for(let o of this.items)wd.addPairToJSMap(i,r,o);return r}toString(e,i,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!ye.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})),gd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:i})}};jr.YAMLMap=Ir;jr.findPair=Tt});var tt=v(vs=>{"use strict";var bd=C(),ws=be(),Nd={collection:"map",default:!0,nodeClass:ws.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return bd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>ws.YAMLMap.from(t,e,i)};vs.map=Nd});var Ne=v(ys=>{"use strict";var Sd=Et(),kd=Or(),Ed=Li(),Qi=C(),Cd=O(),Pd=me(),Lr=class extends Ed.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Qi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=Xi(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let n=Xi(e);if(typeof n!="number")return;let r=this.items[n];return!i&&Qi.isScalar(r)?r.value:r}has(e){let i=Xi(e);return typeof i=="number"&&i<this.items.length}set(e,i){let n=Xi(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Qi.isScalar(r)&&Cd.isScalarValue(i)?r.value=i:this.items[n]=i}toJSON(e,i){let n=[];i?.onCreate&&i.onCreate(n);let r=0;for(let o of this.items)n.push(Pd.toJS(o,String(r++),i));return n}toString(e,i,n){return e?kd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:i}):JSON.stringify(this)}static from(e,i,n){let{replacer:r}=n,o=new this(e);if(i&&Symbol.iterator in Object(i)){let a=0;for(let s of i){if(typeof r=="function"){let c=i instanceof Set?s:String(a++);s=r.call(i,c,s)}o.items.push(Sd.createNode(s,void 0,n))}}return o}};function Xi(t){let e=Qi.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ys.YAMLSeq=Lr});var it=v(Ns=>{"use strict";var xd=C(),bs=Ne(),Rd={collection:"seq",default:!0,nodeClass:bs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return xd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>bs.YAMLSeq.from(t,e,i)};Ns.seq=Rd});var Ot=v(Ss=>{"use strict";var _d=Rt(),Ad={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,n){return e=Object.assign({actualString:!0},e),_d.stringifyString(t,e,i,n)}};Ss.string=Ad});var Zi=v(Cs=>{"use strict";var ks=O(),Es={identify:t=>t==null,createNode:()=>new ks.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ks.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Es.test.test(t)?t:e.options.nullStr};Cs.nullTag=Es});var $r=v(xs=>{"use strict";var Td=O(),Ps={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Td.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&Ps.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?i.options.trueStr:i.options.falseStr}};xs.boolTag=Ps});var nt=v(Rs=>{"use strict";function Od({format:t,minFractionDigits:e,tag:i,value:n}){if(typeof n=="bigint")return String(n);let r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let a=o.indexOf(".");a<0&&(a=o.length,o+=".");let s=e-(o.length-a-1);for(;s-- >0;)o+="0"}return o}Rs.stringifyNumber=Od});var Mr=v(en=>{"use strict";var Id=O(),Dr=nt(),jd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Dr.stringifyNumber},Ld={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():Dr.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 Id.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:Dr.stringifyNumber};en.float=$d;en.floatExp=Ld;en.floatNaN=jd});var qr=v(nn=>{"use strict";var _s=nt(),tn=t=>typeof t=="bigint"||Number.isInteger(t),Br=(t,e,i,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),i);function As(t,e,i){let{value:n}=t;return tn(n)&&n>=0?i+n.toString(e):_s.stringifyNumber(t)}var Dd={identify:t=>tn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>Br(t,2,8,i),stringify:t=>As(t,8,"0o")},Md={identify:tn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>Br(t,0,10,i),stringify:_s.stringifyNumber},Bd={identify:t=>tn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>Br(t,2,16,i),stringify:t=>As(t,16,"0x")};nn.int=Md;nn.intHex=Bd;nn.intOct=Dd});var Os=v(Ts=>{"use strict";var qd=tt(),Fd=Zi(),Wd=it(),Hd=Ot(),zd=$r(),Fr=Mr(),Wr=qr(),Gd=[qd.map,Wd.seq,Hd.string,Fd.nullTag,zd.boolTag,Wr.intOct,Wr.int,Wr.intHex,Fr.floatNaN,Fr.floatExp,Fr.float];Ts.schema=Gd});var Ls=v(js=>{"use strict";var Vd=O(),Jd=tt(),Kd=it();function Is(t){return typeof t=="bigint"||Number.isInteger(t)}var rn=({value:t})=>JSON.stringify(t),Ud=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:rn},{identify:t=>t==null,createNode:()=>new Vd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:rn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:rn},{identify:Is,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>Is(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:rn}],Yd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Xd=[Jd.map,Kd.seq].concat(Ud,Yd);js.schema=Xd});var zr=v($s=>{"use strict";var It=Ci("buffer"),Hr=O(),Qd=Rt(),Zd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof It.Buffer=="function")return It.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(i.length);for(let r=0;r<i.length;++r)n[r]=i.charCodeAt(r);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:i},n,r,o){if(!i)return"";let a=i,s;if(typeof It.Buffer=="function")s=a instanceof It.Buffer?a.toString("base64"):It.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<a.length;++l)c+=String.fromCharCode(a[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Hr.Scalar.BLOCK_LITERAL),e!==Hr.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(s.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=s.substr(d,c);s=f.join(e===Hr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return Qd.stringifyString({comment:t,type:e,value:s},n,r,o)}};$s.binary=Zd});var sn=v(an=>{"use strict";var on=C(),Gr=ve(),eh=O(),th=Ne();function Ds(t,e){if(on.isSeq(t))for(let i=0;i<t.items.length;++i){let n=t.items[i];if(!on.isPair(n)){if(on.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let r=n.items[0]||new Gr.Pair(new eh.Scalar(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
56
- ${r.key.commentBefore}`:n.commentBefore),n.comment){let o=r.value??r.key;o.comment=o.comment?`${n.comment}
57
- ${o.comment}`:n.comment}n=r}t.items[i]=on.isPair(n)?n:new Gr.Pair(n)}}else e("Expected a sequence for this tag");return t}function Ms(t,e,i){let{replacer:n}=i,r=new th.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let a of e){typeof n=="function"&&(a=n.call(e,String(o++),a));let s,c;if(Array.isArray(a))if(a.length===2)s=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let l=Object.keys(a);if(l.length===1)s=l[0],c=a[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=a;r.items.push(Gr.createPair(s,c,i))}return r}var ih={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ds,createNode:Ms};an.createPairs=Ms;an.pairs=ih;an.resolvePairs=Ds});var Kr=v(Jr=>{"use strict";var Bs=C(),Vr=me(),jt=be(),nh=Ne(),qs=sn(),Ie=class t extends nh.YAMLSeq{constructor(){super(),this.add=jt.YAMLMap.prototype.add.bind(this),this.delete=jt.YAMLMap.prototype.delete.bind(this),this.get=jt.YAMLMap.prototype.get.bind(this),this.has=jt.YAMLMap.prototype.has.bind(this),this.set=jt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let o,a;if(Bs.isPair(r)?(o=Vr.toJS(r.key,"",i),a=Vr.toJS(r.value,o,i)):o=Vr.toJS(r,"",i),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,a)}return n}static from(e,i,n){let r=qs.createPairs(e,i,n),o=new this;return o.items=r.items,o}};Ie.tag="tag:yaml.org,2002:omap";var rh={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ie,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=qs.resolvePairs(t,e),n=[];for(let{key:r}of i.items)Bs.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Ie,i)},createNode:(t,e,i)=>Ie.from(t,e,i)};Jr.YAMLOMap=Ie;Jr.omap=rh});var Gs=v(Ur=>{"use strict";var Fs=O();function Ws({value:t,source:e},i){return e&&(t?Hs:zs).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Hs={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 Fs.Scalar(!0),stringify:Ws},zs={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 Fs.Scalar(!1),stringify:Ws};Ur.falseTag=zs;Ur.trueTag=Hs});var Vs=v(cn=>{"use strict";var oh=O(),Yr=nt(),ah={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:Yr.stringifyNumber},sh={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():Yr.stringifyNumber(t)}},ch={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 oh.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let n=t.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Yr.stringifyNumber};cn.float=ch;cn.floatExp=sh;cn.floatNaN=ah});var Ks=v($t=>{"use strict";var Js=nt(),Lt=t=>typeof t=="bigint"||Number.isInteger(t);function ln(t,e,i,{intAsBigInt:n}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let a=BigInt(t);return r==="-"?BigInt(-1)*a:a}let o=parseInt(t,i);return r==="-"?-1*o:o}function Xr(t,e,i){let{value:n}=t;if(Lt(n)){let r=n.toString(e);return n<0?"-"+i+r.substr(1):i+r}return Js.stringifyNumber(t)}var lh={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>ln(t,2,2,i),stringify:t=>Xr(t,2,"0b")},uh={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>ln(t,1,8,i),stringify:t=>Xr(t,8,"0")},fh={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>ln(t,0,10,i),stringify:Js.stringifyNumber},dh={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>ln(t,2,16,i),stringify:t=>Xr(t,16,"0x")};$t.int=fh;$t.intBin=lh;$t.intHex=dh;$t.intOct=uh});var Zr=v(Qr=>{"use strict";var dn=C(),un=ve(),fn=be(),je=class t extends fn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;dn.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new un.Pair(e.key,null):i=new un.Pair(e,null),fn.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let n=fn.findPair(this.items,e);return!i&&dn.isPair(n)?dn.isScalar(n.key)?n.key.value:n.key:n}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=fn.findPair(this.items,e);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new un.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(e,i,n){let{replacer:r}=n,o=new this(e);if(i&&Symbol.iterator in Object(i))for(let a of i)typeof r=="function"&&(a=r.call(i,a,a)),o.items.push(un.createPair(a,null,n));return o}};je.tag="tag:yaml.org,2002:set";var hh={collection:"map",identify:t=>t instanceof Set,nodeClass:je,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>je.from(t,e,i),resolve(t,e){if(dn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new je,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Qr.YAMLSet=je;Qr.set=hh});var to=v(hn=>{"use strict";var mh=nt();function eo(t,e){let i=t[0],n=i==="-"||i==="+"?t.substring(1):t,r=a=>e?BigInt(a):Number(a),o=n.replace(/_/g,"").split(":").reduce((a,s)=>a*r(60)+r(s),r(0));return i==="-"?r(-1)*o:o}function Us(t){let{value:e}=t,i=a=>a;if(typeof e=="bigint")i=a=>BigInt(a);else if(isNaN(e)||!isFinite(e))return mh.stringifyNumber(t);let n="";e<0&&(n="-",e*=i(-1));let r=i(60),o=[e%r];return e<60?o.unshift(0):(e=(e-o[0])/r,o.unshift(e%r),e>=60&&(e=(e-o[0])/r,o.unshift(e))),n+o.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ph={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:i})=>eo(t,i),stringify:Us},gh={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=>eo(t,!1),stringify:Us},Ys={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(Ys.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,o,a,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,o||0,a||0,s||0,c),f=e[8];if(f&&f!=="Z"){let u=eo(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$/,"")??""};hn.floatTime=gh;hn.intTime=ph;hn.timestamp=Ys});var Zs=v(Qs=>{"use strict";var wh=tt(),vh=Zi(),yh=it(),bh=Ot(),Nh=zr(),Xs=Gs(),io=Vs(),mn=Ks(),Sh=Gi(),kh=Kr(),Eh=sn(),Ch=Zr(),no=to(),Ph=[wh.map,yh.seq,bh.string,vh.nullTag,Xs.trueTag,Xs.falseTag,mn.intBin,mn.intOct,mn.int,mn.intHex,io.floatNaN,io.floatExp,io.float,Nh.binary,Sh.merge,kh.omap,Eh.pairs,Ch.set,no.intTime,no.floatTime,no.timestamp];Qs.schema=Ph});var lc=v(ao=>{"use strict";var nc=tt(),xh=Zi(),rc=it(),Rh=Ot(),_h=$r(),ro=Mr(),oo=qr(),Ah=Os(),Th=Ls(),oc=zr(),Dt=Gi(),ac=Kr(),sc=sn(),ec=Zs(),cc=Zr(),pn=to(),tc=new Map([["core",Ah.schema],["failsafe",[nc.map,rc.seq,Rh.string]],["json",Th.schema],["yaml11",ec.schema],["yaml-1.1",ec.schema]]),ic={binary:oc.binary,bool:_h.boolTag,float:ro.float,floatExp:ro.floatExp,floatNaN:ro.floatNaN,floatTime:pn.floatTime,int:oo.int,intHex:oo.intHex,intOct:oo.intOct,intTime:pn.intTime,map:nc.map,merge:Dt.merge,null:xh.nullTag,omap:ac.omap,pairs:sc.pairs,seq:rc.seq,set:cc.set,timestamp:pn.timestamp},Oh={"tag:yaml.org,2002:binary":oc.binary,"tag:yaml.org,2002:merge":Dt.merge,"tag:yaml.org,2002:omap":ac.omap,"tag:yaml.org,2002:pairs":sc.pairs,"tag:yaml.org,2002:set":cc.set,"tag:yaml.org,2002:timestamp":pn.timestamp};function Ih(t,e,i){let n=tc.get(e);if(n&&!t)return i&&!n.includes(Dt.merge)?n.concat(Dt.merge):n.slice();let r=n;if(!r)if(Array.isArray(t))r=[];else{let o=Array.from(tc.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)r=r.concat(o);else typeof t=="function"&&(r=t(r.slice()));return i&&(r=r.concat(Dt.merge)),r.reduce((o,a)=>{let s=typeof a=="string"?ic[a]:a;if(!s){let c=JSON.stringify(a),l=Object.keys(ic).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(s)||o.push(s),o},[])}ao.coreKnownTags=Oh;ao.getTags=Ih});var lo=v(uc=>{"use strict";var so=C(),jh=tt(),Lh=it(),$h=Ot(),gn=lc(),Dh=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,co=class t{constructor({compat:e,customTags:i,merge:n,resolveKnownTags:r,schema:o,sortMapEntries:a,toStringDefaults:s}){this.compat=Array.isArray(e)?gn.getTags(e,"compat"):e?gn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?gn.coreKnownTags:{},this.tags=gn.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,so.MAP,{value:jh.map}),Object.defineProperty(this,so.SCALAR,{value:$h.string}),Object.defineProperty(this,so.SEQ,{value:Lh.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?Dh:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};uc.Schema=co});var dc=v(fc=>{"use strict";var Mh=C(),uo=_t(),Mt=Ct();function Bh(t,e){let i=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&i.push("---");let r=uo.createStringifyContext(t,e),{commentString:o}=r.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=o(t.commentBefore);i.unshift(Mt.indentComment(c,""))}let a=!1,s=null;if(t.contents){if(Mh.isNode(t.contents)){if(t.contents.spaceBefore&&n&&i.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);i.push(Mt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>a=!0,l=uo.stringify(t.contents,r,()=>s=null,c);s&&(l+=Mt.lineComment(l,"",o(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(uo.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
- `)?(i.push("..."),i.push(Mt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&a&&(c=c.replace(/^\n+/,"")),c&&((!a||s)&&i[i.length-1]!==""&&i.push(""),i.push(Mt.indentComment(o(c),"")))}return i.join(`
54
+ ${n}${m}`}else return`${d}${a}${u.join(" ")}${a}${m}`}function rr({indent:t,options:{commentString:e}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let o=ir.indentComment(e(r),t);i.push(o.trimStart())}}Os.stringifyCollection=Ud});var xe=v(Vn=>{"use strict";var Qd=Gn(),Zd=qn(),eh=Hi(),Pe=C(),nr=Ce(),th=O();function Ft(t,e){let i=Pe.isScalar(e)?e.value:e;for(let r of t)if(Pe.isPair(r)&&(r.key===e||r.key===i||Pe.isScalar(r.key)&&r.key.value===i))return r}var zn=class extends eh.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Pe.MAP,e),this.items=[]}static from(e,i,r){let{keepUndefined:n,replacer:o}=r,a=new this(e),s=(c,l)=>{if(typeof o=="function")l=o.call(i,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||n)&&a.items.push(nr.createPair(c,l,r))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&a.items.sort(e.sortMapEntries),a}add(e,i){let r;Pe.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new nr.Pair(e,e?.value):r=new nr.Pair(e.key,e.value);let n=Ft(this.items,r.key),o=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Pe.isScalar(n.value)&&th.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(o){let a=this.items.findIndex(s=>o(r,s)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(e){let i=Ft(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let n=Ft(this.items,e)?.value;return(!i&&Pe.isScalar(n)?n.value:n)??void 0}has(e){return!!Ft(this.items,e)}set(e,i){this.add(new nr.Pair(e,i),!0)}toJSON(e,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let o of this.items)Zd.addPairToJSMap(i,n,o);return n}toString(e,i,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!Pe.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Qd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:i})}};Vn.YAMLMap=zn;Vn.findPair=Ft});var st=v(js=>{"use strict";var ih=C(),Is=xe(),rh={collection:"map",default:!0,nodeClass:Is.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ih.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>Is.YAMLMap.from(t,e,i)};js.map=rh});var Re=v(Ls=>{"use strict";var nh=It(),oh=Gn(),ah=Hi(),ar=C(),sh=O(),ch=Ne(),Kn=class extends ah.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ar.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=or(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let r=or(e);if(typeof r!="number")return;let n=this.items[r];return!i&&ar.isScalar(n)?n.value:n}has(e){let i=or(e);return typeof i=="number"&&i<this.items.length}set(e,i){let r=or(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[r];ar.isScalar(n)&&sh.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(e,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let o of this.items)r.push(ch.toJS(o,String(n++),i));return r}toString(e,i,r){return e?oh.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(e,i,r){let{replacer:n}=r,o=new this(e);if(i&&Symbol.iterator in Object(i)){let a=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(a++);s=n.call(i,c,s)}o.items.push(nh.createNode(s,void 0,r))}}return o}};function or(t){let e=ar.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ls.YAMLSeq=Kn});var ct=v(Ds=>{"use strict";var lh=C(),$s=Re(),uh={collection:"seq",default:!0,nodeClass:$s.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return lh.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>$s.YAMLSeq.from(t,e,i)};Ds.seq=uh});var Wt=v(Bs=>{"use strict";var fh=Dt(),dh={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,r){return e=Object.assign({actualString:!0},e),fh.stringifyString(t,e,i,r)}};Bs.string=dh});var sr=v(Ws=>{"use strict";var Ms=O(),Fs={identify:t=>t==null,createNode:()=>new Ms.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ms.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Fs.test.test(t)?t:e.options.nullStr};Ws.nullTag=Fs});var Jn=v(Hs=>{"use strict";var hh=O(),qs={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new hh.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&qs.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?i.options.trueStr:i.options.falseStr}};Hs.boolTag=qs});var lt=v(Gs=>{"use strict";function mh({format:t,minFractionDigits:e,tag:i,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let a=o.indexOf(".");a<0&&(a=o.length,o+=".");let s=e-(o.length-a-1);for(;s-- >0;)o+="0"}return o}Gs.stringifyNumber=mh});var Yn=v(cr=>{"use strict";var ph=O(),Un=lt(),gh={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:Un.stringifyNumber},wh={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():Un.stringifyNumber(t)}},vh={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 ph.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:Un.stringifyNumber};cr.float=vh;cr.floatExp=wh;cr.floatNaN=gh});var Qn=v(ur=>{"use strict";var zs=lt(),lr=t=>typeof t=="bigint"||Number.isInteger(t),Xn=(t,e,i,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),i);function Vs(t,e,i){let{value:r}=t;return lr(r)&&r>=0?i+r.toString(e):zs.stringifyNumber(t)}var yh={identify:t=>lr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>Xn(t,2,8,i),stringify:t=>Vs(t,8,"0o")},bh={identify:lr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>Xn(t,0,10,i),stringify:zs.stringifyNumber},Nh={identify:t=>lr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>Xn(t,2,16,i),stringify:t=>Vs(t,16,"0x")};ur.int=bh;ur.intHex=Nh;ur.intOct=yh});var Js=v(Ks=>{"use strict";var kh=st(),Sh=sr(),Eh=ct(),Ch=Wt(),Ph=Jn(),Zn=Yn(),eo=Qn(),xh=[kh.map,Eh.seq,Ch.string,Sh.nullTag,Ph.boolTag,eo.intOct,eo.int,eo.intHex,Zn.floatNaN,Zn.floatExp,Zn.float];Ks.schema=xh});var Xs=v(Ys=>{"use strict";var Rh=O(),_h=st(),Ah=ct();function Us(t){return typeof t=="bigint"||Number.isInteger(t)}var fr=({value:t})=>JSON.stringify(t),Th=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:fr},{identify:t=>t==null,createNode:()=>new Rh.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:fr},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:fr},{identify:Us,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>Us(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:fr}],Oh={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ih=[_h.map,Ah.seq].concat(Th,Oh);Ys.schema=Ih});var io=v(Qs=>{"use strict";var qt=ji("buffer"),to=O(),jh=Dt(),Lh={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 i=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let n=0;n<i.length;++n)r[n]=i.charCodeAt(n);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},r,n,o){if(!i)return"";let a=i,s;if(typeof qt.Buffer=="function")s=a instanceof qt.Buffer?a.toString("base64"):qt.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<a.length;++l)c+=String.fromCharCode(a[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=to.Scalar.BLOCK_LITERAL),e!==to.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(s.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=s.substr(d,c);s=f.join(e===to.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return jh.stringifyString({comment:t,type:e,value:s},r,n,o)}};Qs.binary=Lh});var mr=v(hr=>{"use strict";var dr=C(),ro=Ce(),$h=O(),Dh=Re();function Zs(t,e){if(dr.isSeq(t))for(let i=0;i<t.items.length;++i){let r=t.items[i];if(!dr.isPair(r)){if(dr.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let n=r.items[0]||new ro.Pair(new $h.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
56
+ ${n.key.commentBefore}`:r.commentBefore),r.comment){let o=n.value??n.key;o.comment=o.comment?`${r.comment}
57
+ ${o.comment}`:r.comment}r=n}t.items[i]=dr.isPair(r)?r:new ro.Pair(r)}}else e("Expected a sequence for this tag");return t}function ec(t,e,i){let{replacer:r}=i,n=new Dh.YAMLSeq(t);n.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let a of e){typeof r=="function"&&(a=r.call(e,String(o++),a));let s,c;if(Array.isArray(a))if(a.length===2)s=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let l=Object.keys(a);if(l.length===1)s=l[0],c=a[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=a;n.items.push(ro.createPair(s,c,i))}return n}var Bh={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Zs,createNode:ec};hr.createPairs=ec;hr.pairs=Bh;hr.resolvePairs=Zs});var ao=v(oo=>{"use strict";var tc=C(),no=Ne(),Ht=xe(),Mh=Re(),ic=mr(),De=class t extends Mh.YAMLSeq{constructor(){super(),this.add=Ht.YAMLMap.prototype.add.bind(this),this.delete=Ht.YAMLMap.prototype.delete.bind(this),this.get=Ht.YAMLMap.prototype.get.bind(this),this.has=Ht.YAMLMap.prototype.has.bind(this),this.set=Ht.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let o,a;if(tc.isPair(n)?(o=no.toJS(n.key,"",i),a=no.toJS(n.value,o,i)):o=no.toJS(n,"",i),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,a)}return r}static from(e,i,r){let n=ic.createPairs(e,i,r),o=new this;return o.items=n.items,o}};De.tag="tag:yaml.org,2002:omap";var Fh={collection:"seq",identify:t=>t instanceof Map,nodeClass:De,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=ic.resolvePairs(t,e),r=[];for(let{key:n}of i.items)tc.isScalar(n)&&(r.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new De,i)},createNode:(t,e,i)=>De.from(t,e,i)};oo.YAMLOMap=De;oo.omap=Fh});var sc=v(so=>{"use strict";var rc=O();function nc({value:t,source:e},i){return e&&(t?oc:ac).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var oc={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 rc.Scalar(!0),stringify:nc},ac={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 rc.Scalar(!1),stringify:nc};so.falseTag=ac;so.trueTag=oc});var cc=v(pr=>{"use strict";var Wh=O(),co=lt(),qh={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:co.stringifyNumber},Hh={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():co.stringifyNumber(t)}},Gh={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 Wh.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let r=t.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:co.stringifyNumber};pr.float=Gh;pr.floatExp=Hh;pr.floatNaN=qh});var uc=v(zt=>{"use strict";var lc=lt(),Gt=t=>typeof t=="bigint"||Number.isInteger(t);function gr(t,e,i,{intAsBigInt:r}){let n=t[0];if((n==="-"||n==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let a=BigInt(t);return n==="-"?BigInt(-1)*a:a}let o=parseInt(t,i);return n==="-"?-1*o:o}function lo(t,e,i){let{value:r}=t;if(Gt(r)){let n=r.toString(e);return r<0?"-"+i+n.substr(1):i+n}return lc.stringifyNumber(t)}var zh={identify:Gt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>gr(t,2,2,i),stringify:t=>lo(t,2,"0b")},Vh={identify:Gt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>gr(t,1,8,i),stringify:t=>lo(t,8,"0")},Kh={identify:Gt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>gr(t,0,10,i),stringify:lc.stringifyNumber},Jh={identify:Gt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>gr(t,2,16,i),stringify:t=>lo(t,16,"0x")};zt.int=Kh;zt.intBin=zh;zt.intHex=Jh;zt.intOct=Vh});var fo=v(uo=>{"use strict";var yr=C(),wr=Ce(),vr=xe(),Be=class t extends vr.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;yr.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new wr.Pair(e.key,null):i=new wr.Pair(e,null),vr.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let r=vr.findPair(this.items,e);return!i&&yr.isPair(r)?yr.isScalar(r.key)?r.key.value:r.key:r}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=vr.findPair(this.items,e);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new wr.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(e,i,r){let{replacer:n}=r,o=new this(e);if(i&&Symbol.iterator in Object(i))for(let a of i)typeof n=="function"&&(a=n.call(i,a,a)),o.items.push(wr.createPair(a,null,r));return o}};Be.tag="tag:yaml.org,2002:set";var Uh={collection:"map",identify:t=>t instanceof Set,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>Be.from(t,e,i),resolve(t,e){if(yr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Be,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};uo.YAMLSet=Be;uo.set=Uh});var mo=v(br=>{"use strict";var Yh=lt();function ho(t,e){let i=t[0],r=i==="-"||i==="+"?t.substring(1):t,n=a=>e?BigInt(a):Number(a),o=r.replace(/_/g,"").split(":").reduce((a,s)=>a*n(60)+n(s),n(0));return i==="-"?n(-1)*o:o}function fc(t){let{value:e}=t,i=a=>a;if(typeof e=="bigint")i=a=>BigInt(a);else if(isNaN(e)||!isFinite(e))return Yh.stringifyNumber(t);let r="";e<0&&(r="-",e*=i(-1));let n=i(60),o=[e%n];return e<60?o.unshift(0):(e=(e-o[0])/n,o.unshift(e%n),e>=60&&(e=(e-o[0])/n,o.unshift(e))),r+o.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Xh={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:i})=>ho(t,i),stringify:fc},Qh={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=>ho(t,!1),stringify:fc},dc={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(dc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,o,a,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,o||0,a||0,s||0,c),f=e[8];if(f&&f!=="Z"){let u=ho(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$/,"")??""};br.floatTime=Qh;br.intTime=Xh;br.timestamp=dc});var pc=v(mc=>{"use strict";var Zh=st(),em=sr(),tm=ct(),im=Wt(),rm=io(),hc=sc(),po=cc(),Nr=uc(),nm=Zi(),om=ao(),am=mr(),sm=fo(),go=mo(),cm=[Zh.map,tm.seq,im.string,em.nullTag,hc.trueTag,hc.falseTag,Nr.intBin,Nr.intOct,Nr.int,Nr.intHex,po.floatNaN,po.floatExp,po.float,rm.binary,nm.merge,om.omap,am.pairs,sm.set,go.intTime,go.floatTime,go.timestamp];mc.schema=cm});var Cc=v(yo=>{"use strict";var yc=st(),lm=sr(),bc=ct(),um=Wt(),fm=Jn(),wo=Yn(),vo=Qn(),dm=Js(),hm=Xs(),Nc=io(),Vt=Zi(),kc=ao(),Sc=mr(),gc=pc(),Ec=fo(),kr=mo(),wc=new Map([["core",dm.schema],["failsafe",[yc.map,bc.seq,um.string]],["json",hm.schema],["yaml11",gc.schema],["yaml-1.1",gc.schema]]),vc={binary:Nc.binary,bool:fm.boolTag,float:wo.float,floatExp:wo.floatExp,floatNaN:wo.floatNaN,floatTime:kr.floatTime,int:vo.int,intHex:vo.intHex,intOct:vo.intOct,intTime:kr.intTime,map:yc.map,merge:Vt.merge,null:lm.nullTag,omap:kc.omap,pairs:Sc.pairs,seq:bc.seq,set:Ec.set,timestamp:kr.timestamp},mm={"tag:yaml.org,2002:binary":Nc.binary,"tag:yaml.org,2002:merge":Vt.merge,"tag:yaml.org,2002:omap":kc.omap,"tag:yaml.org,2002:pairs":Sc.pairs,"tag:yaml.org,2002:set":Ec.set,"tag:yaml.org,2002:timestamp":kr.timestamp};function pm(t,e,i){let r=wc.get(e);if(r&&!t)return i&&!r.includes(Vt.merge)?r.concat(Vt.merge):r.slice();let n=r;if(!n)if(Array.isArray(t))n=[];else{let o=Array.from(wc.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)n=n.concat(o);else typeof t=="function"&&(n=t(n.slice()));return i&&(n=n.concat(Vt.merge)),n.reduce((o,a)=>{let s=typeof a=="string"?vc[a]:a;if(!s){let c=JSON.stringify(a),l=Object.keys(vc).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(s)||o.push(s),o},[])}yo.coreKnownTags=mm;yo.getTags=pm});var ko=v(Pc=>{"use strict";var bo=C(),gm=st(),wm=ct(),vm=Wt(),Sr=Cc(),ym=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,No=class t{constructor({compat:e,customTags:i,merge:r,resolveKnownTags:n,schema:o,sortMapEntries:a,toStringDefaults:s}){this.compat=Array.isArray(e)?Sr.getTags(e,"compat"):e?Sr.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=n?Sr.coreKnownTags:{},this.tags=Sr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,bo.MAP,{value:gm.map}),Object.defineProperty(this,bo.SCALAR,{value:vm.string}),Object.defineProperty(this,bo.SEQ,{value:wm.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?ym:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Pc.Schema=No});var Rc=v(xc=>{"use strict";var bm=C(),So=Bt(),Kt=jt();function Nm(t,e){let i=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&i.push("---");let n=So.createStringifyContext(t,e),{commentString:o}=n.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=o(t.commentBefore);i.unshift(Kt.indentComment(c,""))}let a=!1,s=null;if(t.contents){if(bm.isNode(t.contents)){if(t.contents.spaceBefore&&r&&i.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);i.push(Kt.indentComment(f,""))}n.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>a=!0,l=So.stringify(t.contents,n,()=>s=null,c);s&&(l+=Kt.lineComment(l,"",o(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(So.stringify(t.contents,n));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
+ `)?(i.push("..."),i.push(Kt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&a&&(c=c.replace(/^\n+/,"")),c&&((!a||s)&&i[i.length-1]!==""&&i.push(""),i.push(Kt.indentComment(o(c),"")))}return i.join(`
59
59
  `)+`
60
- `}fc.stringifyDocument=Bh});var Bt=v(hc=>{"use strict";var qh=kt(),rt=Li(),G=C(),Fh=ve(),Wh=me(),Hh=lo(),zh=dc(),fo=Ti(),Gh=pr(),Vh=Et(),ho=mr(),mo=class t{constructor(e,i,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,G.NODE_TYPE,{value:G.DOC});let r=null;typeof i=="function"||Array.isArray(i)?r=i:n===void 0&&i&&(n=i,i=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:a}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new ho.Directives({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let e=Object.create(t.prototype,{[G.NODE_TYPE]:{value:G.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=G.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ot(this.contents)&&this.contents.add(e)}addIn(e,i){ot(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let n=fo.anchorNames(this);e.anchor=!i||n.has(i)?fo.findNewAnchor(i||"a",n):i}return new qh.Alias(e.anchor)}createNode(e,i,n){let r;if(typeof i=="function")e=i.call({"":e},"",e),r=i;else if(Array.isArray(i)){let m=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=i.filter(m).map(String);y.length>0&&(i=i.concat(y)),r=i}else n===void 0&&i&&(n=i,i=void 0);let{aliasDuplicateObjects:o,anchorPrefix:a,flow:s,keepUndefined:c,onTagObj:l,tag:f}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:p}=fo.createNodeAnchors(this,a||"a"),w={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:p},h=Vh.createNode(e,f,w);return s&&G.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,i,n={}){let r=this.createNode(e,null,n),o=this.createNode(i,null,n);return new Fh.Pair(r,o)}delete(e){return ot(this.contents)?this.contents.delete(e):!1}deleteIn(e){return rt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ot(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return G.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return rt.isEmptyPath(e)?!i&&G.isScalar(this.contents)?this.contents.value:this.contents:G.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return G.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return rt.isEmptyPath(e)?this.contents!==void 0:G.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=rt.collectionFromPath(this.schema,[e],i):ot(this.contents)&&this.contents.set(e,i)}setIn(e,i){rt.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=rt.collectionFromPath(this.schema,Array.from(e),i):ot(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ho.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 ho.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=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(i.schema instanceof Object)this.schema=i.schema;else if(n)this.schema=new Hh.Schema(Object.assign(n,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:n,maxAliasCount:r,onAnchor:o,reviver:a}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Wh.toJS(this.contents,i??"",s);if(typeof o=="function")for(let{count:l,res:f}of s.anchors.values())o(f,l);return typeof a=="function"?Gh.applyReviver(a,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}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 i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return zh.stringifyDocument(this,e)}};function ot(t){if(G.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}hc.Document=mo});var Wt=v(Ft=>{"use strict";var qt=class extends Error{constructor(e,i,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=i}},po=class extends qt{constructor(e,i,n){super("YAMLParseError",e,i,n)}},go=class extends qt{constructor(e,i,n){super("YAMLWarning",e,i,n)}},Jh=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:n,col:r}=i.linePos[0];i.message+=` at line ${n}, column ${r}`;let o=r-1,a=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&a.length>80){let s=Math.min(o-39,a.length-79);a="…"+a.substring(s),o-=s-1}if(a.length>80&&(a=a.substring(0,79)+"…"),n>1&&/^ *$/.test(a.substring(0,o))){let s=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);s.length>80&&(s=s.substring(0,79)+`…
61
- `),a=s+a}if(/[^ ]/.test(a)){let s=1,c=i.linePos[1];c?.line===n&&c.col>r&&(s=Math.max(1,Math.min(c.col-r,80-o)));let l=" ".repeat(o)+"^".repeat(s);i.message+=`:
60
+ `}xc.stringifyDocument=Nm});var Jt=v(_c=>{"use strict";var km=Ot(),ut=Hi(),V=C(),Sm=Ce(),Em=Ne(),Cm=ko(),Pm=Rc(),Eo=Mi(),xm=xn(),Rm=It(),Co=Pn(),Po=class t{constructor(e,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,V.NODE_TYPE,{value:V.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:r===void 0&&i&&(r=i,i=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:a}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Co.Directives({version:a}),this.setSchema(a,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(t.prototype,{[V.NODE_TYPE]:{value:V.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=V.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,i){ft(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let r=Eo.anchorNames(this);e.anchor=!i||r.has(i)?Eo.findNewAnchor(i||"a",r):i}return new km.Alias(e.anchor)}createNode(e,i,r){let n;if(typeof i=="function")e=i.call({"":e},"",e),n=i;else if(Array.isArray(i)){let p=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=i.filter(p).map(String);y.length>0&&(i=i.concat(y)),n=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:o,anchorPrefix:a,flow:s,keepUndefined:c,onTagObj:l,tag:f}=r??{},{onAnchor:u,setAnchors:d,sourceObjects:m}=Eo.createNodeAnchors(this,a||"a"),w={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:m},h=Rm.createNode(e,f,w);return s&&V.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,i,r={}){let n=this.createNode(e,null,r),o=this.createNode(i,null,r);return new Sm.Pair(n,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,i){return V.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return ut.isEmptyPath(e)?!i&&V.isScalar(this.contents)?this.contents.value:this.contents:V.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return V.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ut.isEmptyPath(e)?this.contents!==void 0:V.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=ut.collectionFromPath(this.schema,[e],i):ft(this.contents)&&this.contents.set(e,i)}setIn(e,i){ut.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=ut.collectionFromPath(this.schema,Array.from(e),i):ft(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Co.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Co.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new Cm.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:o,reviver:a}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=Em.toJS(this.contents,i??"",s);if(typeof o=="function")for(let{count:l,res:f}of s.anchors.values())o(f,l);return typeof a=="function"?xm.applyReviver(a,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}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 i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Pm.stringifyDocument(this,e)}};function ft(t){if(V.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}_c.Document=Po});var Xt=v(Yt=>{"use strict";var Ut=class extends Error{constructor(e,i,r,n){super(),this.name=e,this.code=r,this.message=n,this.pos=i}},xo=class extends Ut{constructor(e,i,r){super("YAMLParseError",e,i,r)}},Ro=class extends Ut{constructor(e,i,r){super("YAMLWarning",e,i,r)}},_m=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let o=n-1,a=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&a.length>80){let s=Math.min(o-39,a.length-79);a="…"+a.substring(s),o-=s-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,o))){let s=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
61
+ `),a=s+a}if(/[^ ]/.test(a)){let s=1,c=i.linePos[1];c?.line===r&&c.col>n&&(s=Math.max(1,Math.min(c.col-n,80-o)));let l=" ".repeat(o)+"^".repeat(s);i.message+=`:
62
62
 
63
63
  ${a}
64
64
  ${l}
65
- `}};Ft.YAMLError=qt;Ft.YAMLParseError=po;Ft.YAMLWarning=go;Ft.prettifyError=Jh});var Ht=v(mc=>{"use strict";function Kh(t,{flow:e,indicator:i,next:n,offset:r,onError:o,parentIndent:a,startOnNewline:s}){let c=!1,l=s,f=s,u="",d="",p=!1,w=!1,h=null,m=null,y=null,b=null,S=null,k=null,E=null;for(let N of t)switch(w&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&o(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!e&&(i!=="doc-start"||n?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),f=!0;break;case"comment":{f||o(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let _=N.source.substring(1)||" ";u?u+=d+_:u=_,d="",l=!1;break}case"newline":l?u?u+=N.source:(!k||i!=="seq-item-ind")&&(c=!0):d+=N.source,l=!0,p=!0,(m||y)&&(b=N),f=!0;break;case"anchor":m&&o(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&o(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,E??(E=N.offset),l=!1,f=!1,w=!0;break;case"tag":{y&&o(N,"MULTIPLE_TAGS","A node can have at most one tag"),y=N,E??(E=N.offset),l=!1,f=!1,w=!0;break}case i:(m||y)&&o(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&o(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${e??"collection"}`),k=N,l=i==="seq-item-ind"||i==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&o(N,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=N,l=!1,f=!1;break}default:o(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,f=!1}let g=t[t.length-1],P=g?g.offset+g.source.length:r;return w&&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"),h&&(l&&h.indent<=a||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:k,spaceBefore:c,comment:u,hasNewline:p,anchor:m,tag:y,newlineAfterProp:b,end:P,start:E??P}}mc.resolveProps=Kh});var wn=v(pc=>{"use strict";function wo(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 i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(wo(e.key)||wo(e.value))return!0}return!1;default:return!0}}pc.containsNewline=wo});var vo=v(gc=>{"use strict";var Uh=wn();function Yh(t,e,i){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Uh.containsNewline(e)&&i(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gc.flowIndentCheck=Yh});var yo=v(vc=>{"use strict";var wc=C();function Xh(t,e,i){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let r=typeof n=="function"?n:(o,a)=>o===a||wc.isScalar(o)&&wc.isScalar(a)&&o.value===a.value;return e.some(o=>r(o.key,i))}vc.mapIncludes=Xh});var Ec=v(kc=>{"use strict";var yc=ve(),Qh=be(),bc=Ht(),Zh=wn(),Nc=vo(),em=yo(),Sc="All mapping items must start at the same column";function tm({composeNode:t,composeEmptyNode:e},i,n,r,o){let a=o?.nodeClass??Qh.YAMLMap,s=new a(i.schema);i.atRoot&&(i.atRoot=!1);let c=n.offset,l=null;for(let f of n.items){let{start:u,key:d,sep:p,value:w}=f,h=bc.resolveProps(u,{indicator:"explicit-key-ind",next:d??p?.[0],offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0}),m=!h.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!==n.indent&&r(c,"BAD_INDENT",Sc)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
- `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Zh.containsNewline(d))&&r(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&r(c,"BAD_INDENT",Sc);i.atKey=!0;let y=h.end,b=d?t(i,d,h,r):e(i,y,u,null,h,r);i.schema.compat&&Nc.flowIndentCheck(n.indent,d,r),i.atKey=!1,em.mapIncludes(i,s.items,b)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let S=bc.resolveProps(p??[],{indicator:"map-value-ind",next:w,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){m&&(w?.type==="block-map"&&!S.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<S.found.offset-1024&&r(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=w?t(i,w,S,r):e(i,c,p,null,S,r);i.schema.compat&&Nc.flowIndentCheck(n.indent,w,r),c=k.range[2];let E=new yc.Pair(b,k);i.options.keepSourceTokens&&(E.srcToken=f),s.items.push(E)}else{m&&r(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(b.comment?b.comment+=`
68
- `+S.comment:b.comment=S.comment);let k=new yc.Pair(b);i.options.keepSourceTokens&&(k.srcToken=f),s.items.push(k)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[n.offset,c,l??c],s}kc.resolveBlockMap=tm});var Pc=v(Cc=>{"use strict";var im=Ne(),nm=Ht(),rm=vo();function om({composeNode:t,composeEmptyNode:e},i,n,r,o){let a=o?.nodeClass??im.YAMLSeq,s=new a(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=n.offset,l=null;for(let{start:f,value:u}of n.items){let d=nm.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:n.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&&(s.comment=d.comment);continue}let p=u?t(i,u,d,r):e(i,d.end,f,null,d,r);i.schema.compat&&rm.flowIndentCheck(n.indent,u,r),c=p.range[2],s.items.push(p)}return s.range=[n.offset,c,l??c],s}Cc.resolveBlockSeq=om});var at=v(xc=>{"use strict";function am(t,e,i,n){let r="";if(t){let o=!1,a="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":o=!0;break;case"comment":{i&&!o&&n(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";r?r+=a+f:r=f,a="";break}case"newline":r&&(a+=c),o=!0;break;default:n(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}xc.resolveEnd=am});var Tc=v(Ac=>{"use strict";var sm=C(),cm=ve(),Rc=be(),lm=Ne(),um=at(),_c=Ht(),fm=wn(),dm=yo(),bo="Block collections are not allowed within flow collections",No=t=>t&&(t.type==="block-map"||t.type==="block-seq");function hm({composeNode:t,composeEmptyNode:e},i,n,r,o){let a=n.start.source==="{",s=a?"flow map":"flow sequence",c=o?.nodeClass??(a?Rc.YAMLMap:lm.YAMLSeq),l=new c(i.schema);l.flow=!0;let f=i.atRoot;f&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=n.offset+n.start.source.length;for(let m=0;m<n.items.length;++m){let y=n.items[m],{start:b,key:S,sep:k,value:E}=y,g=_c.resolveProps(b,{flow:s,indicator:"explicit-key-ind",next:S??k?.[0],offset:u,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!g.found){if(!g.anchor&&!g.tag&&!k&&!E){m===0&&g.comma?r(g.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<n.items.length-1&&r(g.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),g.comment&&(l.comment?l.comment+=`
69
- `+g.comment:l.comment=g.comment),u=g.end;continue}!a&&i.options.strict&&fm.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)g.comma&&r(g.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(g.comma||r(g.start,"MISSING_CHAR",`Missing , between ${s} items`),g.comment){let P="";e:for(let N of b)switch(N.type){case"comma":case"space":break;case"comment":P=N.source.substring(1);break e;default:break e}if(P){let N=l.items[l.items.length-1];sm.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
- `+P:N.comment=P,g.comment=g.comment.substring(P.length+1)}}if(!a&&!k&&!g.found){let P=E?t(i,E,g,r):e(i,g.end,k,null,g,r);l.items.push(P),u=P.range[2],No(E)&&r(P.range,"BLOCK_IN_FLOW",bo)}else{i.atKey=!0;let P=g.end,N=S?t(i,S,g,r):e(i,P,b,null,g,r);No(S)&&r(N.range,"BLOCK_IN_FLOW",bo),i.atKey=!1;let _=_c.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:E,offset:N.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(_.found){if(!a&&!g.found&&i.options.strict){if(k)for(let I of k){if(I===_.found)break;if(I.type==="newline"){r(I,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}g.start<_.found.offset-1024&&r(_.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?r(E,"MISSING_CHAR",`Missing space after : in ${s}`):r(_.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let z=E?t(i,E,_,r):_.found?e(i,_.end,k,null,_,r):null;z?No(E)&&r(z.range,"BLOCK_IN_FLOW",bo):_.comment&&(N.comment?N.comment+=`
71
- `+_.comment:N.comment=_.comment);let Ye=new cm.Pair(N,z);if(i.options.keepSourceTokens&&(Ye.srcToken=y),a){let I=l;dm.mapIncludes(i,I.items,N)&&r(P,"DUPLICATE_KEY","Map keys must be unique"),I.items.push(Ye)}else{let I=new Rc.YAMLMap(i.schema);I.flow=!0,I.items.push(Ye);let Ta=(z??N).range;I.range=[N.range[0],Ta[1],Ta[2]],l.items.push(I)}u=z?z.range[2]:_.end}}let d=a?"}":"]",[p,...w]=n.end,h=u;if(p?.source===d)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),y=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",y),p&&p.source.length!==1&&w.unshift(p)}if(w.length>0){let m=um.resolveEnd(w,h,i.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[n.offset,h,m.offset]}else l.range=[n.offset,h,h];return l}Ac.resolveFlowCollection=hm});var Ic=v(Oc=>{"use strict";var mm=C(),pm=O(),gm=be(),wm=Ne(),vm=Ec(),ym=Pc(),bm=Tc();function So(t,e,i,n,r,o){let a=i.type==="block-map"?vm.resolveBlockMap(t,e,i,n,o):i.type==="block-seq"?ym.resolveBlockSeq(t,e,i,n,o):bm.resolveFlowCollection(t,e,i,n,o),s=a.constructor;return r==="!"||r===s.tagName?(a.tag=s.tagName,a):(r&&(a.tag=r),a)}function Nm(t,e,i,n,r){let o=n.tag,a=o?e.directives.tagName(o.source,d=>r(o,"TAG_RESOLVE_FAILED",d)):null;if(i.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=n,w=d&&o?d.offset>o.offset?d:o:d??o;w&&(!p||p.offset<w.offset)&&r(w,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!o||!a||a==="!"||a===gm.YAMLMap.tagName&&s==="map"||a===wm.YAMLSeq.tagName&&s==="seq")return So(t,e,i,r,a);let c=e.schema.tags.find(d=>d.tag===a&&d.collection===s);if(!c){let d=e.schema.knownTags[a];if(d?.collection===s)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${s} collection, but expects ${d.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),So(t,e,i,r,a)}let l=So(t,e,i,r,a,c),f=c.resolve?.(l,d=>r(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=mm.isNode(f)?f:new pm.Scalar(f);return u.range=l.range,u.tag=a,c?.format&&(u.format=c.format),u}Oc.composeCollection=Nm});var Eo=v(jc=>{"use strict";var ko=O();function Sm(t,e,i){let n=e.offset,r=km(e,t.options.strict,i);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let o=r.mode===">"?ko.Scalar.BLOCK_FOLDED:ko.Scalar.BLOCK_LITERAL,a=e.source?Em(e.source):[],s=a.length;for(let h=a.length-1;h>=0;--h){let m=a[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=r.chomp==="+"&&a.length>0?`
73
- `.repeat(Math.max(1,a.length-1)):"",m=n+r.length;return e.source&&(m+=e.source.length),{value:h,type:o,comment:r.comment,range:[n,m,m]}}let c=e.indent+r.indent,l=e.offset+r.length,f=0;for(let h=0;h<s;++h){let[m,y]=a[h];if(y===""||y==="\r")r.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&i(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=h,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+y.length+1}for(let h=a.length-1;h>=s;--h)a[h][0].length>c&&(s=h+1);let u="",d="",p=!1;for(let h=0;h<f;++h)u+=a[h][0].slice(c)+`
74
- `;for(let h=f;h<s;++h){let[m,y]=a[h];l+=m.length+y.length+1;let b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&m.length<c){let k=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(b?2:1),"BAD_INDENT",k),m=""}o===ko.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+y,d=`
75
- `):m.length>c||y[0]===" "?(d===" "?d=`
76
- `:!p&&d===`
65
+ `}};Yt.YAMLError=Ut;Yt.YAMLParseError=xo;Yt.YAMLWarning=Ro;Yt.prettifyError=_m});var Qt=v(Ac=>{"use strict";function Am(t,{flow:e,indicator:i,next:r,offset:n,onError:o,parentIndent:a,startOnNewline:s}){let c=!1,l=s,f=s,u="",d="",m=!1,w=!1,h=null,p=null,y=null,b=null,k=null,S=null,E=null;for(let N of t)switch(w&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&o(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!e&&(i!=="doc-start"||r?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),f=!0;break;case"comment":{f||o(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let _=N.source.substring(1)||" ";u?u+=d+_:u=_,d="",l=!1;break}case"newline":l?u?u+=N.source:(!S||i!=="seq-item-ind")&&(c=!0):d+=N.source,l=!0,m=!0,(p||y)&&(b=N),f=!0;break;case"anchor":p&&o(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&o(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=N,E??(E=N.offset),l=!1,f=!1,w=!0;break;case"tag":{y&&o(N,"MULTIPLE_TAGS","A node can have at most one tag"),y=N,E??(E=N.offset),l=!1,f=!1,w=!0;break}case i:(p||y)&&o(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),S&&o(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${e??"collection"}`),S=N,l=i==="seq-item-ind"||i==="explicit-key-ind",f=!1;break;case"comma":if(e){k&&o(N,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=N,l=!1,f=!1;break}default:o(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,f=!1}let g=t[t.length-1],P=g?g.offset+g.source.length:n;return w&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:S,spaceBefore:c,comment:u,hasNewline:m,anchor:p,tag:y,newlineAfterProp:b,end:P,start:E??P}}Ac.resolveProps=Am});var Er=v(Tc=>{"use strict";function _o(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 i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(_o(e.key)||_o(e.value))return!0}return!1;default:return!0}}Tc.containsNewline=_o});var Ao=v(Oc=>{"use strict";var Tm=Er();function Om(t,e,i){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Tm.containsNewline(e)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Oc.flowIndentCheck=Om});var To=v(jc=>{"use strict";var Ic=C();function Im(t,e,i){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let n=typeof r=="function"?r:(o,a)=>o===a||Ic.isScalar(o)&&Ic.isScalar(a)&&o.value===a.value;return e.some(o=>n(o.key,i))}jc.mapIncludes=Im});var Fc=v(Mc=>{"use strict";var Lc=Ce(),jm=xe(),$c=Qt(),Lm=Er(),Dc=Ao(),$m=To(),Bc="All mapping items must start at the same column";function Dm({composeNode:t,composeEmptyNode:e},i,r,n,o){let a=o?.nodeClass??jm.YAMLMap,s=new a(i.schema);i.atRoot&&(i.atRoot=!1);let c=r.offset,l=null;for(let f of r.items){let{start:u,key:d,sep:m,value:w}=f,h=$c.resolveProps(u,{indicator:"explicit-key-ind",next:d??m?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),p=!h.found;if(p){if(d&&(d.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&n(c,"BAD_INDENT",Bc)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(s.comment?s.comment+=`
67
+ `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Lm.containsNewline(d))&&n(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",Bc);i.atKey=!0;let y=h.end,b=d?t(i,d,h,n):e(i,y,u,null,h,n);i.schema.compat&&Dc.flowIndentCheck(r.indent,d,n),i.atKey=!1,$m.mapIncludes(i,s.items,b)&&n(y,"DUPLICATE_KEY","Map keys must be unique");let k=$c.resolveProps(m??[],{indicator:"map-value-ind",next:w,offset:b.range[2],onError:n,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){p&&(w?.type==="block-map"&&!k.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<k.found.offset-1024&&n(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=w?t(i,w,k,n):e(i,c,m,null,k,n);i.schema.compat&&Dc.flowIndentCheck(r.indent,w,n),c=S.range[2];let E=new Lc.Pair(b,S);i.options.keepSourceTokens&&(E.srcToken=f),s.items.push(E)}else{p&&n(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(b.comment?b.comment+=`
68
+ `+k.comment:b.comment=k.comment);let S=new Lc.Pair(b);i.options.keepSourceTokens&&(S.srcToken=f),s.items.push(S)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}Mc.resolveBlockMap=Dm});var qc=v(Wc=>{"use strict";var Bm=Re(),Mm=Qt(),Fm=Ao();function Wm({composeNode:t,composeEmptyNode:e},i,r,n,o){let a=o?.nodeClass??Bm.YAMLSeq,s=new a(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=r.offset,l=null;for(let{start:f,value:u}of r.items){let d=Mm.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?n(d.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(s.comment=d.comment);continue}let m=u?t(i,u,d,n):e(i,d.end,f,null,d,n);i.schema.compat&&Fm.flowIndentCheck(r.indent,u,n),c=m.range[2],s.items.push(m)}return s.range=[r.offset,c,l??c],s}Wc.resolveBlockSeq=Wm});var dt=v(Hc=>{"use strict";function qm(t,e,i,r){let n="";if(t){let o=!1,a="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":o=!0;break;case"comment":{i&&!o&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";n?n+=a+f:n=f,a="";break}case"newline":n&&(a+=c),o=!0;break;default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:n,offset:e}}Hc.resolveEnd=qm});var Kc=v(Vc=>{"use strict";var Hm=C(),Gm=Ce(),Gc=xe(),zm=Re(),Vm=dt(),zc=Qt(),Km=Er(),Jm=To(),Oo="Block collections are not allowed within flow collections",Io=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Um({composeNode:t,composeEmptyNode:e},i,r,n,o){let a=r.start.source==="{",s=a?"flow map":"flow sequence",c=o?.nodeClass??(a?Gc.YAMLMap:zm.YAMLSeq),l=new c(i.schema);l.flow=!0;let f=i.atRoot;f&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=r.offset+r.start.source.length;for(let p=0;p<r.items.length;++p){let y=r.items[p],{start:b,key:k,sep:S,value:E}=y,g=zc.resolveProps(b,{flow:s,indicator:"explicit-key-ind",next:k??S?.[0],offset:u,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!g.found){if(!g.anchor&&!g.tag&&!S&&!E){p===0&&g.comma?n(g.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):p<r.items.length-1&&n(g.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),g.comment&&(l.comment?l.comment+=`
69
+ `+g.comment:l.comment=g.comment),u=g.end;continue}!a&&i.options.strict&&Km.containsNewline(k)&&n(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)g.comma&&n(g.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(g.comma||n(g.start,"MISSING_CHAR",`Missing , between ${s} items`),g.comment){let P="";e:for(let N of b)switch(N.type){case"comma":case"space":break;case"comment":P=N.source.substring(1);break e;default:break e}if(P){let N=l.items[l.items.length-1];Hm.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
+ `+P:N.comment=P,g.comment=g.comment.substring(P.length+1)}}if(!a&&!S&&!g.found){let P=E?t(i,E,g,n):e(i,g.end,S,null,g,n);l.items.push(P),u=P.range[2],Io(E)&&n(P.range,"BLOCK_IN_FLOW",Oo)}else{i.atKey=!0;let P=g.end,N=k?t(i,k,g,n):e(i,P,b,null,g,n);Io(k)&&n(N.range,"BLOCK_IN_FLOW",Oo),i.atKey=!1;let _=zc.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:N.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!a&&!g.found&&i.options.strict){if(S)for(let j of S){if(j===_.found)break;if(j.type==="newline"){n(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}g.start<_.found.offset-1024&&n(_.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?n(E,"MISSING_CHAR",`Missing space after : in ${s}`):n(_.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let G=E?t(i,E,_,n):_.found?e(i,_.end,S,null,_,n):null;G?Io(E)&&n(G.range,"BLOCK_IN_FLOW",Oo):_.comment&&(N.comment?N.comment+=`
71
+ `+_.comment:N.comment=_.comment);let it=new Gm.Pair(N,G);if(i.options.keepSourceTokens&&(it.srcToken=y),a){let j=l;Jm.mapIncludes(i,j.items,N)&&n(P,"DUPLICATE_KEY","Map keys must be unique"),j.items.push(it)}else{let j=new Gc.YAMLMap(i.schema);j.flow=!0,j.items.push(it);let Ka=(G??N).range;j.range=[N.range[0],Ka[1],Ka[2]],l.items.push(j)}u=G?G.range[2]:_.end}}let d=a?"}":"]",[m,...w]=r.end,h=u;if(m?.source===d)h=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),y=f?`${p} must end with a ${d}`:`${p} in block collection must be sufficiently indented and end with a ${d}`;n(u,f?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&w.unshift(m)}if(w.length>0){let p=Vm.resolveEnd(w,h,i.options.strict,n);p.comment&&(l.comment?l.comment+=`
72
+ `+p.comment:l.comment=p.comment),l.range=[r.offset,h,p.offset]}else l.range=[r.offset,h,h];return l}Vc.resolveFlowCollection=Um});var Uc=v(Jc=>{"use strict";var Ym=C(),Xm=O(),Qm=xe(),Zm=Re(),ep=Fc(),tp=qc(),ip=Kc();function jo(t,e,i,r,n,o){let a=i.type==="block-map"?ep.resolveBlockMap(t,e,i,r,o):i.type==="block-seq"?tp.resolveBlockSeq(t,e,i,r,o):ip.resolveFlowCollection(t,e,i,r,o),s=a.constructor;return n==="!"||n===s.tagName?(a.tag=s.tagName,a):(n&&(a.tag=n),a)}function rp(t,e,i,r,n){let o=r.tag,a=o?e.directives.tagName(o.source,d=>n(o,"TAG_RESOLVE_FAILED",d)):null;if(i.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=r,w=d&&o?d.offset>o.offset?d:o:d??o;w&&(!m||m.offset<w.offset)&&n(w,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!o||!a||a==="!"||a===Qm.YAMLMap.tagName&&s==="map"||a===Zm.YAMLSeq.tagName&&s==="seq")return jo(t,e,i,n,a);let c=e.schema.tags.find(d=>d.tag===a&&d.collection===s);if(!c){let d=e.schema.knownTags[a];if(d?.collection===s)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?n(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${s} collection, but expects ${d.collection??"scalar"}`,!0):n(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),jo(t,e,i,n,a)}let l=jo(t,e,i,n,a,c),f=c.resolve?.(l,d=>n(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=Ym.isNode(f)?f:new Xm.Scalar(f);return u.range=l.range,u.tag=a,c?.format&&(u.format=c.format),u}Jc.composeCollection=rp});var $o=v(Yc=>{"use strict";var Lo=O();function np(t,e,i){let r=e.offset,n=op(e,t.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let o=n.mode===">"?Lo.Scalar.BLOCK_FOLDED:Lo.Scalar.BLOCK_LITERAL,a=e.source?ap(e.source):[],s=a.length;for(let h=a.length-1;h>=0;--h){let p=a[h][1];if(p===""||p==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&a.length>0?`
73
+ `.repeat(Math.max(1,a.length-1)):"",p=r+n.length;return e.source&&(p+=e.source.length),{value:h,type:o,comment:n.comment,range:[r,p,p]}}let c=e.indent+n.indent,l=e.offset+n.length,f=0;for(let h=0;h<s;++h){let[p,y]=a[h];if(y===""||y==="\r")n.indent===0&&p.length>c&&(c=p.length);else{p.length<c&&i(l+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=p.length),f=h,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+y.length+1}for(let h=a.length-1;h>=s;--h)a[h][0].length>c&&(s=h+1);let u="",d="",m=!1;for(let h=0;h<f;++h)u+=a[h][0].slice(c)+`
74
+ `;for(let h=f;h<s;++h){let[p,y]=a[h];l+=p.length+y.length+1;let b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&p.length<c){let S=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(b?2:1),"BAD_INDENT",S),p=""}o===Lo.Scalar.BLOCK_LITERAL?(u+=d+p.slice(c)+y,d=`
75
+ `):p.length>c||y[0]===" "?(d===" "?d=`
76
+ `:!m&&d===`
77
77
  `&&(d=`
78
78
 
79
- `),u+=d+m.slice(c)+y,d=`
80
- `,p=!0):y===""?d===`
79
+ `),u+=d+p.slice(c)+y,d=`
80
+ `,m=!0):y===""?d===`
81
81
  `?u+=`
82
82
  `:d=`
83
- `:(u+=d+y,d=" ",p=!1)}switch(r.chomp){case"-":break;case"+":for(let h=s;h<a.length;++h)u+=`
83
+ `:(u+=d+y,d=" ",m=!1)}switch(n.chomp){case"-":break;case"+":for(let h=s;h<a.length;++h)u+=`
84
84
  `+a[h][0].slice(c);u[u.length-1]!==`
85
85
  `&&(u+=`
86
86
  `);break;default:u+=`
87
- `}let w=n+r.length+e.source.length;return{value:u,type:o,comment:r.comment,range:[n,w,w]}}function km({offset:t,props:e},i,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],o=r[0],a=0,s="",c=-1;for(let d=1;d<r.length;++d){let p=r[d];if(!s&&(p==="-"||p==="+"))s=p;else{let w=Number(p);!a&&w?a=w:c===-1&&(c=t+d)}}c!==-1&&n(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 p=e[d];switch(p.type){case"space":l=!0;case"newline":u+=p.source.length;break;case"comment":i&&!l&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,f=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let w=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",w);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:o,indent:a,chomp:s,comment:f,length:u}}function Em(t){let e=t.split(/\n( *)/),i=e[0],n=i.match(/^( *)/),o=[n?.[1]?[n[1],i.slice(n[1].length)]:["",i]];for(let a=1;a<e.length;a+=2)o.push([e[a],e[a+1]]);return o}jc.resolveBlockScalar=Sm});var Po=v($c=>{"use strict";var Co=O(),Cm=at();function Pm(t,e,i){let{offset:n,type:r,source:o,end:a}=t,s,c,l=(d,p,w)=>i(n+d,p,w);switch(r){case"scalar":s=Co.Scalar.PLAIN,c=xm(o,l);break;case"single-quoted-scalar":s=Co.Scalar.QUOTE_SINGLE,c=Rm(o,l);break;case"double-quoted-scalar":s=Co.Scalar.QUOTE_DOUBLE,c=_m(o,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let f=n+o.length,u=Cm.resolveEnd(a,f,e,i);return{value:c,type:s,comment:u.comment,range:[n,f,u.offset]}}function xm(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Lc(t)}function Rm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Lc(t.slice(1,-1)).replace(/''/g,"'")}function Lc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let w=r+n.length+e.source.length;return{value:u,type:o,comment:n.comment,range:[r,w,w]}}function op({offset:t,props:e},i,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],o=n[0],a=0,s="",c=-1;for(let d=1;d<n.length;++d){let m=n[d];if(!s&&(m==="-"||m==="+"))s=m;else{let w=Number(m);!a&&w?a=w:c===-1&&(c=t+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,f="",u=n.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":l=!0;case"newline":u+=m.source.length;break;case"comment":i&&!l&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,f=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let w=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",w);let h=m.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:o,indent:a,chomp:s,comment:f,length:u}}function ap(t){let e=t.split(/\n( *)/),i=e[0],r=i.match(/^( *)/),o=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let a=1;a<e.length;a+=2)o.push([e[a],e[a+1]]);return o}Yc.resolveBlockScalar=np});var Bo=v(Qc=>{"use strict";var Do=O(),sp=dt();function cp(t,e,i){let{offset:r,type:n,source:o,end:a}=t,s,c,l=(d,m,w)=>i(r+d,m,w);switch(n){case"scalar":s=Do.Scalar.PLAIN,c=lp(o,l);break;case"single-quoted-scalar":s=Do.Scalar.QUOTE_SINGLE,c=up(o,l);break;case"double-quoted-scalar":s=Do.Scalar.QUOTE_DOUBLE,c=fp(o,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let f=r+o.length,u=sp.resolveEnd(a,f,e,i);return{value:c,type:s,comment:u.comment,range:[r,f,u.offset]}}function lp(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Xc(t)}function up(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Xc(t.slice(1,-1)).replace(/''/g,"'")}function Xc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let r=n[1],o=" ",a=e.lastIndex;for(i.lastIndex=a;n=i.exec(t);)n[1]===""?o===`
90
- `?r+=o:o=`
91
- `:(r+=o+n[1],o=" "),a=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=a,n=s.exec(t),r+o+(n?.[1]??"")}function _m(t,e){let i="";for(let n=1;n<t.length-1;++n){let r=t[n];if(!(r==="\r"&&t[n+1]===`
92
- `))if(r===`
93
- `){let{fold:o,offset:a}=Am(t,n);i+=o,n=a}else if(r==="\\"){let o=t[++n],a=Tm[o];if(a)i+=a;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 s=o==="x"?2:o==="u"?4:8;i+=Om(t,n+1,s,e),n+=s}else{let s=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(r===" "||r===" "){let o=n,a=t[n+1];for(;a===" "||a===" ";)a=t[++n+1];a!==`
96
- `&&!(a==="\r"&&t[n+2]===`
97
- `)&&(i+=n>o?t.slice(o,n+1):r)}else i+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function Am(t,e){let i="",n=t[e+1];for(;(n===" "||n===" "||n===`
98
- `||n==="\r")&&!(n==="\r"&&t[e+2]!==`
99
- `);)n===`
89
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let n=r[1],o=" ",a=e.lastIndex;for(i.lastIndex=a;r=i.exec(t);)r[1]===""?o===`
90
+ `?n+=o:o=`
91
+ `:(n+=o+r[1],o=" "),a=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=a,r=s.exec(t),n+o+(r?.[1]??"")}function fp(t,e){let i="";for(let r=1;r<t.length-1;++r){let n=t[r];if(!(n==="\r"&&t[r+1]===`
92
+ `))if(n===`
93
+ `){let{fold:o,offset:a}=dp(t,r);i+=o,r=a}else if(n==="\\"){let o=t[++r],a=hp[o];if(a)i+=a;else if(o===`
94
+ `)for(o=t[r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="\r"&&t[r+1]===`
95
+ `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let s=o==="x"?2:o==="u"?4:8;i+=mp(t,r+1,s,e),r+=s}else{let s=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let o=r,a=t[r+1];for(;a===" "||a===" ";)a=t[++r+1];a!==`
96
+ `&&!(a==="\r"&&t[r+2]===`
97
+ `)&&(i+=r>o?t.slice(o,r+1):n)}else i+=n}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function dp(t,e){let i="",r=t[e+1];for(;(r===" "||r===" "||r===`
98
+ `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
99
+ `);)r===`
100
100
  `&&(i+=`
101
- `),e+=1,n=t[e+1];return i||(i=" "),{fold:i,offset:e}}var Tm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Om(t,e,i,n){let r=t.substr(e,i),a=r.length===i&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(a)}catch{let s=t.substr(e-2,i+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}$c.resolveFlowScalar=Pm});var Bc=v(Mc=>{"use strict";var Le=C(),Dc=O(),Im=Eo(),jm=Po();function Lm(t,e,i,n){let{value:r,type:o,comment:a,range:s}=e.type==="block-scalar"?Im.resolveBlockScalar(t,e,n):jm.resolveFlowScalar(e,t.options.strict,n),c=i?t.directives.tagName(i.source,u=>n(i,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Le.SCALAR]:c?l=$m(t.schema,r,c,i,n):e.type==="scalar"?l=Dm(t,r,e,n):l=t.schema[Le.SCALAR];let f;try{let u=l.resolve(r,d=>n(i??e,"TAG_RESOLVE_FAILED",d),t.options);f=Le.isScalar(u)?u:new Dc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);n(i??e,"TAG_RESOLVE_FAILED",d),f=new Dc.Scalar(r)}return f.range=s,f.source=r,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),a&&(f.comment=a),f}function $m(t,e,i,n,r){if(i==="!")return t[Le.SCALAR];let o=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)o.push(s);else return s;for(let s of o)if(s.test?.test(e))return s;let a=t.knownTags[i];return a&&!a.collection?(t.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[Le.SCALAR])}function Dm({atKey:t,directives:e,schema:i},n,r,o){let a=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(n))||i[Le.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(n))??i[Le.SCALAR];if(a.tag!==s.tag){let c=e.tagString(a.tag),l=e.tagString(s.tag),f=`Value may be parsed as either ${c} or ${l}`;o(r,"TAG_RESOLVE_FAILED",f,!0)}}return a}Mc.composeScalar=Lm});var Fc=v(qc=>{"use strict";function Mm(t,e,i){if(e){i??(i=e.length);for(let n=i-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++n];r?.type==="space";)t+=r.source.length,r=e[++n];break}}return t}qc.emptyScalarPosition=Mm});var zc=v(Ro=>{"use strict";var Bm=kt(),qm=C(),Fm=Ic(),Wc=Bc(),Wm=at(),Hm=Fc(),zm={composeNode:Hc,composeEmptyNode:xo};function Hc(t,e,i,n){let r=t.atKey,{spaceBefore:o,comment:a,anchor:s,tag:c}=i,l,f=!0;switch(e.type){case"alias":l=Gm(t,e,n),(s||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=Wc.composeScalar(t,e,c,n),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Fm.composeCollection(zm,t,e,i,n),s&&(l.anchor=s.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=xo(t,e.offset,void 0,null,i,n)),s&&l.anchor===""&&n(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!qm.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),a&&(e.type==="scalar"&&e.source===""?l.comment=a:l.commentBefore=a),t.options.keepSourceTokens&&f&&(l.srcToken=e),l}function xo(t,e,i,n,{spaceBefore:r,comment:o,anchor:a,tag:s,end:c},l){let f={type:"scalar",offset:Hm.emptyScalarPosition(e,i,n),indent:-1,source:""},u=Wc.composeScalar(t,f,s,l);return a&&(u.anchor=a.source.substring(1),u.anchor===""&&l(a,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function Gm({options:t},{offset:e,source:i,end:n},r){let o=new Bm.Alias(i.substring(1));o.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=e+i.length,s=Wm.resolveEnd(n,a,t.strict,r);return o.range=[e,a,s.offset],s.comment&&(o.comment=s.comment),o}Ro.composeEmptyNode=xo;Ro.composeNode=Hc});var Jc=v(Vc=>{"use strict";var Vm=Bt(),Gc=zc(),Jm=at(),Km=Ht();function Um(t,e,{offset:i,start:n,value:r,end:o},a){let s=Object.assign({_directives:e},t),c=new Vm.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Km.resolveProps(n,{indicator:"doc-start",next:r??o?.[0],offset:i,onError:a,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&a(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Gc.composeNode(l,r,f,a):Gc.composeEmptyNode(l,f.end,n,null,f,a);let u=c.contents.range[2],d=Jm.resolveEnd(o,u,!1,a);return d.comment&&(c.comment=d.comment),c.range=[i,u,d.offset],c}Vc.composeDoc=Um});var Ao=v(Yc=>{"use strict";var Ym=Ci("process"),Xm=mr(),Qm=Bt(),zt=Wt(),Kc=C(),Zm=Jc(),ep=at();function Gt(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:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function Uc(t){let e="",i=!1,n=!1;for(let r=0;r<t.length;++r){let o=t[r];switch(o[0]){case"#":e+=(e===""?"":n?`
101
+ `),e+=1,r=t[e+1];return i||(i=" "),{fold:i,offset:e}}var hp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function mp(t,e,i,r){let n=t.substr(e,i),a=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(a)}catch{let s=t.substr(e-2,i+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Qc.resolveFlowScalar=cp});var tl=v(el=>{"use strict";var Me=C(),Zc=O(),pp=$o(),gp=Bo();function wp(t,e,i,r){let{value:n,type:o,comment:a,range:s}=e.type==="block-scalar"?pp.resolveBlockScalar(t,e,r):gp.resolveFlowScalar(e,t.options.strict,r),c=i?t.directives.tagName(i.source,u=>r(i,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Me.SCALAR]:c?l=vp(t.schema,n,c,i,r):e.type==="scalar"?l=yp(t,n,e,r):l=t.schema[Me.SCALAR];let f;try{let u=l.resolve(n,d=>r(i??e,"TAG_RESOLVE_FAILED",d),t.options);f=Me.isScalar(u)?u:new Zc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);r(i??e,"TAG_RESOLVE_FAILED",d),f=new Zc.Scalar(n)}return f.range=s,f.source=n,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),a&&(f.comment=a),f}function vp(t,e,i,r,n){if(i==="!")return t[Me.SCALAR];let o=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)o.push(s);else return s;for(let s of o)if(s.test?.test(e))return s;let a=t.knownTags[i];return a&&!a.collection?(t.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[Me.SCALAR])}function yp({atKey:t,directives:e,schema:i},r,n,o){let a=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(r))||i[Me.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[Me.SCALAR];if(a.tag!==s.tag){let c=e.tagString(a.tag),l=e.tagString(s.tag),f=`Value may be parsed as either ${c} or ${l}`;o(n,"TAG_RESOLVE_FAILED",f,!0)}}return a}el.composeScalar=wp});var rl=v(il=>{"use strict";function bp(t,e,i){if(e){i??(i=e.length);for(let r=i-1;r>=0;--r){let n=e[r];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++r];n?.type==="space";)t+=n.source.length,n=e[++r];break}}return t}il.emptyScalarPosition=bp});var al=v(Fo=>{"use strict";var Np=Ot(),kp=C(),Sp=Uc(),nl=tl(),Ep=dt(),Cp=rl(),Pp={composeNode:ol,composeEmptyNode:Mo};function ol(t,e,i,r){let n=t.atKey,{spaceBefore:o,comment:a,anchor:s,tag:c}=i,l,f=!0;switch(e.type){case"alias":l=xp(t,e,r),(s||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=nl.composeScalar(t,e,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Sp.composeCollection(Pp,t,e,i,r),s&&(l.anchor=s.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=Mo(t,e.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&t.options.stringKeys&&(!kp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),a&&(e.type==="scalar"&&e.source===""?l.comment=a:l.commentBefore=a),t.options.keepSourceTokens&&f&&(l.srcToken=e),l}function Mo(t,e,i,r,{spaceBefore:n,comment:o,anchor:a,tag:s,end:c},l){let f={type:"scalar",offset:Cp.emptyScalarPosition(e,i,r),indent:-1,source:""},u=nl.composeScalar(t,f,s,l);return a&&(u.anchor=a.source.substring(1),u.anchor===""&&l(a,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function xp({options:t},{offset:e,source:i,end:r},n){let o=new Np.Alias(i.substring(1));o.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&n(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=e+i.length,s=Ep.resolveEnd(r,a,t.strict,n);return o.range=[e,a,s.offset],s.comment&&(o.comment=s.comment),o}Fo.composeEmptyNode=Mo;Fo.composeNode=ol});var ll=v(cl=>{"use strict";var Rp=Jt(),sl=al(),_p=dt(),Ap=Qt();function Tp(t,e,{offset:i,start:r,value:n,end:o},a){let s=Object.assign({_directives:e},t),c=new Rp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Ap.resolveProps(r,{indicator:"doc-start",next:n??o?.[0],offset:i,onError:a,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!f.hasNewline&&a(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?sl.composeNode(l,n,f,a):sl.composeEmptyNode(l,f.end,r,null,f,a);let u=c.contents.range[2],d=_p.resolveEnd(o,u,!1,a);return d.comment&&(c.comment=d.comment),c.range=[i,u,d.offset],c}cl.composeDoc=Tp});var qo=v(dl=>{"use strict";var Op=ji("process"),Ip=Pn(),jp=Jt(),Zt=Xt(),ul=C(),Lp=ll(),$p=dt();function ei(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function fl(t){let e="",i=!1,r=!1;for(let n=0;n<t.length;++n){let o=t[n];switch(o[0]){case"#":e+=(e===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(o.substring(1)||" "),i=!0,n=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:e,afterEmptyLine:n}}var _o=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,n,r,o)=>{let a=Gt(i);o?this.warnings.push(new zt.YAMLWarning(a,n,r)):this.errors.push(new zt.YAMLParseError(a,n,r))},this.directives=new Xm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:n,afterEmptyLine:r}=Uc(this.prelude);if(n){let o=e.contents;if(i)e.comment=e.comment?`${e.comment}
106
- ${n}`:n;else if(r||e.directives.docStart||!o)e.commentBefore=n;else if(Kc.isCollection(o)&&!o.flow&&o.items.length>0){let a=o.items[0];Kc.isPair(a)&&(a=a.key);let s=a.commentBefore;a.commentBefore=s?`${n}
107
- ${s}`:n}else{let a=o.commentBefore;o.commentBefore=a?`${n}
108
- ${a}`:n}}if(i){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:Uc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(i,n)}*next(e){switch(Ym.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,n,r)=>{let o=Gt(e);o[0]+=i,this.onError(o,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=Zm.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new zt.YAMLParseError(Gt(e),"UNEXPECTED_TOKEN",i);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 zt.YAMLParseError(Gt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let i=ep.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
109
- ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new zt.YAMLParseError(Gt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-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),r=new Qm.Document(void 0,n);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,i,i],this.decorate(r,!1),yield r}}};Yc.Composer=_o});var Zc=v(vn=>{"use strict";var tp=Eo(),ip=Po(),np=Wt(),Xc=Rt();function rp(t,e=!0,i){if(t){let n=(r,o,a)=>{let s=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(i)i(s,o,a);else throw new np.YAMLParseError([s,s+1],o,a)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ip.resolveFlowScalar(t,e,n);case"block-scalar":return tp.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function op(t,e){let{implicitKey:i=!1,indent:n,inFlow:r=!1,offset:o=-1,type:a="PLAIN"}=e,s=Xc.stringifyString({type:a,value:t},{implicitKey:i,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
105
+ `)+(o.substring(1)||" "),i=!0,r=!1;break;case"%":t[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:e,afterEmptyLine:r}}var Wo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,o)=>{let a=ei(i);o?this.warnings.push(new Zt.YAMLWarning(a,r,n)):this.errors.push(new Zt.YAMLParseError(a,r,n))},this.directives=new Ip.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:r,afterEmptyLine:n}=fl(this.prelude);if(r){let o=e.contents;if(i)e.comment=e.comment?`${e.comment}
106
+ ${r}`:r;else if(n||e.directives.docStart||!o)e.commentBefore=r;else if(ul.isCollection(o)&&!o.flow&&o.items.length>0){let a=o.items[0];ul.isPair(a)&&(a=a.key);let s=a.commentBefore;a.commentBefore=s?`${r}
107
+ ${s}`:r}else{let a=o.commentBefore;o.commentBefore=a?`${r}
108
+ ${a}`:r}}if(i){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:fl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(i,r)}*next(e){switch(Op.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,r,n)=>{let o=ei(e);o[0]+=i,this.onError(o,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=Lp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Zt.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Zt.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=$p.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
+ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Zt.YAMLParseError(ei(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new jp.Document(void 0,r);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,i,i],this.decorate(n,!1),yield n}}};dl.Composer=Wo});var pl=v(Cr=>{"use strict";var Dp=$o(),Bp=Bo(),Mp=Xt(),hl=Dt();function Fp(t,e=!0,i){if(t){let r=(n,o,a)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,o,a);else throw new Mp.YAMLParseError([s,s+1],o,a)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Bp.resolveFlowScalar(t,e,r);case"block-scalar":return Dp.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Wp(t,e){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:o=-1,type:a="PLAIN"}=e,s=hl.stringifyString({type:a,value:t},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
111
  `),f=s.substring(0,l),u=s.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:o,indent:n,source:f}];return Qc(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:s,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:s,end:c};default:return{type:"scalar",offset:o,indent:n,source:s,end:c}}}function ap(t,e,i={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:o=!1,type:a}=i,s="indent"in t?t.indent:null;if(n&&typeof s=="number"&&(s+=2),!a)switch(t.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let c=Xc.stringifyString({type:a,value:e},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":sp(t,c);break;case'"':To(t,c,"double-quoted-scalar");break;case"'":To(t,c,"single-quoted-scalar");break;default:To(t,c,"scalar")}}function sp(t,e){let i=e.indexOf(`
114
- `),n=e.substring(0,i),r=e.substring(i+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=r}else{let{offset:o}=t,a="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:o,indent:a,source:n}];Qc(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:a,source:`
116
- `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:a,props:s,source:r})}}function Qc(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function To(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let o of n)o.offset+=r;delete t.props,Object.assign(t,{type:i,source:e,end:n});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:i,source:e,end:[r]});break}default:{let n="indent"in t?t.indent:-1,r="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:i,indent:n,source:e,end:r})}}}vn.createScalarToken=op;vn.resolveAsScalar=rp;vn.setScalarValue=ap});var tl=v(el=>{"use strict";var cp=t=>"type"in t?bn(t):yn(t);function bn(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=bn(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=yn(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=yn(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=yn(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function yn({start:t,key:e,sep:i,value:n}){let r="";for(let o of t)r+=o.source;if(e&&(r+=bn(e)),i)for(let o of i)r+=o.source;return n&&(r+=bn(n)),r}el.stringify=cp});var ol=v(rl=>{"use strict";var Oo=Symbol("break visit"),lp=Symbol("skip children"),il=Symbol("remove item");function $e(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nl(Object.freeze([]),t,e)}$e.BREAK=Oo;$e.SKIP=lp;$e.REMOVE=il;$e.itemAtPath=(t,e)=>{let i=t;for(let[n,r]of e){let o=i?.[n];if(o&&"items"in o)i=o.items[r];else return}return i};$e.parentCollection=(t,e)=>{let i=$e.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],r=i?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function nl(t,e,i){let n=i(e,t);if(typeof n=="symbol")return n;for(let r of["key","value"]){let o=e[r];if(o&&"items"in o){for(let a=0;a<o.items.length;++a){let s=nl(Object.freeze(t.concat([[r,a]])),o.items[a],i);if(typeof s=="number")a=s-1;else{if(s===Oo)return Oo;s===il&&(o.items.splice(a,1),a-=1)}}typeof n=="function"&&r==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}rl.visit=$e});var Nn=v(W=>{"use strict";var Io=Zc(),up=tl(),fp=ol(),jo="\uFEFF",Lo="",$o="",Do="",dp=t=>!!t&&"items"in t,hp=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function mp(t){switch(t){case jo:return"<BOM>";case Lo:return"<DOC>";case $o:return"<FLOW_END>";case Do:return"<SCALAR>";default:return JSON.stringify(t)}}function pp(t){switch(t){case jo:return"byte-order-mark";case Lo:return"doc-mode";case $o:return"flow-error-end";case Do:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
112
+ `,d=[{type:"block-scalar-header",offset:o,indent:r,source:f}];return ml(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:o,indent:r,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:s,end:c};default:return{type:"scalar",offset:o,indent:r,source:s,end:c}}}function qp(t,e,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:o=!1,type:a}=i,s="indent"in t?t.indent:null;if(r&&typeof s=="number"&&(s+=2),!a)switch(t.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let c=hl.stringifyString({type:a,value:e},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Hp(t,c);break;case'"':Ho(t,c,"double-quoted-scalar");break;case"'":Ho(t,c,"single-quoted-scalar");break;default:Ho(t,c,"scalar")}}function Hp(t,e){let i=e.indexOf(`
114
+ `),r=e.substring(0,i),n=e.substring(i+1)+`
115
+ `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,t.source=n}else{let{offset:o}=t,a="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:o,indent:a,source:r}];ml(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:a,source:`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:a,props:s,source:n})}}function ml(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function Ho(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),n=e.length;t.props[0].type==="block-scalar-header"&&(n-=t.props[0].source.length);for(let o of r)o.offset+=n;delete t.props,Object.assign(t,{type:i,source:e,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:i,source:e,end:[n]});break}default:{let r="indent"in t?t.indent:-1,n="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:i,indent:r,source:e,end:n})}}}Cr.createScalarToken=Wp;Cr.resolveAsScalar=Fp;Cr.setScalarValue=qp});var wl=v(gl=>{"use strict";var Gp=t=>"type"in t?xr(t):Pr(t);function xr(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=xr(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=Pr(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=Pr(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=Pr(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function Pr({start:t,key:e,sep:i,value:r}){let n="";for(let o of t)n+=o.source;if(e&&(n+=xr(e)),i)for(let o of i)n+=o.source;return r&&(n+=xr(r)),n}gl.stringify=Gp});var Nl=v(bl=>{"use strict";var Go=Symbol("break visit"),zp=Symbol("skip children"),vl=Symbol("remove item");function Fe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),yl(Object.freeze([]),t,e)}Fe.BREAK=Go;Fe.SKIP=zp;Fe.REMOVE=vl;Fe.itemAtPath=(t,e)=>{let i=t;for(let[r,n]of e){let o=i?.[r];if(o&&"items"in o)i=o.items[n];else return}return i};Fe.parentCollection=(t,e)=>{let i=Fe.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function yl(t,e,i){let r=i(e,t);if(typeof r=="symbol")return r;for(let n of["key","value"]){let o=e[n];if(o&&"items"in o){for(let a=0;a<o.items.length;++a){let s=yl(Object.freeze(t.concat([[n,a]])),o.items[a],i);if(typeof s=="number")a=s-1;else{if(s===Go)return Go;s===vl&&(o.items.splice(a,1),a-=1)}}typeof r=="function"&&n==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}bl.visit=Fe});var Rr=v(q=>{"use strict";var zo=pl(),Vp=wl(),Kp=Nl(),Vo="\uFEFF",Ko="",Jo="",Uo="",Jp=t=>!!t&&"items"in t,Up=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Yp(t){switch(t){case Vo:return"<BOM>";case Ko:return"<DOC>";case Jo:return"<FLOW_END>";case Uo:return"<SCALAR>";default:return JSON.stringify(t)}}function Xp(t){switch(t){case Vo:return"byte-order-mark";case Ko:return"doc-mode";case Jo:return"flow-error-end";case Uo: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}W.createScalarToken=Io.createScalarToken;W.resolveAsScalar=Io.resolveAsScalar;W.setScalarValue=Io.setScalarValue;W.stringify=up.stringify;W.visit=fp.visit;W.BOM=jo;W.DOCUMENT=Lo;W.FLOW_END=$o;W.SCALAR=Do;W.isCollection=dp;W.isScalar=hp;W.prettyToken=mp;W.tokenType=pp});var qo=v(sl=>{"use strict";var Vt=Nn();function X(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var al=new Set("0123456789ABCDEFabcdef"),gp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Sn=new Set(",[]{}"),wp=new Set(` ,[]{}
121
- \r `),Mo=t=>!t||wp.has(t),Bo=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,i=!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=!i;let n=this.next??"stream";for(;n&&(i||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
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}q.createScalarToken=zo.createScalarToken;q.resolveAsScalar=zo.resolveAsScalar;q.setScalarValue=zo.setScalarValue;q.stringify=Vp.stringify;q.visit=Kp.visit;q.BOM=Vo;q.DOCUMENT=Ko;q.FLOW_END=Jo;q.SCALAR=Uo;q.isCollection=Jp;q.isScalar=Up;q.prettyToken=Yp;q.tokenType=Xp});var Qo=v(Sl=>{"use strict";var ti=Rr();function ee(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var kl=new Set("0123456789ABCDEFabcdef"),Qp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),_r=new Set(",[]{}"),Zp=new Set(` ,[]{}
121
+ \r `),Yo=t=>!t||Zp.has(t),Xo=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,i=!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=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
122
122
  `?!0:i==="\r"?this.buffer[e+1]===`
123
- `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let n=0;for(;i===" ";)i=this.buffer[++n+e];if(i==="\r"){let r=this.buffer[n+e+1];if(r===`
124
- `||!r&&!this.atEnd)return e+n+1}return i===`
125
- `||n>=this.indentNext||!i&&!this.atEnd?e+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&X(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]===Vt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,n=e.indexOf("#");for(;n!==-1;){let o=e[n-1];if(o===" "||o===" "){i=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let o=e[i-1];if(o===" "||o===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield Vt.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 i=this.peek(3);if((i==="---"||i==="...")&&X(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&X(i)){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 i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);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(Mo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,n=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=n=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&X(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Vt.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.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(Mo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||X(a)||a===",")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),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let o=0;for(;this.buffer[i-1-o]==="\\";)o+=1;if(o%2===0)break;i=this.buffer.indexOf('"',i+1)}let n=this.buffer.substring(0,i),r=n.indexOf(`
127
- `,this.pos);if(r!==-1){for(;r!==-1;){let o=this.continueScalar(r+1);if(o===-1)break;r=n.indexOf(`
128
- `,o)}r!==-1&&(i=r-(n[r-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>X(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":i+=1;break;case`
123
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+e];if(i==="\r"){let n=this.buffer[r+e+1];if(n===`
124
+ `||!n&&!this.atEnd)return e+r+1}return i===`
125
+ `||r>=this.indentNext||!i&&!this.atEnd?e+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ee(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===ti.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){i=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[i-1];if(o===" "||o===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield ti.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&ee(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ee(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ee(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);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(Yo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,r=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&ee(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield ti.FLOW_END,yield*this.parseLineStart();let o=0;for(;n[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),n[o]){case void 0:return"flow";case"#":return yield*this.pushCount(n.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(Yo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||ee(a)||a===",")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),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let o=0;for(;this.buffer[i-1-o]==="\\";)o+=1;if(o%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),n=r.indexOf(`
127
+ `,this.pos);if(n!==-1){for(;n!==-1;){let o=this.continueScalar(n+1);if(o===-1)break;n=r.indexOf(`
128
+ `,o)}n!==-1&&(i=n-(r[n-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>ee(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":i+=1;break;case`
129
129
  `:e=o,i=0;break;case"\r":{let a=this.buffer[o+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
130
- `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i: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 r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
132
- `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let o=e-1,a=this.buffer[o];a==="\r"&&(a=this.buffer[--o]);let s=o;for(;a===" ";)a=this.buffer[--o];if(a===`
133
- `&&o>=this.pos&&o+1+i>s)e=o;else break}while(!0);return yield Vt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let o=this.buffer[n+1];if(X(o)||e&&Sn.has(o))break;i=n}else if(X(r)){let o=this.buffer[n+1];if(r==="\r"&&(o===`
134
- `?(n+=1,r=`
135
- `,o=this.buffer[n+1]):i=n),o==="#"||e&&Sn.has(o))break;if(r===`
136
- `){let a=this.continueScalar(n+1);if(a===-1)break;n=Math.max(n,a-2)}}else{if(e&&Sn.has(r))break;i=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Vt.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(i&&(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(Mo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,n=this.charAt(1);if(X(n)||i&&Sn.has(n)){i?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,i=this.buffer[e];for(;!X(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(gp.has(i))i=this.buffer[++e];else if(i==="%"&&al.has(this.buffer[e+1])&&al.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
130
+ `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i: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 n=e+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
+ `;)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let o=e-1,a=this.buffer[o];a==="\r"&&(a=this.buffer[--o]);let s=o;for(;a===" ";)a=this.buffer[--o];if(a===`
133
+ `&&o>=this.pos&&o+1+i>s)e=o;else break}while(!0);return yield ti.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let o=this.buffer[r+1];if(ee(o)||e&&_r.has(o))break;i=r}else if(ee(n)){let o=this.buffer[r+1];if(n==="\r"&&(o===`
134
+ `?(r+=1,n=`
135
+ `,o=this.buffer[r+1]):i=r),o==="#"||e&&_r.has(o))break;if(n===`
136
+ `){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(e&&_r.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield ti.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(i&&(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(Yo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(ee(r)||i&&_r.has(r)){i?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,i=this.buffer[e];for(;!ee(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(Qp.has(i))i=this.buffer[++e];else if(i==="%"&&kl.has(this.buffer[e+1])&&kl.has(this.buffer[e+2]))i=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 i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||e&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(e){let i=this.pos,n=this.buffer[i];for(;!e(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};sl.Lexer=Bo});var Wo=v(cl=>{"use strict";var Fo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,n=this.lineStarts.length;for(;i<n;){let o=i+n>>1;this.lineStarts[o]<e?i=o+1:n=o}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let r=this.lineStarts[i-1];return{line:i,col:e-r+1}}}};cl.LineCounter=Fo});var zo=v(hl=>{"use strict";var vp=Ci("process"),ll=Nn(),yp=qo();function Se(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function ul(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 dl(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 kn(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 st(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 En(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function fl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Se(e.start,"explicit-key-ind")&&!Se(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,dl(e.value)?e.value.end?En(e.value.end,e.sep):e.value.end=e.sep:En(e.start,e.sep),delete e.sep)}var Ho=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 yp.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,i))yield*this.next(n);i||(yield*this.end())}*next(e){if(this.source=e,vp.env.LOG_TOKENS&&console.log("|",ll.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=ll.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){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 i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let n=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in n?n.indent:0:i.type==="flow-collection"&&n.type==="document"&&(i.indent=0),i.type==="flow-collection"&&fl(i),n.type){case"document":n.value=i;break;case"block-scalar":n.props.push(i);break;case"block-map":{let r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=i;else{Object.assign(r,{key:i,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:i}):r.value=i;break}case"flow-collection":{let r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:i,sep:[]}):r.sep?r.value=i:Object.assign(r,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let r=i.items[i.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&ul(r.start)===-1&&(i.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<i.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),i.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":{ul(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 i=this.startBlockValue(e);i?this.stack.push(i):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 i=kn(this.peek(2)),n=st(i),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};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 i=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||e&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(e){let i=this.pos,r=this.buffer[i];for(;!e(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};Sl.Lexer=Xo});var ea=v(El=>{"use strict";var Zo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,r=this.lineStarts.length;for(;i<r;){let o=i+r>>1;this.lineStarts[o]<e?i=o+1:r=o}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let n=this.lineStarts[i-1];return{line:i,col:e-n+1}}}};El.LineCounter=Zo});var ia=v(_l=>{"use strict";var eg=ji("process"),Cl=Rr(),tg=Qo();function _e(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function Pl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Rl(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 Ar(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 ht(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 Tr(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function xl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!_e(e.start,"explicit-key-ind")&&!_e(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Rl(e.value)?e.value.end?Tr(e.value.end,e.sep):e.value.end=e.sep:Tr(e.start,e.sep),delete e.sep)}var ta=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 tg.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,i))yield*this.next(r);i||(yield*this.end())}*next(e){if(this.source=e,eg.env.LOG_TOKENS&&console.log("|",Cl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=Cl.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&xl(i),r.type){case"document":r.value=i;break;case"block-scalar":r.props.push(i);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=i;else{Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];n.value?r.items.push({start:[],value:i}):n.value=i;break}case"flow-collection":{let n=r.items[r.items.length-1];!n||n.value?r.items.push({start:[],key:i,sep:[]}):n.sep?n.value=i:Object.assign(n,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let n=i.items[i.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Pl(n.start)===-1&&(i.indent===0||n.start.every(o=>o.type!=="comment"||o.indent<i.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Pl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):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 i=Ar(this.peek(2)),r=ht(i),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};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 i=this.source.indexOf(`
139
139
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
140
- `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let n="end"in i.value?i.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 i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){En(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&i.sep&&!i.value){let a=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":a.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(o=i.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":r||i.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):r||i.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(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Se(i.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(dl(i.key)&&!Se(i.sep,"newline")){let a=st(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:s,sep:c}]})}else o.length>0?i.sep=i.sep.concat(o,this.sourceToken):i.sep.push(this.sourceToken);else if(Se(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let a=st(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||r?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Se(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);r||i.value?(e.items.push({start:o,key:a,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(a):(Object.assign(i,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(e);if(a){if(a.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Se(i.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(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let n="end"in i.value?i.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 i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){En(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||Se(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.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 i=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":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:r,sep:[]}):i.sep?this.stack.push(r):Object.assign(i,{key:r,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 r=kn(n),o=st(r);fl(e);let a=e.end.splice(1,e.end.length);a.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
140
+ `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Tr(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",o=[];if(n&&i.sep&&!i.value){let a=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":a.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(o=i.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.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(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_e(i.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(Rl(i.key)&&!_e(i.sep,"newline")){let a=ht(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:s,sep:c}]})}else o.length>0?i.sep=i.sep.concat(o,this.sourceToken):i.sep.push(this.sourceToken);else if(_e(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let a=ht(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?e.items.push({start:o,key:null,sep:[this.sourceToken]}):_e(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);n||i.value?(e.items.push({start:o,key:a,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(a):(Object.assign(i,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(e);if(a){if(a.type==="block-seq"){if(!i.explicitKey&&i.sep&&!_e(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Tr(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||_e(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=Ar(r),o=ht(n);xl(e);let a=e.end.splice(1,e.end.length);a.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
141
141
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
142
- `,i)+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 i=kn(e),n=st(i);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 i=kn(e),n=st(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!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())}}};hl.Parser=Ho});var vl=v(Kt=>{"use strict";var ml=Ao(),bp=Bt(),Jt=Wt(),Np=xr(),Sp=C(),kp=Wo(),pl=zo();function gl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new kp.LineCounter||null,prettyErrors:e}}function Ep(t,e={}){let{lineCounter:i,prettyErrors:n}=gl(e),r=new pl.Parser(i?.addNewLine),o=new ml.Composer(e),a=Array.from(o.compose(r.parse(t)));if(n&&i)for(let s of a)s.errors.forEach(Jt.prettifyError(t,i)),s.warnings.forEach(Jt.prettifyError(t,i));return a.length>0?a:Object.assign([],{empty:!0},o.streamInfo())}function wl(t,e={}){let{lineCounter:i,prettyErrors:n}=gl(e),r=new pl.Parser(i?.addNewLine),o=new ml.Composer(e),a=null;for(let s of o.compose(r.parse(t),!0,t.length))if(!a)a=s;else if(a.options.logLevel!=="silent"){a.errors.push(new Jt.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(a.errors.forEach(Jt.prettifyError(t,i)),a.warnings.forEach(Jt.prettifyError(t,i))),a}function Cp(t,e,i){let n;typeof e=="function"?n=e:i===void 0&&e&&typeof e=="object"&&(i=e);let r=wl(t,i);if(!r)return null;if(r.warnings.forEach(o=>Np.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},i))}function Pp(t,e,i){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let r=Math.round(i);i=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=i??e??{};if(!r)return}return Sp.isDocument(t)&&!n?t.toString(i):new bp.Document(t,n,i).toString(i)}Kt.parse=Cp;Kt.parseAllDocuments=Ep;Kt.parseDocument=wl;Kt.stringify=Pp});var Ut=v(x=>{"use strict";var xp=Ao(),Rp=Bt(),_p=lo(),Go=Wt(),Ap=kt(),ke=C(),Tp=ve(),Op=O(),Ip=be(),jp=Ne(),Lp=Nn(),$p=qo(),Dp=Wo(),Mp=zo(),Cn=vl(),yl=yt();x.Composer=xp.Composer;x.Document=Rp.Document;x.Schema=_p.Schema;x.YAMLError=Go.YAMLError;x.YAMLParseError=Go.YAMLParseError;x.YAMLWarning=Go.YAMLWarning;x.Alias=Ap.Alias;x.isAlias=ke.isAlias;x.isCollection=ke.isCollection;x.isDocument=ke.isDocument;x.isMap=ke.isMap;x.isNode=ke.isNode;x.isPair=ke.isPair;x.isScalar=ke.isScalar;x.isSeq=ke.isSeq;x.Pair=Tp.Pair;x.Scalar=Op.Scalar;x.YAMLMap=Ip.YAMLMap;x.YAMLSeq=jp.YAMLSeq;x.CST=Lp;x.Lexer=$p.Lexer;x.LineCounter=Dp.LineCounter;x.Parser=Mp.Parser;x.parse=Cn.parse;x.parseAllDocuments=Cn.parseAllDocuments;x.parseDocument=Cn.parseDocument;x.stringify=Cn.stringify;x.visit=yl.visit;x.visitAsync=yl.visitAsync});import Pn from"path";function qp(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||Pn.posix.isAbsolute(i)||Pn.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function ct(t){let e=qp(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Sl(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function Xt(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||Pn.posix.isAbsolute(n)||Pn.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let r=n.split("/");if(r.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function Yt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function kl(t,e,i){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function An(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>xn)throw new Error(`${e} exceeds ${xn} characters`);let i=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?i+=1:t[n]==="*"&&(i+=1,t[n+1]==="*"&&(n+=1));if(i>Rn)throw new Error(`${e} contains more than ${Rn} wildcard tokens`);return t}function bl(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>An(n,e)))].sort((n,r)=>n.localeCompare(r,"en"))}function Vo(t,e,i){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Fp(t){if(t===void 0)return{...re,include:[...re.include],exclude:[...re.exclude]};let e=Yt(t,"native.snapshot");return{include:bl(e.include,"native.snapshot.include",re.include),exclude:bl(e.exclude,"native.snapshot.exclude",re.exclude),max_files:Vo(e.max_files,re.max_files,"native.snapshot.max_files"),max_total_bytes:Vo(e.max_total_bytes,re.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Vo(e.max_duration_ms,re.max_duration_ms,"native.snapshot.max_duration_ms")}}function Wp(t){if(t===void 0)return;let e=Yt(t,"native.pending_root_move"),i=e.id,n=e.from_artifact_root,r=e.to_artifact_root,o=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof r!="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 a;if(e.cleanup!==void 0){let s=Yt(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,f=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");a={kind:c,state:l,manifestHash:f}}return{id:i,fromArtifactRoot:ct(n),toArtifactRoot:ct(r),stage:o,...a?{cleanup:a}:{}}}function Hp(t){let e=Yt(t,"native");if(typeof e.artifact_root!="string")throw new Error("native.artifact_root must be a string");let i=e.clarification_mode??"sequential";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let n=e.archive_confirmation??"automatic";if(n!=="automatic"&&n!=="required")throw new Error("native.archive_confirmation must be automatic or required");let r=e.max_verify_failures??Nl;if(!Number.isSafeInteger(r)||r<1)throw new Error("native.max_verify_failures must be a positive integer");let o=Wp(e.pending_root_move);return{artifact_root:ct(e.artifact_root),language:kl(e.language,"en","native.language"),clarification_mode:i,archive_confirmation:n,max_verify_failures:r,snapshot:Fp(e.snapshot),...o?{pending_root_move:o}:{}}}function zp(t){let e=Yt(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="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 r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Sl(e.artifact_layout),language:kl(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function Gp(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Vp(t,e,i,n,r){let o=t.schema!==void 0;if(!(o||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!o)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 s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];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:n,...e?{native:e}:{},...i?{classic:i}:{}}}function Qt(t,e={}){let i=(0,Jo.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let n=i.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 r=n,o=Gp(r.ambient_resume),a=r.native===void 0?void 0:Hp(r.native),s=r.classic===void 0?void 0:zp(r.classic),c=Vp(r,a,s,o,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:o,...a?{native:a}:{},...s?{classic:s}:{}}}var Jo,_n,xn,Rn,Nl,Bp,re,fe=B(()=>{"use strict";Jo=Pi(Ut(),1),_n=64*1024,xn=1024,Rn=64,Nl=5,Bp=[".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/**"],re={include:["**/*"],exclude:[...Bp],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function Ee(t){return t!==0&&t!==0n&&t!=="0"}function oe(t,e){return Ee(t.dev)&&Ee(e.dev)&&Ee(t.ino)&&Ee(e.ino)}function T(t,e){let i=Ee(t.dev)&&Ee(e.dev);if(i&&t.dev!==e.dev)return!1;let n=Ee(t.ino)&&Ee(e.ino);return n&&t.ino!==e.ino?!1:i&&n?!0:t.birthtime===e.birthtime}var ni=B(()=>{"use strict"});import{constants as Tn,promises as De}from"fs";function Qo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Cl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ri(t){return{dev:t.dev,ino:t.ino,birthtime:Qo(t)}}function On(t,e){let i=ri(t),n=ri(e);return oe(i,n)?T(i,n):T(i,n)&&Qo(t)===Qo(e)&&Cl(t)===Cl(e)&&t.size===e.size}async function oi(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,o=await De.lstat(t,{bigint:r});if(!o.isFile()||o.isSymbolicLink())throw new he("not-regular-file",`${n} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new he("too-large",`${n} exceeds ${e} bytes`);let a=await De.realpath(t);await i.verify?.("pre-open",{realPath:a,identity:ri(o)});let s=process.platform==="win32"?Tn.O_RDONLY:Tn.O_RDONLY|Tn.O_NOFOLLOW|Tn.O_NONBLOCK,c;try{c=await De.open(t,s)}catch(l){throw l.code==="ELOOP"?new he("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:r}),De.lstat(t,{bigint:r}),De.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==a||!On(o,l)||!On(o,f))throw new he("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:ri(l)}),await i.hooks?.afterOpen?.();let d=[],p=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:S}=await c.read(w,0,Math.min(w.length,b),null);if(S===0)break;if(p+=S,p>e)throw new he("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(w.subarray(0,S)))}await i.hooks?.beforeFinalCheck?.();let[h,m,y]=await Promise.all([c.stat({bigint:r}),De.lstat(t,{bigint:r}),De.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||y!==a||!On(o,h)||!On(o,m))throw new he("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:ri(h)}),{bytes:Buffer.concat(d,p),stat:h,realPath:y}}finally{await c.close()}}var he,In=B(()=>{"use strict";ni();he=class extends Error{reason;constructor(e,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=e}}});import{promises as jn}from"fs";import Ce from"path";function Qp(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Zo(t,e){let i=Ce.relative(t,e);return i===""||!Ce.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Ce.sep}`)}async function Pl(t,e){let i=Ce.resolve(t),n=await jn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return jn.realpath(i)}async function xl(t,e,i,n){let r=t;for(let o=0;o<i.length;o++){r=Ce.join(r,i[o]);let a;try{a=await jn.lstat(r)}catch(f){if(Qp(f))return{exists:!1,kind:"missing"};throw f}let s=Ce.relative(t,r).replaceAll("\\","/");if(a.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${s}`);let c=o===i.length-1;if(!c&&!a.isDirectory())throw new Error(`${n.label} ancestor ${s} must be a real directory`);if(c&&(n.expected==="file"&&!a.isFile()||n.expected==="directory"&&!a.isDirectory()||n.expected==="any"&&!a.isFile()&&!a.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await jn.realpath(r);if(!Zo(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:a.isFile()?"file":a.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function H(t,e,i){let n=Xt(e,i.label),r=Ce.resolve(t),o=await Pl(r,i.label),a=n.split("/"),s=Ce.resolve(r,...a);if(!Zo(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await xl(r,o,a,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function ae(t,e,i,n){let r=await H(t,e,{label:n.label,expected:"file"});if(!r.exists){let a=new Error(`${n.label} does not exist`);throw a.code="ENOENT",a}let o=await Pl(r.projectRoot,n.label);return oi(r.target,i,{...n,verify:async(a,s)=>{if(!Zo(o,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await xl(r.projectRoot,o,r.relative.split("/"),{label:n.label,expected:"file"})}})}var Pe=B(()=>{"use strict";In();fe()});import{createHash as Zp}from"crypto";function eg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Me(t,e={}){return(await si(t,e)).document}async function tg(t){try{return(await ae(t,ai,_n,{label:ai})).bytes}catch(e){if(eg(e))return null;throw e}}function ig(t){return t?{exists:!0,sha256:Zp("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function si(t,e={}){let i=await tg(t);return{document:i?Qt(i.toString("utf8"),e):null,identity:ig(i)}}async function ea(t){return(await Me(t))?.config??null}var ai,Be=B(()=>{"use strict";fe();Pe();ai=".comet/config.yaml"});import{randomUUID as ng}from"crypto";import{promises as L}from"fs";import D from"path";function ft(t,e){let i=D.relative(t,e);return i===""||!D.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${D.sep}`)}function $n(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function rg(t,e){return T(t,$n(e))}function Ln(t,e){let i=$n(t),n=$n(e);return oe(i,n)?T(i,n):T(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Dn(t){let e=await L.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 L.realpath(t),...$n(e)}}async function xe(t){for(let e of t){let i=await L.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!rg(e,i)||await L.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function og(t,e){let i=D.resolve(t),n=D.resolve(e);if(!ft(i,n))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await Dn(i)],o=D.relative(i,n).split(D.sep).filter(Boolean),a=i;for(let s of o){await xe(r),a=D.join(a,s);try{await L.mkdir(a)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Dn(a);if(!ft(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${a}`);r.push(c)}return await xe(r),r}async function ag(t,e){let i=D.resolve(t),n=D.resolve(e);if(!ft(i,n))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await Dn(i)],o=D.relative(i,n).split(D.sep).filter(Boolean),a=i;for(let s of o){a=D.join(a,s);try{let c=await Dn(a);if(!ft(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${a}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await xe(r),r}async function Rl(t){let e;try{e=await L.open(t,"r"),await e.sync()}catch(i){let n=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw i}finally{await e?.close()}}async function sg(t,e,i){let n=D.dirname(t),r=await og(i.containedRoot,n),o=D.join(n,`.${D.basename(t)}.${ng()}.tmp`),a,s;try{await i.beforeTemporaryOpen?.(),a=await L.open(o,"wx"),s=await a.stat();let[c,l]=await Promise.all([L.lstat(o),L.realpath(o)]);if(await xe(r),!c.isFile()||c.isSymbolicLink()||!Ln(s,c)||!ft(r[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await a.writeFile(e,"utf8"):await a.writeFile(e),await a.sync(),!Ln(s,await a.stat()))throw new Error("Contained atomic write temporary file changed while writing");await a.close(),a=void 0,await i.beforeCommit?.(),await xe(r);let f=await L.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!Ln(f,s))throw new Error("Contained atomic write temporary file changed before commit");i.exclusive?(await L.link(o,t),await L.unlink(o)):await L.rename(o,t),await Rl(n)}catch(c){await a?.close();try{await xe(r),await L.rm(o,{force:!0})}catch{}throw c}}async function Re(t,e,i){await sg(t,e,i)}async function ta(t,e){let i=D.dirname(t),n=await ag(e.containedRoot,i);if(!n)return!1;let r,o;try{r=await L.lstat(t),o=await L.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!ft(n[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await xe(n);let[a,s]=await Promise.all([L.lstat(t),L.realpath(t)]);if(!a.isFile()||a.isSymbolicLink()||!Ln(r,a)||s!==o)throw new Error("Contained file removal target changed before removal");return await L.unlink(t),await xe(n),await Rl(i),!0}var dt=B(()=>{"use strict";ni()});var vN,ia=B(()=>{"use strict";dt();Be();Pe();vN=16*1024});var Mn=B(()=>{"use strict";dt();fe();Be();Pe();ia()});var Hn=B(()=>{"use strict"});var Kl=B(()=>{"use strict"});var ma=B(()=>{"use strict";Hn()});var Ul=B(()=>{"use strict";Hn();ma()});var Yl=B(()=>{"use strict";Hn();dt();Kl();Ul();fe();Pe();Be();Mn();ia();ma()});import{TextDecoder as Yg}from"util";function Xl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Xg(t,e){try{return new Yg("utf-8",{fatal:!0}).decode(t.bytes)}catch(i){throw new Error(`${e} is not valid UTF-8`,{cause:i})}}async function pa(t,e,i,n,r={}){try{let o=await ae(t,e,i,{label:n,hooks:r.hooks});return{result:o,text:Xg(o,n)}}catch(o){let a=o.code;if(a==="ENOENT"||a==="ENOTDIR")return null;throw o}}async function Ql(t,e,i,n,r={}){return(await pa(t,e,i,n,r))?.text??null}async function Zl(t,e,i,n,r,o={}){if(Buffer.byteLength(i,"utf8")>n)throw new Error(`${r} exceeds ${n} bytes`);let a=await pa(t,e,n,r),s=await H(t,e,{label:r,expected:"file"});await Re(s.target,i,{containedRoot:s.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await pa(t,e,n,r);if(!(!a&&!c)){if(!a||!c)throw new Error(`${r} changed before commit`);if(a.result.realPath!==c.result.realPath||!T(Xl(a.result.stat),Xl(c.result.stat))||a.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function eu(t,e,i,n={}){let r=await H(t,e,{label:i,expected:"file"});return r.exists?ta(r.target,{containedRoot:r.projectRoot,beforeRemove:n.beforeRemove}):!1}var tu=B(()=>{"use strict";Yl();ni()});var au={};uf(au,{RUN_STATE_FILE:()=>zn,applyRunStateToDocument:()=>nu,readRunState:()=>ga,removeRunState:()=>ou,runStateFromDocument:()=>wi,writeRunState:()=>wa});import Qg from"path";function gi(t,e){let i=t[e];if(typeof i!="string"||i.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return i}function pi(t,e){let i=gi(t,e);if(Qg.isAbsolute(i)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(i)||i.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return i}function Zg(t){let e=t.run_retries??"{}",i;try{i=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(!i||typeof i!="object"||Array.isArray(i))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let n of Object.values(i))if(!Number.isInteger(n)||Number(n)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return i}function wi(t){if(!t.run_id)return null;let e=gi(t,"run_id"),i=gi(t,"skill"),n=gi(t,"skill_version"),r=gi(t,"skill_hash"),o=pi(t,"pending_ref"),a=pi(t,"trajectory_ref"),s=pi(t,"context_ref"),c=pi(t,"artifacts_ref"),l=pi(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:i,skillVersion:n,skillHash:r,orchestration:t.orchestration,currentStep:iu(t,"current_step"),iteration:f,pending:iu(t,"pending"),pendingRef:o,trajectoryRef:a,contextRef:s,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Zg(t)}}function nu(t,e){e?t.run_id=e.runId:delete t.run_id}function ew(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 tw(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 wi(e)}async function ga(t,e={}){let i=await Ql(t,zn,ru,"Run state",e);if(i===null)return null;let n=JSON.parse(i);return tw(n)}async function wa(t,e,i={}){await Zl(t,zn,JSON.stringify(ew(e),null,2),ru,"Run state",i)}async function ou(t,e={}){await eu(t,zn,"Run state",e)}var iu,zn,ru,vi=B(()=>{"use strict";tu();iu=(t,e)=>{let i=t[e];return i==null?null:String(i)};zn=".comet/run-state.json",ru=256*1024});import rf from"path";import{promises as nf}from"fs";fe();import{promises as lt}from"fs";import R from"path";import Jp from"os";var Uo=".comet/config.yaml";async function Ko(t){try{return await lt.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Kp(t){try{let e=await lt.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Zt(t,e){let i=R.relative(t,e);return i===""||!R.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${R.sep}`)}async function ei(t){let e=[],i=t;for(;!await Ko(i);){let r=R.dirname(i);if(r===i)break;e.push(R.basename(i)),i=r}let n=await lt.realpath(i);return R.resolve(n,...e.reverse())}async function El(t){try{return(await lt.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ti(t){let e=R.resolve(t);try{(await lt.stat(e)).isDirectory()||(e=R.dirname(e))}catch(r){if(r.code!=="ENOENT")throw r}let i=e,n=R.resolve(Jp.homedir());for(;;){if(!(e===n&&i!==n)){let a=R.join(e,...Uo.split("/")),s=e===i||await Kp(a);if(await Ko(a)&&s)return e}if(await Ko(R.join(e,".git")))return e;let o=R.dirname(e);if(o===e)return i;e=o}}function Yo(t){return ct(t)}async function Up(t,e){let i=Yo(e),n=R.resolve(t,...i.split("/")),r=await lt.realpath(t),o=await ei(n);if(!Zt(r,o))throw new Error("native.artifact_root resolves outside the project root");return n}async function Xo(t,e){let i=Yo(e),n=await Up(t,i),r=R.join(n,"comet");if(await El(r))throw new Error("The configured Native comet root must not be a symbolic link");let[o,a]=await Promise.all([ei(n),ei(r)]);if(!Zt(o,a))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:R.resolve(t),configFile:R.join(t,...Uo.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:R.join(r,"specs"),changesDir:R.join(r,"changes"),archiveDir:R.join(r,"archive"),runtimeDir:R.join(r,"runtime"),locksDir:R.join(r,"runtime","locks"),transactionsDir:R.join(r,"runtime","transactions")}}function ut(t,e){return Zt(R.resolve(t),R.resolve(e))}async function de(t,e){let i=R.resolve(t),n=R.resolve(e);if(!Zt(i,n))throw new Error(`Path is outside the Native root: ${e}`);if(await El(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[r,o]=await Promise.all([ei(i),ei(n)]);if(!Zt(r,o))throw new Error(`Path resolves outside the Native root: ${e}`);return n}import{promises as dg}from"fs";import A from"path";import{promises as Yp}from"fs";async function ii(t){try{return await Yp.access(t),!0}catch(e){if(Xp(e))return!1;throw e}}function Xp(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}fe();Be();Mn();Pe();var ci=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},ra=class extends Error{constructor(i,n,r){let o=M(r,i),a=M(r,n);super(`Classic layout conflict: both ${o}/ and ${a}/ exist; run comet doctor and resolve the conflict before writing`);this.configuredRoot=i;this.alternateRoot=n;this.name="ClassicLayoutConflictError"}configuredRoot;alternateRoot;code="classic-layout-conflict"},Tl=".comet/config.yaml";function hg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ol(t){await H(t,Tl,{label:Tl,expected:"file"})}function Il(t,e){let i=A.resolve(t),n=e==="docs"?A.join(i,"docs"):i,r=A.join(n,"openspec"),o=A.join(i,"docs","superpowers");return{projectRoot:i,artifactLayout:e,openSpecBase:n,openSpecRoot:r,changesDir:A.join(r,"changes"),archiveDir:A.join(r,"changes","archive"),specsDir:A.join(r,"specs"),superpowersRoot:o,superpowersSpecsDir:A.join(o,"specs"),superpowersPlansDir:A.join(o,"plans"),superpowersReportsDir:A.join(o,"reports")}}async function mg(t){await Ol(t);let e=await Me(t,{allowPartialProject:!0});if(!e?.config)throw new ci;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new ci("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function pg(t,e){return Il(t,e??await mg(t))}async function gg(t,e){let i=await pg(t,e),n=i.artifactLayout==="legacy"?"docs":"legacy",r=Il(t,n).openSpecRoot,[o,a]=await Promise.all([H(i.projectRoot,M(i.projectRoot,i.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),H(i.projectRoot,M(i.projectRoot,r),{label:"Alternate Classic OpenSpec root",expected:"directory"})]),s=o.exists,c=a.exists;return{paths:i,configuredRootExists:s,alternateRoot:r,alternateRootExists:c,dualRoots:s&&c}}async function wg(t,e){let i=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,e,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of i){let r=M(t.projectRoot,n);await H(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function qe(t,e,i={}){let n=await gg(t,e);if(await wg(n.paths,n.alternateRoot),n.dualRoots&&!i.allowAlternateRoot)throw new ra(n.paths.openSpecRoot,n.alternateRoot,n.paths.projectRoot);if(!n.configuredRootExists){let r=M(n.paths.projectRoot,n.paths.openSpecRoot),o=M(n.paths.projectRoot,n.alternateRoot);throw new ci(`Configured Classic OpenSpec root is missing: ${r} (alternate ${o} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function Bn(t,e,i={}){let n=A.join(A.resolve(t),".comet","classic-root-move.json");if(await ii(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await qe(t,e,i);if(!await ii(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${M(r.projectRoot,r.openSpecRoot)}`);return r}async function jl(t){let e=A.resolve(t),i=null;try{(await dg.lstat(e)).isDirectory()||(e=A.dirname(e))}catch(n){if(!hg(n))throw n}for(;;){A.basename(e)==="openspec"&&(i=A.dirname(e));let n=A.join(e,".comet","config.yaml"),r=!1;if(await ii(n))try{await Ol(e);let a=(await Me(e))?.value;r=!!a&&typeof a=="object"&&!Array.isArray(a)&&(a.schema==="comet.project.v1"||a.default_workflow!==void 0||a.native!==void 0)}catch{}if(r||await ii(A.join(e,".git")))return e;let o=A.dirname(e);if(o===e)return i??A.resolve(t);e=o}}function M(t,e){return A.relative(A.resolve(t),e).replaceAll("\\","/")}import{readFileSync as vg}from"fs";var yg=new Set(["applypatch","create","createfile","deletefile","edit","editfile","patch","strreplaceeditor","write","writefile","writefiletool"]),bg=new Set(["glob","grep","listfiles","read","readfile","search","view"]),Dl=["file_path","filePath","path","target_file","targetFile"],Ml=["file_paths","filePaths","paths","files","targets"],Bl=["operations","edits"],Ng=["patch","diff","patchText","patch_text","changes"],oa=new Set(["claude","codex","windsurf","github-copilot","gemini","amazon-q","qwen","kiro","codebuddy","qoder"]);function aa(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Ll(t){return t.toLowerCase().replace(/[^a-z0-9]+/gu,"")}function Sg(t){for(let e of["tool_name","toolName","tool","name"]){let i=t[e];if(typeof i=="string"&&i.trim())return i.trim()}return null}function kg(t){if(typeof t!="string")return t;let e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return t;try{return JSON.parse(e)}catch{return t}}function Eg(t){for(let e of["tool_input","toolInput","toolArgs","tool_args","arguments"])if(t[e]!==void 0)return kg(t[e]);return t}function $l(t){let e=[],i=[/^\*\*\* (?:Add|Update|Delete) File:\s+(.+?)\s*$/gmu,/^\+\+\+\s+(?:b\/)?(.+?)\s*$/gmu];for(let n of i)for(let r of t.matchAll(n)){let o=r[1]?.trim();o&&o!=="/dev/null"&&e.push(o)}return e}function Fe(t,e){if(typeof e=="string"){let i=e.trim();i&&t.push(i);return}if(Array.isArray(e)){for(let i of e)Fe(t,i);return}if(aa(e)){for(let i of Dl)Fe(t,e[i]);for(let i of Ml)Fe(t,e[i]);for(let i of Bl)Fe(t,e[i])}}function Cg(t,e){let i=[],n=[e,t].filter(aa);for(let r of n){for(let o of Dl)Fe(i,r[o]);for(let o of Ml)Fe(i,r[o]);for(let o of Bl)Fe(i,r[o]);for(let o of Ng){let a=r[o];typeof a=="string"&&i.push(...$l(a))}}return typeof e=="string"&&i.push(...$l(e)),[...new Set(i)]}function li(t,e){if(e?.trim())return{intent:"write",targets:[e.trim()],toolName:null};if(!t.trim())return{intent:"unknown",targets:[],toolName:null};let i;try{i=JSON.parse(t)}catch{return{intent:"unknown",targets:[],toolName:null}}if(!aa(i))return{intent:"unknown",targets:[],toolName:null};let n=Sg(i),r=Cg(i,Eg(i));return n&&yg.has(Ll(n))?{intent:r.length>0?"write":"unknown",targets:r,toolName:n}:n&&bg.has(Ll(n))?{intent:"non-write",targets:[],toolName:n}:n?{intent:"unknown",targets:r,toolName:n}:{intent:r.length>0?"write":"unknown",targets:r,toolName:null}}function sa(){let t=process.env.FILE_PATH;if(t?.trim()||process.stdin.isTTY)return li("",t);try{return li(vg(0,"utf8"),t)}catch{return li("",t)}}function ql(t,e){return oa.has(t)?t==="github-copilot"?{exitCode:0,stdout:e.allowed?`{}
142
+ `,i)+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 i=Ar(e),r=ht(i);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=Ar(e),r=ht(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};_l.Parser=ta});var jl=v(ri=>{"use strict";var Al=qo(),ig=Jt(),ii=Xt(),rg=Mn(),ng=C(),og=ea(),Tl=ia();function Ol(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new og.LineCounter||null,prettyErrors:e}}function ag(t,e={}){let{lineCounter:i,prettyErrors:r}=Ol(e),n=new Tl.Parser(i?.addNewLine),o=new Al.Composer(e),a=Array.from(o.compose(n.parse(t)));if(r&&i)for(let s of a)s.errors.forEach(ii.prettifyError(t,i)),s.warnings.forEach(ii.prettifyError(t,i));return a.length>0?a:Object.assign([],{empty:!0},o.streamInfo())}function Il(t,e={}){let{lineCounter:i,prettyErrors:r}=Ol(e),n=new Tl.Parser(i?.addNewLine),o=new Al.Composer(e),a=null;for(let s of o.compose(n.parse(t),!0,t.length))if(!a)a=s;else if(a.options.logLevel!=="silent"){a.errors.push(new ii.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(a.errors.forEach(ii.prettifyError(t,i)),a.warnings.forEach(ii.prettifyError(t,i))),a}function sg(t,e,i){let r;typeof e=="function"?r=e:i===void 0&&e&&typeof e=="object"&&(i=e);let n=Il(t,i);if(!n)return null;if(n.warnings.forEach(o=>rg.warn(n.options.logLevel,o)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:r},i))}function cg(t,e,i){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=i??e??{};if(!n)return}return ng.isDocument(t)&&!r?t.toString(i):new ig.Document(t,r,i).toString(i)}ri.parse=sg;ri.parseAllDocuments=ag;ri.parseDocument=Il;ri.stringify=cg});var mt=v(x=>{"use strict";var lg=qo(),ug=Jt(),fg=ko(),ra=Xt(),dg=Ot(),Ae=C(),hg=Ce(),mg=O(),pg=xe(),gg=Re(),wg=Rr(),vg=Qo(),yg=ea(),bg=ia(),Or=jl(),Ll=Rt();x.Composer=lg.Composer;x.Document=ug.Document;x.Schema=fg.Schema;x.YAMLError=ra.YAMLError;x.YAMLParseError=ra.YAMLParseError;x.YAMLWarning=ra.YAMLWarning;x.Alias=dg.Alias;x.isAlias=Ae.isAlias;x.isCollection=Ae.isCollection;x.isDocument=Ae.isDocument;x.isMap=Ae.isMap;x.isNode=Ae.isNode;x.isPair=Ae.isPair;x.isScalar=Ae.isScalar;x.isSeq=Ae.isSeq;x.Pair=hg.Pair;x.Scalar=mg.Scalar;x.YAMLMap=pg.YAMLMap;x.YAMLSeq=gg.YAMLSeq;x.CST=wg;x.Lexer=vg.Lexer;x.LineCounter=yg.LineCounter;x.Parser=bg.Parser;x.parse=Or.parse;x.parseAllDocuments=Or.parseAllDocuments;x.parseDocument=Or.parseDocument;x.stringify=Or.stringify;x.visit=Ll.visit;x.visitAsync=Ll.visitAsync});import Ir from"path";function kg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||Ir.posix.isAbsolute(i)||Ir.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function pt(t){let e=kg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Bl(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function ai(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||Ir.posix.isAbsolute(r)||Ir.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let n=r.split("/");if(n.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(n.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return n.join("/")}function ni(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Ml(t,e,i){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function $r(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>jr)throw new Error(`${e} exceeds ${jr} characters`);let i=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?i+=1:t[r]==="*"&&(i+=1,t[r+1]==="*"&&(r+=1));if(i>Lr)throw new Error(`${e} contains more than ${Lr} wildcard tokens`);return t}function $l(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>$r(r,e)))].sort((r,n)=>r.localeCompare(n,"en"))}function na(t,e,i){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function Sg(t){if(t===void 0)return{...le,include:[...le.include],exclude:[...le.exclude]};let e=ni(t,"native.snapshot");return{include:$l(e.include,"native.snapshot.include",le.include),exclude:$l(e.exclude,"native.snapshot.exclude",le.exclude),max_files:na(e.max_files,le.max_files,"native.snapshot.max_files"),max_total_bytes:na(e.max_total_bytes,le.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:na(e.max_duration_ms,le.max_duration_ms,"native.snapshot.max_duration_ms")}}function Eg(t){if(t===void 0)return;let e=ni(t,"native.pending_root_move"),i=e.id,r=e.from_artifact_root,n=e.to_artifact_root,o=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof n!="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 a;if(e.cleanup!==void 0){let s=ni(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,f=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");a={kind:c,state:l,manifestHash:f}}return{id:i,fromArtifactRoot:pt(r),toArtifactRoot:pt(n),stage:o,...a?{cleanup:a}:{}}}function Cg(t,e={}){let i=ni(t,"native"),r=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"sequential";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=i.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let a=i.max_verify_failures??Dl;if(!Number.isSafeInteger(a)||a<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Eg(i.pending_root_move);return{artifact_root:pt(r),language:Ml(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:o,max_verify_failures:a,snapshot:Sg(i.snapshot),...s?{pending_root_move:s}:{}}}function Pg(t){let e=ni(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=e.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Bl(e.artifact_layout),language:Ml(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function xg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Rg(t,e,i,r,n){let o=t.schema!==void 0;if(!(o||t.default_workflow!==void 0||t.workflows!==void 0||!n.allowPartialProject&&t.native!==void 0)||n.allowPartialProject&&!o)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 s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];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:r,...e?{native:e}:{},...i?{classic:i}:{}}}function gt(t,e={}){let i=(0,oa.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let r=i.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=r,o=xg(n.ambient_resume),a=n.native===void 0?void 0:Cg(n.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),s=n.classic===void 0?void 0:Pg(n.classic),c=Rg(n,a,s,o,{allowPartialProject:e.allowPartialProject??!1});return{value:n,config:c,ambient_resume:o,...a?{native:a}:{},...s?{classic:s}:{}}}var oa,oi,jr,Lr,Dl,Ng,le,ue=M(()=>{"use strict";oa=xt(mt(),1),oi=64*1024,jr=1024,Lr=64,Dl=5,Ng=[".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/**"],le={include:["**/*"],exclude:[...Ng],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});function Te(t){return t!==0&&t!==0n&&t!=="0"}function fe(t,e){return Te(t.dev)&&Te(e.dev)&&Te(t.ino)&&Te(e.ino)}function T(t,e){let i=Te(t.dev)&&Te(e.dev);if(i&&t.dev!==e.dev)return!1;let r=Te(t.ino)&&Te(e.ino);return r&&t.ino!==e.ino?!1:i&&r?!0:t.birthtime===e.birthtime}var fi=M(()=>{"use strict"});import{constants as Dr,promises as We}from"fs";function ua(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Wl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function di(t){return{dev:t.dev,ino:t.ino,birthtime:ua(t)}}function Br(t,e){let i=di(t),r=di(e);return fe(i,r)?T(i,r):T(i,r)&&ua(t)===ua(e)&&Wl(t)===Wl(e)&&t.size===e.size}async function hi(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,o=await We.lstat(t,{bigint:n});if(!o.isFile()||o.isSymbolicLink())throw new ge("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new ge("too-large",`${r} exceeds ${e} bytes`);let a=await We.realpath(t);await i.verify?.("pre-open",{realPath:a,identity:di(o)});let s=process.platform==="win32"?Dr.O_RDONLY:Dr.O_RDONLY|Dr.O_NOFOLLOW|Dr.O_NONBLOCK,c;try{c=await We.open(t,s)}catch(l){throw l.code==="ELOOP"?new ge("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:n}),We.lstat(t,{bigint:n}),We.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==a||!Br(o,l)||!Br(o,f))throw new ge("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:di(l)}),await i.hooks?.afterOpen?.();let d=[],m=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-m,{bytesRead:k}=await c.read(w,0,Math.min(w.length,b),null);if(k===0)break;if(m+=k,m>e)throw new ge("too-large",`${r} exceeds ${e} bytes`);d.push(Buffer.from(w.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:n}),We.lstat(t,{bigint:n}),We.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||y!==a||!Br(o,h)||!Br(o,p))throw new ge("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:di(h)}),{bytes:Buffer.concat(d,m),stat:h,realPath:y}}finally{await c.close()}}var ge,Mr=M(()=>{"use strict";fi();ge=class extends Error{reason;constructor(e,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Fr}from"fs";import Oe from"path";function jg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function fa(t,e){let i=Oe.relative(t,e);return i===""||!Oe.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Oe.sep}`)}async function ql(t,e){let i=Oe.resolve(t),r=await Fr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Fr.realpath(i)}async function Hl(t,e,i,r){let n=t;for(let o=0;o<i.length;o++){n=Oe.join(n,i[o]);let a;try{a=await Fr.lstat(n)}catch(f){if(jg(f))return{exists:!1,kind:"missing"};throw f}let s=Oe.relative(t,n).replaceAll("\\","/");if(a.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=o===i.length-1;if(!c&&!a.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!a.isFile()||r.expected==="directory"&&!a.isDirectory()||r.expected==="any"&&!a.isFile()&&!a.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Fr.realpath(n);if(!fa(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:a.isFile()?"file":a.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function H(t,e,i){let r=ai(e,i.label),n=Oe.resolve(t),o=await ql(n,i.label),a=r.split("/"),s=Oe.resolve(n,...a);if(!fa(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await Hl(n,o,a,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function te(t,e,i,r){let n=await H(t,e,{label:r.label,expected:"file"});if(!n.exists){let a=new Error(`${r.label} does not exist`);throw a.code="ENOENT",a}let o=await ql(n.projectRoot,r.label);return hi(n.target,i,{...r,verify:async(a,s)=>{if(!fa(o,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await Hl(n.projectRoot,o,n.relative.split("/"),{label:r.label,expected:"file"})}})}var we=M(()=>{"use strict";Mr();ue()});import{createHash as Lg}from"crypto";function $g(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function qe(t,e={}){return(await pi(t,e)).document}async function Dg(t){try{return(await te(t,mi,oi,{label:mi})).bytes}catch(e){if($g(e))return null;throw e}}function Bg(t){return t?{exists:!0,sha256:Lg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function pi(t,e={}){let i=await Dg(t);return{document:i?gt(i.toString("utf8"),e):null,identity:Bg(i)}}async function da(t){return(await qe(t))?.config??null}var mi,He=M(()=>{"use strict";ue();we();mi=".comet/config.yaml"});import{randomUUID as Mg}from"crypto";import{constants as Fg,promises as I}from"fs";import B from"path";async function ha(t,e){try{return await I.link(t,e),{linked:!0}}catch(i){let r=i.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw i}return await I.copyFile(t,e,Fg.COPYFILE_EXCL),{linked:!1}}function yt(t,e){let i=B.relative(t,e);return i===""||!B.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${B.sep}`)}function qr(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Wg(t,e){return T(t,qr(e))}function Wr(t,e){let i=qr(t),r=qr(e);return fe(i,r)?T(i,r):T(i,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Hr(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),...qr(e)}}async function Ie(t){for(let e of t){let i=await I.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!Wg(e,i)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function qg(t,e){let i=B.resolve(t),r=B.resolve(e);if(!yt(i,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let n=[await Hr(i)],o=B.relative(i,r).split(B.sep).filter(Boolean),a=i;for(let s of o){await Ie(n),a=B.join(a,s);try{await I.mkdir(a)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Hr(a);if(!yt(n[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${a}`);n.push(c)}return await Ie(n),n}async function Hg(t,e){let i=B.resolve(t),r=B.resolve(e);if(!yt(i,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let n=[await Hr(i)],o=B.relative(i,r).split(B.sep).filter(Boolean),a=i;for(let s of o){a=B.join(a,s);try{let c=await Hr(a);if(!yt(n[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${a}`);n.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await Ie(n),n}async function Gl(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(i){let r=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw i}finally{await e?.close()}}async function Gg(t,e,i){let r=B.dirname(t),n=await qg(i.containedRoot,r),o=B.join(r,`.${B.basename(t)}.${Mg()}.tmp`),a,s;try{await i.beforeTemporaryOpen?.(),a=await I.open(o,"wx"),s=await a.stat();let[c,l]=await Promise.all([I.lstat(o),I.realpath(o)]);if(await Ie(n),!c.isFile()||c.isSymbolicLink()||!Wr(s,c)||!yt(n[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await a.writeFile(e,"utf8"):await a.writeFile(e),await a.sync(),!Wr(s,await a.stat()))throw new Error("Contained atomic write temporary file changed while writing");await a.close(),a=void 0,await i.beforeCommit?.(),await Ie(n);let f=await I.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!Wr(f,s))throw new Error("Contained atomic write temporary file changed before commit");i.exclusive?(await ha(o,t),await I.unlink(o)):await I.rename(o,t),await Gl(r)}catch(c){await a?.close();try{await Ie(n),await I.rm(o,{force:!0})}catch{}throw c}}async function ve(t,e,i){await Gg(t,e,i)}async function ma(t,e){let i=B.dirname(t),r=await Hg(e.containedRoot,i);if(!r)return!1;let n,o;try{n=await I.lstat(t),o=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!n.isFile()||n.isSymbolicLink()||!yt(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await Ie(r);let[a,s]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!a.isFile()||a.isSymbolicLink()||!Wr(n,a)||s!==o)throw new Error("Contained file removal target changed before removal");return await I.unlink(t),await Ie(r),await Gl(i),!0}var Ge=M(()=>{"use strict";fi()});var vk,pa=M(()=>{"use strict";Ge();He();we();vk=16*1024});var zr=M(()=>{"use strict";Ge();ue();He();we();pa()});var Xr=M(()=>{"use strict"});var du=M(()=>{"use strict"});var Ra=M(()=>{"use strict";Xr()});var hu=M(()=>{"use strict";Xr();Ra()});var Iw,pu=M(()=>{"use strict";Iw=xt(mt(),1);Ge();ue();we()});var gu=M(()=>{"use strict";Xr();Ge();du();hu();ue();pu();we();He();zr();pa();Ra()});import{TextDecoder as Lw}from"util";function wu(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function $w(t,e){try{return new Lw("utf-8",{fatal:!0}).decode(t.bytes)}catch(i){throw new Error(`${e} is not valid UTF-8`,{cause:i})}}async function _a(t,e,i,r,n={}){try{let o=await te(t,e,i,{label:r,hooks:n.hooks});return{result:o,text:$w(o,r)}}catch(o){let a=o.code;if(a==="ENOENT"||a==="ENOTDIR")return null;throw o}}async function vu(t,e,i,r,n={}){return(await _a(t,e,i,r,n))?.text??null}async function yu(t,e,i,r,n,o={}){if(Buffer.byteLength(i,"utf8")>r)throw new Error(`${n} exceeds ${r} bytes`);let a=await _a(t,e,r,n),s=await H(t,e,{label:n,expected:"file"});await ve(s.target,i,{containedRoot:s.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await _a(t,e,r,n);if(!(!a&&!c)){if(!a||!c)throw new Error(`${n} changed before commit`);if(a.result.realPath!==c.result.realPath||!T(wu(a.result.stat),wu(c.result.stat))||a.text!==c.text)throw new Error(`${n} changed before commit`)}}})}async function bu(t,e,i,r={}){let n=await H(t,e,{label:i,expected:"file"});return n.exists?ma(n.target,{containedRoot:n.projectRoot,beforeRemove:r.beforeRemove}):!1}var Nu=M(()=>{"use strict";gu();fi()});var Pu={};Vf(Pu,{RUN_STATE_FILE:()=>Qr,applyRunStateToDocument:()=>Su,readRunState:()=>Aa,removeRunState:()=>Cu,runStateFromDocument:()=>Si,writeRunState:()=>Ta});import Dw from"path";function ki(t,e){let i=t[e];if(typeof i!="string"||i.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return i}function Ni(t,e){let i=ki(t,e);if(Dw.isAbsolute(i)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(i)||i.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return i}function Bw(t){let e=t.run_retries??"{}",i;try{i=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(i))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return i}function Si(t){if(!t.run_id)return null;let e=ki(t,"run_id"),i=ki(t,"skill"),r=ki(t,"skill_version"),n=ki(t,"skill_hash"),o=Ni(t,"pending_ref"),a=Ni(t,"trajectory_ref"),s=Ni(t,"context_ref"),c=Ni(t,"artifacts_ref"),l=Ni(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:i,skillVersion:r,skillHash:n,orchestration:t.orchestration,currentStep:ku(t,"current_step"),iteration:f,pending:ku(t,"pending"),pendingRef:o,trajectoryRef:a,contextRef:s,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Bw(t)}}function Su(t,e){e?t.run_id=e.runId:delete t.run_id}function Mw(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 Fw(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 Si(e)}async function Aa(t,e={}){let i=await vu(t,Qr,Eu,"Run state",e);if(i===null)return null;let r=JSON.parse(i);return Fw(r)}async function Ta(t,e,i={}){await yu(t,Qr,JSON.stringify(Mw(e),null,2),Eu,"Run state",i)}async function Cu(t,e={}){await bu(t,Qr,"Run state",e)}var ku,Qr,Eu,Ei=M(()=>{"use strict";Nu();ku=(t,e)=>{let i=t[e];return i==null?null:String(i)};Qr=".comet/run-state.json",Eu=256*1024});import Ff from"path";import{promises as Mf}from"fs";ue();import{promises as wt}from"fs";import R from"path";import _g from"os";var sa=".comet/config.yaml";async function aa(t){try{return await wt.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Ag(t){try{let e=await wt.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function si(t,e){let i=R.relative(t,e);return i===""||!R.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${R.sep}`)}async function ci(t){let e=[],i=t;for(;!await aa(i);){let n=R.dirname(i);if(n===i)break;e.push(R.basename(i)),i=n}let r=await wt.realpath(i);return R.resolve(r,...e.reverse())}async function Fl(t){try{return(await wt.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function li(t){let e=R.resolve(t);try{(await wt.stat(e)).isDirectory()||(e=R.dirname(e))}catch(n){if(n.code!=="ENOENT")throw n}let i=e,r=R.resolve(_g.homedir());for(;;){if(!(e===r&&i!==r)){let a=R.join(e,...sa.split("/")),s=e===i||await Ag(a);if(await aa(a)&&s)return e}if(await aa(R.join(e,".git")))return e;let o=R.dirname(e);if(o===e)return i;e=o}}function ca(t){return pt(t)}async function Tg(t,e){let i=ca(e),r=R.resolve(t,...i.split("/")),n=await wt.realpath(t),o=await ci(r);if(!si(n,o))throw new Error("native.artifact_root resolves outside the project root");return r}async function la(t,e){let i=ca(e),r=await Tg(t,i),n=R.join(r,"comet");if(await Fl(n))throw new Error("The configured Native comet root must not be a symbolic link");let[o,a]=await Promise.all([ci(r),ci(n)]);if(!si(o,a))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:R.resolve(t),configFile:R.join(t,...sa.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:R.join(n,"specs"),changesDir:R.join(n,"changes"),archiveDir:R.join(n,"archive"),runtimeDir:R.join(n,"runtime"),locksDir:R.join(n,"runtime","locks"),transactionsDir:R.join(n,"runtime","transactions")}}function vt(t,e){return si(R.resolve(t),R.resolve(e))}async function pe(t,e){let i=R.resolve(t),r=R.resolve(e);if(!si(i,r))throw new Error(`Path is outside the Native root: ${e}`);if(await Fl(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[n,o]=await Promise.all([ci(i),ci(r)]);if(!si(n,o))throw new Error(`Path resolves outside the Native root: ${e}`);return r}import{promises as Ug}from"fs";import A from"path";import{promises as Og}from"fs";async function ui(t){try{return await Og.access(t),!0}catch(e){if(Ig(e))return!1;throw e}}function Ig(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ue();He();zr();we();var ze=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},wa=class extends Error{constructor(i,r,n){let o=$(n,i),a=$(n,r);super(`Classic layout conflict: both ${o}/ and ${a}/ exist; run comet doctor and resolve the conflict before writing`);this.configuredRoot=i;this.alternateRoot=r;this.name="ClassicLayoutConflictError"}configuredRoot;alternateRoot;code="classic-layout-conflict"},Vl=".comet/config.yaml";function Yg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Kl(t){await H(t,Vl,{label:Vl,expected:"file"})}function Jl(t,e){let i=A.resolve(t),r=e==="docs"?A.join(i,"docs"):i,n=A.join(r,"openspec"),o=A.join(i,"docs","superpowers");return{projectRoot:i,artifactLayout:e,openSpecBase:r,openSpecRoot:n,changesDir:A.join(n,"changes"),archiveDir:A.join(n,"changes","archive"),specsDir:A.join(n,"specs"),superpowersRoot:o,superpowersSpecsDir:A.join(o,"specs"),superpowersPlansDir:A.join(o,"plans"),superpowersReportsDir:A.join(o,"reports")}}async function Xg(t){await Kl(t);let e=await qe(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new ze;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new ze("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Qg(t,e){return Jl(t,e??await Xg(t))}async function Zg(t,e){let i=await Qg(t,e),r=i.artifactLayout==="legacy"?"docs":"legacy",n=Jl(t,r).openSpecRoot,[o,a]=await Promise.all([H(i.projectRoot,$(i.projectRoot,i.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),H(i.projectRoot,$(i.projectRoot,n),{label:"Alternate Classic OpenSpec root",expected:"directory"})]),s=o.exists,c=a.exists;return{paths:i,configuredRootExists:s,alternateRoot:n,alternateRootExists:c,dualRoots:s&&c}}async function ew(t,e){let i=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,e,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let r of i){let n=$(t.projectRoot,r);await H(t.projectRoot,n,{label:`Classic managed physical path ${n}`,expected:"directory"})}}async function ye(t,e,i={}){let r=await Zg(t,e);if(await ew(r.paths,r.alternateRoot),r.dualRoots&&!i.allowAlternateRoot)throw new wa(r.paths.openSpecRoot,r.alternateRoot,r.paths.projectRoot);if(!r.configuredRootExists){let n=$(r.paths.projectRoot,r.paths.openSpecRoot),o=$(r.paths.projectRoot,r.alternateRoot);throw new ze(`Configured Classic OpenSpec root is missing: ${n} (alternate ${o} is ${r.alternateRootExists?"present":"missing"})`)}return r.paths}async function Vr(t,e,i={}){let r=A.join(A.resolve(t),".comet","classic-root-move.json");if(await ui(r))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let n=await ye(t,e,i);if(!await ui(n.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${$(n.projectRoot,n.openSpecRoot)}`);return n}async function Ul(t){let e=A.resolve(t),i=null;try{(await Ug.lstat(e)).isDirectory()||(e=A.dirname(e))}catch(r){if(!Yg(r))throw r}for(;;){A.basename(e)==="openspec"&&(i=A.dirname(e));let r=A.join(e,".comet","config.yaml"),n=!1;if(await ui(r))try{await Kl(e);let a=(await qe(e))?.value;n=!!a&&typeof a=="object"&&!Array.isArray(a)&&(a.schema==="comet.project.v1"||a.default_workflow!==void 0||a.native!==void 0)}catch{}if(n||await ui(A.join(e,".git")))return e;let o=A.dirname(e);if(o===e)return i??A.resolve(t);e=o}}function $(t,e){return A.relative(A.resolve(t),e).replaceAll("\\","/")}import{readFileSync as tw}from"fs";import Yl from"path";var iw=new Set(["applypatch","create","createfile","deletefile","edit","editfile","patch","strreplaceeditor","write","writefile","writefiletool"]),rw=new Set(["glob","grep","listfiles","read","readfile","search","view"]),Zl=["file_path","filePath","path","target_file","targetFile"],eu=["file_paths","filePaths","paths","files","targets"],tu=["operations","edits"],nw=["patch","diff","patchText","patch_text","changes"],va=new Set(["claude","codex","windsurf","github-copilot","gemini","amazon-q","qwen","kiro","codebuddy","qoder"]);function ya(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Xl(t){return t.toLowerCase().replace(/[^a-z0-9]+/gu,"")}function ow(t){for(let e of["tool_name","toolName","tool","name"]){let i=t[e];if(typeof i=="string"&&i.trim())return i.trim()}return null}function aw(t){for(let e of["cwd","working_directory","workspaceRoot"]){let i=t[e];if(!(typeof i!="string"||!i.trim()||!Yl.isAbsolute(i.trim())))return Yl.resolve(i.trim())}}function sw(t){if(typeof t!="string")return t;let e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return t;try{return JSON.parse(e)}catch{return t}}function cw(t){for(let e of["tool_input","toolInput","toolArgs","tool_args","arguments"])if(t[e]!==void 0)return sw(t[e]);return t}function Ql(t){let e=[],i=[/^\*\*\* (?:Add|Update|Delete) File:\s+(.+?)\s*$/gmu,/^\+\+\+\s+(?:b\/)?(.+?)\s*$/gmu];for(let r of i)for(let n of t.matchAll(r)){let o=n[1]?.trim();o&&o!=="/dev/null"&&e.push(o)}return e}function Ve(t,e){if(typeof e=="string"){let i=e.trim();i&&t.push(i);return}if(Array.isArray(e)){for(let i of e)Ve(t,i);return}if(ya(e)){for(let i of Zl)Ve(t,e[i]);for(let i of eu)Ve(t,e[i]);for(let i of tu)Ve(t,e[i])}}function lw(t,e){let i=[],r=[e,t].filter(ya);for(let n of r){for(let o of Zl)Ve(i,n[o]);for(let o of eu)Ve(i,n[o]);for(let o of tu)Ve(i,n[o]);for(let o of nw){let a=n[o];typeof a=="string"&&i.push(...Ql(a))}}return typeof e=="string"&&i.push(...Ql(e)),[...new Set(i)]}function gi(t,e){if(e?.trim())return{intent:"write",targets:[e.trim()],toolName:null};if(!t.trim())return{intent:"unknown",targets:[],toolName:null};let i;try{i=JSON.parse(t)}catch{return{intent:"unknown",targets:[],toolName:null}}if(!ya(i))return{intent:"unknown",targets:[],toolName:null};let r=ow(i),n=lw(i,cw(i)),o=aw(i);return r&&iw.has(Xl(r))?{intent:n.length>0?"write":"unknown",targets:n,toolName:r,...o?{cwd:o}:{}}:r&&rw.has(Xl(r))?{intent:"non-write",targets:[],toolName:r,...o?{cwd:o}:{}}:r?{intent:"unknown",targets:n,toolName:r,...o?{cwd:o}:{}}:{intent:n.length>0?"write":"unknown",targets:n,toolName:null,...o?{cwd:o}:{}}}function ba(){let t=process.env.FILE_PATH;if(t?.trim()||process.stdin.isTTY)return gi("",t);try{return gi(tw(0,"utf8"),t)}catch{return gi("",t)}}function iu(t,e){return va.has(t)?t==="github-copilot"?{exitCode:0,stdout:e.allowed?`{}
143
143
  `:`${JSON.stringify({permissionDecision:"deny",permissionDecisionReason:e.reason})}
144
144
  `,stderr:""}:e.allowed?{exitCode:0,stdout:"",stderr:""}:{exitCode:2,stdout:"",stderr:`${e.reason}
145
145
  `}:{exitCode:64,stdout:"",stderr:`Unsupported Comet Hook platform: ${t}
146
- `}}var ui=null;async function Fl(t){if(ui!==null)return t();ui={entries:new Map};try{return await t()}finally{ui=null}}function Wl(t,e){let i=t;for(let n of e)i+="\0"+(typeof n=="string"?n:JSON.stringify(n));return i}function Q(t,e){return(...i)=>{let n=ui;if(n===null)return e(...i);let r=Wl(`async:${t}`,i),o=n.entries.get(r);if(o)return o.value;let a=e(...i).catch(s=>{throw n.entries.delete(r),s});return n.entries.set(r,{value:a}),a}}function ca(t,e){return(...i)=>{let n=ui;if(n===null)return e(...i);let r=Wl(`sync:${t}`,i),o=n.entries.get(r);if(o)return o.value;let a=e(...i);return n.entries.set(r,{value:a}),a}}import{promises as Yn,readFileSync as ok}from"fs";import V from"path";import Hl from"path";dt();fe();Pe();import fi from"path";var WN=2*1024*1024;function xg(t,e,i){let n=fi.resolve(t),r=fi.isAbsolute(e)?fi.resolve(e):fi.resolve(n,e),o=fi.relative(n,r).replaceAll("\\","/");return{root:n,relative:Xt(o,i),target:r}}async function di(t,e,i){let n=xg(t,e,i.label);return H(n.root,n.relative,i)}function la(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}'
147
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function ua(t){let e=la(t);if(e)throw new Error(e)}function Rg(t,e){return{label:M(t,e),directory:e}}async function _g(t,e,i){let n=Rg(t,e);if(!(await di(t,e,{label:i,expected:"directory"})).exists)return{change:n,exists:!1,stateExists:!1};let o=await di(t,Hl.join(e,".comet.yaml"),{label:`${i} state`,expected:"file"});return{change:n,exists:!0,stateExists:o.exists}}async function hi(t,e=process.cwd()){ua(t);let i=await qe(e),n=await _g(i.projectRoot,Hl.join(i.changesDir,t),`Classic active change ${t}`);return{...n.change,exists:n.exists,stateExists:n.stateExists}}var fa=Pi(Ut(),1);import{execFileSync as zl}from"child_process";import{randomUUID as Ag}from"crypto";import{promises as mi}from"fs";import Gl from"path";function Tg(t){try{let e=zl("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 Og=ca("liveGitBranch",t=>Tg(t));function Ig(t){try{return zl("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var jg=ca("isGitWorkTree",t=>Ig(t)),Lg=["current","branch","worktree"];function Vl(t){return Lg.includes(t)}function $g(t){return Vl(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function qn(t,e){let i=Gl.join(t,".comet.yaml"),n=(0,fa.parseDocument)(await mi.readFile(i,"utf8"),{uniqueKeys:!1});if(n.errors.length>0)throw new Error(`Invalid .comet.yaml: ${n.errors[0].message}`);let r=n.toJS()??{},o=typeof r.isolation=="string"?r.isolation:null,a=typeof r.bound_branch=="string"&&r.bound_branch!==""?r.bound_branch:null,s=Vl(o),c=Og(e.cwd),l=s&&a===null&&c===null?jg(e.cwd):!0,f=$g({isolation:o,boundBranch:a,currentBranch:c,gitWorkTree:l});return f.status==="needs-heal"&&e.heal?(await Dg(t,f.branch),{status:"healed",branch:f.branch,bindingRequired:s,currentBranch:c}):{...f,bindingRequired:s,currentBranch:c}}async function Dg(t,e){let i=Gl.join(t,".comet.yaml"),n=(0,fa.parseDocument)(await mi.readFile(i,"utf8"),{uniqueKeys:!1});n.set("bound_branch",e);let r=`${i}.${Ag()}.tmp`;try{await mi.writeFile(r,n.toString(),"utf8"),await mi.rename(r,i)}catch(o){throw await mi.rm(r,{force:!0}),o}}function Mg(t){return t??"detached HEAD"}function Fn(t,e,i){return`change '${t}' is bound to branch '${e}', but current branch is '${Mg(i)}'`}function Wn(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}In();import Bg from"path";var da="comet.selection.v2",qg=16*1024;function ha(t){return Bg.join(t,".comet","current-change.json")}function Fg(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Jl(t){return t===null||typeof t=="string"}function Wg(t){let e;try{e=JSON.parse(t)}catch(i){throw new Error(`current change selection contains invalid JSON: ${i instanceof Error?i.message:String(i)}`,{cause:i})}if(!Fg(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&&!Jl(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:da,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==da)throw new Error(`current change selection schema must be ${da}`);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(!Jl(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 ht(t){let e;try{let n=ha(t),{bytes:r}=await oi(n,qg,{label:"current change selection"});e=r.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",...Wg(e)}}var Jn=Pi(Ut(),1);dt();Pe();import Vn from"path";vi();var ya=["full","hotfix","tweak"],su=1,lu=["open","design","build","verify","archive"],iw=["en","zh-CN"],nw=["off","beta"],rw=["subagent-driven-development","executing-plans","direct"],ow=["plan-ready"],aw=["confirmed"],sw=["tdd","direct"],cw=["off","standard","thorough"],lw=["current","branch","worktree"],uw=["light","full"],fw=["pending","pass","fail"],dw=["pending","handled"],hw=["pending","confirmed"],ba=["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"],mw=["run_id"],uu=new Set([...ba,...mw]),pw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function cu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function mt(t,e){let i=t[e];if(i==null||i==="")return null;if(typeof i!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return i}function q(t,e,i,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!i.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${i.join(", ")}${n?" or null":""}`);return r}function va(t,e,i=!0){let n=t[e];if(n==null||n===""){if(i)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 gw(t,e,i=0){let n=t[e];if(n==null||n==="")return i;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 Gn(t,e){let i=mt(t,e);if(i===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(i)||i.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return i}function ww(t,e){let i=mt(t,e);if(i!==null&&!/^[a-f0-9]{64}$/u.test(i))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return i}function vw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==su)throw new Error(`Invalid Classic state: classic_migration must be ${su}`);return e}function yw(t){if(!ba.some(i=>cu(t,i)))return null;for(let i of pw)if(!cu(t,i))return null;return{workflow:q(t,"workflow",ya,!1),language:q(t,"language",iw),phase:q(t,"phase",lu,!1),contextCompression:q(t,"context_compression",nw),buildMode:q(t,"build_mode",rw),buildPause:q(t,"build_pause",ow),subagentDispatch:q(t,"subagent_dispatch",aw),tddMode:q(t,"tdd_mode",sw),reviewMode:q(t,"review_mode",cw),isolation:q(t,"isolation",lw),boundBranch:mt(t,"bound_branch"),verifyMode:q(t,"verify_mode",uw),autoTransition:va(t,"auto_transition"),baseRef:mt(t,"base_ref"),designDoc:Gn(t,"design_doc"),plan:Gn(t,"plan"),verifyResult:q(t,"verify_result",fw,!1),verifyFailures:gw(t,"verify_failures"),verificationReport:Gn(t,"verification_report"),branchStatus:q(t,"branch_status",dw),createdAt:mt(t,"created_at"),verifiedAt:mt(t,"verified_at"),archiveConfirmation:q(t,"archive_confirmation",hw),archived:va(t,"archived",!1),directOverride:va(t,"direct_override"),handoffContext:Gn(t,"handoff_context"),handoffHash:ww(t,"handoff_hash"),classicProfile:q(t,"classic_profile",ya),classicMigration:vw(t)}}function fu(t,e){let i=e??null;if(i===null&&e===void 0&&t.run_id&&t.skill)try{i=wi(t)}catch(n){let r=n instanceof Error?n.message:String(n);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:n})}return{classic:yw(t),run:i,unknownKeys:Object.keys(t).filter(n=>!uu.has(n))}}function du(t){let e=t.workflow,i=t.phase,n=t.archived,r=t.design_doc;return{workflow:typeof e=="string"&&ya.includes(e)?e:null,phase:typeof i=="string"&&lu.includes(i)?i:null,archived:n===!0,designDoc:typeof r=="string"&&r!==""?r:null,unknownKeys:Object.keys(t).filter(o=>!uu.has(o))}}vi();var bw=2*1024*1024;function yi(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 Nw(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 i of e)t.delete(i)}function Sw(t){let e=!1;for(let i of["build_command","verify_command"])t.has(i)&&(t.delete(i),e=!0);return e}async function hu(t){let e;try{e=(await ae(Vn.dirname(t),Vn.basename(t),bw,{label:"Classic state document"})).bytes.toString("utf8")}catch(n){if(n.code!=="ENOENT")throw n;return new Jn.Document({})}let i=(0,Jn.parseDocument)(e);if(i.errors.length>0)throw new Error(`Invalid Classic state document: ${i.errors[0].message}`);return yi(i),i}async function Kn(t,e={}){let i=e.migrate!==!1,n=Vn.join(t,".comet.yaml"),r=await hu(n),o=yi(r),a=Sw(r);a&&(o=yi(r));let s=await ga(t);if(!s&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(vi(),au));s=c(o),s&&i&&(await wa(t,s),Nw(r),a=!0)}return a&&i&&await Re(n,r.toString(),{containedRoot:t}),fu(yi(r),s)}async function mu(t){let e=await hu(Vn.join(t,".comet.yaml"));return du(yi(e))}var Pw=Q("readCometCurrentSelection",t=>ht(t));async function xw(t,e){ua(e);let i=await hi(e,t);if(!i.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let n=await Kn(i.directory,{migrate:!1});if(!n.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(n.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return i.directory}async function Un(t){let e;try{e=await Pw(t)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let i=e.selection,n;try{n=await xw(t,i.change)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}let r=await qn(n,{heal:!1,cwd:t});return r.status==="drift"?{status:"stale",reason:Fn(i.change,r.boundBranch,r.currentBranch)}:r.status==="unbound-detached"?{status:"stale",reason:Wn(i.change)}:r.status==="ok"?{status:"selected",selection:i}:i.branch!==null&&r.currentBranch!==i.branch?{status:"stale",reason:`current change '${i.change}' was selected on branch '${i.branch}', current branch is '${r.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:i}}function Ae(t,e){return{exitCode:t,stderr:e+`
148
- `}}function _e(t){return Ae(0,`[COMET-HOOK] allowed: ${t}`)}function Ni(t){return t.replaceAll("\\","/").replace(/\/+/gu,"/")}function We(t){let e=Ni(t);return process.platform==="win32"?e.toLowerCase():e}function pu(t,e){let i=Ni(V.relative(e,t));return i===""?"":i.startsWith("../")||i===".."||V.isAbsolute(i)?null:i}async function Rw(t){let e=V.resolve(t),i=V.parse(e).root,n=[],r=e;for(;r&&r!==i;)try{let o=await Yn.realpath(r);return V.join(o,...n.reverse())}catch(o){let a=o.code;if(a!=="ENOENT"&&a!=="ENOTDIR")throw o;n.push(V.basename(r)),r=V.dirname(r)}try{let o=await Yn.realpath(i);return V.join(o,...n.reverse())}catch{return null}}async function _w(t,e){let i=V.isAbsolute(t)?t:V.resolve(process.cwd(),t),n=Ni(i),r=pu(i,e);if(r!==null)return r;try{let o=await Rw(i),a=await Yn.realpath(e);if(o){let s=pu(o,a);if(s!==null)return s;n=Ni(o)}}catch{if(!V.isAbsolute(t))return Ni(t).replace(/^\.\//u,"")}return n.replace(/^\.\//u,"")}async function yu(t){try{let e=await Kn(t,{migrate:!1}),i=Array.from(new Set(e.unknownKeys)).sort();if(i.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${i.join(", ")}`);if(!e.classic)throw new Error("Classic state projection is unavailable");return{changeDir:t,phase:e.classic.phase,classic:e.classic,archived:e.classic.archived}}catch{let e=await mu(t);return e.phase?{changeDir:t,phase:e.phase,classic:null,archived:e.archived}:null}}async function Aw(t){let e=(await qe(t)).changesDir,i=[];if(!(await di(t,e,{label:"Classic changes directory",expected:"directory"})).exists)return i;for(let r of(await Yn.readdir(e,{withFileTypes:!0})).sort((o,a)=>o.name.localeCompare(a.name))){if(r.name==="archive"||la(r.name))continue;let o=await hi(r.name,t);if(!o.exists||!o.stateExists)continue;let a=await yu(o.directory);!a||a.archived||i.push(a)}return i}var Si=Q("classicActiveChanges",t=>Aw(t));async function bu(t){return(await Si(t)).map(e=>({workflow:"classic",name:se(e),phase:e.phase}))}function Nu(t,e){return`${M(t,e.superpowersRoot)}/`}function Su(t,e){return We(t).startsWith(We(e))}function Tw(t,e){return[{prefix:`${M(t,e.superpowersSpecsDir)}/`,field:"designDoc",wireField:"design_doc",phase:"design"},{prefix:`${M(t,e.superpowersPlansDir)}/`,field:"plan",wireField:"plan",phase:"build"},{prefix:`${M(t,e.superpowersReportsDir)}/`,field:"verificationReport",wireField:"verification_report",phase:"verify"}]}function Ow(t,e){let i=We(t),n=e.find(o=>i.startsWith(We(o.prefix)));if(!n)return null;let r=i.slice(We(n.prefix).length);return!r||r.includes("/")||!r.endsWith(".md")?null:n}function ku(t,e){return t.classic?.[e.field]??null}function gu(t,e){return t.classic!==null&&t.phase===e.phase&&!ku(t,e)}function Eu(t){return t.phase==="design"||t.phase==="build"||t.phase==="verify"}function se(t){return t.changeDir?V.basename(t.changeDir):null}var Iw=new Set(["design","plan","verify","verification","verification-report","report"]);function wu(t){return t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function jw(t,e){return[e.classic?.designDoc,e.classic?.plan,e.classic?.verificationReport].some(n=>n&&We(n)===We(t))}function Lw(t,e){let n=(t.split("/").at(-1)??t).replace(/\.[^.]+$/u,"");if(n===e)return!0;let r=[...Iw].map(wu).join("|");return new RegExp(`(^|[-_.])${wu(e)}[-_.](${r})$`,"u").test(n)}async function $w(t,e){let i=await Si(e),n=i.find(a=>jw(t,a));if(n)return{governing:n,match:"recorded"};let o=i.filter(Eu).filter(a=>{let s=se(a);return s!==null&&Lw(t,s)}).sort((a,s)=>(se(s)?.length??0)-(se(a)?.length??0))[0];return o?{governing:o,match:"named"}:null}async function vu(t,e,i){let n=await Si(t);if(n.length===0)return null;if(i)return n.find(a=>se(a)===i)??{blockedResult:bi(e,`selected change '${i}' is no longer active`)};let r=await Un(t);if(r.status==="stale")return{blockedResult:bi(e,r.reason)};if(r.status==="selected"){let o=n.find(a=>se(a)===r.selection.change);return o||{blockedResult:bi(e,`selected change '${r.selection.change}' is no longer active`)}}if(n.length===1){let o=n[0];if(o.changeDir!==null){let a=await qn(o.changeDir,{heal:!1,cwd:t}),s=se(o)??"unknown";if(a.status==="drift")return{blockedResult:bi(e,Fn(s,a.boundBranch,a.currentBranch))};if(a.status==="unbound-detached")return{blockedResult:bi(e,Wn(s))}}return o}return{blockedResult:Gw(e,n.map(o=>se(o)).filter(Boolean))}}async function Dw(t,e,i,n){let r=`${M(e,i.changesDir)}/`;if(t.startsWith(r)){let o=t.slice(r.length),[a]=o.split("/");if(a&&a!=="archive"){let s=await hi(a,e);if(s.stateExists){let c=await yu(s.directory);return c||{changeDir:s.directory,phase:"open",classic:null,archived:!1}}return{changeDir:s.directory,phase:"open",classic:null,archived:!1}}}if(Su(t,Nu(e,i))){let o=await $w(t,e);if(o?.match==="recorded")return{...o.governing,superpowersArtifact:"matched"};let a=Ow(t,Tw(e,i));if(o)return a?{...o.governing,superpowersArtifact:gu(o.governing,a)?"matched":"unmatched",superpowersSlot:a}:{...o.governing,superpowersArtifact:"matched"};if(a){let l=await vu(e,t,n);return!l||"blockedResult"in l?l:{...l,superpowersArtifact:gu(l,a)?"matched":"unmatched",superpowersSlot:a}}let s=await Si(e),c=n?s.find(l=>se(l)===n)??null:s[0]??null;return c?{...c,superpowersArtifact:"unmatched"}:null}return vu(e,t,n)}function Mw(t){return!t.includes("/")&&t.endsWith(".md")}function Bw(t){return t.startsWith(".comet/")||t.includes("/.comet/")}function qw(t){return t===".superpowers"||t.startsWith(".superpowers/")}function Fw(t,e,i){if(!t.startsWith(i))return null;let n=t.endsWith("/.comet.yaml")||t.endsWith("/.openspec.yaml"),r=t.endsWith("/proposal.md")||t.endsWith("/design.md")||t.endsWith("/tasks.md"),o=t.includes("/.comet/"),a=t.includes("/specs/");return e==="open"&&(r||n||o||a)?`${t} (phase: open, openspec artifacts)`:e==="design"&&(r||n||o||a)?`${t} (phase: design, handoff/spec)`:e==="build"&&(t.endsWith("/tasks.md")||n||a)?`${t} (phase: build, spec/tasks)`:e==="verify"&&(t.endsWith("/tasks.md")||n)?`${t} (phase: verify, tasks/state)`:e==="archive"&&n?`${t} (phase: archive, state)`:null}function Ww(t,e){let i=e==="open"?[" BLOCKED: source writes are not allowed during open"," This phase does not allow source writes"," ALLOWED: create proposal/design/tasks artifacts and run guard"," NEXT: finish clarification and artifacts, then run guard --apply"]:e==="design"?[" BLOCKED: source writes are not allowed during design"," This phase does not allow source writes"," ALLOWED: run brainstorming, create the Design Doc, and run guard"," NEXT: finish the Design Doc, then run comet guard <change-name> design --apply to enter build"]:[" BLOCKED: source writes are not allowed during archive"," This phase does not allow source writes"," ALLOWED: confirm archive state and run the archive script"];return Ae(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e}`,` Target file: ${t}`,"",...i,""].join(`
149
- `))}function Hw(t){return Ae(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," Current phase: build (workflow: full), but design_doc is empty",` Target file: ${t}`,""," BLOCKED: full workflow source writes require a recorded Design Doc"," This phase does not allow source writes until design_doc is recorded"," NEXT: return to design, create/link the Design Doc, then run guard again",""].join(`
150
- `))}function zw(t,e){let i=e.superpowersSlot,n=i?ku(e,i):null,r=i?e.phase!==i.phase?[` BLOCKED: ${i.wireField} cannot be first-written in phase ${e.phase}`,` Expected phase: ${i.phase}`," NEXT: resume the matching Comet phase or use an already recorded artifact path"]:n?[` BLOCKED: ${i.wireField} is already recorded for this change`,` Recorded path: ${n}`," NEXT: write the recorded artifact or explicitly correct the state path"]:[" BLOCKED: standard Superpowers artifact state is incomplete"," NEXT: validate the active change state, then retry the matching phase"]:[" BLOCKED: unmatched Superpowers artifact"," This docs/superpowers/ path does not match any active change artifact"," NEXT: use a recorded artifact path or a standard phase artifact directory"];return Ae(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e.phase}`,` Target file: ${t}`,"",...r,""].join(`
151
- `))}function Gw(t,e){return Ae(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: multiple active changes require a current change",` Target file: ${t}`,` Active changes: ${e.join(", ")}`,""," NEXT: run comet state select <change-name>, then retry the source write",""].join(`
152
- `))}function bi(t,e){return Ae(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: current change selection is stale or invalid",` Target file: ${t}`,` Reason: ${e}`,""," NEXT: run comet state select <change-name>, then retry the source write",""].join(`
153
- `))}async function Vw(t,e,i){let n=await _w(e,t),r;try{r=await Bn(t)}catch(c){return Ae(2,`[COMET-HOOK] blocked: ${c instanceof Error?c.message:String(c)}`)}if(Bw(n))return _e(`${n} (whitelist: comet config)`);if(qw(n))return _e(`${n} (whitelist: superpowers workspace)`);if(n==="CLAUDE.md"||n==="CHANGELOG.md"||n==="README.md"||Mw(n))return _e(`${n} (whitelist: root markdown)`);let o;try{o=await Dw(n,t,r,i)}catch(c){return Ae(2,`[COMET-HOOK] blocked: ${c instanceof Error?c.message:String(c)}`)}if(!o)return _e("no active comet change");if("blockedResult"in o)return o.blockedResult;if(o.archived)return _e(`${n} (own change archived)`);let a=o.phase,s=Fw(n,a,`${M(t,r.openSpecRoot)}/`);if(s)return _e(s);if(Su(n,Nu(t,r))){if(o.superpowersArtifact==="matched"&&Eu(o))return _e(`${n} (phase: ${a}, superpowers)`);if(o.superpowersArtifact==="unmatched")return zw(n,o)}return a==="build"&&o.classic?.workflow==="full"&&!o.classic.designDoc?Hw(n):a==="build"||a==="verify"?_e(`${n} (phase: ${a})`):Ww(n,a)}async function Cu(t,e,i){if(i.intent!=="non-write")try{await Bn(t)}catch(o){return{allowed:!1,reason:o instanceof Error?o.message:String(o),workflow:"classic",change:e}}let n;try{n=await Si(t)}catch(o){return{allowed:!1,reason:o instanceof Error?o.message:String(o),workflow:"classic",change:e}}let r=n.find(o=>se(o)===e);if(!r)return{allowed:!1,reason:`Selected Classic change ${e} is missing or archived; resume /comet-classic before retrying`,workflow:"classic",change:e};if(i.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};if(i.intent==="unknown"||i.targets.length===0)return r.phase==="verify"||r.phase==="build"&&!(r.classic?.workflow==="full"&&!r.classic.designDoc)?{allowed:!0,reason:`Classic change is in ${r.phase}`,workflow:"classic",change:e,phase:r.phase}:{allowed:!1,reason:`Hook write target could not be determined while Classic change ${e} is in ${r.phase}; resume /comet-classic before retrying`,workflow:"classic",change:e,phase:r.phase};for(let o of i.targets){let a=await Vw(t,o,e);if(a.exitCode!==0)return{allowed:!1,reason:a.stderr?.trim()||"Classic phase guard blocked the write",workflow:"classic",change:e,phase:r.phase}}return{allowed:!0,reason:`Classic write allowed in ${r.phase}`,workflow:"classic",change:e,phase:r.phase}}import{promises as hy}from"fs";import vt from"path";var _a=Pi(Ut(),1);import{promises as Vv}from"fs";import Ke from"path";import{createHash as Yw}from"node:crypto";import{promises as Z}from"node:fs";import J from"node:path";import{TextDecoder as Xw}from"node:util";var Jw=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),Kw=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function Uw(t){return t.toLowerCase().startsWith(".env")}function Na(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>Uw(n))?"environment-file":i.some(n=>Kw.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>Jw.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}ni();var Qw=1024*1024;function Sa(t,e){let i=J.relative(t,e);return i===""||!J.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${J.sep}`)}function Zw(t){let e=J.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(r=>{let o=r.codePointAt(0)??0;return o<=31||o===127})||J.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),n=Na(t);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${t}`);return t}function ev(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function tv(t,e){return T({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Xn(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return oe(i,n)?T(i,n):T(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Pu(t){let e=await Z.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await Z.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function iv(t,e){let i=J.resolve(t),n=J.resolve(e);if(!Sa(i,n))throw new Error("Native artifact path is outside its root");let r=[await Pu(i)],o=i;for(let a of J.relative(i,n).split(J.sep).filter(Boolean)){o=J.join(o,a);let s=await Pu(o);if(!Sa(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${o}`);r.push(s)}return r}async function xu(t){for(let e of t){let i=await Z.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!tv(e,i)||await Z.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function ka(t){let e=Zw(t.ref),i=ev(t.maxBytes??Qw),n=J.resolve(t.root,...e.split("/")),r=await iv(t.root,J.dirname(n));await t.hooks?.afterParentChainCaptured?.();let o=await Z.lstat(n);if(!o.isFile()||o.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(o.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let a=await Z.realpath(n);if(!Sa(r[0].realPath,a))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await Z.open(n,"r");try{let[c,l,f]=await Promise.all([s.stat(),Z.lstat(n),Z.realpath(n)]);if(await xu(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||f!==a||!Xn(o,c)||!Xn(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let u=[],d=0,p=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let S=i+1-d,k=await s.read(p,0,Math.min(p.length,S),null);if(k.bytesRead===0)break;if(d+=k.bytesRead,d>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);u.push(Buffer.from(p.subarray(0,k.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[w,h,m]=await Promise.all([s.stat(),Z.lstat(n),Z.realpath(n)]);if(await xu(r),!h.isFile()||h.isSymbolicLink()||m!==a||!Xn(c,w)||!Xn(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(u,d),b;try{b=new Xw("utf-8",{fatal:!0}).decode(y)}catch(S){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:S})}return{ref:e,size:d,hash:Yw("sha256").update(y).digest("hex"),text:b}}finally{await s.close()}}fe();Be();Mn();var Qn=An;async function Zn(t){let e=(await Me(t))?.config??null;return e?.native?e:null}import{AsyncLocalStorage as nv}from"async_hooks";In();var Dk=16*1024;var Mk=new nv;import{TextDecoder as dv}from"util";import{createHash as rv}from"node:crypto";import{constants as er,promises as ee}from"node:fs";import te from"node:path";import{TextDecoder as ov}from"node:util";function ir(t,e){let i=te.relative(t,e);return i===""||!te.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${te.sep}`)}function av(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function sv(t,e){return T({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function cv(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function tr(t,e){return T({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Ca(t,e){let i=await ee.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await ee.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function lv(t,e,i){let n=te.resolve(t),r=te.resolve(e);if(!ir(n,r))throw new Error(`${i} is outside its managed root`);let o=[await Ca(n,i)],a=n;for(let s of te.relative(n,r).split(te.sep).filter(Boolean)){await He(o,i),a=te.join(a,s);let c=await Ca(a,i);if(!ir(o[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${a}`);o.push(c)}return await He(o,i),o}async function He(t,e){for(let i of t){let n=await ee.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!sv(i,n)||await ee.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function uv(t,e,i){let n=[],r=0,o=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let a=e+1-r,{bytesRead:s}=await t.read(o,0,Math.min(o.length,a),null);if(s===0)break;if(r+=s,r>e)throw new Error(`${i} exceeds ${e} bytes`);n.push(Buffer.from(o.subarray(0,s)))}return Buffer.concat(n,r)}async function Ru(t){let e=av(t.maxBytes),i=te.resolve(t.file),n=await lv(t.root,te.dirname(i),t.label),r=await Promise.all((t.forbiddenRoots??[]).map(f=>Ca(te.resolve(f),t.label)));await t.hooks?.afterParentChainCaptured?.(),await He(n,t.label);let o=await ee.lstat(i);if(!o.isFile()||o.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(o.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let a=cv(o),s=await ee.realpath(i);if(!ir(n[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(r.some(f=>ir(f.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?er.O_RDONLY:er.O_RDONLY|er.O_NOFOLLOW|er.O_NONBLOCK,l=await ee.open(i,c);try{let f=await l.stat();await t.hooks?.afterOpen?.();let[u,d]=await Promise.all([ee.lstat(i),ee.realpath(i)]);if(await He(n,t.label),await He(r,t.label),!f.isFile()||!u.isFile()||u.isSymbolicLink()||d!==s||!tr(a,f)||!tr(a,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let p=await uv(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[w,h,m]=await Promise.all([l.stat(),ee.lstat(i),ee.realpath(i)]);if(await He(n,t.label),await He(r,t.label),!h.isFile()||h.isSymbolicLink()||m!==s||!tr(a,w)||!tr(a,h))throw new Error(`${t.label} changed while reading`);return{bytes:p,hash:rv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function _u(t){let e=await Ru(t),i;try{i=new ov("utf-8",{fatal:!0}).decode(e.bytes)}catch(n){throw new Error(`${t.label} is not valid UTF-8`,{cause:n})}return{...e,text:i}}var iE=256*1024,nE=1024*1024,rE=16*1024;var oE=64*1024*1024;var aE=new dv("utf-8",{fatal:!0});import rr from"path";import{createHash as hv}from"crypto";function Ou(t){return hv("sha256").update(t).digest("hex")}var xE={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},pv=1e3,gv=8*1024*1024,wv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,vv=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),yv=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),bv=new Set(["schema","include","exclude","hash"]),Nv=new Set(["provider","gitSelection","physicalSelection","projection"]),Sv=new Set(["provider","selection"]),kv=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),Ev=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),Cv=new Set(["schema","status","before","after"]),Pv=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),xv=new Set(["path","hash","size","type","gitObjectId"]),Rv=new Set(["path","size","type","reason"]),_v=new Set(["ref","hash","count"]),Av=new Set(["change-created","legacy-migration","explicit"]),Tv=new Set(["file","directory","other"]),Ov=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),or=/^[a-f0-9]{64}$/u,Iv=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var RE=64*1024,_E=64*1024;var AE={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},TE={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function nr(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var OE=(1n<<256n)-1n;function jv(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function Lv(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
154
- `)}function $v(t,e){return Ou(`comet.native.snapshot-policy.v1
155
- ${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function Pa(t,e,i){let n=new Set(e),r=[...e];for(;r.length>0;){if(i&&!i())return null;let o=r.pop(),a=t[o];a&&(a.kind==="star"||a.kind==="globstar"||a.kind==="globstar-slash")&&!n.has(o+1)&&(n.add(o+1),r.push(o+1))}return n}function Dv(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function Iu(t){let e=Qn(t,"Native snapshot pattern"),i=[];for(let n=0;n<e.length;n+=1){let r=e[n];r==="*"&&e[n+1]==="*"?(n+=1,e[n+1]==="/"?(n+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):r==="*"?i.push({kind:"star"}):r==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:r})}return(n,r)=>{let o=r?Dv(r):void 0;if(o&&!o())return!1;let a=Pa(i,new Set([0]),o);if(a===null)return!1;for(let s of n){if(o&&!o())return!1;let c=new Set;for(let l of a){if(o&&!o())return!1;let f=i[l];f&&(f.kind==="literal"&&f.value===s||f.kind==="question"&&s!=="/"?c.add(l+1):f.kind==="star"&&s!=="/"||f.kind==="globstar"?c.add(l):f.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(a=Pa(i,c,o),a===null||a.size===0)return!1}return Pa(i,a,o)?.has(i.length)??!1}}function Mv(t){if(t===void 0)return;let e=[...new Set(t.include.map(r=>Qn(r,"include")))].sort((r,o)=>r.localeCompare(o,"en")),i=[...new Set(t.exclude.map(r=>Qn(r,"exclude")))].sort((r,o)=>r.localeCompare(o,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let n=$v(e,i);if("hash"in t&&t.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:n},includeMatchers:e.map(Iu),excludeMatchers:i.map(Iu),excludedDirectoryPrefixes:i.flatMap(r=>{if(!r.endsWith("/**"))return[];let o=r.slice(0,-3);return/[*?]/u.test(o)?[]:[o]}).sort((r,o)=>r.localeCompare(o,"en"))}}function K(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function U(t,e,i){let n=Object.keys(t).find(r=>!e.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function gt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function ce(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function $u(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=rr.posix.normalize(t);if(i!==t||rr.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function Bv(t,e){let i=K(t,`Native snapshot entry ${e}`);U(i,xv,`Native snapshot entry ${e}`);let n=$u(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!or.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let r={path:n,hash:i.hash,size:ce(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!Iv.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function qv(t,e){let i=K(t,`Native snapshot omission ${e}`);if(U(i,Rv,`Native snapshot omission ${e}`),!Tv.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!Ov.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:$u(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:ce(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function Fv(t){let e=K(t,"Native snapshot omission overflow");if(U(e,_v,"Native snapshot omission overflow"),typeof e.hash!="string"||!or.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:gt(e.count,"Native snapshot omission overflow count")}}function pt(t,e){let i=K(t,e);if(U(i,Ev,e),typeof i.hash!="string"||!or.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let n=ce(i.recordCount,`${e} recordCount`),r=ce(i.storedRecordCount,`${e} storedRecordCount`),o=ce(i.stdoutBytes,`${e} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:o,overflow:i.overflow}}function ju(t){let e=K(t,"Native Git selection evidence");if(U(e,kv,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=pt(e.stageBefore,"Native Git selection stageBefore"),n=pt(e.combined,"Native Git selection combined"),r=pt(e.stageAfter,"Native Git selection stageAfter"),o=pt(e.finalStageBefore,"Native Git selection finalStageBefore"),a=pt(e.finalCombined,"Native Git selection finalCombined"),s=pt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,o,a,s].some(u=>u.overflow),l=!nr(i,r)||!nr(r,o)||!nr(n,a)||!nr(o,s),f=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==f)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:f,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:o,finalCombined:a,finalStageAfter:s}}function Lu(t,e){let i=K(t,e);if(U(i,Pv,e),typeof i.hash!="string"||!or.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let n=ce(i.visitedNodeCount,`${e} visitedNodeCount`),r=ce(i.recordCount,`${e} recordCount`),o=ce(i.storedRecordCount,`${e} storedRecordCount`),a=ce(i.encodedBytes,`${e} encodedBytes`);if(o>r||!i.overflow&&o!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:o,encodedBytes:a,overflow:i.overflow,unstable:i.unstable}}function Wv(t){let e=K(t,"Native physical selection evidence");if(U(e,Cv,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Lu(e.before,"Native physical selection before"),n=Lu(e.after,"Native physical selection after"),r=i.overflow||n.overflow,o=i.unstable||n.unstable||!jv(i,n);if(!r&&!o)throw new Error("Native physical selection evidence must describe an exceptional selection");let a=r&&o?"overflow-and-changed":r?"overflow":"changed";if(e.status!==a)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:a,before:i,after:n}}function Hv(t){let e=K(t,"Native content snapshot manifest");if(U(e,vv,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!Av.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let g=K(e.capture,"Native content snapshot capture");if(U(g,Nv,"Native content snapshot capture"),g.provider!=="git"&&g.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let P=g.gitSelection===void 0?void 0:ju(g.gitSelection),N=g.physicalSelection===void 0?void 0:Wv(g.physicalSelection),_=null;if(g.projection!==void 0){let z=K(g.projection,"Native content snapshot projection");if(U(z,Sv,"Native content snapshot projection"),z.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");_={provider:"git",...z.selection===void 0?{}:{selection:ju(z.selection)}}}if(g.provider==="git"){if(N||_)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...P?{gitSelection:P}:{}}}else{if(P)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(N&&_)throw new Error("Native physical-tree capture cannot combine selection and projection");i=_?{provider:"physical-tree",projection:_}:{provider:"physical-tree",...N?{physicalSelection:N}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=K(e.limits,"Native content snapshot limits");U(n,yv,"Native content snapshot limits");let r={maxFiles:gt(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:gt(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:gt(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:gt(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:gt(n.maxDurationMs,"Native snapshot maxDurationMs")}},o;if(e.policy!==void 0){let g=K(e.policy,"Native snapshot policy");if(U(g,bv,"Native snapshot policy"),g.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(g.include)||!Array.isArray(g.exclude))throw new Error("Native snapshot policy patterns must be arrays");o=Mv({include:g.include,exclude:g.exclude,hash:g.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let a=e.entries.map(Bv),s=e.omitted.map(qv),c=ce(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:Fv(e.omissionOverflow);if(a.length>r.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(a.some(g=>g.size>r.maxFileBytes)||a.reduce((g,P)=>g+P.size,0)>r.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(a.map(g=>g.path)).size!==a.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>pv||c<s.length)throw new Error("Native content snapshot omission count is invalid");let f=c-s.length;if(f===0&&l||f>0&&l?.count!==f)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let u=s.filter(g=>g.reason==="git-enumeration-limit"),d=s.filter(g=>g.reason==="git-selection-changed");for(let g of[...u,...d])if(g.path!=="."||g.size!==null||g.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(u.length>1||d.length>1)throw new Error("Native Git selection omissions must not be duplicated");let p=i?.provider==="git"?i.gitSelection:i?.projection?.selection,w=p?.status==="overflow"||p?.status==="overflow-and-changed",h=p?.status==="changed"||p?.status==="overflow-and-changed";if(w!==(u.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(d.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let m=s.filter(g=>g.reason==="physical-enumeration-limit"),y=s.filter(g=>g.reason==="physical-selection-changed");for(let g of[...m,...y])if(g.path!=="."||g.size!==null||g.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(m.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let b=i?.physicalSelection,S=b?.status==="overflow"||b?.status==="overflow-and-changed",k=b?.status==="changed"||b?.status==="overflow-and-changed";if(S!==(m.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(k!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:r,...o?{policy:o}:{},entries:a,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(Lv(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function zv(t,e){if(!wv.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=rr.join(t.changesDir,e);if(!ut(t.changesDir,i))throw new Error("Native change path escaped");return rr.join(i,"runtime","baseline-manifest.json")}async function Du(t,e){let i=zv(t,e);await de(t.nativeRoot,i);try{let n=await _u({root:t.nativeRoot,file:i,maxBytes:gv,label:"Native baseline snapshot manifest"});return Hv(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}vi();var GE={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};var nC=16*1024;var ze="comet.native.v3",Ge="comet.native.v2",Ve="comet.native.v1";var Bu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Jv=new Set(Bu),qu=new Set([...Bu,"minimum_runtime_version","revision"]),Kv=new Set([...qu,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Uv=new Set(["capability","operation","source","base_hash"]),Yv=new Set(["shape","build","verify","archive"]),Xv=new Set(["implicit","confirmed"]),Qv=new Set(["pending","pass","fail"]),wt="comet-state.yaml",Ra=/^[a-f0-9]{64}$/u,Fu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Zv=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,ar=class extends Error{constructor(i,n){super(`Native change ${i} uses ${n}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=n;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},Ue=class extends Error{constructor(i,n){super(i!==ze||n===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${n}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=n;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"};var CC=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
156
- `);function Ei(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Wu(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function sr(t){if(!Fu.test(t))throw new Error(`Invalid Native change name: ${t}`)}function ey(t){if(!Fu.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Hu(t,e){if(t.length===0||Ke.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function ty(t,e){let i=Ei(t,`spec_changes[${e}]`);if(Wu(i,Uv,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(ey(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let n=i.source,r=i.base_hash;if(n!==void 0&&typeof n!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof n=="string"&&Hu(n,`Spec source for ${i.capability}`),i.operation==="create"){if(!n)throw new Error(`Create spec ${i.capability} requires source`);if(r!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!n)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof r!="string"||!Ra.test(r))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(n!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof r!="string"||!Ra.test(r))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof n=="string"?{source:n}:{},base_hash:r}}function iy(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function Aa(t,e){if(Wu(t,e,wt),typeof t.name!="string")throw new Error("Native change name is required");if(sr(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!Yv.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Xv.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(ty),n=i.map(r=>r.capability).filter((r,o,a)=>a.indexOf(r)!==o);if(n.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(n)].join(", ")}`);if(typeof t.verification_result!="string"||!Qv.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Hu(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!iy(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function zu(t){let e=Ei(t,wt);if(e.schema!==Ve)throw new Error(`Expected ${Ve}`);return{schema:Ve,...Aa(e,Jv)}}function ki(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function xa(t,e,i){if(t===null)return null;let n=typeof t=="string"?Zv.exec(t):null;if(!n||n[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function ny(t){if(t==null)return null;if(typeof t!="string"||!Ra.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function ry(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function Gu(t){let e=Ei(t,wt);if(e.schema!==Ge)throw new Error(`Expected ${Ge}`);if(ki(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Ge} minimum_runtime_version must be 2`);return{schema:Ge,minimum_runtime_version:2,revision:ki(e.revision,"Native v2 revision"),...Aa(e,qu)}}function oy(t){let e=Ei(t,wt);if(e.schema!==ze){if(e.schema===Ve||e.schema===Ge){let a=e.schema===Ve?zu(e):Gu(e);throw new ar(a.name,a.schema)}throw new Ue(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=ki(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Ue(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let n=ki(e.revision,"Native revision"),r=Aa(e,Kv),o=ny(e.approved_contract_hash);if(r.approval===null&&o!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:ze,minimum_runtime_version:3,revision:n,verification_protocol:ry(e.verification_protocol),...r,approved_contract_hash:o,implementation_scope:xa(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:xa(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:xa(e.partial_allowance,"Native partial_allowance","allowances")}}function ay(t){let e=Ei(t,wt);if(e.schema===Ve){let r=zu(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${ze}`}}if(e.schema===Ge){let r=Gu(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${ze}`}}if(e.schema!==ze){let r=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new Ue(typeof e.schema=="string"?e.schema:"(missing)",r).message}}let i=ki(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new Ue(e.schema,i).message};let n=oy(e);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function Vu(t,e){sr(e);let i=Ke.join(t.changesDir,e);if(!ut(t.changesDir,i))throw new Error("Native change path escaped");return i}async function sy(t,e){let i=Ke.join(Vu(t,e),"runtime","schema-migration.json");await de(t.nativeRoot,i);try{return await Vv.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var cy=256*1024;async function ly(t,e=Ke.dirname(t)){let i=Ke.relative(e,t).split(Ke.sep).join("/"),n=await ka({root:e,ref:i,maxBytes:cy}),r=(0,_a.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${r.errors[0].message}`);return r.toJS()}async function uy(t,e){let i=Ke.join(Vu(t,e),wt);await de(t.nativeRoot,i);let n=ay(await ly(i,t.nativeRoot));if(n.state&&n.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await sy(t,e)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(n.status==="current"&&n.state&&await fy(t,n.state),n)}async function fy(t,e){if(await Du(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}async function cr(t,e){let i=await uy(t,e);if(i.status==="migration-required")throw new ar(e,i.schema);if(i.status==="runtime-incompatible"||!i.state)throw new Ue(i.schema,i.minimumRuntimeVersion);return i.state}var TC=16*1024;async function dy(t){let e=await ht(t.projectRoot);return e.status==="missing"||e.selection.workflow!=="native"?null:(sr(e.selection.change),e.selection)}async function Ju(t){let e=await dy(t);return e?(await cr(t,e.change),e.change):null}function lr(t,e){let i=vt.relative(t,e);return i===""||!i.startsWith("..")&&!vt.isAbsolute(i)}function my(t,e,i){return i.targets.length>0&&i.targets.every(n=>{let r=vt.resolve(t,n);return lr(t,r)?vt.relative(t,r).replaceAll("\\","/")===".comet/config.yaml"||lr(e,r):!0})}async function py(t){let e=await Zn(t);if(!e||!(e.workflows??[e.default_workflow]).includes("native"))return null;let i=await Xo(t,e.native.artifact_root),n;try{n=await hy.readdir(i.changesDir,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return{paths:i,changes:[]};throw o}let r=[];for(let o of n.sort((a,s)=>a.name.localeCompare(s.name))){if(!o.isDirectory()||o.isSymbolicLink())continue;let a=await cr(i,o.name);a.archived||r.push(a)}return{paths:i,changes:r}}var Ku=Q("nativeActiveContext",t=>py(t));async function Uu(t){return((await Ku(t))?.changes??[]).map(i=>({workflow:"native",name:i.name,phase:i.phase}))}async function Yu(t,e,i){let n=await Ku(t);if(!n)return{allowed:!0,reason:"Native workflow is not enabled"};if(e.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};if(n.changes.length===0)return{allowed:!0,reason:my(t,n.paths.nativeRoot,e)?"Native control artifact write":"No Native changes exist"};let r;if(i){if(r=n.changes.find(s=>s.name===i),!r)return{allowed:!1,reason:`Selected Native change ${i} is missing or archived; resume /comet-native before retrying`,workflow:"native",change:i}}else if(n.changes.length===1)r=n.changes[0];else{let s=await Ju(n.paths);if(r=n.changes.find(c=>c.name===s),!r)return{allowed:!1,reason:"Multiple Native changes are active; select the change to resume before writing code",workflow:"native"}}if(r.phase==="build")return{allowed:!0,reason:"Native change is in Build",workflow:"native",phase:r.phase,change:r.name};if(e.intent==="unknown"||e.targets.length===0)return{allowed:!1,reason:`Hook write target could not be determined while Native change ${r.name} is in ${r.phase}; resume /comet-native before retrying`,workflow:"native",phase:r.phase,change:r.name};let o=!1,a=!1;for(let s of e.targets){let c=vt.resolve(t,s);if(!lr(t,c)){a=!0;continue}if(vt.relative(t,c).replaceAll("\\","/")===".comet/config.yaml"||lr(n.paths.nativeRoot,c)){o=!0;continue}return{allowed:!1,reason:`Native change ${r.name} is in ${r.phase}; implementation writes are only allowed in build. Resume /comet-native to continue safely`,workflow:"native",phase:r.phase,change:r.name}}return{allowed:!0,reason:o?"Native control artifact write":a?"Write target is outside the guarded project":"No guarded write target was provided",workflow:"native",phase:r.phase,change:r.name}}Be();var Xu=Q("readWorkflowProjectConfig",t=>ea(t)),GC=Q("discoverNativeProject",t=>ti(t));var gy=Q("readCometCurrentSelection",t=>ht(t)),ef={listNative:Uu,listClassic:bu,inspectNative:Yu,inspectClassic:Cu};function wy(t){return t?t.workflows??[t.default_workflow]:["classic"]}async function Qu(t,e,i,n){let[r,o]=await Promise.all([e.includes("native")?n?.workflow==="native"?n.candidates:i.listNative(t):[],e.includes("classic")?n?.workflow==="classic"?n.candidates:i.listClassic(t):[]]);return[...r,...o]}function Zu(t,e){return t.length===0?{status:"none",staleSelection:e}:t.length===1?{status:"inferred",owner:t[0],staleSelection:e}:{status:"ambiguous",candidates:t,staleSelection:e}}async function vy(t,e=ef){let i=await Xu(t),n=wy(i),r;try{r=await gy(t)}catch(o){return{status:"stale",code:"selection-unreadable",reason:o instanceof Error?o.message:String(o)}}if(r.status==="selected"){let o=r.selection;if(!n.includes(o.workflow))return{status:"stale",code:"workflow-disabled",reason:`selected workflow '${o.workflow}' is not enabled for this project`};let a;try{a=o.workflow==="native"?await e.listNative(t):await e.listClassic(t)}catch(c){return{status:"stale",code:"change-state-unreadable",reason:`cannot safely enumerate active Comet changes: ${c instanceof Error?c.message:String(c)}`}}let s=a.find(c=>c.name===o.change);if(!s){let c={code:"target-missing",reason:`selected ${o.workflow} change '${o.change}' is missing or archived`};try{let l=await Qu(t,n,e,{workflow:o.workflow,candidates:a});return Zu(l,c)}catch(l){return{status:"stale",code:"change-state-unreadable",reason:`cannot safely enumerate active Comet changes: ${l instanceof Error?l.message:String(l)}`}}}if(o.workflow==="classic"){let c=await Un(t);if(c.status!=="selected")return{status:"stale",code:"classic-selection-invalid",reason:c.status==="stale"?c.reason:`selected Classic change '${o.change}' is no longer active`}}return{status:"owned",owner:s}}try{let o=await Qu(t,n,e);return Zu(o)}catch(o){return{status:"stale",code:"change-state-unreadable",reason:`cannot safely enumerate active Comet changes: ${o instanceof Error?o.message:String(o)}`}}}async function tf(t,e,i=ef){if(e.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};try{let n=await vy(t,i);if(n.status==="none")return{allowed:!0,reason:"No active Comet change"};if(n.status==="stale")return{allowed:!1,reason:`${n.reason}. Resume /comet-native or /comet-classic and select the current change before retrying`};if(n.status==="ambiguous")return{allowed:!1,reason:`Multiple active Comet changes require one current selection: ${n.candidates.map(o=>`${o.workflow}:${o.name}`).join(", ")}`};let r=n.owner;return r.workflow==="native"?i.inspectNative(t,e,r.name):i.inspectClassic(t,r.name,e)}catch(n){return{allowed:!1,reason:`Comet Hook Router failed closed: ${n instanceof Error?n.message:String(n)}`}}}var yy="Usage: comet-hook-router --platform <platform-id> [--project-root <project-root>]";function by(t){let e,i;for(let n=0;n<t.length;n++){let r=t[n];if(r==="--platform"){e=t[++n];continue}if(r==="--project-root"){i=t[++n];continue}throw new Error(`Unknown argument: ${r}`)}if(!e||e.startsWith("--"))throw new Error("--platform is required");if(!oa.has(e))throw new Error(`unsupported Hook platform: ${e}`);if(i?.startsWith("--"))throw new Error("--project-root requires a value");return{platformId:e,...i?{projectRoot:rf.resolve(i)}:{}}}async function Ny(t){if(t.projectRoot)return t.projectRoot;let e=await ti(process.cwd());for(let r of[[".comet","config.yaml"],[".git"]])try{return await nf.lstat(rf.join(e,...r)),e}catch(o){if(o.code!=="ENOENT")throw o}let i=await jl(process.cwd()),n=await qe(i);try{return await nf.lstat(n.changesDir),i}catch(r){if(r.code!=="ENOENT")throw r}return null}async function Sy(t){let e;try{e=by(t)}catch(r){return process.stderr.write(`${r instanceof Error?r.message:String(r)}
157
- ${yy}
158
- `),64}let i;try{let r=await Ny(e),o=sa();i=r?await Fl(()=>tf(r,o)):{allowed:!0,reason:"No Comet project discovered"}}catch(r){i={allowed:!1,reason:`Comet Hook Router failed closed during project discovery: ${r instanceof Error?r.message:String(r)}`}}let n=ql(e.platformId,i);return n.stdout&&process.stdout.write(n.stdout),n.stderr&&process.stderr.write(n.stderr),n.exitCode}process.exitCode=await Sy(process.argv.slice(2));export{Ny as projectRootFrom,Sy as runCometHookRouter};
146
+ `}}var wi=null;async function ru(t){if(wi!==null)return t();wi={entries:new Map};try{return await t()}finally{wi=null}}function nu(t,e){let i=t;for(let r of e)i+="\0"+(typeof r=="string"?r:JSON.stringify(r));return i}function K(t,e){return(...i)=>{let r=wi;if(r===null)return e(...i);let n=nu(`async:${t}`,i),o=r.entries.get(n);if(o)return o.value;let a=e(...i).catch(s=>{throw r.entries.delete(n),s});return r.entries.set(n,{value:a}),a}}function Na(t,e){return(...i)=>{let r=wi;if(r===null)return e(...i);let n=nu(`sync:${t}`,i),o=r.entries.get(n);if(o)return o.value;let a=e(...i);return r.entries.set(n,{value:a}),a}}import{promises as on,readFileSync as EE}from"fs";import J from"path";import au from"path";Ge();ue();we();import vi from"path";var Hk=2*1024*1024;function fw(t,e,i){let r=vi.resolve(t),n=vi.isAbsolute(e)?vi.resolve(e):vi.resolve(r,e),o=vi.relative(r,n).replaceAll("\\","/");return{root:r,relative:ai(o,i),target:n}}async function bt(t,e,i){let r=fw(t,e,i.label);return H(r.root,r.relative,i)}async function ou(t,e,i){return(await bt(t,e,{label:i.label,expected:i.expected??"any"})).exists}function ka(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}'
147
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function Sa(t){let e=ka(t);if(e)throw new Error(e)}function dw(t,e){return{label:$(t,e),directory:e}}async function hw(t,e,i){let r=dw(t,e);if(!(await bt(t,e,{label:i,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await bt(t,au.join(e,".comet.yaml"),{label:`${i} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}async function yi(t,e=process.cwd()){Sa(t);let i=await ye(e),r=await hw(i.projectRoot,au.join(i.changesDir,t),`Classic active change ${t}`);return{...r.change,exists:r.exists,stateExists:r.stateExists}}import{promises as Ea}from"fs";import z from"path";function su(t,e){let i=z.relative(t,e);return i===""||i!==".."&&!i.startsWith(`..${z.sep}`)&&!z.isAbsolute(i)}async function mw(t){let e=z.resolve(t),i=z.parse(e).root,r=[],n=e;for(;n&&n!==i;)try{let o=await Ea.realpath(n);return z.join(o,...r.reverse())}catch(o){let a=o.code;if(a!=="ENOENT"&&a!=="ENOTDIR")throw o;r.push(z.basename(n)),n=z.dirname(n)}try{let o=await Ea.realpath(i);return z.join(o,...r.reverse())}catch{return null}}async function Kr(t,e){let i=z.resolve(t),r=await Ea.realpath(i),n=[],o=[];for(let a of e){let s=z.isAbsolute(a)?z.resolve(a):z.resolve(i,a),c=await mw(s);((c?su(r,c):su(i,s))?n:o).push(a)}return{projectTargets:n,externalTargets:o}}var Ca=xt(mt(),1);import{execFileSync as cu}from"child_process";import{randomUUID as pw}from"crypto";import{promises as bi}from"fs";import lu from"path";function gw(t){try{let e=cu("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 ww=Na("liveGitBranch",t=>gw(t));function vw(t){try{return cu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var yw=Na("isGitWorkTree",t=>vw(t)),bw=["current","branch","worktree"];function uu(t){return bw.includes(t)}function Nw(t){return uu(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function Jr(t,e){let i=lu.join(t,".comet.yaml"),r=(0,Ca.parseDocument)(await bi.readFile(i,"utf8"),{uniqueKeys:!1});if(r.errors.length>0)throw new Error(`Invalid .comet.yaml: ${r.errors[0].message}`);let n=r.toJS()??{},o=typeof n.isolation=="string"?n.isolation:null,a=typeof n.bound_branch=="string"&&n.bound_branch!==""?n.bound_branch:null,s=uu(o),c=ww(e.cwd),l=s&&a===null&&c===null?yw(e.cwd):!0,f=Nw({isolation:o,boundBranch:a,currentBranch:c,gitWorkTree:l});return f.status==="needs-heal"&&e.heal?(await kw(t,f.branch),{status:"healed",branch:f.branch,bindingRequired:s,currentBranch:c}):{...f,bindingRequired:s,currentBranch:c}}async function kw(t,e){let i=lu.join(t,".comet.yaml"),r=(0,Ca.parseDocument)(await bi.readFile(i,"utf8"),{uniqueKeys:!1});r.set("bound_branch",e);let n=`${i}.${pw()}.tmp`;try{await bi.writeFile(n,r.toString(),"utf8"),await bi.rename(n,i)}catch(o){throw await bi.rm(n,{force:!0}),o}}function Sw(t){return t??"detached HEAD"}function Ur(t,e,i){return`change '${t}' is bound to branch '${e}', but current branch is '${Sw(i)}'`}function Yr(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}Mr();import Ew from"path";var Pa="comet.selection.v2",Cw=16*1024;function xa(t){return Ew.join(t,".comet","current-change.json")}function Pw(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function fu(t){return t===null||typeof t=="string"}function xw(t){let e;try{e=JSON.parse(t)}catch(i){throw new Error(`current change selection contains invalid JSON: ${i instanceof Error?i.message:String(i)}`,{cause:i})}if(!Pw(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&&!fu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Pa,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Pa)throw new Error(`current change selection schema must be ${Pa}`);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(!fu(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 Nt(t){let e;try{let r=xa(t),{bytes:n}=await hi(r,Cw,{label:"current change selection"});e=n.toString("utf8")}catch(r){if(r.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${r instanceof Error?r.message:String(r)}`,{cause:r})}return{status:"selected",...xw(e)}}var tn=xt(mt(),1);Ge();we();import en from"path";Ei();var Ia=["full","hotfix","tweak"],xu=1,_u=["open","design","build","verify","archive"],Ww=["en","zh-CN"],qw=["off","beta"],Hw=["subagent-driven-development","executing-plans","direct"],Gw=["plan-ready"],zw=["confirmed"],Vw=["tdd","direct"],Kw=["off","standard","thorough"],Jw=["current","branch","worktree"],Uw=["light","full"],Yw=["pending","pass","fail"],Xw=["pending","handled"],Qw=["pending","confirmed"],ja=["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"],Zw=["run_id"],Au=new Set([...ja,...Zw]),ev=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Ru(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(t,e){let i=t[e];if(i==null||i==="")return null;if(typeof i!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return i}function F(t,e,i,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!="string"||!i.includes(n))throw new Error(`Invalid Classic state: ${e} must be one of ${i.join(", ")}${r?" or null":""}`);return n}function Oa(t,e,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!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function tv(t,e,i=0){let r=t[e];if(r==null||r==="")return i;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function Zr(t,e){let i=kt(t,e);if(i===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(i)||i.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return i}function iv(t,e){let i=kt(t,e);if(i!==null&&!/^[a-f0-9]{64}$/u.test(i))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return i}function rv(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==xu)throw new Error(`Invalid Classic state: classic_migration must be ${xu}`);return e}function nv(t){if(!ja.some(i=>Ru(t,i)))return null;for(let i of ev)if(!Ru(t,i))return null;return{workflow:F(t,"workflow",Ia,!1),language:F(t,"language",Ww),phase:F(t,"phase",_u,!1),contextCompression:F(t,"context_compression",qw),buildMode:F(t,"build_mode",Hw),buildPause:F(t,"build_pause",Gw),subagentDispatch:F(t,"subagent_dispatch",zw),tddMode:F(t,"tdd_mode",Vw),reviewMode:F(t,"review_mode",Kw),isolation:F(t,"isolation",Jw),boundBranch:kt(t,"bound_branch"),verifyMode:F(t,"verify_mode",Uw),autoTransition:Oa(t,"auto_transition"),baseRef:kt(t,"base_ref"),designDoc:Zr(t,"design_doc"),plan:Zr(t,"plan"),verifyResult:F(t,"verify_result",Yw,!1),verifyFailures:tv(t,"verify_failures"),verificationReport:Zr(t,"verification_report"),branchStatus:F(t,"branch_status",Xw),createdAt:kt(t,"created_at"),verifiedAt:kt(t,"verified_at"),archiveConfirmation:F(t,"archive_confirmation",Qw),archived:Oa(t,"archived",!1),directOverride:Oa(t,"direct_override"),handoffContext:Zr(t,"handoff_context"),handoffHash:iv(t,"handoff_hash"),classicProfile:F(t,"classic_profile",Ia),classicMigration:rv(t)}}function Tu(t,e){let i=e??null;if(i===null&&e===void 0&&t.run_id&&t.skill)try{i=Si(t)}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(n.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:nv(t),run:i,unknownKeys:Object.keys(t).filter(r=>!Au.has(r))}}function Ou(t){let e=t.workflow,i=t.phase,r=t.archived,n=t.design_doc;return{workflow:typeof e=="string"&&Ia.includes(e)?e:null,phase:typeof i=="string"&&_u.includes(i)?i:null,archived:r===!0,designDoc:typeof n=="string"&&n!==""?n:null,unknownKeys:Object.keys(t).filter(o=>!Au.has(o))}}Ei();var ov=2*1024*1024;function Ci(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 av(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 i of e)t.delete(i)}function sv(t){let e=!1;for(let i of["build_command","verify_command"])t.has(i)&&(t.delete(i),e=!0);return e}async function Iu(t){let e;try{e=(await te(en.dirname(t),en.basename(t),ov,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new tn.Document({})}let i=(0,tn.parseDocument)(e);if(i.errors.length>0)throw new Error(`Invalid Classic state document: ${i.errors[0].message}`);return Ci(i),i}async function rn(t,e={}){let i=e.migrate!==!1,r=en.join(t,".comet.yaml"),n=await Iu(r),o=Ci(n),a=sv(n);a&&(o=Ci(n));let s=await Aa(t);if(!s&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Ei(),Pu));s=c(o),s&&i&&(await Ta(t,s),av(n),a=!0)}return a&&i&&await ve(r,n.toString(),{containedRoot:t}),Tu(Ci(n),s)}async function ju(t){let e=await Iu(en.join(t,".comet.yaml"));return Ou(Ci(e))}var fv=K("readCometCurrentSelection",t=>Nt(t));async function dv(t,e){Sa(e);let i=await yi(e,t);if(!i.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let r=await rn(i.directory,{migrate:!1});if(!r.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(r.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return i.directory}async function nn(t){let e;try{e=await fv(t)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let i=e.selection,r;try{r=await dv(t,i.change)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}let n=await Jr(r,{heal:!1,cwd:t});return n.status==="drift"?{status:"stale",reason:Ur(i.change,n.boundBranch,n.currentBranch)}:n.status==="unbound-detached"?{status:"stale",reason:Yr(i.change)}:n.status==="ok"?{status:"selected",selection:i}:i.branch!==null&&n.currentBranch!==i.branch?{status:"stale",reason:`current change '${i.change}' was selected on branch '${i.branch}', current branch is '${n.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:i}}import Ke from"node:path";async function Lu(t,e){if(!e||e==="null")return{status:"missing",recordedPath:null};let i=await ye(t),r=Ke.resolve(t,e),n=Ke.relative(i.superpowersPlansDir,r);return Ke.isAbsolute(e)||!n||n.startsWith(`..${Ke.sep}`)||Ke.isAbsolute(n)||n.includes(Ke.sep)||Ke.extname(n).toLowerCase()!==".md"?{status:"broken",recordedPath:e}:await ou(t,e,{label:`Classic build plan ${e}`,expected:"file"})?{status:"ready",recordedPath:e}:{status:"broken",recordedPath:e}}function ie(t,e){return{exitCode:t,stderr:e+`
148
+ `}}function be(t){return ie(0,`[COMET-HOOK] allowed: ${t}`)}function xi(t){return t.replaceAll("\\","/").replace(/\/+/gu,"/")}function Je(t){let e=xi(t);return process.platform==="win32"?e.toLowerCase():e}function $u(t,e){let i=xi(J.relative(e,t));return i===""?"":i.startsWith("../")||i===".."||J.isAbsolute(i)?null:i}async function hv(t){let e=J.resolve(t),i=J.parse(e).root,r=[],n=e;for(;n&&n!==i;)try{let o=await on.realpath(n);return J.join(o,...r.reverse())}catch(o){let a=o.code;if(a!=="ENOENT"&&a!=="ENOTDIR")throw o;r.push(J.basename(n)),n=J.dirname(n)}try{let o=await on.realpath(i);return J.join(o,...r.reverse())}catch{return null}}async function mv(t,e){let i=J.isAbsolute(t)?t:J.resolve(e,t),r=xi(i),n=$u(i,e);if(n!==null)return n;try{let o=await hv(i),a=await on.realpath(e);if(o){let s=$u(o,a);if(s!==null)return s;r=xi(o)}}catch{if(!J.isAbsolute(t))return xi(t).replace(/^\.\//u,"")}return r.replace(/^\.\//u,"")}async function Fu(t){try{let e=await rn(t,{migrate:!1}),i=Array.from(new Set(e.unknownKeys)).sort();if(i.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${i.join(", ")}`);if(!e.classic)throw new Error("Classic state projection is unavailable");return{changeDir:t,phase:e.classic.phase,classic:e.classic,archived:e.classic.archived}}catch(e){let i=await ju(t);return i.phase?{changeDir:t,phase:i.phase,classic:null,archived:i.archived,invalidState:e instanceof Error&&e.message.includes("unknown field")}:null}}async function pv(t){let e=(await ye(t)).changesDir,i=[];if(!(await bt(t,e,{label:"Classic changes directory",expected:"directory"})).exists)return i;for(let n of(await on.readdir(e,{withFileTypes:!0})).sort((o,a)=>o.name.localeCompare(a.name))){if(n.name==="archive"||ka(n.name))continue;let o=await yi(n.name,t);if(!o.exists||!o.stateExists)continue;let a=await Fu(o.directory);!a||a.archived||i.push(a)}return i}var Ri=K("classicActiveChanges",t=>pv(t)),Wu=K("classicPlanReadiness",Lu);async function qu(t){return(await Ri(t)).map(e=>({workflow:"classic",name:re(e),phase:e.phase}))}function Hu(t,e){return`${$(t,e.superpowersRoot)}/`}function Gu(t,e){return Je(t).startsWith(Je(e))}function gv(t,e){return[{prefix:`${$(t,e.superpowersSpecsDir)}/`,field:"designDoc",wireField:"design_doc",phase:"design"},{prefix:`${$(t,e.superpowersPlansDir)}/`,field:"plan",wireField:"plan",phase:"build"},{prefix:`${$(t,e.superpowersReportsDir)}/`,field:"verificationReport",wireField:"verification_report",phase:"verify"}]}function wv(t,e){let i=Je(t),r=e.find(o=>i.startsWith(Je(o.prefix)));if(!r)return null;let n=i.slice(Je(r.prefix).length);return!n||n.includes("/")||!n.endsWith(".md")?null:r}function zu(t,e){return t.classic?.[e.field]??null}function vv(t,e){return t.classic!==null&&t.phase===e.phase&&!zu(t,e)}async function Du(t,e,i){return vv(e,i)?!0:i.field!=="plan"||e.phase!=="build"?!1:(await Wu(t,e.classic?.plan??null)).status==="broken"}function Vu(t){return t.phase==="design"||t.phase==="build"||t.phase==="verify"}function re(t){return t.changeDir?J.basename(t.changeDir):null}var yv=new Set(["design","plan","verify","verification","verification-report","report"]);function Bu(t){return t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function bv(t,e){return[e.classic?.designDoc,e.classic?.plan,e.classic?.verificationReport].some(r=>r&&Je(r)===Je(t))}function Nv(t,e){let r=(t.split("/").at(-1)??t).replace(/\.[^.]+$/u,"");if(r===e)return!0;let n=[...yv].map(Bu).join("|");return new RegExp(`(^|[-_.])${Bu(e)}[-_.](${n})$`,"u").test(r)}async function kv(t,e){let i=await Ri(e),r=i.find(a=>bv(t,a));if(r)return{governing:r,match:"recorded"};let o=i.filter(Vu).filter(a=>{let s=re(a);return s!==null&&Nv(t,s)}).sort((a,s)=>(re(s)?.length??0)-(re(a)?.length??0))[0];return o?{governing:o,match:"named"}:null}async function Mu(t,e,i){let r=await Ri(t);if(r.length===0)return null;if(i)return r.find(a=>re(a)===i)??{blockedResult:Pi(e,`selected change '${i}' is no longer active`)};let n=await nn(t);if(n.status==="stale")return{blockedResult:Pi(e,n.reason)};if(n.status==="selected"){let o=r.find(a=>re(a)===n.selection.change);return o||{blockedResult:Pi(e,`selected change '${n.selection.change}' is no longer active`)}}if(r.length===1){let o=r[0];if(o.changeDir!==null){let a=await Jr(o.changeDir,{heal:!1,cwd:t}),s=re(o)??"unknown";if(a.status==="drift")return{blockedResult:Pi(e,Ur(s,a.boundBranch,a.currentBranch))};if(a.status==="unbound-detached")return{blockedResult:Pi(e,Yr(s))}}return o}return{blockedResult:Ov(e,r.map(o=>re(o)).filter(Boolean))}}async function Sv(t,e,i,r){let n=`${$(e,i.changesDir)}/`;if(t.startsWith(n)){let o=t.slice(n.length),[a]=o.split("/");if(a&&a!=="archive"){let s=await yi(a,e);if(s.stateExists){let c=await Fu(s.directory);return c||{changeDir:s.directory,phase:"open",classic:null,archived:!1}}return{changeDir:s.directory,phase:"open",classic:null,archived:!1}}}if(Gu(t,Hu(e,i))){let o=await kv(t,e);if(o?.match==="recorded")return{...o.governing,superpowersArtifact:"matched"};let a=wv(t,gv(e,i));if(o)return a?{...o.governing,superpowersArtifact:await Du(e,o.governing,a)?"matched":"unmatched",superpowersSlot:a}:{...o.governing,superpowersArtifact:"matched"};if(a){let l=await Mu(e,t,r);return!l||"blockedResult"in l?l:{...l,superpowersArtifact:await Du(e,l,a)?"matched":"unmatched",superpowersSlot:a}}let s=await Ri(e),c=r?s.find(l=>re(l)===r)??null:s[0]??null;return c?{...c,superpowersArtifact:"unmatched"}:null}return Mu(e,t,r)}function Ev(t){return!t.includes("/")&&t.endsWith(".md")}function Cv(t){return t.startsWith(".comet/")||t.includes("/.comet/")}function Pv(t){return t===".superpowers"||t.startsWith(".superpowers/")}function xv(t,e,i){if(!t.startsWith(i))return null;let r=t.endsWith("/.comet.yaml")||t.endsWith("/.openspec.yaml"),n=t.endsWith("/proposal.md")||t.endsWith("/design.md")||t.endsWith("/tasks.md"),o=t.includes("/.comet/"),a=t.includes("/specs/");return e==="open"&&(n||r||o||a)?`${t} (phase: open, openspec artifacts)`:e==="design"&&(n||r||o||a)?`${t} (phase: design, handoff/spec)`:e==="build"&&(t.endsWith("/tasks.md")||r||a)?`${t} (phase: build, spec/tasks)`:e==="verify"&&(t.endsWith("/tasks.md")||r)?`${t} (phase: verify, tasks/state)`:e==="archive"&&r?`${t} (phase: archive, state)`:null}function Rv(t,e){let i=e==="open"?[" BLOCKED: source writes are not allowed during open"," This phase does not allow source writes"," ALLOWED: create proposal/design/tasks artifacts and run guard"," NEXT: finish clarification and artifacts, then run guard --apply"]:e==="design"?[" BLOCKED: source writes are not allowed during design"," This phase does not allow source writes"," ALLOWED: run brainstorming, create the Design Doc, and run guard"," NEXT: finish the Design Doc, then run comet guard <change-name> design --apply to enter build"]:[" BLOCKED: source writes are not allowed during archive"," This phase does not allow source writes"," ALLOWED: confirm archive state and run the archive script"];return ie(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e}`,` Target file: ${t}`,"",...i,""].join(`
149
+ `))}function _v(t){return ie(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," Current phase: build (workflow: full), but design_doc is empty",` Target file: ${t}`,""," BLOCKED: full workflow source writes require a recorded Design Doc"," This phase does not allow source writes until design_doc is recorded"," NEXT: return to design, create/link the Design Doc, then run guard again",""].join(`
150
+ `))}function Av(t,e,i,r,n){let o=re(e)??"<change-name>",a=i.status==="missing",s=a?"classic-build-plan-missing":"classic-build-plan-broken",c=a?"plan is not recorded":"the recorded plan path does not resolve to a file",l=a?[]:[`RECORDED_PLAN: ${i.recordedPath}`],f=e.changeDir?$(r,e.changeDir):"<classic-change-dir>",u=$(r,n.superpowersPlansDir),d=a?`comet state set ${o} plan <repository-relative-plan-path>`:`comet state set ${o} plan <new-repository-relative-plan-path>`,m=a?["2. Load the Superpowers writing-plans Skill.",`3. Read the Design Doc path from "comet state get ${o} design_doc" and read ${f}/tasks.md.`,`4. Create the implementation plan under ${u}/.`,"5. Record the plan path:",` ${d}`]:[`2. Restore the plan file at ${i.recordedPath}, or load the Superpowers writing-plans Skill and create a replacement under ${u}/.`,"3. When creating a replacement, record its path:",` ${d}`];return ie(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",`ERROR_CODE: ${s}`,`CHANGE: ${o}`,"WORKFLOW: full","PHASE: build",`TARGET: ${t}`,`STATE: ${c}`,...l,"","BLOCKED: project source writes require a ready Superpowers implementation plan.","","ALLOWED_RECOVERY_WRITES:",`- ${u}/<plan-file>.md`,"- Comet state updates performed by the comet CLI",`- ${f} artifacts allowed by the build phase`,"","RECOVERY:",`1. Invoke /comet-build for ${o} and resume Step 1.`,...m,`${a?"6":"4"}. Verify recovery:`,` comet state check ${o} build --recover`,"","SUCCESS: plan is reported as DONE and recovery advances beyond plan creation.",`RETRY: retry the original Write/Edit for ${t} only after SUCCESS.`,"PROHIBITED: do not treat tasks.md as the implementation plan or write project source before SUCCESS.","If writing-plans is unavailable, stop and report the missing Skill instead of bypassing this check.",""].join(`
151
+ `))}function Tv(t,e){let i=e.superpowersSlot,r=i?zu(e,i):null,n=i?e.phase!==i.phase?[` BLOCKED: ${i.wireField} cannot be first-written in phase ${e.phase}`,` Expected phase: ${i.phase}`," NEXT: resume the matching Comet phase or use an already recorded artifact path"]:r?[` BLOCKED: ${i.wireField} is already recorded for this change`,` Recorded path: ${r}`," NEXT: write the recorded artifact or explicitly correct the state path"]:[" BLOCKED: standard Superpowers artifact state is incomplete"," NEXT: validate the active change state, then retry the matching phase"]:[" BLOCKED: unmatched Superpowers artifact"," This docs/superpowers/ path does not match any active change artifact"," NEXT: use a recorded artifact path or a standard phase artifact directory"];return ie(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e.phase}`,` Target file: ${t}`,"",...n,""].join(`
152
+ `))}function Ov(t,e){return ie(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: multiple active changes require a current change",` Target file: ${t}`,` Active changes: ${e.join(", ")}`,""," NEXT: run comet state select <change-name>, then retry the source write",""].join(`
153
+ `))}function Pi(t,e){return ie(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: current change selection is stale or invalid",` Target file: ${t}`,` Reason: ${e}`,""," NEXT: run comet state select <change-name>, then retry the source write",""].join(`
154
+ `))}async function Iv(t,e,i,r=Kr){try{if((await r(t,[e])).projectTargets.length===0)return be(`${e} (outside guarded project)`)}catch(l){return ie(2,[`[COMET-HOOK] blocked: scope could not be determined safely for ${e}.`,`REASON: ${l instanceof Error?l.message:String(l)}`,"NEXT: verify that the project root is accessible, then retry the write."].join(`
155
+ `))}let n=await mv(e,t),o;try{o=await Vr(t)}catch(l){return ie(2,`[COMET-HOOK] blocked: ${l instanceof Error?l.message:String(l)}`)}if(Cv(n))return be(`${n} (whitelist: comet config)`);if(Pv(n))return be(`${n} (whitelist: superpowers workspace)`);if(n==="CLAUDE.md"||n==="CHANGELOG.md"||n==="README.md"||Ev(n))return be(`${n} (whitelist: root markdown)`);let a;try{a=await Sv(n,t,o,i)}catch(l){return ie(2,`[COMET-HOOK] blocked: ${l instanceof Error?l.message:String(l)}`)}if(!a)return be("no active comet change");if("blockedResult"in a)return a.blockedResult;if(a.archived)return be(`${n} (own change archived)`);let s=a.phase,c=xv(n,s,`${$(t,o.openSpecRoot)}/`);if(c)return be(c);if(Gu(n,Hu(t,o))){if(a.superpowersArtifact==="matched"&&Vu(a))return be(`${n} (phase: ${s}, superpowers)`);if(a.superpowersArtifact==="unmatched")return Tv(n,a)}if(a.invalidState)return ie(2,`[COMET-HOOK] blocked: active Classic state is invalid; repair .comet.yaml before writing ${n}`);if(s==="build"&&a.classic?.workflow==="full"&&!a.classic.designDoc)return _v(n);if(s==="build"&&a.classic?.workflow==="full"){let l=await Wu(t,a.classic.plan);if(l.status!=="ready")return Av(n,a,l,t,o)}return s==="build"||s==="verify"?be(`${n} (phase: ${s})`):Rv(n,s)}async function Ku(t,e,i,r={}){if(i.intent!=="non-write")try{await Vr(t)}catch(a){return{allowed:!1,reason:a instanceof Error?a.message:String(a),workflow:"classic",change:e}}let n;try{n=await Ri(t)}catch(a){return{allowed:!1,reason:a instanceof Error?a.message:String(a),workflow:"classic",change:e}}let o=n.find(a=>re(a)===e);if(!o)return{allowed:!1,reason:`Selected Classic change ${e} is missing or archived; resume /comet-classic before retrying`,workflow:"classic",change:e};if(i.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};if(i.intent==="unknown"||i.targets.length===0)return{allowed:!0,reason:"Hook write target was not attributed to the guarded project",workflow:"classic",change:e,phase:o.phase};for(let a of i.targets){let s=await Iv(t,a,e,r.scopeTargets);if(s.exitCode!==0)return{allowed:!1,reason:s.stderr?.trim()||"Classic phase guard blocked the write",workflow:"classic",change:e,phase:o.phase}}return{allowed:!0,reason:`Classic write allowed in ${o.phase}`,workflow:"classic",change:e,phase:o.phase}}import{promises as lb}from"fs";import Pt from"path";var za=xt(mt(),1);import{promises as qy}from"fs";import et from"path";import{createHash as Dv}from"node:crypto";import{promises as ne}from"node:fs";import U from"node:path";import{TextDecoder as Bv}from"node:util";var jv=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),Lv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function $v(t){return t.toLowerCase().startsWith(".env")}function La(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>$v(r))?"environment-file":i.some(r=>Lv.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>jv.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}fi();var Mv=1024*1024;function $a(t,e){let i=U.relative(t,e);return i===""||!U.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${U.sep}`)}function Fv(t){let e=U.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(n=>{let o=n.codePointAt(0)??0;return o<=31||o===127})||U.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),r=La(t);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${t}`);return t}function Wv(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function qv(t,e){return T({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function an(t,e){let i={...t,birthtime:t.birthtimeMs},r={...e,birthtime:e.birthtimeMs};return fe(i,r)?T(i,r):T(i,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Ju(t){let e=await ne.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await ne.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function Hv(t,e){let i=U.resolve(t),r=U.resolve(e);if(!$a(i,r))throw new Error("Native artifact path is outside its root");let n=[await Ju(i)],o=i;for(let a of U.relative(i,r).split(U.sep).filter(Boolean)){o=U.join(o,a);let s=await Ju(o);if(!$a(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${o}`);n.push(s)}return n}async function Uu(t){for(let e of t){let i=await ne.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!qv(e,i)||await ne.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function sn(t){let e=Fv(t.ref),i=Wv(t.maxBytes??Mv),r=U.resolve(t.root,...e.split("/")),n=await Hv(t.root,U.dirname(r));await t.hooks?.afterParentChainCaptured?.();let o=await ne.lstat(r);if(!o.isFile()||o.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(o.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let a=await ne.realpath(r);if(!$a(n[0].realPath,a))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await ne.open(r,"r");try{let[c,l,f]=await Promise.all([s.stat(),ne.lstat(r),ne.realpath(r)]);if(await Uu(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||f!==a||!an(o,c)||!an(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let u=[],d=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let k=i+1-d,S=await s.read(m,0,Math.min(m.length,k),null);if(S.bytesRead===0)break;if(d+=S.bytesRead,d>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);u.push(Buffer.from(m.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[w,h,p]=await Promise.all([s.stat(),ne.lstat(r),ne.realpath(r)]);if(await Uu(n),!h.isFile()||h.isSymbolicLink()||p!==a||!an(c,w)||!an(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(u,d),b;try{b=new Bv("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:k})}return{ref:e,size:d,hash:Dv("sha256").update(y).digest("hex"),text:b}}finally{await s.close()}}ue();He();zr();var cn=$r;async function ln(t){let e=(await qe(t))?.config??null;return e?.native?e:null}import{AsyncLocalStorage as Gv}from"async_hooks";Mr();var nC=16*1024;var oC=new Gv;import{TextDecoder as Zv}from"util";import{createHash as zv}from"node:crypto";import{constants as un,promises as oe}from"node:fs";import ae from"node:path";import{TextDecoder as Vv}from"node:util";function dn(t,e){let i=ae.relative(t,e);return i===""||!ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ae.sep}`)}function Kv(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Jv(t,e){return T({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Uv(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function fn(t,e){return T({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Ba(t,e){let i=await oe.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await oe.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Yv(t,e,i){let r=ae.resolve(t),n=ae.resolve(e);if(!dn(r,n))throw new Error(`${i} is outside its managed root`);let o=[await Ba(r,i)],a=r;for(let s of ae.relative(r,n).split(ae.sep).filter(Boolean)){await Ue(o,i),a=ae.join(a,s);let c=await Ba(a,i);if(!dn(o[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${a}`);o.push(c)}return await Ue(o,i),o}async function Ue(t,e){for(let i of t){let r=await oe.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Jv(i,r)||await oe.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Xv(t,e,i){let r=[],n=0,o=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let a=e+1-n,{bytesRead:s}=await t.read(o,0,Math.min(o.length,a),null);if(s===0)break;if(n+=s,n>e)throw new Error(`${i} exceeds ${e} bytes`);r.push(Buffer.from(o.subarray(0,s)))}return Buffer.concat(r,n)}async function Yu(t){let e=Kv(t.maxBytes),i=ae.resolve(t.file),r=await Yv(t.root,ae.dirname(i),t.label),n=await Promise.all((t.forbiddenRoots??[]).map(f=>Ba(ae.resolve(f),t.label)));await t.hooks?.afterParentChainCaptured?.(),await Ue(r,t.label);let o=await oe.lstat(i);if(!o.isFile()||o.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(o.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let a=Uv(o),s=await oe.realpath(i);if(!dn(r[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(n.some(f=>dn(f.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?un.O_RDONLY:un.O_RDONLY|un.O_NOFOLLOW|un.O_NONBLOCK,l=await oe.open(i,c);try{let f=await l.stat();await t.hooks?.afterOpen?.();let[u,d]=await Promise.all([oe.lstat(i),oe.realpath(i)]);if(await Ue(r,t.label),await Ue(n,t.label),!f.isFile()||!u.isFile()||u.isSymbolicLink()||d!==s||!fn(a,f)||!fn(a,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await Xv(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[w,h,p]=await Promise.all([l.stat(),oe.lstat(i),oe.realpath(i)]);if(await Ue(r,t.label),await Ue(n,t.label),!h.isFile()||h.isSymbolicLink()||p!==s||!fn(a,w)||!fn(a,h))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:zv("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function Xu(t){let e=await Yu(t),i;try{i=new Vv("utf-8",{fatal:!0}).decode(e.bytes)}catch(r){throw new Error(`${t.label} is not valid UTF-8`,{cause:r})}return{...e,text:i}}var SC=256*1024,EC=1024*1024,CC=16*1024;var PC=64*1024*1024;var xC=new Zv("utf-8",{fatal:!0});import mn from"path";import{createHash as ey}from"crypto";function ef(t){return ey("sha256").update(t).digest("hex")}var JC={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},iy=1e3,ry=8*1024*1024,ny=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,oy=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),ay=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),sy=new Set(["schema","include","exclude","hash"]),cy=new Set(["provider","gitSelection","physicalSelection","projection"]),ly=new Set(["provider","selection"]),uy=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),fy=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),dy=new Set(["schema","status","before","after"]),hy=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),my=new Set(["path","hash","size","type","gitObjectId"]),py=new Set(["path","size","type","reason"]),gy=new Set(["ref","hash","count"]),wy=new Set(["change-created","legacy-migration","explicit"]),vy=new Set(["file","directory","other"]),yy=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),pn=/^[a-f0-9]{64}$/u,by=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var UC=64*1024,YC=64*1024;var XC={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},QC={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function hn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var ZC=(1n<<256n)-1n;function Ny(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function ky(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
156
+ `)}function Sy(t,e){return ef(`comet.native.snapshot-policy.v1
157
+ ${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function Ma(t,e,i){let r=new Set(e),n=[...e];for(;n.length>0;){if(i&&!i())return null;let o=n.pop(),a=t[o];a&&(a.kind==="star"||a.kind==="globstar"||a.kind==="globstar-slash")&&!r.has(o+1)&&(r.add(o+1),n.push(o+1))}return r}function Ey(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function tf(t){let e=cn(t,"Native snapshot pattern"),i=[];for(let r=0;r<e.length;r+=1){let n=e[r];n==="*"&&e[r+1]==="*"?(r+=1,e[r+1]==="/"?(r+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):n==="*"?i.push({kind:"star"}):n==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:n})}return(r,n)=>{let o=n?Ey(n):void 0;if(o&&!o())return!1;let a=Ma(i,new Set([0]),o);if(a===null)return!1;for(let s of r){if(o&&!o())return!1;let c=new Set;for(let l of a){if(o&&!o())return!1;let f=i[l];f&&(f.kind==="literal"&&f.value===s||f.kind==="question"&&s!=="/"?c.add(l+1):f.kind==="star"&&s!=="/"||f.kind==="globstar"?c.add(l):f.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(a=Ma(i,c,o),a===null||a.size===0)return!1}return Ma(i,a,o)?.has(i.length)??!1}}function Cy(t){if(t===void 0)return;let e=[...new Set(t.include.map(n=>cn(n,"include")))].sort((n,o)=>n.localeCompare(o,"en")),i=[...new Set(t.exclude.map(n=>cn(n,"exclude")))].sort((n,o)=>n.localeCompare(o,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let r=Sy(e,i);if("hash"in t&&t.hash!==r)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:r},includeMatchers:e.map(tf),excludeMatchers:i.map(tf),excludedDirectoryPrefixes:i.flatMap(n=>{if(!n.endsWith("/**"))return[];let o=n.slice(0,-3);return/[*?]/u.test(o)?[]:[o]}).sort((n,o)=>n.localeCompare(o,"en"))}}function Y(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function X(t,e,i){let r=Object.keys(t).find(n=>!e.has(n));if(r)throw new Error(`${i} contains unknown field: ${r}`)}function Et(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function de(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function of(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=mn.posix.normalize(t);if(i!==t||mn.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function Py(t,e){let i=Y(t,`Native snapshot entry ${e}`);X(i,my,`Native snapshot entry ${e}`);let r=of(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!pn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let n={path:r,hash:i.hash,size:de(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!by.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);n.gitObjectId=i.gitObjectId}return n}function xy(t,e){let i=Y(t,`Native snapshot omission ${e}`);if(X(i,py,`Native snapshot omission ${e}`),!vy.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!yy.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:of(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:de(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function Ry(t){let e=Y(t,"Native snapshot omission overflow");if(X(e,gy,"Native snapshot omission overflow"),typeof e.hash!="string"||!pn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:Et(e.count,"Native snapshot omission overflow count")}}function St(t,e){let i=Y(t,e);if(X(i,fy,e),typeof i.hash!="string"||!pn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let r=de(i.recordCount,`${e} recordCount`),n=de(i.storedRecordCount,`${e} storedRecordCount`),o=de(i.stdoutBytes,`${e} stdoutBytes`);if(n>r||!i.overflow&&n!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:r,storedRecordCount:n,stdoutBytes:o,overflow:i.overflow}}function rf(t){let e=Y(t,"Native Git selection evidence");if(X(e,uy,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=St(e.stageBefore,"Native Git selection stageBefore"),r=St(e.combined,"Native Git selection combined"),n=St(e.stageAfter,"Native Git selection stageAfter"),o=St(e.finalStageBefore,"Native Git selection finalStageBefore"),a=St(e.finalCombined,"Native Git selection finalCombined"),s=St(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,r,n,o,a,s].some(u=>u.overflow),l=!hn(i,n)||!hn(n,o)||!hn(r,a)||!hn(o,s),f=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==f)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:f,stageBefore:i,combined:r,stageAfter:n,finalStageBefore:o,finalCombined:a,finalStageAfter:s}}function nf(t,e){let i=Y(t,e);if(X(i,hy,e),typeof i.hash!="string"||!pn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let r=de(i.visitedNodeCount,`${e} visitedNodeCount`),n=de(i.recordCount,`${e} recordCount`),o=de(i.storedRecordCount,`${e} storedRecordCount`),a=de(i.encodedBytes,`${e} encodedBytes`);if(o>n||!i.overflow&&o!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:r,recordCount:n,storedRecordCount:o,encodedBytes:a,overflow:i.overflow,unstable:i.unstable}}function _y(t){let e=Y(t,"Native physical selection evidence");if(X(e,dy,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=nf(e.before,"Native physical selection before"),r=nf(e.after,"Native physical selection after"),n=i.overflow||r.overflow,o=i.unstable||r.unstable||!Ny(i,r);if(!n&&!o)throw new Error("Native physical selection evidence must describe an exceptional selection");let a=n&&o?"overflow-and-changed":n?"overflow":"changed";if(e.status!==a)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:a,before:i,after:r}}function Ay(t){let e=Y(t,"Native content snapshot manifest");if(X(e,oy,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!wy.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let g=Y(e.capture,"Native content snapshot capture");if(X(g,cy,"Native content snapshot capture"),g.provider!=="git"&&g.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let P=g.gitSelection===void 0?void 0:rf(g.gitSelection),N=g.physicalSelection===void 0?void 0:_y(g.physicalSelection),_=null;if(g.projection!==void 0){let G=Y(g.projection,"Native content snapshot projection");if(X(G,ly,"Native content snapshot projection"),G.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");_={provider:"git",...G.selection===void 0?{}:{selection:rf(G.selection)}}}if(g.provider==="git"){if(N||_)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...P?{gitSelection:P}:{}}}else{if(P)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(N&&_)throw new Error("Native physical-tree capture cannot combine selection and projection");i=_?{provider:"physical-tree",projection:_}:{provider:"physical-tree",...N?{physicalSelection:N}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let r=Y(e.limits,"Native content snapshot limits");X(r,ay,"Native content snapshot limits");let n={maxFiles:Et(r.maxFiles,"Native snapshot maxFiles"),maxFileBytes:Et(r.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:Et(r.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:Et(r.maxManifestBytes,"Native snapshot maxManifestBytes"),...r.maxDurationMs===void 0?{}:{maxDurationMs:Et(r.maxDurationMs,"Native snapshot maxDurationMs")}},o;if(e.policy!==void 0){let g=Y(e.policy,"Native snapshot policy");if(X(g,sy,"Native snapshot policy"),g.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(g.include)||!Array.isArray(g.exclude))throw new Error("Native snapshot policy patterns must be arrays");o=Cy({include:g.include,exclude:g.exclude,hash:g.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let a=e.entries.map(Py),s=e.omitted.map(xy),c=de(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:Ry(e.omissionOverflow);if(a.length>n.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(a.some(g=>g.size>n.maxFileBytes)||a.reduce((g,P)=>g+P.size,0)>n.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(a.map(g=>g.path)).size!==a.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>iy||c<s.length)throw new Error("Native content snapshot omission count is invalid");let f=c-s.length;if(f===0&&l||f>0&&l?.count!==f)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let u=s.filter(g=>g.reason==="git-enumeration-limit"),d=s.filter(g=>g.reason==="git-selection-changed");for(let g of[...u,...d])if(g.path!=="."||g.size!==null||g.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(u.length>1||d.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,w=m?.status==="overflow"||m?.status==="overflow-and-changed",h=m?.status==="changed"||m?.status==="overflow-and-changed";if(w!==(u.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(d.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let p=s.filter(g=>g.reason==="physical-enumeration-limit"),y=s.filter(g=>g.reason==="physical-selection-changed");for(let g of[...p,...y])if(g.path!=="."||g.size!==null||g.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(p.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let b=i?.physicalSelection,k=b?.status==="overflow"||b?.status==="overflow-and-changed",S=b?.status==="changed"||b?.status==="overflow-and-changed";if(k!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:n,...o?{policy:o}:{},entries:a,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(ky(E)>n.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function Ty(t,e){if(!ny.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=mn.join(t.changesDir,e);if(!vt(t.changesDir,i))throw new Error("Native change path escaped");return mn.join(i,"runtime","baseline-manifest.json")}async function af(t,e){let i=Ty(t,e);await pe(t.nativeRoot,i);try{let r=await Xu({root:t.nativeRoot,file:i,maxBytes:ry,label:"Native baseline snapshot manifest"});return Ay(JSON.parse(r.text))}catch(r){if(r.code==="ENOENT")return null;throw r}}Ei();var dP={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};import{createHash as Ly}from"node:crypto";import{promises as gn}from"node:fs";import je from"node:path";import{execFileSync as Iy}from"child_process";import Ai from"path";function _i(t,e){return Iy("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function jy(t,e){let i=Ai.normalize(t),r=Ai.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function sf(t){try{let e=Ai.resolve(_i(t,["rev-parse","--show-toplevel"])),r=_i(t,["worktree","list","--porcelain","-z"]).split("\0").find(a=>a.startsWith("worktree ")),n=r?Ai.resolve(r.slice(9)):e,o=null;try{o=_i(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!jy(e,n),currentWorktreeRoot:e,primaryWorktreeRoot:n,currentBranch:o}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function cf(t){try{_i(t,["rev-parse","--is-inside-work-tree"])}catch{return[]}return _i(t,["worktree","list","--porcelain","-z"]).split("\0").filter(i=>i.startsWith("worktree ")).map(i=>Ai.resolve(i.slice(9)))}var Ti=/^[a-f0-9]{64}$/u,$y=16*1024,Wa=process.platform;function df(t,e){let i=je.relative(t,e);return je.isAbsolute(i)||i===".."||i.startsWith(`..${je.sep}`)?null:i.replaceAll("\\","/")||"."}function hf(t){return Array.from(t).some(e=>{let i=e.codePointAt(0)??0;return i<=31||i===127})}function mf(t,e){if(t.length===0||hf(t)||t.includes("\\")||je.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes(".."))throw new Error(`${e} must be a portable project-relative path`);let i=je.posix.normalize(t);if(i!==t||i===".."||i.startsWith("../"))throw new Error(`${e} must be a normalized project-relative path`);return i}function qa(t,e){return Ly("sha256").update(`${t}
158
+ ${e}`).digest("hex")}async function lf(t,e){let i=await gn.realpath(e),r=await gn.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Wa==="win32"?je.normalize(i).toLowerCase():i;return qa(t,`${n}
159
+ ${r.dev}
160
+ ${r.ino}
161
+ ${r.birthtimeMs}`)}async function uf(t,e){let i=await gn.realpath(e),r=await gn.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=Wa==="win32"?je.normalize(i).toLowerCase():i;return qa(t,n)}function Dy(t){if(typeof t!="string")throw new Error("Native workspace capturedAt is invalid");let e=new Date(t);if(!Number.isFinite(e.getTime())||e.toISOString()!==t)throw new Error("Native workspace capturedAt is invalid");return t}function ff(t,e){if(t===null)return null;if(typeof t!="string"||t.length===0||t.trim()!==t||hf(t))throw new Error(`${e} must be a non-empty branch name or null`);return t}function pf(t){if(!new Set(["current","branch","worktree"]).has(t.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(ff(t.changeBranch,"Native workspace change branch"),ff(t.targetBranch,"Native workspace target branch"),(t.isolation==="branch"||t.isolation==="worktree")&&(t.changeBranch===null||t.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function wn(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace identity must be an object");let e=t,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","isolation","changeBranch","targetBranch","finish"]),r=Object.keys(e).filter(a=>!i.has(a));if(r.length>0)throw new Error(`Native workspace identity has unknown field(s): ${r.join(", ")}`);if(e.schema!=="comet.native.workspace.v2"&&e.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(e.capturedRevision)||e.capturedRevision<1||typeof e.nativeRootRef!="string"||!Ti.test(String(e.projectRootId))||!Ti.test(String(e.nativeRootId)))throw new Error("Native workspace identity is invalid");Dy(e.capturedAt),mf(e.nativeRootRef,"Native workspace root ref");let n=e.projectRootPathId!==void 0,o=e.nativeRootPathId!==void 0;if(n!==o)throw new Error("Native workspace path identities must be provided together");if(n&&!Ti.test(String(e.projectRootPathId))||o&&!Ti.test(String(e.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(e.sessionHash!==void 0&&!Ti.test(String(e.sessionHash)))throw new Error("Native workspace session hash is invalid");if(e.schema==="comet.native.workspace.v2"){if(e.isolation!==void 0||e.changeBranch!==void 0||e.targetBranch!==void 0||e.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof e.isolation!="string"||e.changeBranch===void 0||e.targetBranch===void 0||e.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(pf(e),e.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(e.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function By(t,e){return je.join(t.changesDir,e,"runtime","workspace.json")}function My(t,e){let i=df(t.nativeRoot,By(t,e));if(!i||i===".")throw new Error("Native workspace file escaped its root");return mf(i,"Native workspace file ref")}async function Fy(t,e){try{let i=await sn({root:t.nativeRoot,ref:My(t,e),maxBytes:$y});return JSON.parse(i.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function Wy(t){if(!Number.isSafeInteger(t.revision)||t.revision<1)throw new Error("Native workspace revision must be a positive integer");let e=df(t.paths.projectRoot,t.paths.nativeRoot);if(!e)throw new Error("Native root is outside the project root");let[i,r,n,o]=await Promise.all([lf("comet.native.workspace-project-root.v2",t.paths.projectRoot),lf("comet.native.workspace-native-root.v2",t.paths.nativeRoot),uf("comet.native.workspace-project-root-path.v2",t.paths.projectRoot),uf("comet.native.workspace-native-root-path.v2",t.paths.nativeRoot)]),a=(t.now??new Date).toISOString();if(t.finish&&!t.binding)throw new Error("Native workspace finish requires a workspace binding");t.binding&&pf(t.binding);let s={capturedAt:a,capturedRevision:t.revision,nativeRootRef:e,projectRootId:i,nativeRootId:r,projectRootPathId:n,nativeRootPathId:o,...t.sessionId?{sessionHash:qa("comet.native.workspace-session.v2",`${i}
162
+ ${r}
163
+ ${t.sessionId}`)}:{}},c=t.binding?{schema:"comet.native.workspace.v3",...s,...t.binding,finish:t.finish??null}:{schema:"comet.native.workspace.v2",...s};return wn(c),c}async function gf(t,e){let i=await Fy(t,e);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(wn(i),i)}async function wf(t){wn(t.identity);let e=await Wy({paths:t.paths,name:"workspace-advisory",revision:t.identity.capturedRevision}),i=[],r=[];return e.nativeRootRef!==t.identity.nativeRootRef&&i.push("native-root-ref"),t.identity.projectRootPathId&&t.identity.nativeRootPathId?(e.projectRootPathId!==t.identity.projectRootPathId&&i.push("project-root-path"),e.nativeRootPathId!==t.identity.nativeRootPathId&&i.push("native-root-path")):(e.projectRootId!==t.identity.projectRootId&&i.push("project-root-legacy-identity"),e.nativeRootId!==t.identity.nativeRootId&&i.push("native-root-legacy-identity")),Wa==="win32"&&i.length>0&&i.every(o=>o==="project-root-legacy-identity"||o==="native-root-legacy-identity")?r.push("workspace-inspection-unavailable"):i.length>0&&r.push("workspace-root-changed"),{state:r.length===0?"aligned":r.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:r,driftComponents:i}}async function vf(t){if(wn(t.identity),t.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await wf(t)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=sf(t.paths.projectRoot);return t.identity.changeBranch===null?i.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:i.isGitWorktree?i.currentBranch!==t.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${t.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:t.identity.isolation==="worktree"&&!i.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}async function yf(t,e){let i=await gf(t,e);if(i===null)return null;let r=await vf({paths:t,identity:i});if(r.state==="drifted")throw new Error(`${r.code}: ${r.message}`);return i}var Ye="comet.native.v3",Xe="comet.native.v2",Qe="comet.native.v1";var bf=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Hy=new Set(bf),Nf=new Set([...bf,"minimum_runtime_version","revision"]),Gy=new Set([...Nf,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),zy=new Set(["capability","operation","source","base_hash"]),Vy=new Set(["shape","build","verify","archive"]),Ky=new Set(["implicit","confirmed"]),Jy=new Set(["pending","pass","fail"]),Ct="comet-state.yaml",Ga=/^[a-f0-9]{64}$/u,kf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Uy=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,vn=class extends Error{constructor(i,r){super(`Native change ${i} uses ${r}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=r;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},tt=class extends Error{constructor(i,r){super(i!==Ye||r===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${r}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=r;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"};var ix=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
164
+ `);function Ii(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Sf(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function yn(t){if(!kf.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Yy(t){if(!kf.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Ef(t,e){if(t.length===0||et.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function Xy(t,e){let i=Ii(t,`spec_changes[${e}]`);if(Sf(i,zy,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(Yy(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let r=i.source,n=i.base_hash;if(r!==void 0&&typeof r!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof r=="string"&&Ef(r,`Spec source for ${i.capability}`),i.operation==="create"){if(!r)throw new Error(`Create spec ${i.capability} requires source`);if(n!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!r)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof n!="string"||!Ga.test(n))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(r!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof n!="string"||!Ga.test(n))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof r=="string"?{source:r}:{},base_hash:n}}function Qy(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function Va(t,e){if(Sf(t,e,Ct),typeof t.name!="string")throw new Error("Native change name is required");if(yn(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!Vy.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Ky.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(Xy),r=i.map(n=>n.capability).filter((n,o,a)=>a.indexOf(n)!==o);if(r.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(r)].join(", ")}`);if(typeof t.verification_result!="string"||!Jy.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Ef(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!Qy(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function Cf(t){let e=Ii(t,Ct);if(e.schema!==Qe)throw new Error(`Expected ${Qe}`);return{schema:Qe,...Va(e,Hy)}}function Oi(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function Ha(t,e,i){if(t===null)return null;let r=typeof t=="string"?Uy.exec(t):null;if(!r||r[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function Zy(t){if(t==null)return null;if(typeof t!="string"||!Ga.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function eb(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function Pf(t){let e=Ii(t,Ct);if(e.schema!==Xe)throw new Error(`Expected ${Xe}`);if(Oi(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Xe} minimum_runtime_version must be 2`);return{schema:Xe,minimum_runtime_version:2,revision:Oi(e.revision,"Native v2 revision"),...Va(e,Nf)}}function tb(t){let e=Ii(t,Ct);if(e.schema!==Ye){if(e.schema===Qe||e.schema===Xe){let a=e.schema===Qe?Cf(e):Pf(e);throw new vn(a.name,a.schema)}throw new tt(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=Oi(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new tt(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let r=Oi(e.revision,"Native revision"),n=Va(e,Gy),o=Zy(e.approved_contract_hash);if(n.approval===null&&o!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Ye,minimum_runtime_version:3,revision:r,verification_protocol:eb(e.verification_protocol),...n,approved_contract_hash:o,implementation_scope:Ha(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:Ha(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:Ha(e.partial_allowance,"Native partial_allowance","allowances")}}function ib(t){let e=Ii(t,Ct);if(e.schema===Qe){let n=Cf(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:1,state:n,message:`Native change ${n.name} requires migration to ${Ye}`}}if(e.schema===Xe){let n=Pf(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n,message:`Native change ${n.name} requires migration to ${Ye}`}}if(e.schema!==Ye){let n=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:n,state:null,message:new tt(typeof e.schema=="string"?e.schema:"(missing)",n).message}}let i=Oi(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new tt(e.schema,i).message};let r=tb(e);return{status:"current",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r}}function xf(t,e){yn(e);let i=et.join(t.changesDir,e);if(!vt(t.changesDir,i))throw new Error("Native change path escaped");return i}async function rb(t,e){let i=et.join(xf(t,e),"runtime","schema-migration.json");await pe(t.nativeRoot,i);try{return await qy.lstat(i),!0}catch(r){if(r.code==="ENOENT")return!1;throw r}}var nb=256*1024;async function ob(t,e=et.dirname(t)){let i=et.relative(e,t).split(et.sep).join("/"),r=await sn({root:e,ref:i,maxBytes:nb}),n=(0,za.parseDocument)(r.text,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${n.errors[0].message}`);return n.toJS()}async function ab(t,e){let i=et.join(xf(t,e),Ct);await pe(t.nativeRoot,i);let r=ib(await ob(i,t.nativeRoot));if(r.state&&r.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await rb(t,e)?{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimumRuntimeVersion,state:r.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(r.status==="current"&&r.state&&await sb(t,r.state),r)}async function sb(t,e){if(await af(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}async function bn(t,e){let i=await ab(t,e);if(i.status==="migration-required")throw new vn(e,i.schema);if(i.status==="runtime-incompatible"||!i.state)throw new tt(i.schema,i.minimumRuntimeVersion);return await yf(t,e),i.state}var cx=16*1024;async function cb(t){let e=await Nt(t.projectRoot);return e.status==="missing"||e.selection.workflow!=="native"?null:(yn(e.selection.change),e.selection)}async function Rf(t){let e=await cb(t);return e?(await bn(t,e.change),e.change):null}function Nn(t,e){let i=Pt.relative(t,e);return i===""||!i.startsWith("..")&&!Pt.isAbsolute(i)}function ub(t,e,i){return i.targets.length>0&&i.targets.every(r=>{let n=Pt.resolve(t,r);return Nn(t,n)?Pt.relative(t,n).replaceAll("\\","/")===".comet/config.yaml"||Nn(e,n):!0})}async function fb(t){let e=await ln(t);if(!e||!(e.workflows??[e.default_workflow]).includes("native"))return null;let i=await la(t,e.native.artifact_root),r;try{r=await lb.readdir(i.changesDir,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return{paths:i,changes:[]};throw o}let n=[];for(let o of r.sort((a,s)=>a.name.localeCompare(s.name))){if(!o.isDirectory()||o.isSymbolicLink())continue;let a=await bn(i,o.name);a.archived||n.push(a)}return{paths:i,changes:n}}var _f=K("nativeActiveContext",t=>fb(t));async function Af(t){return((await _f(t))?.changes??[]).map(i=>({workflow:"native",name:i.name,phase:i.phase}))}async function Tf(t,e,i){let r=await _f(t);if(!r)return{allowed:!0,reason:"Native workflow is not enabled"};if(e.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};if(r.changes.length===0)return{allowed:!0,reason:ub(t,r.paths.nativeRoot,e)?"Native control artifact write":"No Native changes exist"};let n;if(i){if(n=r.changes.find(s=>s.name===i),!n)return{allowed:!1,reason:`Selected Native change ${i} is missing or archived; resume /comet-native before retrying`,workflow:"native",change:i}}else if(r.changes.length===1)n=r.changes[0];else{let s=await Rf(r.paths);if(n=r.changes.find(c=>c.name===s),!n)return{allowed:!1,reason:"Multiple Native changes are active; select the change to resume before writing code",workflow:"native"}}if(n.phase==="build")return{allowed:!0,reason:"Native change is in Build",workflow:"native",phase:n.phase,change:n.name};if(e.intent==="unknown"||e.targets.length===0)return{allowed:!0,reason:"Hook write target was not attributed to the guarded project",workflow:"native",phase:n.phase,change:n.name};let o=!1,a=!1;for(let s of e.targets){let c=Pt.resolve(t,s);if(!Nn(t,c)){a=!0;continue}if(Pt.relative(t,c).replaceAll("\\","/")===".comet/config.yaml"||Nn(r.paths.nativeRoot,c)){o=!0;continue}return{allowed:!1,reason:`Native change ${n.name} is in ${n.phase}; implementation writes are only allowed in build. Resume /comet-native to continue safely`,workflow:"native",phase:n.phase,change:n.name}}return{allowed:!0,reason:o?"Native control artifact write":a?"Write target is outside the guarded project":"No guarded write target was provided",workflow:"native",phase:n.phase,change:n.name}}He();var Of=K("readWorkflowProjectConfig",t=>da(t)),kx=K("discoverNativeProject",t=>li(t));var db=K("readCometCurrentSelection",t=>Nt(t)),Lf={listNative:Af,listClassic:qu,inspectNative:Tf,inspectClassic:Ku};function hb(t){return t?t.workflows??[t.default_workflow]:["classic"]}async function If(t,e,i,r,n={}){let o=async()=>{if(!e.includes("classic"))return[];if(r?.workflow==="classic")return r.candidates;try{return await i.listClassic(t)}catch(c){if(n.tolerateUnavailableClassic&&c instanceof ze)return[];throw c}},[a,s]=await Promise.all([e.includes("native")?r?.workflow==="native"?r.candidates:i.listNative(t):[],o()]);return[...a,...s]}function jf(t,e){return t.length===0?{status:"none",staleSelection:e}:t.length===1?{status:"inferred",owner:t[0],staleSelection:e}:{status:"ambiguous",candidates:t,staleSelection:e}}async function mb(t,e=Lf){let i=await Of(t),r=hb(i),n;try{n=await db(t)}catch(o){return{status:"stale",code:"selection-unreadable",reason:o instanceof Error?o.message:String(o)}}if(n.status==="selected"){let o=n.selection;if(!r.includes(o.workflow))return{status:"stale",code:"workflow-disabled",reason:`selected workflow '${o.workflow}' is not enabled for this project`};let a;try{a=o.workflow==="native"?await e.listNative(t):await e.listClassic(t)}catch(c){return{status:"stale",code:"change-state-unreadable",reason:`cannot safely enumerate active Comet changes: ${c instanceof Error?c.message:String(c)}`}}let s=a.find(c=>c.name===o.change);if(!s){let c={code:"target-missing",reason:`selected ${o.workflow} change '${o.change}' is missing or archived`};try{let l=await If(t,r,e,{workflow:o.workflow,candidates:a});return jf(l,c)}catch(l){return{status:"stale",code:"change-state-unreadable",reason:`cannot safely enumerate active Comet changes: ${l instanceof Error?l.message:String(l)}`}}}if(o.workflow==="classic"){let c=await nn(t);if(c.status!=="selected")return{status:"stale",code:"classic-selection-invalid",reason:c.status==="stale"?c.reason:`selected Classic change '${o.change}' is no longer active`}}return{status:"owned",owner:s}}try{let o=await If(t,r,e,void 0,{tolerateUnavailableClassic:!0});return jf(o)}catch(o){return{status:"stale",code:"change-state-unreadable",reason:`cannot safely enumerate active Comet changes: ${o instanceof Error?o.message:String(o)}`}}}async function $f(t,e,i=Lf){if(e.intent==="non-write")return{allowed:!0,reason:"Hook event is not a write"};if(e.intent==="unknown"||e.targets.length===0)return{allowed:!0,reason:"Hook write target is outside Comet attribution"};let r;try{let n=await(i.scopeTargets??Kr)(t,e.targets);if(n.projectTargets.length===0)return{allowed:!0,reason:"Write targets are outside the guarded project"};r={...e,targets:n.projectTargets}}catch(n){return{allowed:!1,reason:["Comet Hook Router scope could not be determined safely.",`Reason: ${n instanceof Error?n.message:String(n)}`,"Next: verify that the project root is accessible, then retry the write."].join(" ")}}try{let n=await mb(t,i);if(n.status==="none")return{allowed:!0,reason:"No active Comet change"};if(n.status==="stale")return{allowed:!1,reason:`${n.reason}. Resume /comet-native or /comet-classic and select the current change before retrying`};if(n.status==="ambiguous")return{allowed:!1,reason:`Multiple active Comet changes require one current selection: ${n.candidates.map(a=>`${a.workflow}:${a.name}`).join(", ")}`};let o=n.owner;return o.workflow==="native"?i.inspectNative(t,r,o.name):i.inspectClassic(t,o.name,r)}catch(n){return{allowed:!1,reason:`Comet Hook Router failed closed: ${n instanceof Error?n.message:String(n)}`}}}import{promises as pb}from"fs";import Q from"path";function gb(t,e){let i=Q.resolve(t),r=Q.resolve(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function wb(t,e){let i=Q.relative(t,e);return i===""||i!==".."&&!i.startsWith(`..${Q.sep}`)&&!Q.isAbsolute(i)}function Df(t,e){return[...e].sort((i,r)=>r.length-i.length).find(i=>wb(i,t))??null}async function vb(t){for(let e of[".git",Q.join(".comet","config.yaml")])try{await pb.lstat(Q.join(t,e))}catch(i){throw i.code!=="ENOENT"?i:new Error(`linked worktree ${t} is not initialized for Comet: missing ${e.replaceAll("\\","/")}`,{cause:i})}}async function Bf(t,e){let i=Q.resolve(t),r=cf(i);if(r.length<2||e.targets.length===0)return i;let o=(e.cwd?Df(Q.resolve(e.cwd),r):null)??i,a=new Map;for(let c of e.targets){let l=Q.isAbsolute(c)?Q.resolve(c):Q.resolve(o,c),f=Df(l,r);if(!f)continue;let u=process.platform==="win32"?f.toLowerCase():f;a.set(u,f)}if(a.size===0)return i;if(a.size>1)throw new Error("one Hook request cannot write across multiple Git worktrees");let[s]=a.values();return gb(s,i)||await vb(s),s}var yb="Usage: comet-hook-router --platform <platform-id> [--project-root <project-root>]";function bb(t){let e,i;for(let r=0;r<t.length;r++){let n=t[r];if(n==="--platform"){e=t[++r];continue}if(n==="--project-root"){i=t[++r];continue}throw new Error(`Unknown argument: ${n}`)}if(!e||e.startsWith("--"))throw new Error("--platform is required");if(!va.has(e))throw new Error(`unsupported Hook platform: ${e}`);if(i?.startsWith("--"))throw new Error("--project-root requires a value");return{platformId:e,...i?{projectRoot:Ff.resolve(i)}:{}}}async function Nb(t,e){if(t.projectRoot)return e?Bf(t.projectRoot,e):t.projectRoot;let i=await li(process.cwd());for(let o of[[".comet","config.yaml"],[".git"]])try{return await Mf.lstat(Ff.join(i,...o)),i}catch(a){if(a.code!=="ENOENT")throw a}let r=await Ul(process.cwd()),n=await ye(r);try{return await Mf.lstat(n.changesDir),r}catch(o){if(o.code!=="ENOENT")throw o}return null}async function kb(t){let e;try{e=bb(t)}catch(n){return process.stderr.write(`${n instanceof Error?n.message:String(n)}
165
+ ${yb}
166
+ `),64}let i;try{let n=ba(),o=await Nb(e,n);i=o?await ru(()=>$f(o,n)):{allowed:!0,reason:"No Comet project discovered"}}catch(n){i={allowed:!1,reason:`Comet Hook Router failed closed during project discovery: ${n instanceof Error?n.message:String(n)}`}}let r=iu(e.platformId,i);return r.stdout&&process.stdout.write(r.stdout),r.stderr&&process.stderr.write(r.stderr),r.exitCode}process.exitCode=await kb(process.argv.slice(2));export{Nb as projectRootFrom,kb as runCometHookRouter};