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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (761) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +85 -56
  3. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.html +8 -0
  4. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.json +286 -0
  5. package/assets/manifest.json +26 -17
  6. package/assets/skills/comet/SKILL.md +1 -1
  7. package/assets/skills/comet/agents/openai.yaml +3 -0
  8. package/assets/skills/comet/rules/comet-phase-guard.en.md +1 -1
  9. package/assets/skills/comet/rules/comet-phase-guard.md +1 -1
  10. package/assets/skills/comet/rules/comet-workflow-guard.en.md +2 -2
  11. package/assets/skills/comet/rules/comet-workflow-guard.md +2 -2
  12. package/assets/skills/comet/scripts/comet-archive.mjs +128 -128
  13. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +77 -77
  14. package/assets/skills/comet/scripts/comet-guard.mjs +144 -144
  15. package/assets/skills/comet/scripts/comet-handoff.mjs +107 -107
  16. package/assets/skills/comet/scripts/comet-hook-guard.mjs +128 -128
  17. package/assets/skills/comet/scripts/comet-hook-router.mjs +143 -141
  18. package/assets/skills/comet/scripts/comet-resume-probe.mjs +100 -100
  19. package/assets/skills/comet/scripts/comet-runtime.mjs +194 -193
  20. package/assets/skills/comet/scripts/comet-state.mjs +118 -118
  21. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +95 -95
  22. package/assets/skills/comet-any/SKILL.md +2 -1
  23. package/assets/skills/comet-any/agents/openai.yaml +5 -0
  24. package/assets/skills/comet-archive/SKILL.md +7 -6
  25. package/assets/skills/comet-archive/agents/openai.yaml +5 -0
  26. package/assets/skills/comet-build/SKILL.md +28 -68
  27. package/assets/skills/comet-build/agents/openai.yaml +5 -0
  28. package/assets/skills/comet-classic/SKILL.md +28 -22
  29. package/assets/skills/comet-classic/agents/openai.yaml +3 -0
  30. package/assets/skills/{comet → comet-classic}/reference/auto-transition.md +1 -1
  31. package/assets/skills/{comet → comet-classic}/reference/comet-yaml-fields.md +3 -3
  32. package/assets/skills/{comet → comet-classic}/reference/context-recovery.md +5 -5
  33. package/assets/skills/{comet → comet-classic}/reference/debug-gate.md +2 -2
  34. package/assets/skills/{comet → comet-classic}/reference/decision-point.md +1 -1
  35. package/assets/skills/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  36. package/assets/skills/{comet → comet-classic}/reference/file-structure.md +1 -1
  37. package/assets/skills/{comet → comet-classic}/reference/intent-frame.md +1 -1
  38. package/assets/skills/{comet → comet-classic}/reference/scripts.md +4 -2
  39. package/assets/skills/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  40. package/assets/skills/comet-classic/reference/workspace.md +23 -0
  41. package/assets/skills/comet-design/SKILL.md +7 -6
  42. package/assets/skills/comet-design/agents/openai.yaml +5 -0
  43. package/assets/skills/comet-hotfix/SKILL.md +10 -9
  44. package/assets/skills/comet-hotfix/agents/openai.yaml +5 -0
  45. package/assets/skills/comet-native/SKILL.md +60 -171
  46. package/assets/skills/comet-native/agents/openai.yaml +3 -0
  47. package/assets/skills/comet-native/reference/artifacts.md +24 -89
  48. package/assets/skills/comet-native/reference/clarification.md +54 -29
  49. package/assets/skills/comet-native/reference/commands.md +30 -173
  50. package/assets/skills/comet-native/reference/recovery.md +38 -88
  51. package/assets/skills/comet-native/reference/workspace.md +23 -0
  52. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +184 -152
  53. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +214 -158
  54. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +132 -123
  55. package/assets/skills/comet-native/scripts/comet-native-init.mjs +134 -124
  56. package/assets/skills/comet-native/scripts/comet-native-new.mjs +165 -158
  57. package/assets/skills/comet-native/scripts/comet-native-next.mjs +183 -152
  58. package/assets/skills/comet-native/scripts/comet-native-root.mjs +152 -147
  59. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +247 -202
  60. package/assets/skills/comet-native/scripts/comet-native-select.mjs +150 -143
  61. package/assets/skills/comet-native/scripts/comet-native-show.mjs +128 -121
  62. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +133 -151
  63. package/assets/skills/comet-native/scripts/comet-native-status.mjs +147 -140
  64. package/assets/skills/comet-open/SKILL.md +31 -11
  65. package/assets/skills/comet-open/agents/openai.yaml +5 -0
  66. package/assets/skills/comet-tweak/SKILL.md +11 -10
  67. package/assets/skills/comet-tweak/agents/openai.yaml +5 -0
  68. package/assets/skills/comet-verify/SKILL.md +9 -8
  69. package/assets/skills/comet-verify/agents/openai.yaml +5 -0
  70. package/assets/skills-zh/comet/SKILL.md +1 -1
  71. package/assets/skills-zh/comet/agents/openai.yaml +3 -0
  72. package/assets/skills-zh/comet-any/SKILL.md +2 -1
  73. package/assets/skills-zh/comet-any/agents/openai.yaml +5 -0
  74. package/assets/skills-zh/comet-archive/SKILL.md +7 -6
  75. package/assets/skills-zh/comet-archive/agents/openai.yaml +5 -0
  76. package/assets/skills-zh/comet-build/SKILL.md +28 -68
  77. package/assets/skills-zh/comet-build/agents/openai.yaml +5 -0
  78. package/assets/skills-zh/comet-classic/SKILL.md +29 -23
  79. package/assets/skills-zh/comet-classic/agents/openai.yaml +3 -0
  80. package/assets/skills-zh/{comet → comet-classic}/reference/auto-transition.md +1 -1
  81. package/assets/skills-zh/{comet → comet-classic}/reference/comet-yaml-fields.md +3 -3
  82. package/assets/skills-zh/{comet → comet-classic}/reference/context-recovery.md +5 -5
  83. package/assets/skills-zh/{comet → comet-classic}/reference/debug-gate.md +2 -2
  84. package/assets/skills-zh/{comet → comet-classic}/reference/decision-point.md +1 -1
  85. package/assets/skills-zh/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  86. package/assets/skills-zh/{comet → comet-classic}/reference/file-structure.md +1 -1
  87. package/assets/skills-zh/{comet → comet-classic}/reference/intent-frame.md +1 -1
  88. package/assets/skills-zh/{comet → comet-classic}/reference/scripts.md +4 -2
  89. package/assets/skills-zh/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  90. package/assets/skills-zh/comet-classic/reference/workspace.md +23 -0
  91. package/assets/skills-zh/comet-design/SKILL.md +7 -6
  92. package/assets/skills-zh/comet-design/agents/openai.yaml +5 -0
  93. package/assets/skills-zh/comet-hotfix/SKILL.md +10 -9
  94. package/assets/skills-zh/comet-hotfix/agents/openai.yaml +5 -0
  95. package/assets/skills-zh/comet-native/SKILL.md +60 -171
  96. package/assets/skills-zh/comet-native/agents/openai.yaml +3 -0
  97. package/assets/skills-zh/comet-native/reference/artifacts.md +24 -89
  98. package/assets/skills-zh/comet-native/reference/clarification.md +40 -15
  99. package/assets/skills-zh/comet-native/reference/commands.md +30 -173
  100. package/assets/skills-zh/comet-native/reference/recovery.md +36 -86
  101. package/assets/skills-zh/comet-native/reference/workspace.md +23 -0
  102. package/assets/skills-zh/comet-open/SKILL.md +31 -11
  103. package/assets/skills-zh/comet-open/agents/openai.yaml +5 -0
  104. package/assets/skills-zh/comet-tweak/SKILL.md +11 -10
  105. package/assets/skills-zh/comet-tweak/agents/openai.yaml +5 -0
  106. package/assets/skills-zh/comet-verify/SKILL.md +9 -8
  107. package/assets/skills-zh/comet-verify/agents/openai.yaml +5 -0
  108. package/bin/fast-runtime-router.js +0 -4
  109. package/dist/app/cli/index.js +20 -1
  110. package/dist/app/cli/index.js.map +1 -1
  111. package/dist/app/commands/classic.d.ts.map +1 -1
  112. package/dist/app/commands/classic.js +2 -0
  113. package/dist/app/commands/classic.js.map +1 -1
  114. package/dist/app/commands/doctor.d.ts.map +1 -1
  115. package/dist/app/commands/doctor.js +8 -0
  116. package/dist/app/commands/doctor.js.map +1 -1
  117. package/dist/app/commands/eval.d.ts +9 -2
  118. package/dist/app/commands/eval.d.ts.map +1 -1
  119. package/dist/app/commands/eval.js +293 -48
  120. package/dist/app/commands/eval.js.map +1 -1
  121. package/dist/app/commands/init.d.ts.map +1 -1
  122. package/dist/app/commands/init.js +11 -2
  123. package/dist/app/commands/init.js.map +1 -1
  124. package/dist/app/commands/update.d.ts.map +1 -1
  125. package/dist/app/commands/update.js +13 -3
  126. package/dist/app/commands/update.js.map +1 -1
  127. package/dist/config/repository-layout.json +0 -8
  128. package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
  129. package/dist/domains/bundle/bundle-platform.js +8 -0
  130. package/dist/domains/bundle/bundle-platform.js.map +1 -1
  131. package/dist/domains/bundle/types.d.ts +1 -1
  132. package/dist/domains/bundle/types.d.ts.map +1 -1
  133. package/dist/domains/comet-classic/classic-cli.d.ts +1 -1
  134. package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
  135. package/dist/domains/comet-classic/classic-cli.js +3 -0
  136. package/dist/domains/comet-classic/classic-cli.js.map +1 -1
  137. package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
  138. package/dist/domains/comet-classic/classic-current-change.js +29 -3
  139. package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
  140. package/dist/domains/comet-classic/classic-guard.js +2 -2
  141. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  142. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  143. package/dist/domains/comet-classic/classic-hook-guard.js +14 -1
  144. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  145. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  146. package/dist/domains/comet-classic/classic-state-command.js +31 -8
  147. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  148. package/dist/domains/comet-classic/classic-workspace-command.d.ts +3 -0
  149. package/dist/domains/comet-classic/classic-workspace-command.d.ts.map +1 -0
  150. package/dist/domains/comet-classic/classic-workspace-command.js +45 -0
  151. package/dist/domains/comet-classic/classic-workspace-command.js.map +1 -0
  152. package/dist/domains/comet-classic/classic-workspace.d.ts +38 -0
  153. package/dist/domains/comet-classic/classic-workspace.d.ts.map +1 -0
  154. package/dist/domains/comet-classic/classic-workspace.js +315 -0
  155. package/dist/domains/comet-classic/classic-workspace.js.map +1 -0
  156. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  157. package/dist/domains/comet-entry/hook-adapter.js +3 -0
  158. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  159. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -0
  160. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  161. package/dist/domains/comet-entry/hook-router-entry.js +32 -3
  162. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  163. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  164. package/dist/domains/comet-entry/init-workflow.js +13 -5
  165. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  166. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -1
  167. package/dist/domains/comet-entry/project-activation.js +2 -1
  168. package/dist/domains/comet-entry/project-activation.js.map +1 -1
  169. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  170. package/dist/domains/comet-entry/resume-probe.js +48 -4
  171. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  172. package/dist/domains/comet-native/index.d.ts +1 -0
  173. package/dist/domains/comet-native/index.d.ts.map +1 -1
  174. package/dist/domains/comet-native/index.js +1 -0
  175. package/dist/domains/comet-native/index.js.map +1 -1
  176. package/dist/domains/comet-native/native-acceptance.d.ts +4 -3
  177. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  178. package/dist/domains/comet-native/native-acceptance.js +23 -18
  179. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  180. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  181. package/dist/domains/comet-native/native-archive-command.js +204 -61
  182. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  183. package/dist/domains/comet-native/native-archive-transaction.d.ts.map +1 -1
  184. package/dist/domains/comet-native/native-archive-transaction.js +28 -23
  185. package/dist/domains/comet-native/native-archive-transaction.js.map +1 -1
  186. package/dist/domains/comet-native/native-archive.d.ts +1 -0
  187. package/dist/domains/comet-native/native-archive.d.ts.map +1 -1
  188. package/dist/domains/comet-native/native-archive.js +56 -12
  189. package/dist/domains/comet-native/native-archive.js.map +1 -1
  190. package/dist/domains/comet-native/native-bounded-file.d.ts +32 -2
  191. package/dist/domains/comet-native/native-bounded-file.d.ts.map +1 -1
  192. package/dist/domains/comet-native/native-bounded-file.js +87 -6
  193. package/dist/domains/comet-native/native-bounded-file.js.map +1 -1
  194. package/dist/domains/comet-native/native-build-evidence.d.ts.map +1 -1
  195. package/dist/domains/comet-native/native-build-evidence.js +23 -1
  196. package/dist/domains/comet-native/native-build-evidence.js.map +1 -1
  197. package/dist/domains/comet-native/native-change.d.ts +1 -0
  198. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  199. package/dist/domains/comet-native/native-change.js +96 -8
  200. package/dist/domains/comet-native/native-change.js.map +1 -1
  201. package/dist/domains/comet-native/native-check-executor.d.ts +36 -0
  202. package/dist/domains/comet-native/native-check-executor.d.ts.map +1 -0
  203. package/dist/domains/comet-native/native-check-executor.js +132 -0
  204. package/dist/domains/comet-native/native-check-executor.js.map +1 -0
  205. package/dist/domains/comet-native/native-check-receipt-model.d.ts +9 -0
  206. package/dist/domains/comet-native/native-check-receipt-model.d.ts.map +1 -1
  207. package/dist/domains/comet-native/native-check-receipt-model.js +70 -8
  208. package/dist/domains/comet-native/native-check-receipt-model.js.map +1 -1
  209. package/dist/domains/comet-native/native-check-receipt-storage.d.ts.map +1 -1
  210. package/dist/domains/comet-native/native-check-receipt-storage.js +9 -8
  211. package/dist/domains/comet-native/native-check-receipt-storage.js.map +1 -1
  212. package/dist/domains/comet-native/native-check-receipt.d.ts.map +1 -1
  213. package/dist/domains/comet-native/native-check-receipt.js +123 -60
  214. package/dist/domains/comet-native/native-check-receipt.js.map +1 -1
  215. package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -1
  216. package/dist/domains/comet-native/native-checkpoint-command.js +0 -6
  217. package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -1
  218. package/dist/domains/comet-native/native-checkpoint-storage.d.ts.map +1 -1
  219. package/dist/domains/comet-native/native-checkpoint-storage.js +27 -19
  220. package/dist/domains/comet-native/native-checkpoint-storage.js.map +1 -1
  221. package/dist/domains/comet-native/native-children.d.ts +49 -0
  222. package/dist/domains/comet-native/native-children.d.ts.map +1 -0
  223. package/dist/domains/comet-native/native-children.js +388 -0
  224. package/dist/domains/comet-native/native-children.js.map +1 -0
  225. package/dist/domains/comet-native/native-cli-help.d.ts +6 -0
  226. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -0
  227. package/dist/domains/comet-native/native-cli-help.js +192 -0
  228. package/dist/domains/comet-native/native-cli-help.js.map +1 -0
  229. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  230. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  231. package/dist/domains/comet-native/native-cli-shared.js +46 -24
  232. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  233. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  234. package/dist/domains/comet-native/native-cli.js +18 -11
  235. package/dist/domains/comet-native/native-cli.js.map +1 -1
  236. package/dist/domains/comet-native/native-config.d.ts +2 -1
  237. package/dist/domains/comet-native/native-config.d.ts.map +1 -1
  238. package/dist/domains/comet-native/native-config.js +2 -1
  239. package/dist/domains/comet-native/native-config.js.map +1 -1
  240. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  241. package/dist/domains/comet-native/native-continuation.js +175 -147
  242. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  243. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  244. package/dist/domains/comet-native/native-diagnostics.js +96 -13
  245. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  246. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  247. package/dist/domains/comet-native/native-doctor-command.js +332 -0
  248. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  249. package/dist/domains/comet-native/native-doctor.d.ts +1 -0
  250. package/dist/domains/comet-native/native-doctor.d.ts.map +1 -1
  251. package/dist/domains/comet-native/native-doctor.js +116 -22
  252. package/dist/domains/comet-native/native-doctor.js.map +1 -1
  253. package/dist/domains/comet-native/native-evidence-projection.d.ts +50 -0
  254. package/dist/domains/comet-native/native-evidence-projection.d.ts.map +1 -0
  255. package/dist/domains/comet-native/native-evidence-projection.js +284 -0
  256. package/dist/domains/comet-native/native-evidence-projection.js.map +1 -0
  257. package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
  258. package/dist/domains/comet-native/native-evidence-retention.js +14 -12
  259. package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
  260. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  261. package/dist/domains/comet-native/native-evidence-storage.js +14 -11
  262. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  263. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  264. package/dist/domains/comet-native/native-findings.js +18 -0
  265. package/dist/domains/comet-native/native-findings.js.map +1 -1
  266. package/dist/domains/comet-native/native-git-provenance.d.ts +16 -0
  267. package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -0
  268. package/dist/domains/comet-native/native-git-provenance.js +171 -0
  269. package/dist/domains/comet-native/native-git-provenance.js.map +1 -0
  270. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  271. package/dist/domains/comet-native/native-hook-guard.js +199 -19
  272. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  273. package/dist/domains/comet-native/native-init-command.d.ts.map +1 -1
  274. package/dist/domains/comet-native/native-init-command.js +14 -2
  275. package/dist/domains/comet-native/native-init-command.js.map +1 -1
  276. package/dist/domains/comet-native/native-local-execution.d.ts +25 -0
  277. package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -0
  278. package/dist/domains/comet-native/native-local-execution.js +241 -0
  279. package/dist/domains/comet-native/native-local-execution.js.map +1 -0
  280. package/dist/domains/comet-native/native-lock.d.ts +1 -1
  281. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  282. package/dist/domains/comet-native/native-lock.js +9 -9
  283. package/dist/domains/comet-native/native-lock.js.map +1 -1
  284. package/dist/domains/comet-native/native-loop-runtime.d.ts +63 -0
  285. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -0
  286. package/dist/domains/comet-native/native-loop-runtime.js +580 -0
  287. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -0
  288. package/dist/domains/comet-native/native-mutation-lock.d.ts +2 -0
  289. package/dist/domains/comet-native/native-mutation-lock.d.ts.map +1 -1
  290. package/dist/domains/comet-native/native-mutation-lock.js +23 -2
  291. package/dist/domains/comet-native/native-mutation-lock.js.map +1 -1
  292. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  293. package/dist/domains/comet-native/native-new-command.js +27 -20
  294. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  295. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  296. package/dist/domains/comet-native/native-next-command.js +193 -62
  297. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  298. package/dist/domains/comet-native/native-paths.d.ts +18 -0
  299. package/dist/domains/comet-native/native-paths.d.ts.map +1 -1
  300. package/dist/domains/comet-native/native-paths.js +125 -13
  301. package/dist/domains/comet-native/native-paths.js.map +1 -1
  302. package/dist/domains/comet-native/native-portable-acceptance.d.ts +28 -0
  303. package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -0
  304. package/dist/domains/comet-native/native-portable-acceptance.js +73 -0
  305. package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -0
  306. package/dist/domains/comet-native/native-portable-archive.d.ts +37 -0
  307. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -0
  308. package/dist/domains/comet-native/native-portable-archive.js +492 -0
  309. package/dist/domains/comet-native/native-portable-archive.js.map +1 -0
  310. package/dist/domains/comet-native/native-portable-continuation.d.ts +30 -0
  311. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -0
  312. package/dist/domains/comet-native/native-portable-continuation.js +403 -0
  313. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -0
  314. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts +9 -0
  315. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -0
  316. package/dist/domains/comet-native/native-portable-migration-runtime.js +213 -0
  317. package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -0
  318. package/dist/domains/comet-native/native-portable-migration.d.ts +42 -0
  319. package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -0
  320. package/dist/domains/comet-native/native-portable-migration.js +212 -0
  321. package/dist/domains/comet-native/native-portable-migration.js.map +1 -0
  322. package/dist/domains/comet-native/native-portable-recovery.d.ts +15 -0
  323. package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -0
  324. package/dist/domains/comet-native/native-portable-recovery.js +203 -0
  325. package/dist/domains/comet-native/native-portable-recovery.js.map +1 -0
  326. package/dist/domains/comet-native/native-portable-runtime.d.ts +155 -0
  327. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -0
  328. package/dist/domains/comet-native/native-portable-runtime.js +1550 -0
  329. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -0
  330. package/dist/domains/comet-native/native-portable-state.d.ts +30 -0
  331. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -0
  332. package/dist/domains/comet-native/native-portable-state.js +701 -0
  333. package/dist/domains/comet-native/native-portable-state.js.map +1 -0
  334. package/dist/domains/comet-native/native-portable-status.d.ts +65 -0
  335. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -0
  336. package/dist/domains/comet-native/native-portable-status.js +133 -0
  337. package/dist/domains/comet-native/native-portable-status.js.map +1 -0
  338. package/dist/domains/comet-native/native-portable-text.d.ts +8 -0
  339. package/dist/domains/comet-native/native-portable-text.d.ts.map +1 -0
  340. package/dist/domains/comet-native/native-portable-text.js +28 -0
  341. package/dist/domains/comet-native/native-portable-text.js.map +1 -0
  342. package/dist/domains/comet-native/native-portable-transactions.d.ts +41 -0
  343. package/dist/domains/comet-native/native-portable-transactions.d.ts.map +1 -0
  344. package/dist/domains/comet-native/native-portable-transactions.js +204 -0
  345. package/dist/domains/comet-native/native-portable-transactions.js.map +1 -0
  346. package/dist/domains/comet-native/native-portable-types.d.ts +166 -0
  347. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -0
  348. package/dist/domains/comet-native/native-portable-types.js +18 -0
  349. package/dist/domains/comet-native/native-portable-types.js.map +1 -0
  350. package/dist/domains/comet-native/native-repair-integration.js +5 -5
  351. package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
  352. package/dist/domains/comet-native/native-resume-view.d.ts.map +1 -1
  353. package/dist/domains/comet-native/native-resume-view.js +1 -5
  354. package/dist/domains/comet-native/native-resume-view.js.map +1 -1
  355. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  356. package/dist/domains/comet-native/native-root-move.js +4 -20
  357. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  358. package/dist/domains/comet-native/native-run-consistency.d.ts.map +1 -1
  359. package/dist/domains/comet-native/native-run-consistency.js +8 -12
  360. package/dist/domains/comet-native/native-run-consistency.js.map +1 -1
  361. package/dist/domains/comet-native/native-run-store.js +4 -4
  362. package/dist/domains/comet-native/native-run-store.js.map +1 -1
  363. package/dist/domains/comet-native/native-runner-input.d.ts +160 -0
  364. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -0
  365. package/dist/domains/comet-native/native-runner-input.js +347 -0
  366. package/dist/domains/comet-native/native-runner-input.js.map +1 -0
  367. package/dist/domains/comet-native/native-runner-protocol.d.ts +40 -0
  368. package/dist/domains/comet-native/native-runner-protocol.d.ts.map +1 -0
  369. package/dist/domains/comet-native/native-runner-protocol.js +55 -0
  370. package/dist/domains/comet-native/native-runner-protocol.js.map +1 -0
  371. package/dist/domains/comet-native/native-runtime-package.d.ts +3 -0
  372. package/dist/domains/comet-native/native-runtime-package.d.ts.map +1 -1
  373. package/dist/domains/comet-native/native-runtime-package.js +5 -1
  374. package/dist/domains/comet-native/native-runtime-package.js.map +1 -1
  375. package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
  376. package/dist/domains/comet-native/native-schema-migration.js +30 -27
  377. package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
  378. package/dist/domains/comet-native/native-select-command.d.ts.map +1 -1
  379. package/dist/domains/comet-native/native-select-command.js +8 -4
  380. package/dist/domains/comet-native/native-select-command.js.map +1 -1
  381. package/dist/domains/comet-native/native-selection.d.ts.map +1 -1
  382. package/dist/domains/comet-native/native-selection.js +11 -2
  383. package/dist/domains/comet-native/native-selection.js.map +1 -1
  384. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
  385. package/dist/domains/comet-native/native-show-command.js +37 -0
  386. package/dist/domains/comet-native/native-show-command.js.map +1 -1
  387. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  388. package/dist/domains/comet-native/native-snapshot.js +13 -10
  389. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  390. package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -1
  391. package/dist/domains/comet-native/native-spec-command.js +14 -28
  392. package/dist/domains/comet-native/native-spec-command.js.map +1 -1
  393. package/dist/domains/comet-native/native-specs.js +3 -3
  394. package/dist/domains/comet-native/native-specs.js.map +1 -1
  395. package/dist/domains/comet-native/native-status-command.d.ts.map +1 -1
  396. package/dist/domains/comet-native/native-status-command.js +7 -17
  397. package/dist/domains/comet-native/native-status-command.js.map +1 -1
  398. package/dist/domains/comet-native/native-status-discovery.d.ts +51 -0
  399. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -0
  400. package/dist/domains/comet-native/native-status-discovery.js +299 -0
  401. package/dist/domains/comet-native/native-status-discovery.js.map +1 -0
  402. package/dist/domains/comet-native/native-trajectory-recovery.d.ts.map +1 -1
  403. package/dist/domains/comet-native/native-trajectory-recovery.js +6 -9
  404. package/dist/domains/comet-native/native-trajectory-recovery.js.map +1 -1
  405. package/dist/domains/comet-native/native-transaction.d.ts.map +1 -1
  406. package/dist/domains/comet-native/native-transaction.js +31 -20
  407. package/dist/domains/comet-native/native-transaction.js.map +1 -1
  408. package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
  409. package/dist/domains/comet-native/native-transition-evidence.js +1 -0
  410. package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
  411. package/dist/domains/comet-native/native-transition-journal.d.ts.map +1 -1
  412. package/dist/domains/comet-native/native-transition-journal.js +71 -22
  413. package/dist/domains/comet-native/native-transition-journal.js.map +1 -1
  414. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  415. package/dist/domains/comet-native/native-transitions.js +167 -15
  416. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  417. package/dist/domains/comet-native/native-types.d.ts +36 -1
  418. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  419. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  420. package/dist/domains/comet-native/native-verification-receipt-runtime.js +18 -100
  421. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  422. package/dist/domains/comet-native/native-verification-report-v2.d.ts +12 -0
  423. package/dist/domains/comet-native/native-verification-report-v2.d.ts.map +1 -0
  424. package/dist/domains/comet-native/native-verification-report-v2.js +141 -0
  425. package/dist/domains/comet-native/native-verification-report-v2.js.map +1 -0
  426. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  427. package/dist/domains/comet-native/native-verification-runtime.js +7 -2
  428. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  429. package/dist/domains/comet-native/native-verification-scope.d.ts +23 -0
  430. package/dist/domains/comet-native/native-verification-scope.d.ts.map +1 -1
  431. package/dist/domains/comet-native/native-verification-scope.js +106 -19
  432. package/dist/domains/comet-native/native-verification-scope.js.map +1 -1
  433. package/dist/domains/comet-native/native-verifier-protocol.d.ts +49 -0
  434. package/dist/domains/comet-native/native-verifier-protocol.d.ts.map +1 -0
  435. package/dist/domains/comet-native/native-verifier-protocol.js +157 -0
  436. package/dist/domains/comet-native/native-verifier-protocol.js.map +1 -0
  437. package/dist/domains/comet-native/native-workspace-finish.d.ts +61 -0
  438. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -0
  439. package/dist/domains/comet-native/native-workspace-finish.js +332 -0
  440. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -0
  441. package/dist/domains/comet-native/native-workspace-preparation.d.ts +32 -0
  442. package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -0
  443. package/dist/domains/comet-native/native-workspace-preparation.js +324 -0
  444. package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -0
  445. package/dist/domains/comet-native/native-workspace.d.ts +9 -1
  446. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  447. package/dist/domains/comet-native/native-workspace.js +109 -11
  448. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  449. package/dist/domains/dashboard/collector.d.ts +1 -1
  450. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  451. package/dist/domains/dashboard/collector.js +102 -87
  452. package/dist/domains/dashboard/collector.js.map +1 -1
  453. package/dist/domains/dashboard/native-adapter.d.ts +155 -126
  454. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  455. package/dist/domains/dashboard/native-adapter.js +165 -268
  456. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  457. package/dist/domains/dashboard/native-collector.d.ts +5 -4
  458. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  459. package/dist/domains/dashboard/native-collector.js +506 -439
  460. package/dist/domains/dashboard/native-collector.js.map +1 -1
  461. package/dist/domains/dashboard/native-legacy-adapter.d.ts +37 -0
  462. package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -0
  463. package/dist/domains/dashboard/native-legacy-adapter.js +127 -0
  464. package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -0
  465. package/dist/domains/dashboard/server.d.ts.map +1 -1
  466. package/dist/domains/dashboard/server.js +5 -3
  467. package/dist/domains/dashboard/server.js.map +1 -1
  468. package/dist/domains/dashboard/types.d.ts +5 -0
  469. package/dist/domains/dashboard/types.d.ts.map +1 -1
  470. package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-B5cFR6hS.js +1 -0
  471. package/dist/domains/dashboard/web/assets/arc-CVQDtMsu.js +1 -0
  472. package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-C0v0kULK.js +36 -0
  473. package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-DpHLuxu4.js +132 -0
  474. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Ca5zba3N.js → c4Diagram-5PPSVZJV-BHnFxUs1.js} +1 -1
  475. package/dist/domains/dashboard/web/assets/channel-eM0x3m1G.js +1 -0
  476. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-Bj6HWRwi.js → chunk-2GRJ4B5K-CGC9gh5n.js} +1 -1
  477. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-B1kXfg5N.js → chunk-2Q5K7J3B-l4puLU_O.js} +1 -1
  478. package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-ls9jQHZc.js +231 -0
  479. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BAJLB5V6.js → chunk-5VM5RSS4-BVavmTEq.js} +1 -1
  480. package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-Dungt2g9.js +88 -0
  481. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-CwghIMO9.js → chunk-GF5L2VYU-BidXO_ZP.js} +5 -5
  482. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-JYluRsP-.js → chunk-JWPE2WC7-57L5Up5X.js} +1 -1
  483. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-CCVPBm0J.js → chunk-KBJHAD2P-C5u5vbwr.js} +1 -1
  484. package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-CvLz21I2.js +1 -0
  485. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DfYm7pN7.js → chunk-XXDRQBXY-D5nJpckG.js} +1 -1
  486. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-CEFhao2K.js +1 -0
  487. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-CEFhao2K.js +1 -0
  488. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-BBrkuiAU.js → cose-bilkent-JH36ORCC-Dp0JAGyE.js} +1 -1
  489. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-DlFhgQHt.js → cynefin-VYW2F7L2-EjC54l1g.js} +2 -2
  490. package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-CpYrW3w3.js +62 -0
  491. package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-h5K39rCk.js +4 -0
  492. package/dist/domains/dashboard/web/assets/demo-BfLsKrIL.js +45 -0
  493. package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-CKQj9O4H.js +30 -0
  494. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BQahyP-C.js → diagram-B4RE2ZJO-DXRIYcnW.js} +3 -3
  495. package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-wWutQYmv.js +24 -0
  496. package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-EgXLJQYi.js +24 -0
  497. package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-CsQRXDQZ.js +41 -0
  498. package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-gm328Eho.js +1 -0
  499. package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-BbbMVUx_.js +85 -0
  500. package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-1Y7scCns.js +156 -0
  501. package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-BAoBqczv.js +292 -0
  502. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-DCxvMAUJ.js → gitGraphDiagram-DS77QQ5N-CMUAyEzl.js} +3 -3
  503. package/dist/domains/dashboard/web/assets/{graph--OzhPTMs.js → graph-DOmOIIwC.js} +1 -1
  504. package/dist/domains/dashboard/web/assets/{index-Blit0P5Z.js → index-CCApJ0Yr.js} +1 -1
  505. package/dist/domains/dashboard/web/assets/index-DWdm_XBi.js +257 -0
  506. package/dist/domains/dashboard/web/assets/index-DhhbseFJ.css +1 -0
  507. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-9qXEkzDe.js → infoDiagram-6WML65LV-BaCdtYYC.js} +1 -1
  508. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkf5othW.js → ishikawaDiagram-WSZJBQD7-DQQlNnjU.js} +4 -4
  509. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C2_IkO4s.js → journeyDiagram-NVQOT4AX-DW9wUMqn.js} +1 -1
  510. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BxWgu4DL.js → kanban-definition-27J2QSJJ-C_ITaZ0q.js} +7 -7
  511. package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +1 -0
  512. package/dist/domains/dashboard/web/assets/{linear-Dkr6p-Ro.js → linear-DXOo6ZRT.js} +1 -1
  513. package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +1 -0
  514. package/dist/domains/dashboard/web/assets/mermaid.core-ol-0NI97.js +306 -0
  515. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-C9xyxGfa.js → mindmap-definition-FAOFIHXS-CHF_HOLV.js} +1 -1
  516. package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-wQEvkNF8.js +1 -0
  517. package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-C3H3kiIP.js +39 -0
  518. package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +3 -0
  519. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-Cy6iOcxc.js → quadrantDiagram-CIZ2JOQS-S0FdVzJb.js} +4 -4
  520. package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-DCDXDaVg.js +1 -0
  521. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-B_gZONhx.js → requirementDiagram-LRYGKXZP-BW8J4gO_.js} +1 -1
  522. package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-DQQBmLoy.js +40 -0
  523. package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-2tDcli0Y.js +162 -0
  524. package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-4sEZLBKb.js +1 -0
  525. package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-OgPb8pyR.js +1 -0
  526. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-CiDNPr4P.js +1 -0
  527. package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-DR7lwtxd.js +2 -0
  528. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-DggHFP9q.js +8 -0
  529. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DvONX2YQ.js → timeline-definition-Z64GVDOM-DNIJVlQV.js} +4 -4
  530. package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-CClhw4QZ.js +34 -0
  531. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-cf39WX2o.js → wardleyDiagram-T6FBY63Y-DzR3aFPS.js} +3 -3
  532. package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DZhq0ZRj.js +7 -0
  533. package/dist/domains/dashboard/web/index.html +16 -16
  534. package/dist/domains/dashboard/workspace.d.ts +24 -0
  535. package/dist/domains/dashboard/workspace.d.ts.map +1 -0
  536. package/dist/domains/dashboard/workspace.js +87 -0
  537. package/dist/domains/dashboard/workspace.js.map +1 -0
  538. package/dist/domains/eval/index.d.ts +3 -0
  539. package/dist/domains/eval/index.d.ts.map +1 -1
  540. package/dist/domains/eval/index.js +3 -0
  541. package/dist/domains/eval/index.js.map +1 -1
  542. package/dist/domains/eval/standalone-context.d.ts +19 -0
  543. package/dist/domains/eval/standalone-context.d.ts.map +1 -0
  544. package/dist/domains/eval/standalone-context.js +107 -0
  545. package/dist/domains/eval/standalone-context.js.map +1 -0
  546. package/dist/domains/eval/standalone-static-collect.d.ts +22 -0
  547. package/dist/domains/eval/standalone-static-collect.d.ts.map +1 -0
  548. package/dist/domains/eval/standalone-static-collect.js +779 -0
  549. package/dist/domains/eval/standalone-static-collect.js.map +1 -0
  550. package/dist/domains/eval/user-environment.d.ts +6 -0
  551. package/dist/domains/eval/user-environment.d.ts.map +1 -0
  552. package/dist/domains/eval/user-environment.js +73 -0
  553. package/dist/domains/eval/user-environment.js.map +1 -0
  554. package/dist/domains/integrations/openspec.d.ts +1 -1
  555. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  556. package/dist/domains/integrations/openspec.js +110 -26
  557. package/dist/domains/integrations/openspec.js.map +1 -1
  558. package/dist/domains/integrations/superpowers.d.ts +5 -1
  559. package/dist/domains/integrations/superpowers.d.ts.map +1 -1
  560. package/dist/domains/integrations/superpowers.js +21 -2
  561. package/dist/domains/integrations/superpowers.js.map +1 -1
  562. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  563. package/dist/domains/skill/platform-inspect.js +11 -3
  564. package/dist/domains/skill/platform-inspect.js.map +1 -1
  565. package/dist/domains/skill/platform-install.d.ts +8 -2
  566. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  567. package/dist/domains/skill/platform-install.js +115 -34
  568. package/dist/domains/skill/platform-install.js.map +1 -1
  569. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  570. package/dist/domains/skill/project-instructions.js +5 -3
  571. package/dist/domains/skill/project-instructions.js.map +1 -1
  572. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  573. package/dist/domains/skill/uninstall.js +69 -15
  574. package/dist/domains/skill/uninstall.js.map +1 -1
  575. package/dist/domains/workflow-contract/hook-write-policy.d.ts +9 -0
  576. package/dist/domains/workflow-contract/hook-write-policy.d.ts.map +1 -0
  577. package/dist/domains/workflow-contract/hook-write-policy.js +52 -0
  578. package/dist/domains/workflow-contract/hook-write-policy.js.map +1 -0
  579. package/dist/domains/workflow-contract/index.d.ts +3 -0
  580. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  581. package/dist/domains/workflow-contract/index.js +2 -0
  582. package/dist/domains/workflow-contract/index.js.map +1 -1
  583. package/dist/domains/workflow-contract/project-config.d.ts +3 -1
  584. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  585. package/dist/domains/workflow-contract/project-config.js +119 -19
  586. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  587. package/dist/domains/workflow-contract/project-gitignore.d.ts +9 -0
  588. package/dist/domains/workflow-contract/project-gitignore.d.ts.map +1 -0
  589. package/dist/domains/workflow-contract/project-gitignore.js +108 -0
  590. package/dist/domains/workflow-contract/project-gitignore.js.map +1 -0
  591. package/dist/domains/workflow-contract/protected-project-path.d.ts +13 -0
  592. package/dist/domains/workflow-contract/protected-project-path.d.ts.map +1 -1
  593. package/dist/domains/workflow-contract/protected-project-path.js +83 -0
  594. package/dist/domains/workflow-contract/protected-project-path.js.map +1 -1
  595. package/dist/domains/workflow-contract/types.d.ts +4 -0
  596. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  597. package/dist/platform/install/platforms.d.ts +3 -1
  598. package/dist/platform/install/platforms.d.ts.map +1 -1
  599. package/dist/platform/install/platforms.js +22 -2
  600. package/dist/platform/install/platforms.js.map +1 -1
  601. package/dist/platform/paths/git-worktree.d.ts +8 -1
  602. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  603. package/dist/platform/paths/git-worktree.js +41 -7
  604. package/dist/platform/paths/git-worktree.js.map +1 -1
  605. package/dist/platform/process/external-command.d.ts +13 -0
  606. package/dist/platform/process/external-command.d.ts.map +1 -0
  607. package/dist/platform/process/external-command.js +45 -0
  608. package/dist/platform/process/external-command.js.map +1 -0
  609. package/dist/platform/process/git.d.ts +12 -0
  610. package/dist/platform/process/git.d.ts.map +1 -0
  611. package/dist/platform/process/git.js +86 -0
  612. package/dist/platform/process/git.js.map +1 -0
  613. package/dist/platform/process/spawn-command.d.ts +8 -0
  614. package/dist/platform/process/spawn-command.d.ts.map +1 -0
  615. package/dist/platform/process/spawn-command.js +113 -0
  616. package/dist/platform/process/spawn-command.js.map +1 -0
  617. package/eval/.env.example +115 -0
  618. package/eval/README.md +237 -14
  619. package/eval/langfuse/.env.example +9 -0
  620. package/eval/langfuse/tests/conftest.py +146 -0
  621. package/eval/langfuse/tests/tasks/test_tasks.py +109 -0
  622. package/eval/langfuse/tests/test_adapter.py +272 -0
  623. package/eval/langsmith/.env.example +16 -0
  624. package/eval/langsmith/tests/conftest.py +10 -1
  625. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +4 -2
  626. package/eval/local/tasks/comet-native-clarification/validation/test_native_clarification.py +9 -21
  627. package/eval/local/tasks/comet-native-clarification-depth/validation/test_native_clarification_depth.py +4 -7
  628. package/eval/local/tasks/comet-native-clarification-modes/validation/test_native_clarification_modes.py +4 -10
  629. package/eval/local/tasks/comet-native-interrupted-transition/instruction.md +1 -1
  630. package/eval/local/tasks/comet-native-interrupted-transition/validation/test_native_interrupted_transition.py +15 -16
  631. package/eval/local/tasks/comet-native-repository-fact/instruction.md +2 -2
  632. package/eval/local/tasks/comet-native-repository-fact/validation/test_native_repository_fact.py +8 -2
  633. package/eval/local/tasks/comet-native-wave-b-decision-resume/instruction.md +8 -4
  634. package/eval/local/tasks/comet-native-wave-b-decision-resume/task.toml +6 -6
  635. package/eval/local/tasks/comet-native-wave-b-decision-resume/validation/test_native_wave_b_decision_resume.py +126 -135
  636. package/eval/local/tasks/comet-native-wave-c-verification-integrity/instruction.md +6 -6
  637. package/eval/local/tasks/comet-native-wave-c-verification-integrity/task.toml +8 -8
  638. package/eval/local/tasks/comet-native-wave-c-verification-integrity/validation/test_native_wave_c_verification_integrity.py +97 -317
  639. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +7 -7
  640. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +4 -4
  641. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +130 -199
  642. package/eval/local/tasks/comet-native-wave-e-parallel-safety/instruction.md +5 -5
  643. package/eval/local/tasks/comet-native-wave-e-parallel-safety/task.toml +8 -8
  644. package/eval/local/tasks/comet-native-wave-e-parallel-safety/validation/test_native_wave_e_parallel_safety.py +135 -239
  645. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -2
  646. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/instruction.md +3 -3
  647. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/task.toml +6 -6
  648. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/validation/test_native_wave_f_dashboard_readonly.py +81 -439
  649. package/eval/local/tasks/comet-native-workflow/instruction.md +5 -4
  650. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +145 -502
  651. package/eval/local/tasks/index.yaml +5 -5
  652. package/eval/local/tests/conftest.py +701 -80
  653. package/eval/local/tests/scaffold/fixtures/custom-agent/adapter.yaml +19 -0
  654. package/eval/local/tests/scaffold/test_agents.py +76 -0
  655. package/eval/local/tests/scaffold/test_aligned_comparison.py +70 -0
  656. package/eval/local/tests/scaffold/test_auto_tasks.py +350 -0
  657. package/eval/local/tests/scaffold/test_conftest_helpers.py +267 -18
  658. package/eval/local/tests/scaffold/test_custom_agents.py +174 -0
  659. package/eval/local/tests/scaffold/test_eval_context.py +217 -0
  660. package/eval/local/tests/scaffold/test_execution.py +364 -0
  661. package/eval/local/tests/scaffold/test_inline_tasks.py +56 -0
  662. package/eval/local/tests/scaffold/test_langfuse_trajectory.py +263 -0
  663. package/eval/local/tests/scaffold/test_langsmith_conftest.py +63 -0
  664. package/eval/local/tests/scaffold/test_logging.py +162 -0
  665. package/eval/local/tests/scaffold/test_manifest_tasks.py +76 -0
  666. package/eval/local/tests/scaffold/test_manifests.py +396 -0
  667. package/eval/local/tests/scaffold/test_native_aligned_eval.py +163 -35
  668. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +75 -2054
  669. package/eval/local/tests/scaffold/test_profiles.py +64 -6
  670. package/eval/local/tests/scaffold/test_task_resolution.py +212 -0
  671. package/eval/local/tests/scaffold/test_tasks.py +38 -52
  672. package/eval/local/tests/scaffold/test_utils.py +480 -4
  673. package/eval/local/tests/tasks/test_tasks.py +219 -17
  674. package/eval/local/treatments/comet/comet_native_phase1.yaml +7 -4
  675. package/eval/pyproject.toml +9 -4
  676. package/eval/scaffold/__init__.py +6 -0
  677. package/eval/scaffold/docker/agent-overlay.Dockerfile +41 -0
  678. package/eval/scaffold/python/__init__.py +128 -20
  679. package/eval/scaffold/python/agents.py +239 -0
  680. package/eval/scaffold/python/aligned_comparison.py +156 -27
  681. package/eval/scaffold/python/auto_tasks.py +700 -0
  682. package/eval/scaffold/python/custom_agents.py +172 -0
  683. package/eval/scaffold/python/eval_context.py +236 -0
  684. package/eval/scaffold/python/eval_schema.py +135 -0
  685. package/eval/scaffold/python/execution.py +544 -0
  686. package/eval/scaffold/python/generated_task_cache.py +230 -0
  687. package/eval/scaffold/python/generic_llm_judge.py +41 -14
  688. package/eval/scaffold/python/inline_tasks.py +118 -0
  689. package/eval/scaffold/python/judge_config.py +158 -37
  690. package/eval/scaffold/python/langfuse_adapter.py +1023 -0
  691. package/eval/scaffold/python/llm_judge.py +68 -11
  692. package/eval/scaffold/python/logging.py +157 -17
  693. package/eval/scaffold/python/manifest_tasks.py +69 -0
  694. package/eval/scaffold/python/manifests.py +443 -22
  695. package/eval/scaffold/python/native_eval.py +10 -5
  696. package/eval/scaffold/python/paths.py +11 -1
  697. package/eval/scaffold/python/task_resolution.py +176 -0
  698. package/eval/scaffold/python/tasks.py +17 -4
  699. package/eval/scaffold/python/utils.py +167 -11
  700. package/eval/scaffold/python/validation/core.py +48 -2
  701. package/eval/scaffold/python/validation/generic_rubric.py +9 -0
  702. package/eval/scaffold/python/validation/native_v4.py +249 -0
  703. package/eval/scaffold/python/validation/native_wave.py +4 -5
  704. package/eval/scaffold/python/validation/native_workflow.py +199 -98
  705. package/eval/scaffold/python/validation/rubric.py +130 -2
  706. package/eval/scaffold/shell/agent-runtime-config.sh +88 -0
  707. package/eval/scaffold/shell/docker.sh +534 -33
  708. package/eval/scaffold/shell/run-agent-runtime.sh +49 -0
  709. package/eval/scaffold/shell/run-claude-loop.sh +153 -14
  710. package/eval/schemas/comet.eval/v1alpha1.schema.json +244 -0
  711. package/package.json +9 -3
  712. package/assets/skills/comet-native/scripts/comet-native-check.mjs +0 -179
  713. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +0 -179
  714. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +0 -151
  715. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +0 -187
  716. package/dist/domains/comet-native/native-check-entry.d.ts +0 -2
  717. package/dist/domains/comet-native/native-check-entry.d.ts.map +0 -1
  718. package/dist/domains/comet-native/native-check-entry.js +0 -4
  719. package/dist/domains/comet-native/native-check-entry.js.map +0 -1
  720. package/dist/domains/comet-native/native-checkpoint-entry.d.ts +0 -2
  721. package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +0 -1
  722. package/dist/domains/comet-native/native-checkpoint-entry.js +0 -4
  723. package/dist/domains/comet-native/native-checkpoint-entry.js.map +0 -1
  724. package/dist/domains/comet-native/native-evidence-entry.d.ts +0 -2
  725. package/dist/domains/comet-native/native-evidence-entry.d.ts.map +0 -1
  726. package/dist/domains/comet-native/native-evidence-entry.js +0 -4
  727. package/dist/domains/comet-native/native-evidence-entry.js.map +0 -1
  728. package/dist/domains/comet-native/native-receipt-entry.d.ts +0 -2
  729. package/dist/domains/comet-native/native-receipt-entry.d.ts.map +0 -1
  730. package/dist/domains/comet-native/native-receipt-entry.js +0 -4
  731. package/dist/domains/comet-native/native-receipt-entry.js.map +0 -1
  732. package/dist/domains/dashboard/web/assets/arc-ClrSujVb.js +0 -1
  733. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-B4A_t84A.js +0 -36
  734. package/dist/domains/dashboard/web/assets/blockDiagram-GPEHLZMM-D72u2953.js +0 -132
  735. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +0 -1
  736. package/dist/domains/dashboard/web/assets/chunk-AQP2D5EJ-BA_zgMXZ.js +0 -231
  737. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +0 -1
  738. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +0 -1
  739. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-B0Bk5oiP.js +0 -4
  740. package/dist/domains/dashboard/web/assets/demo-DZYPLZpF.js +0 -25
  741. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-tvTUiBA2.js +0 -43
  742. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-BZfcK29q.js +0 -10
  743. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-D5bJnW2C.js +0 -24
  744. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-DTwWdzWJ.js +0 -24
  745. package/dist/domains/dashboard/web/assets/erDiagram-TEJ5UH35-BbvrdCp9.js +0 -85
  746. package/dist/domains/dashboard/web/assets/flowDiagram-I6XJVG4X-DgbR7Tcc.js +0 -162
  747. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-wWMOA7F4.js +0 -292
  748. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +0 -1
  749. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +0 -257
  750. package/dist/domains/dashboard/web/assets/layout-SsrduOYp.js +0 -1
  751. package/dist/domains/dashboard/web/assets/mermaid.core-DZUcsoG4.js +0 -301
  752. package/dist/domains/dashboard/web/assets/pieDiagram-4H26LBE5-Dn67tdOF.js +0 -30
  753. package/dist/domains/dashboard/web/assets/purify.es-VaSPOPhr.js +0 -3
  754. package/dist/domains/dashboard/web/assets/sankeyDiagram-5OEKKPKP-C3u-4dOk.js +0 -40
  755. package/dist/domains/dashboard/web/assets/sequenceDiagram-3UESZ5HK-Xd3ByTVF.js +0 -162
  756. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-CJGHL7Up.js +0 -1
  757. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +0 -1
  758. package/dist/domains/dashboard/web/assets/vennDiagram-CIIHVFJN-B-L4qWy4.js +0 -34
  759. package/dist/domains/dashboard/web/assets/xychartDiagram-2RQKCTM6-Dk1vcm3u.js +0 -7
  760. /package/assets/skills/{comet → comet-classic}/reference/classic-layout.md +0 -0
  761. /package/assets/skills-zh/{comet → comet-classic}/reference/classic-layout.md +0 -0
@@ -1,185 +1,190 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var mf=Object.create;var zo=Object.defineProperty;var vf=Object.getOwnPropertyDescriptor;var gf=Object.getOwnPropertyNames;var wf=Object.getPrototypeOf,yf=Object.prototype.hasOwnProperty;var Ii=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Nf=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gf(t))!yf.call(e,r)&&r!==i&&zo(e,r,{get:()=>t[r],enumerable:!(n=vf(t,r))||n.enumerable});return e};var wr=(e,t,i)=>(i=e!=null?mf(wf(e)):{},Nf(t||!e||!e.__esModule?zo(i,"default",{value:e,enumerable:!0}):i,e));var R=w(F=>{"use strict";var yr=Symbol.for("yaml.alias"),Jo=Symbol.for("yaml.document"),ji=Symbol.for("yaml.map"),Go=Symbol.for("yaml.pair"),Nr=Symbol.for("yaml.scalar"),Oi=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),bf=e=>!!e&&typeof e=="object"&&e[ge]===yr,kf=e=>!!e&&typeof e=="object"&&e[ge]===Jo,Sf=e=>!!e&&typeof e=="object"&&e[ge]===ji,Ef=e=>!!e&&typeof e=="object"&&e[ge]===Go,Ko=e=>!!e&&typeof e=="object"&&e[ge]===Nr,Rf=e=>!!e&&typeof e=="object"&&e[ge]===Oi;function Uo(e){if(e&&typeof e=="object")switch(e[ge]){case ji:case Oi:return!0}return!1}function Cf(e){if(e&&typeof e=="object")switch(e[ge]){case yr:case ji:case Nr:case Oi:return!0}return!1}var Pf=e=>(Ko(e)||Uo(e))&&!!e.anchor;F.ALIAS=yr;F.DOC=Jo;F.MAP=ji;F.NODE_TYPE=ge;F.PAIR=Go;F.SCALAR=Nr;F.SEQ=Oi;F.hasAnchor=Pf;F.isAlias=bf;F.isCollection=Uo;F.isDocument=kf;F.isMap=Sf;F.isNode=Cf;F.isPair=Ef;F.isScalar=Ko;F.isSeq=Rf});var Pt=w(br=>{"use strict";var M=R(),V=Symbol("break visit"),Yo=Symbol("skip children"),fe=Symbol("remove node");function $i(e,t){let i=Xo(t);M.isDocument(e)?rt(null,e.contents,i,Object.freeze([e]))===fe&&(e.contents=null):rt(null,e,i,Object.freeze([]))}$i.BREAK=V;$i.SKIP=Yo;$i.REMOVE=fe;function rt(e,t,i,n){let r=Qo(e,t,i,n);if(M.isNode(r)||M.isPair(r))return Zo(e,n,r),rt(e,r,i,n);if(typeof r!="symbol"){if(M.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=rt(a,t.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(t.items.splice(a,1),a-=1)}}}else if(M.isPair(t)){n=Object.freeze(n.concat(t));let a=rt("key",t.key,i,n);if(a===V)return V;a===fe&&(t.key=null);let o=rt("value",t.value,i,n);if(o===V)return V;o===fe&&(t.value=null)}}return r}async function Hi(e,t){let i=Xo(t);M.isDocument(e)?await at(null,e.contents,i,Object.freeze([e]))===fe&&(e.contents=null):await at(null,e,i,Object.freeze([]))}Hi.BREAK=V;Hi.SKIP=Yo;Hi.REMOVE=fe;async function at(e,t,i,n){let r=await Qo(e,t,i,n);if(M.isNode(r)||M.isPair(r))return Zo(e,n,r),at(e,r,i,n);if(typeof r!="symbol"){if(M.isCollection(t)){n=Object.freeze(n.concat(t));for(let a=0;a<t.items.length;++a){let o=await at(a,t.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(t.items.splice(a,1),a-=1)}}}else if(M.isPair(t)){n=Object.freeze(n.concat(t));let a=await at("key",t.key,i,n);if(a===V)return V;a===fe&&(t.key=null);let o=await at("value",t.value,i,n);if(o===V)return V;o===fe&&(t.value=null)}}return r}function Xo(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Qo(e,t,i,n){if(typeof i=="function")return i(e,t,n);if(M.isMap(t))return i.Map?.(e,t,n);if(M.isSeq(t))return i.Seq?.(e,t,n);if(M.isPair(t))return i.Pair?.(e,t,n);if(M.isScalar(t))return i.Scalar?.(e,t,n);if(M.isAlias(t))return i.Alias?.(e,t,n)}function Zo(e,t,i){let n=t[t.length-1];if(M.isCollection(n))n.items[e]=i;else if(M.isPair(n))e==="key"?n.key=i:n.value=i;else if(M.isDocument(n))n.contents=i;else{let r=M.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}br.visit=$i;br.visitAsync=Hi});var kr=w(ts=>{"use strict";var es=R(),Af=Pt(),xf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Tf=e=>e.replace(/[!,[\]{}]/g,t=>xf[t]),At=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let n=t.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[a,o]=n;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=n;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${r}`,!0),!1}}tagName(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,n,r]=t.match(/^(.*!)([^!]*)$/s);r||i(`The ${t} tag has no suffix`);let a=this.tags[n];if(a)try{return a+decodeURIComponent(r)}catch(o){return i(String(o)),null}return n==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,n]of Object.entries(this.tags))if(t.startsWith(n))return i+Tf(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(t&&n.length>0&&es.isNode(t.contents)){let a={};Af.visit(t.contents,(o,s)=>{es.isNode(s)&&s.tag&&(a[s.tag]=!0)}),r=Object.keys(a)}else r=[];for(let[a,o]of n)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||r.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
- `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};ts.Directives=At});var Mi=w(xt=>{"use strict";var is=R(),_f=Pt();function If(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function ns(e){let t=new Set;return _f.visit(e,{Value(i,n){n.anchor&&t.add(n.anchor)}}),t}function rs(e,t){for(let i=1;;++i){let n=`${e}${i}`;if(!t.has(n))return n}}function jf(e,t){let i=[],n=new Map,r=null;return{onAnchor:a=>{i.push(a),r??(r=ns(e));let o=rs(t,r);return r.add(o),o},setAnchors:()=>{for(let a of i){let o=n.get(a);if(typeof o=="object"&&o.anchor&&(is.isScalar(o.node)||is.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:n}}xt.anchorIsValid=If;xt.anchorNames=ns;xt.createNodeAnchors=jf;xt.findNewAnchor=rs});var Sr=w(as=>{"use strict";function Tt(e,t,i,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,a=n.length;r<a;++r){let o=n[r],s=Tt(e,n,String(r),o);s===void 0?delete n[r]:s!==o&&(n[r]=s)}else if(n instanceof Map)for(let r of Array.from(n.keys())){let a=n.get(r),o=Tt(e,n,r,a);o===void 0?n.delete(r):o!==a&&n.set(r,o)}else if(n instanceof Set)for(let r of Array.from(n)){let a=Tt(e,n,r,r);a===void 0?n.delete(r):a!==r&&(n.delete(r),n.add(a))}else for(let[r,a]of Object.entries(n)){let o=Tt(e,n,r,a);o===void 0?delete n[r]:o!==a&&(n[r]=o)}return e.call(t,i,n)}as.applyReviver=Tt});var Ne=w(ss=>{"use strict";var Of=R();function os(e,t,i){if(Array.isArray(e))return e.map((n,r)=>os(n,String(r),i));if(e&&typeof e.toJSON=="function"){if(!i||!Of.hasAnchor(e))return e.toJSON(t,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(e,n),i.onCreate=a=>{n.res=a,delete i.onCreate};let r=e.toJSON(t,i);return i.onCreate&&i.onCreate(r),r}return typeof e=="bigint"&&!i?.keep?Number(e):e}ss.toJS=os});var Fi=w(ls=>{"use strict";var $f=Sr(),cs=R(),Hf=Ne(),Er=class{constructor(t){Object.defineProperty(this,cs.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:a}={}){if(!cs.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=Hf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof a=="function"?$f.applyReviver(a,{"":s},"",s):s}};ls.NodeBase=Er});var _t=w(us=>{"use strict";var Mf=Mi(),Ff=Pt(),ot=R(),Lf=Fi(),Df=Ne(),Rr=class extends Lf.NodeBase{constructor(t){super(ot.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;i?.aliasResolveCache?n=i.aliasResolveCache:(n=[],Ff.visit(t,{Node:(a,o)=>{(ot.isAlias(o)||ot.hasAnchor(o))&&n.push(o)}}),i&&(i.aliasResolveCache=n));let r;for(let a of n){if(a===this)break;a.anchor===this.source&&(r=a)}return r}toJSON(t,i){if(!i)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:a}=i,o=this.resolve(r,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=n.get(o);if(s||(Df.toJS(o,null,i),s=n.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=Li(r,o,n)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,i,n){let r=`*${this.source}`;if(t){if(Mf.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${r} `}return r}};function Li(e,t,i){if(ot.isAlias(t)){let n=t.resolve(e),r=i&&n&&i.get(n);return r?r.count*r.aliasCount:0}else if(ot.isCollection(t)){let n=0;for(let r of t.items){let a=Li(e,r,i);a>n&&(n=a)}return n}else if(ot.isPair(t)){let n=Li(e,t.key,i),r=Li(e,t.value,i);return Math.max(n,r)}return 1}us.Alias=Rr});var $=w(Cr=>{"use strict";var Bf=R(),qf=Fi(),Vf=Ne(),Wf=e=>!e||typeof e!="function"&&typeof e!="object",be=class extends qf.NodeBase{constructor(t){super(Bf.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Vf.toJS(this.value,t,i)}toString(){return String(this.value)}};be.BLOCK_FOLDED="BLOCK_FOLDED";be.BLOCK_LITERAL="BLOCK_LITERAL";be.PLAIN="PLAIN";be.QUOTE_DOUBLE="QUOTE_DOUBLE";be.QUOTE_SINGLE="QUOTE_SINGLE";Cr.Scalar=be;Cr.isScalarValue=Wf});var It=w(ds=>{"use strict";var zf=_t(),Fe=R(),fs=$(),Jf="tag:yaml.org,2002:";function Gf(e,t,i){if(t){let n=i.filter(a=>a.tag===t),r=n.find(a=>!a.format)??n[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return i.find(n=>n.identify?.(e)&&!n.format)}function Kf(e,t,i){if(Fe.isDocument(e)&&(e=e.contents),Fe.isNode(e))return e;if(Fe.isPair(e)){let f=i.schema[Fe.MAP].createNode?.(i.schema,null,i);return f.items.push(e),f}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:n,onAnchor:r,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(n&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=r(e)),new zf.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=Jf+t.slice(2));let l=Gf(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new fs.Scalar(e);return c&&(c.node=f),f}l=e instanceof Map?o[Fe.MAP]:Symbol.iterator in Object(e)?o[Fe.SEQ]:o[Fe.MAP]}a&&(a(l),delete i.onTagObj);let u=l?.createNode?l.createNode(i.schema,e,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,e,i):new fs.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}ds.createNode=Kf});var Bi=w(Di=>{"use strict";var Uf=It(),de=R(),Yf=Fi();function Pr(e,t,i){let n=i;for(let r=t.length-1;r>=0;--r){let a=t[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=n,n=o}else n=new Map([[a,n]])}return Uf.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var hs=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Ar=class extends Yf.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(n=>de.isNode(n)||de.isPair(n)?n.clone(t):n),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(hs(t))this.add(i);else{let[n,...r]=t,a=this.get(n,!0);if(de.isCollection(a))a.addIn(r,i);else if(a===void 0&&this.schema)this.set(n,Pr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(t){let[i,...n]=t;if(n.length===0)return this.delete(i);let r=this.get(i,!0);if(de.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}getIn(t,i){let[n,...r]=t,a=this.get(n,!0);return r.length===0?!i&&de.isScalar(a)?a.value:a:de.isCollection(a)?a.getIn(r,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!de.isPair(i))return!1;let n=i.value;return n==null||t&&de.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(t){let[i,...n]=t;if(n.length===0)return this.has(i);let r=this.get(i,!0);return de.isCollection(r)?r.hasIn(n):!1}setIn(t,i){let[n,...r]=t;if(r.length===0)this.set(n,i);else{let a=this.get(n,!0);if(de.isCollection(a))a.setIn(r,i);else if(a===void 0&&this.schema)this.set(n,Pr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};Di.Collection=Ar;Di.collectionFromPath=Pr;Di.isEmptyPath=hs});var jt=w(qi=>{"use strict";var Xf=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function xr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Qf=(e,t,i)=>e.endsWith(`
6
- `)?xr(i,t):i.includes(`
4
+ var Yu=Object.create;var Co=Object.defineProperty;var Xu=Object.getOwnPropertyDescriptor;var Qu=Object.getOwnPropertyNames;var Zu=Object.getPrototypeOf,ed=Object.prototype.hasOwnProperty;var Ri=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var td=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Qu(t))!ed.call(e,n)&&n!==i&&Co(e,n,{get:()=>t[n],enumerable:!(r=Xu(t,n))||r.enumerable});return e};var St=(e,t,i)=>(i=e!=null?Yu(Zu(e)):{},td(t||!e||!e.__esModule?Co(i,"default",{value:e,enumerable:!0}):i,e));var P=g(B=>{"use strict";var sn=Symbol.for("yaml.alias"),Ao=Symbol.for("yaml.document"),xi=Symbol.for("yaml.map"),_o=Symbol.for("yaml.pair"),cn=Symbol.for("yaml.scalar"),Ci=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),id=e=>!!e&&typeof e=="object"&&e[ge]===sn,rd=e=>!!e&&typeof e=="object"&&e[ge]===Ao,nd=e=>!!e&&typeof e=="object"&&e[ge]===xi,ad=e=>!!e&&typeof e=="object"&&e[ge]===_o,To=e=>!!e&&typeof e=="object"&&e[ge]===cn,od=e=>!!e&&typeof e=="object"&&e[ge]===Ci;function Io(e){if(e&&typeof e=="object")switch(e[ge]){case xi:case Ci:return!0}return!1}function sd(e){if(e&&typeof e=="object")switch(e[ge]){case sn:case xi:case cn:case Ci:return!0}return!1}var cd=e=>(To(e)||Io(e))&&!!e.anchor;B.ALIAS=sn;B.DOC=Ao;B.MAP=xi;B.NODE_TYPE=ge;B.PAIR=_o;B.SCALAR=cn;B.SEQ=Ci;B.hasAnchor=cd;B.isAlias=id;B.isCollection=Io;B.isDocument=rd;B.isMap=nd;B.isNode=sd;B.isPair=ad;B.isScalar=To;B.isSeq=od});var Et=g(ln=>{"use strict";var D=P(),q=Symbol("break visit"),jo=Symbol("skip children"),ue=Symbol("remove node");function Ai(e,t){let i=$o(t);D.isDocument(e)?Ze(null,e.contents,i,Object.freeze([e]))===ue&&(e.contents=null):Ze(null,e,i,Object.freeze([]))}Ai.BREAK=q;Ai.SKIP=jo;Ai.REMOVE=ue;function Ze(e,t,i,r){let n=Oo(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Ho(e,r,n),Ze(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=Ze(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ue&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=Ze("key",t.key,i,r);if(a===q)return q;a===ue&&(t.key=null);let o=Ze("value",t.value,i,r);if(o===q)return q;o===ue&&(t.value=null)}}return n}async function _i(e,t){let i=$o(t);D.isDocument(e)?await et(null,e.contents,i,Object.freeze([e]))===ue&&(e.contents=null):await et(null,e,i,Object.freeze([]))}_i.BREAK=q;_i.SKIP=jo;_i.REMOVE=ue;async function et(e,t,i,r){let n=await Oo(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Ho(e,r,n),et(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=await et(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ue&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=await et("key",t.key,i,r);if(a===q)return q;a===ue&&(t.key=null);let o=await et("value",t.value,i,r);if(o===q)return q;o===ue&&(t.value=null)}}return n}function $o(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Oo(e,t,i,r){if(typeof i=="function")return i(e,t,r);if(D.isMap(t))return i.Map?.(e,t,r);if(D.isSeq(t))return i.Seq?.(e,t,r);if(D.isPair(t))return i.Pair?.(e,t,r);if(D.isScalar(t))return i.Scalar?.(e,t,r);if(D.isAlias(t))return i.Alias?.(e,t,r)}function Ho(e,t,i){let r=t[t.length-1];if(D.isCollection(r))r.items[e]=i;else if(D.isPair(r))e==="key"?r.key=i:r.value=i;else if(D.isDocument(r))r.contents=i;else{let n=D.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}ln.visit=Ai;ln.visitAsync=_i});var un=g(Bo=>{"use strict";var Do=P(),ld=Et(),ud={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dd=e=>e.replace(/[!,[\]{}]/g,t=>ud[t]),Pt=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.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[a,o]=r;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=t.match(/^(.*!)([^!]*)$/s);n||i(`The ${t} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(n)}catch(o){return i(String(o)),null}return r==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,r]of Object.entries(this.tags))if(t.startsWith(r))return i+dd(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(t&&r.length>0&&Do.isNode(t.contents)){let a={};ld.visit(t.contents,(o,s)=>{Do.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of r)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
+ `)}};Pt.defaultYaml={explicit:!1,version:"1.2"};Pt.defaultTags={"!!":"tag:yaml.org,2002:"};Bo.Directives=Pt});var Ti=g(Rt=>{"use strict";var Lo=P(),fd=Et();function hd(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function Mo(e){let t=new Set;return fd.visit(e,{Value(i,r){r.anchor&&t.add(r.anchor)}}),t}function Fo(e,t){for(let i=1;;++i){let r=`${e}${i}`;if(!t.has(r))return r}}function pd(e,t){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=Mo(e));let o=Fo(t,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&(Lo.isScalar(o.node)||Lo.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:r}}Rt.anchorIsValid=hd;Rt.anchorNames=Mo;Rt.createNodeAnchors=pd;Rt.findNewAnchor=Fo});var dn=g(Vo=>{"use strict";function xt(e,t,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,a=r.length;n<a;++n){let o=r[n],s=xt(e,r,String(n),o);s===void 0?delete r[n]:s!==o&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let a=r.get(n),o=xt(e,r,n,a);o===void 0?r.delete(n):o!==a&&r.set(n,o)}else if(r instanceof Set)for(let n of Array.from(r)){let a=xt(e,r,n,n);a===void 0?r.delete(n):a!==n&&(r.delete(n),r.add(a))}else for(let[n,a]of Object.entries(r)){let o=xt(e,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return e.call(t,i,r)}Vo.applyReviver=xt});var be=g(Wo=>{"use strict";var md=P();function qo(e,t,i){if(Array.isArray(e))return e.map((r,n)=>qo(r,String(n),i));if(e&&typeof e.toJSON=="function"){if(!i||!md.hasAnchor(e))return e.toJSON(t,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(e,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=e.toJSON(t,i);return i.onCreate&&i.onCreate(n),n}return typeof e=="bigint"&&!i?.keep?Number(e):e}Wo.toJS=qo});var Ii=g(Jo=>{"use strict";var vd=dn(),zo=P(),gd=be(),fn=class{constructor(t){Object.defineProperty(this,zo.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!zo.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=gd.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?vd.applyReviver(a,{"":s},"",s):s}};Jo.NodeBase=fn});var Ct=g(Go=>{"use strict";var wd=Ti(),yd=Et(),tt=P(),Nd=Ii(),bd=be(),hn=class extends Nd.NodeBase{constructor(t){super(tt.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],yd.visit(t,{Node:(a,o)=>{(tt.isAlias(o)||tt.hasAnchor(o))&&r.push(o)}}),i&&(i.aliasResolveCache=r));let n;for(let a of r){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(t,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:a}=i,o=this.resolve(n,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(o);if(s||(bd.toJS(o,null,i),s=r.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ji(n,o,r)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,i,r){let n=`*${this.source}`;if(t){if(wd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${n} `}return n}};function ji(e,t,i){if(tt.isAlias(t)){let r=t.resolve(e),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(tt.isCollection(t)){let r=0;for(let n of t.items){let a=ji(e,n,i);a>r&&(r=a)}return r}else if(tt.isPair(t)){let r=ji(e,t.key,i),n=ji(e,t.value,i);return Math.max(r,n)}return 1}Go.Alias=hn});var j=g(pn=>{"use strict";var kd=P(),Sd=Ii(),Ed=be(),Pd=e=>!e||typeof e!="function"&&typeof e!="object",ke=class extends Sd.NodeBase{constructor(t){super(kd.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Ed.toJS(this.value,t,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";pn.Scalar=ke;pn.isScalarValue=Pd});var At=g(Ko=>{"use strict";var Rd=Ct(),Me=P(),Uo=j(),xd="tag:yaml.org,2002:";function Cd(e,t,i){if(t){let r=i.filter(a=>a.tag===t),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return i.find(r=>r.identify?.(e)&&!r.format)}function Ad(e,t,i){if(Me.isDocument(e)&&(e=e.contents),Me.isNode(e))return e;if(Me.isPair(e)){let d=i.schema[Me.MAP].createNode?.(i.schema,null,i);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=n(e)),new Rd.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=xd+t.slice(2));let l=Cd(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new Uo.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?o[Me.MAP]:Symbol.iterator in Object(e)?o[Me.SEQ]:o[Me.MAP]}a&&(a(l),delete i.onTagObj);let u=l?.createNode?l.createNode(i.schema,e,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,e,i):new Uo.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}Ko.createNode=Ad});var Oi=g($i=>{"use strict";var _d=At(),de=P(),Td=Ii();function mn(e,t,i){let r=i;for(let n=t.length-1;n>=0;--n){let a=t[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return _d.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Yo=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,vn=class extends Td.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(r=>de.isNode(r)||de.isPair(r)?r.clone(t):r),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(Yo(t))this.add(i);else{let[r,...n]=t,a=this.get(r,!0);if(de.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,mn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(t){let[i,...r]=t;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(de.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(t,i){let[r,...n]=t,a=this.get(r,!0);return n.length===0?!i&&de.isScalar(a)?a.value:a:de.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!de.isPair(i))return!1;let r=i.value;return r==null||t&&de.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[i,...r]=t;if(r.length===0)return this.has(i);let n=this.get(i,!0);return de.isCollection(n)?n.hasIn(r):!1}setIn(t,i){let[r,...n]=t;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(de.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,mn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};$i.Collection=vn;$i.collectionFromPath=mn;$i.isEmptyPath=Yo});var _t=g(Hi=>{"use strict";var Id=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function gn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var jd=(e,t,i)=>e.endsWith(`
6
+ `)?gn(i,t):i.includes(`
7
7
  `)?`
8
- `+xr(i,t):(e.endsWith(" ")?"":" ")+i;qi.indentComment=xr;qi.lineComment=Qf;qi.stringifyComment=Xf});var ms=w(Ot=>{"use strict";var Zf="flow",Tr="block",Vi="quoted";function ed(e,t,i="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!r||r<0)return e;r<a&&(a=0);let c=Math.max(1+a,1+r-t.length);if(e.length<=c)return e;let l=[],u={},f=r-t.length;typeof n=="number"&&(n>r-Math.max(2,a)?l.push(0):f=r-n);let d,m,g=!1,h=-1,p=-1,y=-1;i===Tr&&(h=ps(e,h,t.length),h!==-1&&(f=h+c));for(let k;k=e[h+=1];){if(i===Vi&&k==="\\"){switch(p=h,e[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===Tr&&(h=ps(e,h,t.length)),f=h+t.length+c,d=void 0;else{if(k===" "&&m&&m!==" "&&m!==`
10
- `&&m!==" "){let S=e[h+1];S&&S!==" "&&S!==`
11
- `&&S!==" "&&(d=h)}if(h>=f)if(d)l.push(d),f=d+c,d=void 0;else if(i===Vi){for(;m===" "||m===" ";)m=k,k=e[h+=1],g=!0;let S=h>y+1?h-2:p-1;if(u[S])return e;l.push(S),u[S]=!0,f=S+c,d=void 0}else g=!0}m=k}if(g&&s&&s(),l.length===0)return e;o&&o();let N=e.slice(0,l[0]);for(let k=0;k<l.length;++k){let S=l[k],E=l[k+1]||e.length;S===0?N=`
12
- ${t}${e.slice(0,E)}`:(i===Vi&&u[S]&&(N+=`${e[S]}\\`),N+=`
13
- ${t}${e.slice(S+1,E)}`)}return N}function ps(e,t,i){let n=t,r=t+1,a=e[r];for(;a===" "||a===" ";)if(t<r+i)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
- `);n=t,r=t+1,a=e[r]}return n}Ot.FOLD_BLOCK=Tr;Ot.FOLD_FLOW=Zf;Ot.FOLD_QUOTED=Vi;Ot.foldFlowLines=ed});var Ht=w(vs=>{"use strict";var ie=$(),ke=ms(),zi=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ji=e=>/^(%|---|\.\.\.)/m.test(e);function td(e,t,i){if(!t||t<0)return!1;let n=t-i,r=e.length;if(r<=n)return!1;for(let a=0,o=0;a<r;++a)if(e[a]===`
15
- `){if(a-o>n)return!0;if(o=a+1,r-o<=n)return!1}return!0}function $t(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=t,r=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ji(e)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let u=i.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(n||i[c+2]==='"'||i.length<r)c+=1;else{for(o+=i.slice(s,c)+`
8
+ `+gn(i,t):(e.endsWith(" ")?"":" ")+i;Hi.indentComment=gn;Hi.lineComment=jd;Hi.stringifyComment=Id});var Qo=g(Tt=>{"use strict";var $d="flow",wn="block",Di="quoted";function Od(e,t,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return e;n<a&&(a=0);let c=Math.max(1+a,1+n-t.length);if(e.length<=c)return e;let l=[],u={},d=n-t.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):d=n-r);let f,p,v=!1,h=-1,m=-1,w=-1;i===wn&&(h=Xo(e,h,t.length),h!==-1&&(d=h+c));for(let b;b=e[h+=1];){if(i===Di&&b==="\\"){switch(m=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
9
+ `)i===wn&&(h=Xo(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
10
+ `&&p!==" "){let k=e[h+1];k&&k!==" "&&k!==`
11
+ `&&k!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(i===Di){for(;p===" "||p===" ";)p=b,b=e[h+=1],v=!0;let k=h>w+1?h-2:m-1;if(u[k])return e;l.push(k),u[k]=!0,d=k+c,f=void 0}else v=!0}p=b}if(v&&s&&s(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let k=l[b],S=l[b+1]||e.length;k===0?y=`
12
+ ${t}${e.slice(0,S)}`:(i===Di&&u[k]&&(y+=`${e[k]}\\`),y+=`
13
+ ${t}${e.slice(k+1,S)}`)}return y}function Xo(e,t,i){let r=t,n=t+1,a=e[n];for(;a===" "||a===" ";)if(t<n+i)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
+ `);r=t,n=t+1,a=e[n]}return r}Tt.FOLD_BLOCK=wn;Tt.FOLD_FLOW=$d;Tt.FOLD_QUOTED=Di;Tt.foldFlowLines=Od});var jt=g(Zo=>{"use strict";var ie=j(),Se=Qo(),Li=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Mi=e=>/^(%|---|\.\.\.)/m.test(e);function Hd(e,t,i){if(!t||t<0)return!1;let r=t-i,n=e.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(e[a]===`
15
+ `){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function It(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=t,n=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Mi(e)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let u=i.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(r||i[c+2]==='"'||i.length<n)c+=1;else{for(o+=i.slice(s,c)+`
16
16
 
17
17
  `;i[c+2]==="\\"&&i[c+3]==="n"&&i[c+4]!=='"';)o+=`
18
- `,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,n?o:ke.foldFlowLines(o,a,ke.FOLD_QUOTED,zi(t,!1))}function _r(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(e))return $t(e,t);let i=t.indent||(Ji(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${i}`)+"'";return t.implicitKey?n:ke.foldFlowLines(n,i,ke.FOLD_FLOW,zi(t,!1))}function st(e,t){let{singleQuote:i}=t.options,n;if(i===!1)n=$t;else{let r=e.includes('"'),a=e.includes("'");r&&!a?n=_r:a&&!r?n=$t:n=i?_r:$t}return n(e,t)}var Ir;try{Ir=new RegExp(`(^|(?<!
18
+ `,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,r?o:Se.foldFlowLines(o,a,Se.FOLD_QUOTED,Li(t,!1))}function yn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(e))return It(e,t);let i=t.indent||(Mi(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${i}`)+"'";return t.implicitKey?r:Se.foldFlowLines(r,i,Se.FOLD_FLOW,Li(t,!1))}function it(e,t){let{singleQuote:i}=t.options,r;if(i===!1)r=It;else{let n=e.includes('"'),a=e.includes("'");n&&!a?r=yn:a&&!n?r=It:r=i?yn:It}return r(e,t)}var Nn;try{Nn=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Ir=/\n+(?!\n|$)/g}function Wi({comment:e,type:t,value:i},n,r,a){let{blockQuote:o,commentString:s,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(i))return st(i,n);let l=n.indent||(n.forceBlockIndent||Ji(i)?" ":""),u=o==="literal"?!0:o==="folded"||t===ie.Scalar.BLOCK_FOLDED?!1:t===ie.Scalar.BLOCK_LITERAL?!0:!td(i,c,l.length);if(!i)return u?`|
23
+ |$)`,"g")}catch{Nn=/\n+(?!\n|$)/g}function Bi({comment:e,type:t,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return it(i,r);let l=r.indent||(r.forceBlockIndent||Mi(i)?" ":""),u=o==="literal"?!0:o==="folded"||t===ie.Scalar.BLOCK_FOLDED?!1:t===ie.Scalar.BLOCK_LITERAL?!0:!Hd(i,c,l.length);if(!i)return u?`|
24
24
  `:`>
25
- `;let f,d;for(d=i.length;d>0;--d){let E=i[d-1];if(E!==`
26
- `&&E!==" "&&E!==" ")break}let m=i.substring(d),g=m.indexOf(`
27
- `);g===-1?f="-":i===m||g!==m.length-1?(f="+",a&&a()):f="",m&&(i=i.slice(0,-m.length),m[m.length-1]===`
28
- `&&(m=m.slice(0,-1)),m=m.replace(Ir,`$&${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 N=i.substring(0,y<p?y+1:p);N&&(i=i.substring(N.length),N=N.replace(/\n+/g,`$&${l}`));let S=(h?l?"2":"1":"")+f;if(e&&(S+=" "+s(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!u){let E=i.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,C=zi(n,!0);o!=="folded"&&t!==ie.Scalar.BLOCK_FOLDED&&(C.onOverflow=()=>{v=!0});let b=ke.foldFlowLines(`${N}${E}${m}`,l,ke.FOLD_BLOCK,C);if(!v)return`>${S}
31
- ${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${S}
32
- ${l}${N}${i}${m}`}function id(e,t,i,n){let{type:r,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
33
- `)||u&&/[[\]{},]/.test(a))return st(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
- `)?st(a,t):Wi(e,t,i,n);if(!s&&!u&&r!==ie.Scalar.PLAIN&&a.includes(`
35
- `))return Wi(e,t,i,n);if(Ji(a)){if(c==="")return t.forceBlockIndent=!0,Wi(e,t,i,n);if(s&&c===l)return st(a,t)}let f=a.replace(/\n+/g,`$&
36
- ${c}`);if(o){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:m,tags:g}=t.doc.schema;if(g.some(d)||m?.some(d))return st(a,t)}return s?f:ke.foldFlowLines(f,c,ke.FOLD_FLOW,zi(t,!1))}function nd(e,t,i,n){let{implicitKey:r,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ie.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return r||a?st(o.value,t):Wi(o,t,i,n);case ie.Scalar.QUOTE_DOUBLE:return $t(o.value,t);case ie.Scalar.QUOTE_SINGLE:return _r(o.value,t);case ie.Scalar.PLAIN:return id(o,t,i,n);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:f}=t.options,d=r&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}vs.stringifyString=nd});var Mt=w(jr=>{"use strict";var rd=Mi(),Se=R(),ad=jt(),od=Ht();function sd(e,t){let i=Object.assign({blockQuote:!0,commentString:ad.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},e.schema.toStringOptions,t),n;switch(i.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:n,options:i}}function cd(e,t){if(t.tag){let r=e.filter(a=>a.tag===t.tag);if(r.length>0)return r.find(a=>a.format===t.format)??r[0]}let i,n;if(Se.isScalar(t)){n=t.value;let r=e.filter(a=>a.identify?.(n));if(r.length>1){let a=r.filter(o=>o.test);a.length>0&&(r=a)}i=r.find(a=>a.format===t.format)??r.find(a=>!a.format)}else n=t,i=e.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 ld(e,t,{anchors:i,doc:n}){if(!n.directives)return"";let r=[],a=(Se.isScalar(e)||Se.isCollection(e))&&e.anchor;a&&rd.anchorIsValid(a)&&(i.add(a),r.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function ud(e,t,i,n){if(Se.isPair(e))return e.toString(t,i,n);if(Se.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,a=Se.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>r=c});r??(r=cd(t.doc.schema.tags,a));let o=ld(a,r,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof r.stringify=="function"?r.stringify(a,t,i,n):Se.isScalar(a)?od.stringifyString(a,t,i,n):a.toString(t,i,n);return o?Se.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${t.indent}${s}`:s}jr.createStringifyContext=sd;jr.stringify=ud});var Ns=w(ys=>{"use strict";var we=R(),gs=$(),ws=Mt(),Ft=jt();function fd({key:e,value:t},i,n,r){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=i,d=we.isNode(e)&&e.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(e)||!we.isNode(e)&&typeof e=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let m=!f&&(!e||d&&t==null&&!i.inFlow||we.isCollection(e)||(we.isScalar(e)?e.type===gs.Scalar.BLOCK_FOLDED||e.type===gs.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(f||!a),indent:s+c});let g=!1,h=!1,p=ws.stringify(e,i,()=>g=!0,()=>h=!0);if(!m&&!i.inFlow&&p.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(i.inFlow){if(a||t==null)return g&&n&&n(),p===""?"?":m?`? ${p}`:p}else if(a&&!f||t==null&&m)return p=`? ${p}`,d&&!g?p+=Ft.lineComment(p,i.indent,l(d)):h&&r&&r(),p;g&&(d=null),m?(d&&(p+=Ft.lineComment(p,i.indent,l(d))),p=`? ${p}
38
- ${s}:`):(p=`${p}:`,d&&(p+=Ft.lineComment(p,i.indent,l(d))));let y,N,k;we.isNode(t)?(y=!!t.spaceBefore,N=t.commentBefore,k=t.comment):(y=!1,N=null,k=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!m&&!d&&we.isScalar(t)&&(i.indentAtStart=p.length+1),h=!1,!u&&c.length>=2&&!i.inFlow&&!m&&we.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=ws.stringify(t,i,()=>S=!0,()=>h=!0),v=" ";if(d||y||N){if(v=y?`
39
- `:"",N){let C=l(N);v+=`
40
- ${Ft.indentComment(C,i.indent)}`}E===""&&!i.inFlow?v===`
41
- `&&k&&(v=`
25
+ `;let d,f;for(f=i.length;f>0;--f){let S=i[f-1];if(S!==`
26
+ `&&S!==" "&&S!==" ")break}let p=i.substring(f),v=p.indexOf(`
27
+ `);v===-1?d="-":i===p||v!==p.length-1?(d="+",a&&a()):d="",p&&(i=i.slice(0,-p.length),p[p.length-1]===`
28
+ `&&(p=p.slice(0,-1)),p=p.replace(Nn,`$&${l}`));let h=!1,m,w=-1;for(m=0;m<i.length;++m){let S=i[m];if(S===" ")h=!0;else if(S===`
29
+ `)w=m;else break}let y=i.substring(0,w<m?w+1:m);y&&(i=i.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+d;if(e&&(k+=" "+s(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let S=i.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,A=Li(r,!0);o!=="folded"&&t!==ie.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{E=!0});let N=Se.foldFlowLines(`${y}${S}${p}`,l,Se.FOLD_BLOCK,A);if(!E)return`>${k}
31
+ ${l}${N}`}return i=i.replace(/\n+/g,`$&${l}`),`|${k}
32
+ ${l}${y}${i}${p}`}function Dd(e,t,i,r){let{type:n,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
33
+ `)||u&&/[[\]{},]/.test(a))return it(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
+ `)?it(a,t):Bi(e,t,i,r);if(!s&&!u&&n!==ie.Scalar.PLAIN&&a.includes(`
35
+ `))return Bi(e,t,i,r);if(Mi(a)){if(c==="")return t.forceBlockIndent=!0,Bi(e,t,i,r);if(s&&c===l)return it(a,t)}let d=a.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:v}=t.doc.schema;if(v.some(f)||p?.some(f))return it(a,t)}return s?d:Se.foldFlowLines(d,c,Se.FOLD_FLOW,Li(t,!1))}function Bd(e,t,i,r){let{implicitKey:n,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ie.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return n||a?it(o.value,t):Bi(o,t,i,r);case ie.Scalar.QUOTE_DOUBLE:return It(o.value,t);case ie.Scalar.QUOTE_SINGLE:return yn(o.value,t);case ie.Scalar.PLAIN:return Dd(o,t,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,f=n&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Zo.stringifyString=Bd});var $t=g(bn=>{"use strict";var Ld=Ti(),Ee=P(),Md=_t(),Fd=jt();function Vd(e,t){let i=Object.assign({blockQuote:!0,commentString:Md.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},e.schema.toStringOptions,t),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function qd(e,t){if(t.tag){let n=e.filter(a=>a.tag===t.tag);if(n.length>0)return n.find(a=>a.format===t.format)??n[0]}let i,r;if(Ee.isScalar(t)){r=t.value;let n=e.filter(a=>a.identify?.(r));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}i=n.find(a=>a.format===t.format)??n.find(a=>!a.format)}else r=t,i=e.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 Wd(e,t,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(Ee.isScalar(e)||Ee.isCollection(e))&&e.anchor;a&&Ld.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function zd(e,t,i,r){if(Ee.isPair(e))return e.toString(t,i,r);if(Ee.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,a=Ee.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=qd(t.doc.schema.tags,a));let o=Wd(a,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,t,i,r):Ee.isScalar(a)?Fd.stringifyString(a,t,i,r):a.toString(t,i,r);return o?Ee.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
+ ${t.indent}${s}`:s}bn.createStringifyContext=Vd;bn.stringify=zd});var rs=g(is=>{"use strict";var we=P(),es=j(),ts=$t(),Ot=_t();function Jd({key:e,value:t},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=i,f=we.isNode(e)&&e.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(e)||!we.isNode(e)&&typeof e=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!e||f&&t==null&&!i.inFlow||we.isCollection(e)||(we.isScalar(e)?e.type===es.Scalar.BLOCK_FOLDED||e.type===es.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let v=!1,h=!1,m=ts.stringify(e,i,()=>v=!0,()=>h=!0);if(!p&&!i.inFlow&&m.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(a||t==null)return v&&r&&r(),m===""?"?":p?`? ${m}`:m}else if(a&&!d||t==null&&p)return m=`? ${m}`,f&&!v?m+=Ot.lineComment(m,i.indent,l(f)):h&&n&&n(),m;v&&(f=null),p?(f&&(m+=Ot.lineComment(m,i.indent,l(f))),m=`? ${m}
38
+ ${s}:`):(m=`${m}:`,f&&(m+=Ot.lineComment(m,i.indent,l(f))));let w,y,b;we.isNode(t)?(w=!!t.spaceBefore,y=t.commentBefore,b=t.comment):(w=!1,y=null,b=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!p&&!f&&we.isScalar(t)&&(i.indentAtStart=m.length+1),h=!1,!u&&c.length>=2&&!i.inFlow&&!p&&we.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let k=!1,S=ts.stringify(t,i,()=>k=!0,()=>h=!0),E=" ";if(f||w||y){if(E=w?`
39
+ `:"",y){let A=l(y);E+=`
40
+ ${Ot.indentComment(A,i.indent)}`}S===""&&!i.inFlow?E===`
41
+ `&&b&&(E=`
42
42
 
43
- `):v+=`
44
- ${i.indent}`}else if(!m&&we.isCollection(t)){let C=E[0],b=E.indexOf(`
45
- `),_=b!==-1,z=i.inFlow??t.flow??t.items.length===0;if(_||!z){let nt=!1;if(_&&(C==="&"||C==="!")){let H=E.indexOf(" ");C==="&"&&H!==-1&&H<b&&E[H+1]==="!"&&(H=E.indexOf(" ",H+1)),(H===-1||b<H)&&(nt=!0)}nt||(v=`
46
- ${i.indent}`)}}else(E===""||E[0]===`
47
- `)&&(v="");return p+=v+E,i.inFlow?S&&n&&n():k&&!S?p+=Ft.lineComment(p,i.indent,l(k)):h&&r&&r(),p}ys.stringifyPair=fd});var $r=w(Or=>{"use strict";var bs=Ii("process");function dd(e,...t){e==="debug"&&console.log(...t)}function hd(e,t){(e==="debug"||e==="warn")&&(typeof bs.emitWarning=="function"?bs.emitWarning(t):console.warn(t))}Or.debug=dd;Or.warn=hd});var Xi=w(Yi=>{"use strict";var Ui=R(),ks=$(),Gi="<<",Ki={identify:e=>e===Gi||typeof e=="symbol"&&e.description===Gi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ks.Scalar(Symbol(Gi)),{addToJSMap:Ss}),stringify:()=>Gi},pd=(e,t)=>(Ki.identify(t)||Ui.isScalar(t)&&(!t.type||t.type===ks.Scalar.PLAIN)&&Ki.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Ki.tag&&i.default);function Ss(e,t,i){let n=Es(e,i);if(Ui.isSeq(n))for(let r of n.items)Hr(e,t,r);else if(Array.isArray(n))for(let r of n)Hr(e,t,r);else Hr(e,t,n)}function Hr(e,t,i){let n=Es(e,i);if(!Ui.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,e,Map);for(let[a,o]of r)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Es(e,t){return e&&Ui.isAlias(t)?t.resolve(e.doc,e):t}Yi.addMergeToJSMap=Ss;Yi.isMergeKey=pd;Yi.merge=Ki});var Fr=w(Ps=>{"use strict";var md=$r(),Rs=Xi(),vd=Mt(),Cs=R(),Mr=Ne();function gd(e,t,{key:i,value:n}){if(Cs.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,n);else if(Rs.isMergeKey(e,i))Rs.addMergeToJSMap(e,t,n);else{let r=Mr.toJS(i,"",e);if(t instanceof Map)t.set(r,Mr.toJS(n,r,e));else if(t instanceof Set)t.add(r);else{let a=wd(i,r,e),o=Mr.toJS(n,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function wd(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(Cs.isNode(e)&&i?.doc){let n=vd.createStringifyContext(i.doc,{});n.anchors=new Set;for(let a of i.anchors.keys())n.anchors.add(a.anchor);n.inFlow=!0,n.inStringifyKey=!0;let r=e.toString(n);if(!i.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),md.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return r}return JSON.stringify(t)}Ps.addPairToJSMap=gd});var Ee=w(Lr=>{"use strict";var As=It(),yd=Ns(),Nd=Fr(),Qi=R();function bd(e,t,i){let n=As.createNode(e,void 0,i),r=As.createNode(t,void 0,i);return new Zi(n,r)}var Zi=class e{constructor(t,i=null){Object.defineProperty(this,Qi.NODE_TYPE,{value:Qi.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:n}=this;return Qi.isNode(i)&&(i=i.clone(t)),Qi.isNode(n)&&(n=n.clone(t)),new e(i,n)}toJSON(t,i){let n=i?.mapAsMap?new Map:{};return Nd.addPairToJSMap(i,n,this)}toString(t,i,n){return t?.doc?yd.stringifyPair(this,t,i,n):JSON.stringify(this)}};Lr.Pair=Zi;Lr.createPair=bd});var Dr=w(Ts=>{"use strict";var Le=R(),xs=Mt(),en=jt();function kd(e,t,i){return(t.inFlow??e.flow?Ed:Sd)(e,t,i)}function Sd({comment:e,items:t},i,{blockItemPrefix:n,flowChars:r,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,u=Object.assign({},i,{indent:a,type:null}),f=!1,d=[];for(let g=0;g<t.length;++g){let h=t[g],p=null;if(Le.isNode(h))!f&&h.spaceBefore&&d.push(""),tn(i,d,h.commentBefore,f),h.comment&&(p=h.comment);else if(Le.isPair(h)){let N=Le.isNode(h.key)?h.key:null;N&&(!f&&N.spaceBefore&&d.push(""),tn(i,d,N.commentBefore,f))}f=!1;let y=xs.stringify(h,u,()=>p=null,()=>f=!0);p&&(y+=en.lineComment(y,a,l(p))),f&&p&&(f=!1),d.push(n+y)}let m;if(d.length===0)m=r.start+r.end;else{m=d[0];for(let g=1;g<d.length;++g){let h=d[g];m+=h?`
43
+ `):E+=`
44
+ ${i.indent}`}else if(!p&&we.isCollection(t)){let A=S[0],N=S.indexOf(`
45
+ `),O=N!==-1,Ne=i.inFlow??t.flow??t.items.length===0;if(O||!Ne){let Qe=!1;if(O&&(A==="&"||A==="!")){let H=S.indexOf(" ");A==="&"&&H!==-1&&H<N&&S[H+1]==="!"&&(H=S.indexOf(" ",H+1)),(H===-1||N<H)&&(Qe=!0)}Qe||(E=`
46
+ ${i.indent}`)}}else(S===""||S[0]===`
47
+ `)&&(E="");return m+=E+S,i.inFlow?k&&r&&r():b&&!k?m+=Ot.lineComment(m,i.indent,l(b)):h&&n&&n(),m}is.stringifyPair=Jd});var Sn=g(kn=>{"use strict";var ns=Ri("process");function Gd(e,...t){e==="debug"&&console.log(...t)}function Ud(e,t){(e==="debug"||e==="warn")&&(typeof ns.emitWarning=="function"?ns.emitWarning(t):console.warn(t))}kn.debug=Gd;kn.warn=Ud});var zi=g(Wi=>{"use strict";var qi=P(),as=j(),Fi="<<",Vi={identify:e=>e===Fi||typeof e=="symbol"&&e.description===Fi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new as.Scalar(Symbol(Fi)),{addToJSMap:os}),stringify:()=>Fi},Kd=(e,t)=>(Vi.identify(t)||qi.isScalar(t)&&(!t.type||t.type===as.Scalar.PLAIN)&&Vi.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Vi.tag&&i.default);function os(e,t,i){let r=ss(e,i);if(qi.isSeq(r))for(let n of r.items)En(e,t,n);else if(Array.isArray(r))for(let n of r)En(e,t,n);else En(e,t,r)}function En(e,t,i){let r=ss(e,i);if(!qi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,e,Map);for(let[a,o]of n)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function ss(e,t){return e&&qi.isAlias(t)?t.resolve(e.doc,e):t}Wi.addMergeToJSMap=os;Wi.isMergeKey=Kd;Wi.merge=Vi});var Rn=g(us=>{"use strict";var Yd=Sn(),cs=zi(),Xd=$t(),ls=P(),Pn=be();function Qd(e,t,{key:i,value:r}){if(ls.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,r);else if(cs.isMergeKey(e,i))cs.addMergeToJSMap(e,t,r);else{let n=Pn.toJS(i,"",e);if(t instanceof Map)t.set(n,Pn.toJS(r,n,e));else if(t instanceof Set)t.add(n);else{let a=Zd(i,n,e),o=Pn.toJS(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Zd(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(ls.isNode(e)&&i?.doc){let r=Xd.createStringifyContext(i.doc,{});r.anchors=new Set;for(let a of i.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=e.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Yd.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(t)}us.addPairToJSMap=Qd});var Pe=g(xn=>{"use strict";var ds=At(),ef=rs(),tf=Rn(),Ji=P();function rf(e,t,i){let r=ds.createNode(e,void 0,i),n=ds.createNode(t,void 0,i);return new Gi(r,n)}var Gi=class e{constructor(t,i=null){Object.defineProperty(this,Ji.NODE_TYPE,{value:Ji.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:r}=this;return Ji.isNode(i)&&(i=i.clone(t)),Ji.isNode(r)&&(r=r.clone(t)),new e(i,r)}toJSON(t,i){let r=i?.mapAsMap?new Map:{};return tf.addPairToJSMap(i,r,this)}toString(t,i,r){return t?.doc?ef.stringifyPair(this,t,i,r):JSON.stringify(this)}};xn.Pair=Gi;xn.createPair=rf});var Cn=g(hs=>{"use strict";var Fe=P(),fs=$t(),Ui=_t();function nf(e,t,i){return(t.inFlow??e.flow?of:af)(e,t,i)}function af({comment:e,items:t},i,{blockItemPrefix:r,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,u=Object.assign({},i,{indent:a,type:null}),d=!1,f=[];for(let v=0;v<t.length;++v){let h=t[v],m=null;if(Fe.isNode(h))!d&&h.spaceBefore&&f.push(""),Ki(i,f,h.commentBefore,d),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(!d&&y.spaceBefore&&f.push(""),Ki(i,f,y.commentBefore,d))}d=!1;let w=fs.stringify(h,u,()=>m=null,()=>d=!0);m&&(w+=Ui.lineComment(w,a,l(m))),d&&m&&(d=!1),f.push(r+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let v=1;v<f.length;++v){let h=f[v];p+=h?`
48
48
  ${c}${h}`:`
49
- `}}return e?(m+=`
50
- `+en.indentComment(l(e),c),s&&s()):f&&o&&o(),m}function Ed({items:e},t,{flowChars:i,itemIndent:n}){let{indent:r,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;n+=a;let c=Object.assign({},t,{indent:n,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<e.length;++g){let h=e[g],p=null;if(Le.isNode(h))h.spaceBefore&&f.push(""),tn(t,f,h.commentBefore,!1),h.comment&&(p=h.comment);else if(Le.isPair(h)){let N=Le.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&f.push(""),tn(t,f,N.commentBefore,!1),N.comment&&(l=!0));let k=Le.isNode(h.value)?h.value:null;k?(k.comment&&(p=k.comment),k.commentBefore&&(l=!0)):h.value==null&&N?.comment&&(p=N.comment)}p&&(l=!0);let y=xs.stringify(h,c,()=>p=null);l||(l=f.length>u||y.includes(`
51
- `)),g<e.length-1?y+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=f.reduce((N,k)=>N+k.length+2,2)+(y.length+2)>t.options.lineWidth)),l&&(y+=",")),p&&(y+=en.lineComment(y,n,s(p))),f.push(y),u=f.length}let{start:d,end:m}=i;if(f.length===0)return d+m;if(!l){let g=f.reduce((h,p)=>h+p.length+2,2);l=t.options.lineWidth>0&&g>t.options.lineWidth}if(l){let g=d;for(let h of f)g+=h?`
52
- ${a}${r}${h}`:`
53
- `;return`${g}
54
- ${r}${m}`}else return`${d}${o}${f.join(" ")}${o}${m}`}function tn({indent:e,options:{commentString:t}},i,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let a=en.indentComment(t(n),e);i.push(a.trimStart())}}Ts.stringifyCollection=kd});var Ce=w(qr=>{"use strict";var Rd=Dr(),Cd=Fr(),Pd=Bi(),Re=R(),nn=Ee(),Ad=$();function Lt(e,t){let i=Re.isScalar(t)?t.value:t;for(let n of e)if(Re.isPair(n)&&(n.key===t||n.key===i||Re.isScalar(n.key)&&n.key.value===i))return n}var Br=class extends Pd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Re.MAP,t),this.items=[]}static from(t,i,n){let{keepUndefined:r,replacer:a}=n,o=new this(t),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||r)&&o.items.push(nn.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 t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let n;Re.isPair(t)?n=t:!t||typeof t!="object"||!("key"in t)?n=new nn.Pair(t,t?.value):n=new nn.Pair(t.key,t.value);let r=Lt(this.items,n.key),a=this.schema?.sortMapEntries;if(r){if(!i)throw new Error(`Key ${n.key} already set`);Re.isScalar(r.value)&&Ad.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(a){let o=this.items.findIndex(s=>a(n,s)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(t){let i=Lt(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let r=Lt(this.items,t)?.value;return(!i&&Re.isScalar(r)?r.value:r)??void 0}has(t){return!!Lt(this.items,t)}set(t,i){this.add(new nn.Pair(t,i),!0)}toJSON(t,i,n){let r=n?new n:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(r);for(let a of this.items)Cd.addPairToJSMap(i,r,a);return r}toString(t,i,n){if(!t)return JSON.stringify(this);for(let r of this.items)if(!Re.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Rd.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:n,onComment:i})}};qr.YAMLMap=Br;qr.findPair=Lt});var ct=w(Is=>{"use strict";var xd=R(),_s=Ce(),Td={collection:"map",default:!0,nodeClass:_s.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return xd.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>_s.YAMLMap.from(e,t,i)};Is.map=Td});var Pe=w(js=>{"use strict";var _d=It(),Id=Dr(),jd=Bi(),an=R(),Od=$(),$d=Ne(),Vr=class extends jd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(an.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=rn(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let n=rn(t);if(typeof n!="number")return;let r=this.items[n];return!i&&an.isScalar(r)?r.value:r}has(t){let i=rn(t);return typeof i=="number"&&i<this.items.length}set(t,i){let n=rn(t);if(typeof n!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[n];an.isScalar(r)&&Od.isScalarValue(i)?r.value=i:this.items[n]=i}toJSON(t,i){let n=[];i?.onCreate&&i.onCreate(n);let r=0;for(let a of this.items)n.push($d.toJS(a,String(r++),i));return n}toString(t,i,n){return t?Id.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:n,onComment:i}):JSON.stringify(this)}static from(t,i,n){let{replacer:r}=n,a=new this(t);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof r=="function"){let c=i instanceof Set?s:String(o++);s=r.call(i,c,s)}a.items.push(_d.createNode(s,void 0,n))}}return a}};function rn(e){let t=an.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}js.YAMLSeq=Vr});var lt=w($s=>{"use strict";var Hd=R(),Os=Pe(),Md={collection:"seq",default:!0,nodeClass:Os.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Hd.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>Os.YAMLSeq.from(e,t,i)};$s.seq=Md});var Dt=w(Hs=>{"use strict";var Fd=Ht(),Ld={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,n){return t=Object.assign({actualString:!0},t),Fd.stringifyString(e,t,i,n)}};Hs.string=Ld});var on=w(Ls=>{"use strict";var Ms=$(),Fs={identify:e=>e==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:e},t)=>typeof e=="string"&&Fs.test.test(e)?e:t.options.nullStr};Ls.nullTag=Fs});var Wr=w(Bs=>{"use strict";var Dd=$(),Ds={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Dd.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&Ds.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?i.options.trueStr:i.options.falseStr}};Bs.boolTag=Ds});var ut=w(qs=>{"use strict";function Bd({format:e,minFractionDigits:t,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 a=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}qs.stringifyNumber=Bd});var Jr=w(sn=>{"use strict";var qd=$(),zr=ut(),Vd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:zr.stringifyNumber},Wd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():zr.stringifyNumber(e)}},zd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new qd.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:zr.stringifyNumber};sn.float=zd;sn.floatExp=Wd;sn.floatNaN=Vd});var Kr=w(ln=>{"use strict";var Vs=ut(),cn=e=>typeof e=="bigint"||Number.isInteger(e),Gr=(e,t,i,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),i);function Ws(e,t,i){let{value:n}=e;return cn(n)&&n>=0?i+n.toString(t):Vs.stringifyNumber(e)}var Jd={identify:e=>cn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>Gr(e,2,8,i),stringify:e=>Ws(e,8,"0o")},Gd={identify:cn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>Gr(e,0,10,i),stringify:Vs.stringifyNumber},Kd={identify:e=>cn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>Gr(e,2,16,i),stringify:e=>Ws(e,16,"0x")};ln.int=Gd;ln.intHex=Kd;ln.intOct=Jd});var Js=w(zs=>{"use strict";var Ud=ct(),Yd=on(),Xd=lt(),Qd=Dt(),Zd=Wr(),Ur=Jr(),Yr=Kr(),eh=[Ud.map,Xd.seq,Qd.string,Yd.nullTag,Zd.boolTag,Yr.intOct,Yr.int,Yr.intHex,Ur.floatNaN,Ur.floatExp,Ur.float];zs.schema=eh});var Us=w(Ks=>{"use strict";var th=$(),ih=ct(),nh=lt();function Gs(e){return typeof e=="bigint"||Number.isInteger(e)}var un=({value:e})=>JSON.stringify(e),rh=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:un},{identify:e=>e==null,createNode:()=>new th.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:un},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:un},{identify:Gs,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>Gs(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:un}],ah={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},oh=[ih.map,nh.seq].concat(rh,ah);Ks.schema=oh});var Qr=w(Ys=>{"use strict";var Bt=Ii("buffer"),Xr=$(),sh=Ht(),ch={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Bt.Buffer=="function")return Bt.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.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 t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:i},n,r,a){if(!i)return"";let o=i,s;if(typeof Bt.Buffer=="function")s=o instanceof Bt.Buffer?o.toString("base64"):Bt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Xr.Scalar.BLOCK_LITERAL),t!==Xr.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=s.substr(d,c);s=u.join(t===Xr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return sh.stringifyString({comment:e,type:t,value:s},n,r,a)}};Ys.binary=ch});var hn=w(dn=>{"use strict";var fn=R(),Zr=Ee(),lh=$(),uh=Pe();function Xs(e,t){if(fn.isSeq(e))for(let i=0;i<e.items.length;++i){let n=e.items[i];if(!fn.isPair(n)){if(fn.isMap(n)){n.items.length>1&&t("Each pair must have its own sequence indicator");let r=n.items[0]||new Zr.Pair(new lh.Scalar(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
56
- ${r.key.commentBefore}`:n.commentBefore),n.comment){let a=r.value??r.key;a.comment=a.comment?`${n.comment}
57
- ${a.comment}`:n.comment}n=r}e.items[i]=fn.isPair(n)?n:new Zr.Pair(n)}}else t("Expected a sequence for this tag");return e}function Qs(e,t,i){let{replacer:n}=i,r=new uh.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof n=="function"&&(o=n.call(t,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;r.items.push(Zr.createPair(s,c,i))}return r}var fh={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Xs,createNode:Qs};dn.createPairs=Qs;dn.pairs=fh;dn.resolvePairs=Xs});var ia=w(ta=>{"use strict";var Zs=R(),ea=Ne(),qt=Ce(),dh=Pe(),ec=hn(),De=class e extends dh.YAMLSeq{constructor(){super(),this.add=qt.YAMLMap.prototype.add.bind(this),this.delete=qt.YAMLMap.prototype.delete.bind(this),this.get=qt.YAMLMap.prototype.get.bind(this),this.has=qt.YAMLMap.prototype.has.bind(this),this.set=qt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(Zs.isPair(r)?(a=ea.toJS(r.key,"",i),o=ea.toJS(r.value,a,i)):a=ea.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(t,i,n){let r=ec.createPairs(t,i,n),a=new this;return a.items=r.items,a}};De.tag="tag:yaml.org,2002:omap";var hh={collection:"seq",identify:e=>e instanceof Map,nodeClass:De,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=ec.resolvePairs(e,t),n=[];for(let{key:r}of i.items)Zs.isScalar(r)&&(n.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new De,i)},createNode:(e,t,i)=>De.from(e,t,i)};ta.YAMLOMap=De;ta.omap=hh});var ac=w(na=>{"use strict";var tc=$();function ic({value:e,source:t},i){return t&&(e?nc:rc).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var nc={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new tc.Scalar(!0),stringify:ic},rc={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new tc.Scalar(!1),stringify:ic};na.falseTag=rc;na.trueTag=nc});var oc=w(pn=>{"use strict";var ph=$(),ra=ut(),mh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ra.stringifyNumber},vh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ra.stringifyNumber(e)}},gh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new ph.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let n=e.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(t.minFractionDigits=n.length)}return t},stringify:ra.stringifyNumber};pn.float=gh;pn.floatExp=vh;pn.floatNaN=mh});var cc=w(Wt=>{"use strict";var sc=ut(),Vt=e=>typeof e=="bigint"||Number.isInteger(e);function mn(e,t,i,{intAsBigInt:n}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),n){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return r==="-"?BigInt(-1)*o:o}let a=parseInt(e,i);return r==="-"?-1*a:a}function aa(e,t,i){let{value:n}=e;if(Vt(n)){let r=n.toString(t);return n<0?"-"+i+r.substr(1):i+r}return sc.stringifyNumber(e)}var wh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>mn(e,2,2,i),stringify:e=>aa(e,2,"0b")},yh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>mn(e,1,8,i),stringify:e=>aa(e,8,"0")},Nh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>mn(e,0,10,i),stringify:sc.stringifyNumber},bh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>mn(e,2,16,i),stringify:e=>aa(e,16,"0x")};Wt.int=Nh;Wt.intBin=wh;Wt.intHex=bh;Wt.intOct=yh});var sa=w(oa=>{"use strict";var wn=R(),vn=Ee(),gn=Ce(),Be=class e extends gn.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;wn.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new vn.Pair(t.key,null):i=new vn.Pair(t,null),gn.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let n=gn.findPair(this.items,t);return!i&&wn.isPair(n)?wn.isScalar(n.key)?n.key.value:n.key:n}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=gn.findPair(this.items,t);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new vn.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,n){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(t,i,n){let{replacer:r}=n,a=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(vn.createPair(o,null,n));return a}};Be.tag="tag:yaml.org,2002:set";var kh={collection:"map",identify:e=>e instanceof Set,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>Be.from(e,t,i),resolve(e,t){if(wn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Be,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};oa.YAMLSet=Be;oa.set=kh});var la=w(yn=>{"use strict";var Sh=ut();function ca(e,t){let i=e[0],n=i==="-"||i==="+"?e.substring(1):e,r=o=>t?BigInt(o):Number(o),a=n.replace(/_/g,"").split(":").reduce((o,s)=>o*r(60)+r(s),r(0));return i==="-"?r(-1)*a:a}function lc(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Sh.stringifyNumber(e);let n="";t<0&&(n="-",t*=i(-1));let r=i(60),a=[t%r];return t<60?a.unshift(0):(t=(t-a[0])/r,a.unshift(t%r),t>=60&&(t=(t-a[0])/r,a.unshift(t))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Eh={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:i})=>ca(e,i),stringify:lc},Rh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>ca(e,!1),stringify:lc},uc={identify:e=>e 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(e){let t=e.match(uc.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),u=t[8];if(u&&u!=="Z"){let f=ca(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yn.floatTime=Rh;yn.intTime=Eh;yn.timestamp=uc});var hc=w(dc=>{"use strict";var Ch=ct(),Ph=on(),Ah=lt(),xh=Dt(),Th=Qr(),fc=ac(),ua=oc(),Nn=cc(),_h=Xi(),Ih=ia(),jh=hn(),Oh=sa(),fa=la(),$h=[Ch.map,Ah.seq,xh.string,Ph.nullTag,fc.trueTag,fc.falseTag,Nn.intBin,Nn.intOct,Nn.int,Nn.intHex,ua.floatNaN,ua.floatExp,ua.float,Th.binary,_h.merge,Ih.omap,jh.pairs,Oh.set,fa.intTime,fa.floatTime,fa.timestamp];dc.schema=$h});var Sc=w(pa=>{"use strict";var gc=ct(),Hh=on(),wc=lt(),Mh=Dt(),Fh=Wr(),da=Jr(),ha=Kr(),Lh=Js(),Dh=Us(),yc=Qr(),zt=Xi(),Nc=ia(),bc=hn(),pc=hc(),kc=sa(),bn=la(),mc=new Map([["core",Lh.schema],["failsafe",[gc.map,wc.seq,Mh.string]],["json",Dh.schema],["yaml11",pc.schema],["yaml-1.1",pc.schema]]),vc={binary:yc.binary,bool:Fh.boolTag,float:da.float,floatExp:da.floatExp,floatNaN:da.floatNaN,floatTime:bn.floatTime,int:ha.int,intHex:ha.intHex,intOct:ha.intOct,intTime:bn.intTime,map:gc.map,merge:zt.merge,null:Hh.nullTag,omap:Nc.omap,pairs:bc.pairs,seq:wc.seq,set:kc.set,timestamp:bn.timestamp},Bh={"tag:yaml.org,2002:binary":yc.binary,"tag:yaml.org,2002:merge":zt.merge,"tag:yaml.org,2002:omap":Nc.omap,"tag:yaml.org,2002:pairs":bc.pairs,"tag:yaml.org,2002:set":kc.set,"tag:yaml.org,2002:timestamp":bn.timestamp};function qh(e,t,i){let n=mc.get(t);if(n&&!e)return i&&!n.includes(zt.merge)?n.concat(zt.merge):n.slice();let r=n;if(!r)if(Array.isArray(e))r=[];else{let a=Array.from(mc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)r=r.concat(a);else typeof e=="function"&&(r=e(r.slice()));return i&&(r=r.concat(zt.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?vc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(vc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}pa.coreKnownTags=Bh;pa.getTags=qh});var ga=w(Ec=>{"use strict";var ma=R(),Vh=ct(),Wh=lt(),zh=Dt(),kn=Sc(),Jh=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,va=class e{constructor({compat:t,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?kn.getTags(t,"compat"):t?kn.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?kn.coreKnownTags:{},this.tags=kn.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,ma.MAP,{value:Vh.map}),Object.defineProperty(this,ma.SCALAR,{value:zh.string}),Object.defineProperty(this,ma.SEQ,{value:Wh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Jh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Ec.Schema=va});var Cc=w(Rc=>{"use strict";var Gh=R(),wa=Mt(),Jt=jt();function Kh(e,t){let i=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(i.push(c),n=!0):e.directives.docStart&&(n=!0)}n&&i.push("---");let r=wa.createStringifyContext(e,t),{commentString:a}=r.options;if(e.commentBefore){i.length!==1&&i.unshift("");let c=a(e.commentBefore);i.unshift(Jt.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(Gh.isNode(e.contents)){if(e.contents.spaceBefore&&n&&i.push(""),e.contents.commentBefore){let u=a(e.contents.commentBefore);i.push(Jt.indentComment(u,""))}r.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=wa.stringify(e.contents,r,()=>s=null,c);s&&(l+=Jt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(wa.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
- `)?(i.push("..."),i.push(Jt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Jt.indentComment(a(c),"")))}return i.join(`
49
+ `}}return e?(p+=`
50
+ `+Ui.indentComment(l(e),c),s&&s()):d&&o&&o(),p}function of({items:e},t,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let v=0;v<e.length;++v){let h=e[v],m=null;if(Fe.isNode(h))h.spaceBefore&&d.push(""),Ki(t,d,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(y.spaceBefore&&d.push(""),Ki(t,d,y.commentBefore,!1),y.comment&&(l=!0));let b=Fe.isNode(h.value)?h.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):h.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=fs.stringify(h,c,()=>m=null);l||(l=d.length>u||w.includes(`
51
+ `)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),m&&(w+=Ui.lineComment(w,r,s(m))),d.push(w),u=d.length}let{start:f,end:p}=i;if(d.length===0)return f+p;if(!l){let v=d.reduce((h,m)=>h+m.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=f;for(let h of d)v+=h?`
52
+ ${a}${n}${h}`:`
53
+ `;return`${v}
54
+ ${n}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function Ki({indent:e,options:{commentString:t}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=Ui.indentComment(t(r),e);i.push(a.trimStart())}}hs.stringifyCollection=nf});var xe=g(_n=>{"use strict";var sf=Cn(),cf=Rn(),lf=Oi(),Re=P(),Yi=Pe(),uf=j();function Ht(e,t){let i=Re.isScalar(t)?t.value:t;for(let r of e)if(Re.isPair(r)&&(r.key===t||r.key===i||Re.isScalar(r.key)&&r.key.value===i))return r}var An=class extends lf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Re.MAP,t),this.items=[]}static from(t,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(t),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(Yi.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 t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let r;Re.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Yi.Pair(t,t?.value):r=new Yi.Pair(t.key,t.value);let n=Ht(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Re.isScalar(n.value)&&uf.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(a){let o=this.items.findIndex(s=>a(r,s)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){let i=Ht(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let n=Ht(this.items,t)?.value;return(!i&&Re.isScalar(n)?n.value:n)??void 0}has(t){return!!Ht(this.items,t)}set(t,i){this.add(new Yi.Pair(t,i),!0)}toJSON(t,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)cf.addPairToJSMap(i,n,a);return n}toString(t,i,r){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Re.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),sf.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:i})}};_n.YAMLMap=An;_n.findPair=Ht});var rt=g(ms=>{"use strict";var df=P(),ps=xe(),ff={collection:"map",default:!0,nodeClass:ps.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return df.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>ps.YAMLMap.from(e,t,i)};ms.map=ff});var Ce=g(vs=>{"use strict";var hf=At(),pf=Cn(),mf=Oi(),Qi=P(),vf=j(),gf=be(),Tn=class extends mf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Qi.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=Xi(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let r=Xi(t);if(typeof r!="number")return;let n=this.items[r];return!i&&Qi.isScalar(n)?n.value:n}has(t){let i=Xi(t);return typeof i=="number"&&i<this.items.length}set(t,i){let r=Xi(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[r];Qi.isScalar(n)&&vf.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(t,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(gf.toJS(a,String(n++),i));return r}toString(t,i,r){return t?pf.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(t,i,r){let{replacer:n}=r,a=new this(t);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(o++);s=n.call(i,c,s)}a.items.push(hf.createNode(s,void 0,r))}}return a}};function Xi(e){let t=Qi.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}vs.YAMLSeq=Tn});var nt=g(ws=>{"use strict";var wf=P(),gs=Ce(),yf={collection:"seq",default:!0,nodeClass:gs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return wf.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>gs.YAMLSeq.from(e,t,i)};ws.seq=yf});var Dt=g(ys=>{"use strict";var Nf=jt(),bf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,r){return t=Object.assign({actualString:!0},t),Nf.stringifyString(e,t,i,r)}};ys.string=bf});var Zi=g(ks=>{"use strict";var Ns=j(),bs={identify:e=>e==null,createNode:()=>new Ns.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ns.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&bs.test.test(e)?e:t.options.nullStr};ks.nullTag=bs});var In=g(Es=>{"use strict";var kf=j(),Ss={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new kf.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&Ss.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?i.options.trueStr:i.options.falseStr}};Es.boolTag=Ss});var at=g(Ps=>{"use strict";function Sf({format:e,minFractionDigits:t,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 a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Ps.stringifyNumber=Sf});var $n=g(er=>{"use strict";var Ef=j(),jn=at(),Pf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jn.stringifyNumber},Rf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():jn.stringifyNumber(e)}},xf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Ef.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:jn.stringifyNumber};er.float=xf;er.floatExp=Rf;er.floatNaN=Pf});var Hn=g(ir=>{"use strict";var Rs=at(),tr=e=>typeof e=="bigint"||Number.isInteger(e),On=(e,t,i,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),i);function xs(e,t,i){let{value:r}=e;return tr(r)&&r>=0?i+r.toString(t):Rs.stringifyNumber(e)}var Cf={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>On(e,2,8,i),stringify:e=>xs(e,8,"0o")},Af={identify:tr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>On(e,0,10,i),stringify:Rs.stringifyNumber},_f={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>On(e,2,16,i),stringify:e=>xs(e,16,"0x")};ir.int=Af;ir.intHex=_f;ir.intOct=Cf});var As=g(Cs=>{"use strict";var Tf=rt(),If=Zi(),jf=nt(),$f=Dt(),Of=In(),Dn=$n(),Bn=Hn(),Hf=[Tf.map,jf.seq,$f.string,If.nullTag,Of.boolTag,Bn.intOct,Bn.int,Bn.intHex,Dn.floatNaN,Dn.floatExp,Dn.float];Cs.schema=Hf});var Is=g(Ts=>{"use strict";var Df=j(),Bf=rt(),Lf=nt();function _s(e){return typeof e=="bigint"||Number.isInteger(e)}var rr=({value:e})=>JSON.stringify(e),Mf=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:rr},{identify:e=>e==null,createNode:()=>new Df.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:rr},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:rr},{identify:_s,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>_s(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:rr}],Ff={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Vf=[Bf.map,Lf.seq].concat(Mf,Ff);Ts.schema=Vf});var Mn=g(js=>{"use strict";var Bt=Ri("buffer"),Ln=j(),qf=jt(),Wf={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Bt.Buffer=="function")return Bt.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.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 t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof Bt.Buffer=="function")s=o instanceof Bt.Buffer?o.toString("base64"):Bt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Ln.Scalar.BLOCK_LITERAL),t!==Ln.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=s.substr(f,c);s=u.join(t===Ln.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return qf.stringifyString({comment:e,type:t,value:s},r,n,a)}};js.binary=Wf});var or=g(ar=>{"use strict";var nr=P(),Fn=Pe(),zf=j(),Jf=Ce();function $s(e,t){if(nr.isSeq(e))for(let i=0;i<e.items.length;++i){let r=e.items[i];if(!nr.isPair(r)){if(nr.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let n=r.items[0]||new Fn.Pair(new zf.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
56
+ ${n.key.commentBefore}`:r.commentBefore),r.comment){let a=n.value??n.key;a.comment=a.comment?`${r.comment}
57
+ ${a.comment}`:r.comment}r=n}e.items[i]=nr.isPair(r)?r:new Fn.Pair(r)}}else t("Expected a sequence for this tag");return e}function Os(e,t,i){let{replacer:r}=i,n=new Jf.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof r=="function"&&(o=r.call(t,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(Fn.createPair(s,c,i))}return n}var Gf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:$s,createNode:Os};ar.createPairs=Os;ar.pairs=Gf;ar.resolvePairs=$s});var Wn=g(qn=>{"use strict";var Hs=P(),Vn=be(),Lt=xe(),Uf=Ce(),Ds=or(),Ve=class e extends Uf.YAMLSeq{constructor(){super(),this.add=Lt.YAMLMap.prototype.add.bind(this),this.delete=Lt.YAMLMap.prototype.delete.bind(this),this.get=Lt.YAMLMap.prototype.get.bind(this),this.has=Lt.YAMLMap.prototype.has.bind(this),this.set=Lt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(Hs.isPair(n)?(a=Vn.toJS(n.key,"",i),o=Vn.toJS(n.value,a,i)):a=Vn.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(t,i,r){let n=Ds.createPairs(t,i,r),a=new this;return a.items=n.items,a}};Ve.tag="tag:yaml.org,2002:omap";var Kf={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=Ds.resolvePairs(e,t),r=[];for(let{key:n}of i.items)Hs.isScalar(n)&&(r.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new Ve,i)},createNode:(e,t,i)=>Ve.from(e,t,i)};qn.YAMLOMap=Ve;qn.omap=Kf});var Vs=g(zn=>{"use strict";var Bs=j();function Ls({value:e,source:t},i){return t&&(e?Ms:Fs).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var Ms={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Bs.Scalar(!0),stringify:Ls},Fs={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Bs.Scalar(!1),stringify:Ls};zn.falseTag=Fs;zn.trueTag=Ms});var qs=g(sr=>{"use strict";var Yf=j(),Jn=at(),Xf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Jn.stringifyNumber},Qf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Jn.stringifyNumber(e)}},Zf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Yf.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let r=e.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Jn.stringifyNumber};sr.float=Zf;sr.floatExp=Qf;sr.floatNaN=Xf});var zs=g(Ft=>{"use strict";var Ws=at(),Mt=e=>typeof e=="bigint"||Number.isInteger(e);function cr(e,t,i,{intAsBigInt:r}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let a=parseInt(e,i);return n==="-"?-1*a:a}function Gn(e,t,i){let{value:r}=e;if(Mt(r)){let n=r.toString(t);return r<0?"-"+i+n.substr(1):i+n}return Ws.stringifyNumber(e)}var eh={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>cr(e,2,2,i),stringify:e=>Gn(e,2,"0b")},th={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>cr(e,1,8,i),stringify:e=>Gn(e,8,"0")},ih={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>cr(e,0,10,i),stringify:Ws.stringifyNumber},rh={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>cr(e,2,16,i),stringify:e=>Gn(e,16,"0x")};Ft.int=ih;Ft.intBin=eh;Ft.intHex=rh;Ft.intOct=th});var Kn=g(Un=>{"use strict";var dr=P(),lr=Pe(),ur=xe(),qe=class e extends ur.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;dr.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new lr.Pair(t.key,null):i=new lr.Pair(t,null),ur.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let r=ur.findPair(this.items,t);return!i&&dr.isPair(r)?dr.isScalar(r.key)?r.key.value:r.key:r}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=ur.findPair(this.items,t);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new lr.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(t,i,r){let{replacer:n}=r,a=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(lr.createPair(o,null,r));return a}};qe.tag="tag:yaml.org,2002:set";var nh={collection:"map",identify:e=>e instanceof Set,nodeClass:qe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>qe.from(e,t,i),resolve(e,t){if(dr.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new qe,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Un.YAMLSet=qe;Un.set=nh});var Xn=g(fr=>{"use strict";var ah=at();function Yn(e,t){let i=e[0],r=i==="-"||i==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),a=r.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return i==="-"?n(-1)*a:a}function Js(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return ah.stringifyNumber(e);let r="";t<0&&(r="-",t*=i(-1));let n=i(60),a=[t%n];return t<60?a.unshift(0):(t=(t-a[0])/n,a.unshift(t%n),t>=60&&(t=(t-a[0])/n,a.unshift(t))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var oh={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:i})=>Yn(e,i),stringify:Js},sh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Yn(e,!1),stringify:Js},Gs={identify:e=>e 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(e){let t=e.match(Gs.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),u=t[8];if(u&&u!=="Z"){let d=Yn(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};fr.floatTime=sh;fr.intTime=oh;fr.timestamp=Gs});var Ys=g(Ks=>{"use strict";var ch=rt(),lh=Zi(),uh=nt(),dh=Dt(),fh=Mn(),Us=Vs(),Qn=qs(),hr=zs(),hh=zi(),ph=Wn(),mh=or(),vh=Kn(),Zn=Xn(),gh=[ch.map,uh.seq,dh.string,lh.nullTag,Us.trueTag,Us.falseTag,hr.intBin,hr.intOct,hr.int,hr.intHex,Qn.floatNaN,Qn.floatExp,Qn.float,fh.binary,hh.merge,ph.omap,mh.pairs,vh.set,Zn.intTime,Zn.floatTime,Zn.timestamp];Ks.schema=gh});var oc=g(ia=>{"use strict";var ec=rt(),wh=Zi(),tc=nt(),yh=Dt(),Nh=In(),ea=$n(),ta=Hn(),bh=As(),kh=Is(),ic=Mn(),Vt=zi(),rc=Wn(),nc=or(),Xs=Ys(),ac=Kn(),pr=Xn(),Qs=new Map([["core",bh.schema],["failsafe",[ec.map,tc.seq,yh.string]],["json",kh.schema],["yaml11",Xs.schema],["yaml-1.1",Xs.schema]]),Zs={binary:ic.binary,bool:Nh.boolTag,float:ea.float,floatExp:ea.floatExp,floatNaN:ea.floatNaN,floatTime:pr.floatTime,int:ta.int,intHex:ta.intHex,intOct:ta.intOct,intTime:pr.intTime,map:ec.map,merge:Vt.merge,null:wh.nullTag,omap:rc.omap,pairs:nc.pairs,seq:tc.seq,set:ac.set,timestamp:pr.timestamp},Sh={"tag:yaml.org,2002:binary":ic.binary,"tag:yaml.org,2002:merge":Vt.merge,"tag:yaml.org,2002:omap":rc.omap,"tag:yaml.org,2002:pairs":nc.pairs,"tag:yaml.org,2002:set":ac.set,"tag:yaml.org,2002:timestamp":pr.timestamp};function Eh(e,t,i){let r=Qs.get(t);if(r&&!e)return i&&!r.includes(Vt.merge)?r.concat(Vt.merge):r.slice();let n=r;if(!n)if(Array.isArray(e))n=[];else{let a=Array.from(Qs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)n=n.concat(a);else typeof e=="function"&&(n=e(n.slice()));return i&&(n=n.concat(Vt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?Zs[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Zs).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}ia.coreKnownTags=Sh;ia.getTags=Eh});var aa=g(sc=>{"use strict";var ra=P(),Ph=rt(),Rh=nt(),xh=Dt(),mr=oc(),Ch=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,na=class e{constructor({compat:t,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?mr.getTags(t,"compat"):t?mr.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?mr.coreKnownTags:{},this.tags=mr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,ra.MAP,{value:Ph.map}),Object.defineProperty(this,ra.SCALAR,{value:xh.string}),Object.defineProperty(this,ra.SEQ,{value:Rh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ch:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};sc.Schema=na});var lc=g(cc=>{"use strict";var Ah=P(),oa=$t(),qt=_t();function _h(e,t){let i=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(i.push(c),r=!0):e.directives.docStart&&(r=!0)}r&&i.push("---");let n=oa.createStringifyContext(e,t),{commentString:a}=n.options;if(e.commentBefore){i.length!==1&&i.unshift("");let c=a(e.commentBefore);i.unshift(qt.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(Ah.isNode(e.contents)){if(e.contents.spaceBefore&&r&&i.push(""),e.contents.commentBefore){let u=a(e.contents.commentBefore);i.push(qt.indentComment(u,""))}n.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=oa.stringify(e.contents,n,()=>s=null,c);s&&(l+=qt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(oa.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
+ `)?(i.push("..."),i.push(qt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(qt.indentComment(a(c),"")))}return i.join(`
59
59
  `)+`
60
- `}Rc.stringifyDocument=Kh});var Gt=w(Pc=>{"use strict";var Uh=_t(),ft=Bi(),Y=R(),Yh=Ee(),Xh=Ne(),Qh=ga(),Zh=Cc(),ya=Mi(),ep=Sr(),tp=It(),Na=kr(),ba=class e{constructor(t,i,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let r=null;typeof i=="function"||Array.isArray(i)?r=i:n===void 0&&i&&(n=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Na.Directives({version:o}),this.setSchema(o,n),this.contents=t===void 0?null:this.createNode(t,r,n)}clone(){let t=Object.create(e.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Y.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){dt(this.contents)&&this.contents.add(t)}addIn(t,i){dt(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let n=ya.anchorNames(this);t.anchor=!i||n.has(i)?ya.findNewAnchor(i||"a",n):i}return new Uh.Alias(t.anchor)}createNode(t,i,n){let r;if(typeof i=="function")t=i.call({"":t},"",t),r=i;else if(Array.isArray(i)){let p=N=>typeof N=="number"||N instanceof String||N instanceof Number,y=i.filter(p).map(String);y.length>0&&(i=i.concat(y)),r=i}else n===void 0&&i&&(n=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:f,setAnchors:d,sourceObjects:m}=ya.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},h=tp.createNode(t,u,g);return s&&Y.isCollection(h)&&(h.flow=!0),d(),h}createPair(t,i,n={}){let r=this.createNode(t,null,n),a=this.createNode(i,null,n);return new Yh.Pair(r,a)}delete(t){return dt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ft.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):dt(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return Y.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return ft.isEmptyPath(t)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return Y.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return ft.isEmptyPath(t)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=ft.collectionFromPath(this.schema,[t],i):dt(this.contents)&&this.contents.set(t,i)}setIn(t,i){ft.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=ft.collectionFromPath(this.schema,Array.from(t),i):dt(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let n;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Na.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Na.Directives({version:t}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let r=JSON.stringify(t);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 Qh.Schema(Object.assign(n,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:n,maxAliasCount:r,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Xh.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?ep.applyReviver(o,{"":c},"",c):c}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Zh.stringifyDocument(this,t)}};function dt(e){if(Y.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Pc.Document=ba});var Yt=w(Ut=>{"use strict";var Kt=class extends Error{constructor(t,i,n,r){super(),this.name=t,this.code=n,this.message=r,this.pos=i}},ka=class extends Kt{constructor(t,i,n){super("YAMLParseError",t,i,n)}},Sa=class extends Kt{constructor(t,i,n){super("YAMLWarning",t,i,n)}},ip=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>t.linePos(s));let{line:n,col:r}=i.linePos[0];i.message+=` at line ${n}, column ${r}`;let a=r-1,o=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,a))){let s=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);s.length>80&&(s=s.substring(0,79)+`…
61
- `),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===n&&c.col>r&&(s=Math.max(1,Math.min(c.col-r,80-a)));let l=" ".repeat(a)+"^".repeat(s);i.message+=`:
60
+ `}cc.stringifyDocument=_h});var Wt=g(uc=>{"use strict";var Th=Ct(),ot=Oi(),Y=P(),Ih=Pe(),jh=be(),$h=aa(),Oh=lc(),sa=Ti(),Hh=dn(),Dh=At(),ca=un(),la=class e{constructor(t,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:r===void 0&&i&&(r=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=a;let{version:o}=a;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ca.Directives({version:o}),this.setSchema(o,r),this.contents=t===void 0?null:this.createNode(t,n,r)}clone(){let t=Object.create(e.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Y.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){st(this.contents)&&this.contents.add(t)}addIn(t,i){st(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let r=sa.anchorNames(this);t.anchor=!i||r.has(i)?sa.findNewAnchor(i||"a",r):i}return new Th.Alias(t.anchor)}createNode(t,i,r){let n;if(typeof i=="function")t=i.call({"":t},"",t),n=i;else if(Array.isArray(i)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=i.filter(m).map(String);w.length>0&&(i=i.concat(w)),n=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=sa.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=Dh.createNode(t,u,v);return s&&Y.isCollection(h)&&(h.flow=!0),f(),h}createPair(t,i,r={}){let n=this.createNode(t,null,r),a=this.createNode(i,null,r);return new Ih.Pair(n,a)}delete(t){return st(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ot.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):st(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return Y.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return ot.isEmptyPath(t)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return Y.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return ot.isEmptyPath(t)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=ot.collectionFromPath(this.schema,[t],i):st(this.contents)&&this.contents.set(t,i)}setIn(t,i){ot.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=ot.collectionFromPath(this.schema,Array.from(t),i):st(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ca.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ca.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(t);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 $h.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=jh.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?Hh.applyReviver(o,{"":c},"",c):c}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Oh.stringifyDocument(this,t)}};function st(e){if(Y.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}uc.Document=la});var Gt=g(Jt=>{"use strict";var zt=class extends Error{constructor(t,i,r,n){super(),this.name=t,this.code=r,this.message=n,this.pos=i}},ua=class extends zt{constructor(t,i,r){super("YAMLParseError",t,i,r)}},da=class extends zt{constructor(t,i,r){super("YAMLWarning",t,i,r)}},Bh=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>t.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,a))){let s=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
61
+ `),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===r&&c.col>n&&(s=Math.max(1,Math.min(c.col-n,80-a)));let l=" ".repeat(a)+"^".repeat(s);i.message+=`:
62
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};Ut.YAMLError=Kt;Ut.YAMLParseError=ka;Ut.YAMLWarning=Sa;Ut.prettifyError=ip});var Xt=w(Ac=>{"use strict";function np(e,{flow:t,indicator:i,next:n,offset:r,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,f="",d="",m=!1,g=!1,h=null,p=null,y=null,N=null,k=null,S=null,E=null;for(let b of e)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&a(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(l&&b.type!=="comment"&&b.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),b.type){case"space":!t&&(i!=="doc-start"||n?.type!=="flow-collection")&&b.source.includes(" ")&&(h=b),u=!0;break;case"comment":{u||a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let _=b.source.substring(1)||" ";f?f+=d+_:f=_,d="",l=!1;break}case"newline":l?f?f+=b.source:(!S||i!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,m=!0,(p||y)&&(N=b),u=!0;break;case"anchor":p&&a(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&a(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=b,E??(E=b.offset),l=!1,u=!1,g=!0;break;case"tag":{y&&a(b,"MULTIPLE_TAGS","A node can have at most one tag"),y=b,E??(E=b.offset),l=!1,u=!1,g=!0;break}case i:(p||y)&&a(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),S&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${t??"collection"}`),S=b,l=i==="seq-item-ind"||i==="explicit-key-ind",u=!1;break;case"comma":if(t){k&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),k=b,l=!1,u=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,u=!1}let v=e[e.length-1],C=v?v.offset+v.source.length:r;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&a(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:S,spaceBefore:c,comment:f,hasNewline:m,anchor:p,tag:y,newlineAfterProp:N,end:C,start:E??C}}Ac.resolveProps=np});var Sn=w(xc=>{"use strict";function Ea(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
- `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(Ea(t.key)||Ea(t.value))return!0}return!1;default:return!0}}xc.containsNewline=Ea});var Ra=w(Tc=>{"use strict";var rp=Sn();function ap(e,t,i){if(t?.type==="flow-collection"){let n=t.end[0];n.indent===e&&(n.source==="]"||n.source==="}")&&rp.containsNewline(t)&&i(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Tc.flowIndentCheck=ap});var Ca=w(Ic=>{"use strict";var _c=R();function op(e,t,i){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let r=typeof n=="function"?n:(a,o)=>a===o||_c.isScalar(a)&&_c.isScalar(o)&&a.value===o.value;return t.some(a=>r(a.key,i))}Ic.mapIncludes=op});var Fc=w(Mc=>{"use strict";var jc=Ee(),sp=Ce(),Oc=Xt(),cp=Sn(),$c=Ra(),lp=Ca(),Hc="All mapping items must start at the same column";function up({composeNode:e,composeEmptyNode:t},i,n,r,a){let o=a?.nodeClass??sp.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:f,key:d,sep:m,value:g}=u,h=Oc.resolveProps(f,{indicator:"explicit-key-ind",next:d??m?.[0],offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0}),p=!h.found;if(p){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",Hc)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(s.comment?s.comment+=`
67
- `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||cp.containsNewline(d))&&r(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&r(c,"BAD_INDENT",Hc);i.atKey=!0;let y=h.end,N=d?e(i,d,h,r):t(i,y,f,null,h,r);i.schema.compat&&$c.flowIndentCheck(n.indent,d,r),i.atKey=!1,lp.mapIncludes(i,s.items,N)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let k=Oc.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:N.range[2],onError:r,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){p&&(g?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<k.found.offset-1024&&r(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=g?e(i,g,k,r):t(i,c,m,null,k,r);i.schema.compat&&$c.flowIndentCheck(n.indent,g,r),c=S.range[2];let E=new jc.Pair(N,S);i.options.keepSourceTokens&&(E.srcToken=u),s.items.push(E)}else{p&&r(N.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(N.comment?N.comment+=`
68
- `+k.comment:N.comment=k.comment);let S=new jc.Pair(N);i.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[n.offset,c,l??c],s}Mc.resolveBlockMap=up});var Dc=w(Lc=>{"use strict";var fp=Pe(),dp=Xt(),hp=Ra();function pp({composeNode:e,composeEmptyNode:t},i,n,r,a){let o=a?.nodeClass??fp.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:f}of n.items){let d=dp.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(s.comment=d.comment);continue}let m=f?e(i,f,d,r):t(i,d.end,u,null,d,r);i.schema.compat&&hp.flowIndentCheck(n.indent,f,r),c=m.range[2],s.items.push(m)}return s.range=[n.offset,c,l??c],s}Lc.resolveBlockSeq=pp});var ht=w(Bc=>{"use strict";function mp(e,t,i,n){let r="";if(e){let a=!1,o="";for(let s of e){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&n(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";r?r+=o+u:r=u,o="";break}case"newline":r&&(o+=c),a=!0;break;default:n(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:r,offset:t}}Bc.resolveEnd=mp});var zc=w(Wc=>{"use strict";var vp=R(),gp=Ee(),qc=Ce(),wp=Pe(),yp=ht(),Vc=Xt(),Np=Sn(),bp=Ca(),Pa="Block collections are not allowed within flow collections",Aa=e=>e&&(e.type==="block-map"||e.type==="block-seq");function kp({composeNode:e,composeEmptyNode:t},i,n,r,a){let o=n.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?qc.YAMLMap:wp.YAMLSeq),l=new c(i.schema);l.flow=!0;let u=i.atRoot;u&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let f=n.offset+n.start.source.length;for(let p=0;p<n.items.length;++p){let y=n.items[p],{start:N,key:k,sep:S,value:E}=y,v=Vc.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:k??S?.[0],offset:f,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!S&&!E){p===0&&v.comma?r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):p<n.items.length-1&&r(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
69
- `+v.comment:l.comment=v.comment),f=v.end;continue}!o&&i.options.strict&&Np.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||r(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let C="";e:for(let b of N)switch(b.type){case"comma":case"space":break;case"comment":C=b.source.substring(1);break e;default:break e}if(C){let b=l.items[l.items.length-1];vp.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
- `+C:b.comment=C,v.comment=v.comment.substring(C.length+1)}}if(!o&&!S&&!v.found){let C=E?e(i,E,v,r):t(i,v.end,S,null,v,r);l.items.push(C),f=C.range[2],Aa(E)&&r(C.range,"BLOCK_IN_FLOW",Pa)}else{i.atKey=!0;let C=v.end,b=k?e(i,k,v,r):t(i,C,N,null,v,r);Aa(k)&&r(b.range,"BLOCK_IN_FLOW",Pa),i.atKey=!1;let _=Vc.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(_.found){if(!o&&!v.found&&i.options.strict){if(S)for(let H of S){if(H===_.found)break;if(H.type==="newline"){r(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.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?e(i,E,_,r):_.found?t(i,_.end,S,null,_,r):null;z?Aa(E)&&r(z.range,"BLOCK_IN_FLOW",Pa):_.comment&&(b.comment?b.comment+=`
71
- `+_.comment:b.comment=_.comment);let nt=new gp.Pair(b,z);if(i.options.keepSourceTokens&&(nt.srcToken=y),o){let H=l;bp.mapIncludes(i,H.items,b)&&r(C,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(nt)}else{let H=new qc.YAMLMap(i.schema);H.flow=!0,H.items.push(nt);let Wo=(z??b).range;H.range=[b.range[0],Wo[1],Wo[2]],l.items.push(H)}f=z?z.range[2]:_.end}}let d=o?"}":"]",[m,...g]=n.end,h=f;if(m?.source===d)h=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),y=u?`${p} must end with a ${d}`:`${p} in block collection must be sufficiently indented and end with a ${d}`;r(f,u?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let p=yp.resolveEnd(g,h,i.options.strict,r);p.comment&&(l.comment?l.comment+=`
72
- `+p.comment:l.comment=p.comment),l.range=[n.offset,h,p.offset]}else l.range=[n.offset,h,h];return l}Wc.resolveFlowCollection=kp});var Gc=w(Jc=>{"use strict";var Sp=R(),Ep=$(),Rp=Ce(),Cp=Pe(),Pp=Fc(),Ap=Dc(),xp=zc();function xa(e,t,i,n,r,a){let o=i.type==="block-map"?Pp.resolveBlockMap(e,t,i,n,a):i.type==="block-seq"?Ap.resolveBlockSeq(e,t,i,n,a):xp.resolveFlowCollection(e,t,i,n,a),s=o.constructor;return r==="!"||r===s.tagName?(o.tag=s.tagName,o):(r&&(o.tag=r),o)}function Tp(e,t,i,n,r){let a=n.tag,o=a?t.directives.tagName(a.source,d=>r(a,"TAG_RESOLVE_FAILED",d)):null;if(i.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=n,g=d&&a?d.offset>a.offset?d:a:d??a;g&&(!m||m.offset<g.offset)&&r(g,"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(!a||!o||o==="!"||o===Rp.YAMLMap.tagName&&s==="map"||o===Cp.YAMLSeq.tagName&&s==="seq")return xa(e,t,i,r,o);let c=t.schema.tags.find(d=>d.tag===o&&d.collection===s);if(!c){let d=t.schema.knownTags[o];if(d?.collection===s)t.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(a,"BAD_COLLECTION_TYPE",`${d.tag} used for ${s} collection, but expects ${d.collection??"scalar"}`,!0):r(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),xa(e,t,i,r,o)}let l=xa(e,t,i,r,o,c),u=c.resolve?.(l,d=>r(a,"TAG_RESOLVE_FAILED",d),t.options)??l,f=Sp.isNode(u)?u:new Ep.Scalar(u);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}Jc.composeCollection=Tp});var _a=w(Kc=>{"use strict";var Ta=$();function _p(e,t,i){let n=t.offset,r=Ip(t,e.options.strict,i);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let a=r.mode===">"?Ta.Scalar.BLOCK_FOLDED:Ta.Scalar.BLOCK_LITERAL,o=t.source?jp(t.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let p=o[h][1];if(p===""||p==="\r")s=h;else break}if(s===0){let h=r.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",p=n+r.length;return t.source&&(p+=t.source.length),{value:h,type:a,comment:r.comment,range:[n,p,p]}}let c=t.indent+r.indent,l=t.offset+r.length,u=0;for(let h=0;h<s;++h){let[p,y]=o[h];if(y===""||y==="\r")r.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"),r.indent===0&&(c=p.length),u=h,c===0&&!e.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+y.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let f="",d="",m=!1;for(let h=0;h<u;++h)f+=o[h][0].slice(c)+`
74
- `;for(let h=u;h<s;++h){let[p,y]=o[h];l+=p.length+y.length+1;let N=y[y.length-1]==="\r";if(N&&(y=y.slice(0,-1)),y&&p.length<c){let S=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(N?2:1),"BAD_INDENT",S),p=""}a===Ta.Scalar.BLOCK_LITERAL?(f+=d+p.slice(c)+y,d=`
75
- `):p.length>c||y[0]===" "?(d===" "?d=`
76
- `:!m&&d===`
77
- `&&(d=`
65
+ `}};Jt.YAMLError=zt;Jt.YAMLParseError=ua;Jt.YAMLWarning=da;Jt.prettifyError=Bh});var Ut=g(dc=>{"use strict";function Lh(e,{flow:t,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d="",f="",p=!1,v=!1,h=null,m=null,w=null,y=null,b=null,k=null,S=null;for(let N of e)switch(v&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&a(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!t&&(i!=="doc-start"||r?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),u=!0;break;case"comment":{u||a(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=N.source.substring(1)||" ";d?d+=f+O:d=O,f="",l=!1;break}case"newline":l?d?d+=N.source:(!k||i!=="seq-item-ind")&&(c=!0):f+=N.source,l=!0,p=!0,(m||w)&&(y=N),u=!0;break;case"anchor":m&&a(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&a(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,S??(S=N.offset),l=!1,u=!1,v=!0;break;case"tag":{w&&a(N,"MULTIPLE_TAGS","A node can have at most one tag"),w=N,S??(S=N.offset),l=!1,u=!1,v=!0;break}case i:(m||w)&&a(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),k=N,l=i==="seq-item-ind"||i==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&a(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=N,l=!1,u=!1;break}default:a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,u=!1}let E=e[e.length-1],A=E?E.offset+E.source.length:n;return v&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&a(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:k,spaceBefore:c,comment:d,hasNewline:p,anchor:m,tag:w,newlineAfterProp:y,end:A,start:S??A}}dc.resolveProps=Lh});var vr=g(fc=>{"use strict";function fa(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(fa(t.key)||fa(t.value))return!0}return!1;default:return!0}}fc.containsNewline=fa});var ha=g(hc=>{"use strict";var Mh=vr();function Fh(e,t,i){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Mh.containsNewline(t)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}hc.flowIndentCheck=Fh});var pa=g(mc=>{"use strict";var pc=P();function Vh(e,t,i){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||pc.isScalar(a)&&pc.isScalar(o)&&a.value===o.value;return t.some(a=>n(a.key,i))}mc.mapIncludes=Vh});var bc=g(Nc=>{"use strict";var vc=Pe(),qh=xe(),gc=Ut(),Wh=vr(),wc=ha(),zh=pa(),yc="All mapping items must start at the same column";function Jh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??qh.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:d,key:f,sep:p,value:v}=u,h=gc.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&n(c,"BAD_INDENT",yc)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
+ `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Wh.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",yc);i.atKey=!0;let w=h.end,y=f?e(i,f,h,n):t(i,w,d,null,h,n);i.schema.compat&&wc.flowIndentCheck(r.indent,f,n),i.atKey=!1,zh.mapIncludes(i,s.items,y)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let b=gc.resolveProps(p??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){m&&(v?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<b.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=v?e(i,v,b,n):t(i,c,p,null,b,n);i.schema.compat&&wc.flowIndentCheck(r.indent,v,n),c=k.range[2];let S=new vc.Pair(y,k);i.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
68
+ `+b.comment:y.comment=b.comment);let k=new vc.Pair(y);i.options.keepSourceTokens&&(k.srcToken=u),s.items.push(k)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}Nc.resolveBlockMap=Jh});var Sc=g(kc=>{"use strict";var Gh=Ce(),Uh=Ut(),Kh=ha();function Yh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??Gh.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:d}of r.items){let f=Uh.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let p=d?e(i,d,f,n):t(i,f.end,u,null,f,n);i.schema.compat&&Kh.flowIndentCheck(r.indent,d,n),c=p.range[2],s.items.push(p)}return s.range=[r.offset,c,l??c],s}kc.resolveBlockSeq=Yh});var ct=g(Ec=>{"use strict";function Xh(e,t,i,r){let n="";if(e){let a=!1,o="";for(let s of e){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),a=!0;break;default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}Ec.resolveEnd=Xh});var Cc=g(xc=>{"use strict";var Qh=P(),Zh=Pe(),Pc=xe(),ep=Ce(),tp=ct(),Rc=Ut(),ip=vr(),rp=pa(),ma="Block collections are not allowed within flow collections",va=e=>e&&(e.type==="block-map"||e.type==="block-seq");function np({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Pc.YAMLMap:ep.YAMLSeq),l=new c(i.schema);l.flow=!0;let u=i.atRoot;u&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let d=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let w=r.items[m],{start:y,key:b,sep:k,value:S}=w,E=Rc.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??k?.[0],offset:d,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!S){m===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<r.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),d=E.end;continue}!o&&i.options.strict&&ip.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${s} items`),E.comment){let A="";e:for(let N of y)switch(N.type){case"comma":case"space":break;case"comment":A=N.source.substring(1);break e;default:break e}if(A){let N=l.items[l.items.length-1];Qh.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
+ `+A:N.comment=A,E.comment=E.comment.substring(A.length+1)}}if(!o&&!k&&!E.found){let A=S?e(i,S,E,n):t(i,E.end,k,null,E,n);l.items.push(A),d=A.range[2],va(S)&&n(A.range,"BLOCK_IN_FLOW",ma)}else{i.atKey=!0;let A=E.end,N=b?e(i,b,E,n):t(i,A,y,null,E,n);va(b)&&n(N.range,"BLOCK_IN_FLOW",ma),i.atKey=!1;let O=Rc.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:S,offset:N.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(O.found){if(!o&&!E.found&&i.options.strict){if(k)for(let H of k){if(H===O.found)break;if(H.type==="newline"){n(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<O.found.offset-1024&&n(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?n(S,"MISSING_CHAR",`Missing space after : in ${s}`):n(O.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let Ne=S?e(i,S,O,n):O.found?t(i,O.end,k,null,O,n):null;Ne?va(S)&&n(Ne.range,"BLOCK_IN_FLOW",ma):O.comment&&(N.comment?N.comment+=`
71
+ `+O.comment:N.comment=O.comment);let Qe=new Zh.Pair(N,Ne);if(i.options.keepSourceTokens&&(Qe.srcToken=w),o){let H=l;rp.mapIncludes(i,H.items,N)&&n(A,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(Qe)}else{let H=new Pc.YAMLMap(i.schema);H.flow=!0,H.items.push(Qe);let xo=(Ne??N).range;H.range=[N.range[0],xo[1],xo[2]],l.items.push(H)}d=Ne?Ne.range[2]:O.end}}let f=o?"}":"]",[p,...v]=r.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),w=u?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&v.unshift(p)}if(v.length>0){let m=tp.resolveEnd(v,h,i.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[r.offset,h,m.offset]}else l.range=[r.offset,h,h];return l}xc.resolveFlowCollection=np});var _c=g(Ac=>{"use strict";var ap=P(),op=j(),sp=xe(),cp=Ce(),lp=bc(),up=Sc(),dp=Cc();function ga(e,t,i,r,n,a){let o=i.type==="block-map"?lp.resolveBlockMap(e,t,i,r,a):i.type==="block-seq"?up.resolveBlockSeq(e,t,i,r,a):dp.resolveFlowCollection(e,t,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function fp(e,t,i,r,n){let a=r.tag,o=a?t.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!p||p.offset<v.offset)&&n(v,"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(!a||!o||o==="!"||o===sp.YAMLMap.tagName&&s==="map"||o===cp.YAMLSeq.tagName&&s==="seq")return ga(e,t,i,n,o);let c=t.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=t.schema.knownTags[o];if(f?.collection===s)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ga(e,t,i,n,o)}let l=ga(e,t,i,n,o,c),u=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),t.options)??l,d=ap.isNode(u)?u:new op.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}Ac.composeCollection=fp});var ya=g(Tc=>{"use strict";var wa=j();function hp(e,t,i){let r=t.offset,n=pp(t,e.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?wa.Scalar.BLOCK_FOLDED:wa.Scalar.BLOCK_LITERAL,o=t.source?mp(t.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&o.length>0?`
73
+ `.repeat(Math.max(1,o.length-1)):"",m=r+n.length;return t.source&&(m+=t.source.length),{value:h,type:a,comment:n.comment,range:[r,m,m]}}let c=t.indent+n.indent,l=t.offset+n.length,u=0;for(let h=0;h<s;++h){let[m,w]=o[h];if(w===""||w==="\r")n.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"),n.indent===0&&(c=m.length),u=h,c===0&&!e.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let d="",f="",p=!1;for(let h=0;h<u;++h)d+=o[h][0].slice(c)+`
74
+ `;for(let h=u;h<s;++h){let[m,w]=o[h];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}a===wa.Scalar.BLOCK_LITERAL?(d+=f+m.slice(c)+w,f=`
75
+ `):m.length>c||w[0]===" "?(f===" "?f=`
76
+ `:!p&&f===`
77
+ `&&(f=`
78
78
 
79
- `),f+=d+p.slice(c)+y,d=`
80
- `,m=!0):y===""?d===`
81
- `?f+=`
82
- `:d=`
83
- `:(f+=d+y,d=" ",m=!1)}switch(r.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)f+=`
84
- `+o[h][0].slice(c);f[f.length-1]!==`
85
- `&&(f+=`
86
- `);break;default:f+=`
87
- `}let g=n+r.length+t.source.length;return{value:f,type:a,comment:r.comment,range:[n,g,g]}}function Ip({offset:e,props:t},i,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],a=r[0],o=0,s="",c=-1;for(let d=1;d<r.length;++d){let m=r[d];if(!s&&(m==="-"||m==="+"))s=m;else{let g=Number(m);!o&&g?o=g:c===-1&&(c=e+d)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,u="",f=r.length;for(let d=1;d<t.length;++d){let m=t[d];switch(m.type){case"space":l=!0;case"newline":f+=m.source.length;break;case"comment":i&&!l&&n(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,u=m.source.substring(1);break;case"error":n(m,"UNEXPECTED_TOKEN",m.message),f+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;n(m,"UNEXPECTED_TOKEN",g);let h=m.source;h&&typeof h=="string"&&(f+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:f}}function jp(e){let t=e.split(/\n( *)/),i=t[0],n=i.match(/^( *)/),a=[n?.[1]?[n[1],i.slice(n[1].length)]:["",i]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}Kc.resolveBlockScalar=_p});var ja=w(Yc=>{"use strict";var Ia=$(),Op=ht();function $p(e,t,i){let{offset:n,type:r,source:a,end:o}=e,s,c,l=(d,m,g)=>i(n+d,m,g);switch(r){case"scalar":s=Ia.Scalar.PLAIN,c=Hp(a,l);break;case"single-quoted-scalar":s=Ia.Scalar.QUOTE_SINGLE,c=Mp(a,l);break;case"double-quoted-scalar":s=Ia.Scalar.QUOTE_DOUBLE,c=Fp(a,l);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+a.length,n+a.length]}}let u=n+a.length,f=Op.resolveEnd(o,u,t,i);return{value:c,type:s,comment:f.comment,range:[n,u,f.offset]}}function Hp(e,t){let i="";switch(e[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 ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Uc(e)}function Mp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Uc(e.slice(1,-1)).replace(/''/g,"'")}function Uc(e){let t,i;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
79
+ `),d+=f+m.slice(c)+w,f=`
80
+ `,p=!0):w===""?f===`
81
+ `?d+=`
82
+ `:f=`
83
+ `:(d+=f+w,f=" ",p=!1)}switch(n.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)d+=`
84
+ `+o[h][0].slice(c);d[d.length-1]!==`
85
+ `&&(d+=`
86
+ `);break;default:d+=`
87
+ `}let v=r+n.length+t.source.length;return{value:d,type:a,comment:n.comment,range:[r,v,v]}}function pp({offset:e,props:t},i,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!s&&(p==="-"||p==="+"))s=p;else{let v=Number(p);!o&&v?o=v:c===-1&&(c=e+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":i&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let v=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",v);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function mp(e){let t=e.split(/\n( *)/),i=t[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}Tc.resolveBlockScalar=hp});var ba=g(jc=>{"use strict";var Na=j(),vp=ct();function gp(e,t,i){let{offset:r,type:n,source:a,end:o}=e,s,c,l=(f,p,v)=>i(r+f,p,v);switch(n){case"scalar":s=Na.Scalar.PLAIN,c=wp(a,l);break;case"single-quoted-scalar":s=Na.Scalar.QUOTE_SINGLE,c=yp(a,l);break;case"double-quoted-scalar":s=Na.Scalar.QUOTE_DOUBLE,c=Np(a,l);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=vp.resolveEnd(o,u,t,i);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function wp(e,t){let i="";switch(e[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 ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Ic(e)}function yp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Ic(e.slice(1,-1)).replace(/''/g,"'")}function Ic(e){let t,i;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=t.exec(e);if(!n)return e;let r=n[1],a=" ",o=t.lastIndex;for(i.lastIndex=o;n=i.exec(e);)n[1]===""?a===`
90
- `?r+=a:a=`
91
- `:(r+=a+n[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,n=s.exec(e),r+a+(n?.[1]??"")}function Fp(e,t){let i="";for(let n=1;n<e.length-1;++n){let r=e[n];if(!(r==="\r"&&e[n+1]===`
92
- `))if(r===`
93
- `){let{fold:a,offset:o}=Lp(e,n);i+=a,n=o}else if(r==="\\"){let a=e[++n],o=Dp[a];if(o)i+=o;else if(a===`
94
- `)for(a=e[n+1];a===" "||a===" ";)a=e[++n+1];else if(a==="\r"&&e[n+1]===`
95
- `)for(a=e[++n+1];a===" "||a===" ";)a=e[++n+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Bp(e,n+1,s,t),n+=s}else{let s=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(r===" "||r===" "){let a=n,o=e[n+1];for(;o===" "||o===" ";)o=e[++n+1];o!==`
96
- `&&!(o==="\r"&&e[n+2]===`
97
- `)&&(i+=n>a?e.slice(a,n+1):r)}else i+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function Lp(e,t){let i="",n=e[t+1];for(;(n===" "||n===" "||n===`
98
- `||n==="\r")&&!(n==="\r"&&e[t+2]!==`
99
- `);)n===`
89
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let n=r[1],a=" ",o=t.lastIndex;for(i.lastIndex=o;r=i.exec(e);)r[1]===""?a===`
90
+ `?n+=a:a=`
91
+ `:(n+=a+r[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),n+a+(r?.[1]??"")}function Np(e,t){let i="";for(let r=1;r<e.length-1;++r){let n=e[r];if(!(n==="\r"&&e[r+1]===`
92
+ `))if(n===`
93
+ `){let{fold:a,offset:o}=bp(e,r);i+=a,r=o}else if(n==="\\"){let a=e[++r],o=kp[a];if(o)i+=o;else if(a===`
94
+ `)for(a=e[r+1];a===" "||a===" ";)a=e[++r+1];else if(a==="\r"&&e[r+1]===`
95
+ `)for(a=e[++r+1];a===" "||a===" ";)a=e[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Sp(e,r+1,s,t),r+=s}else{let s=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=e[r+1];for(;o===" "||o===" ";)o=e[++r+1];o!==`
96
+ `&&!(o==="\r"&&e[r+2]===`
97
+ `)&&(i+=r>a?e.slice(a,r+1):n)}else i+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function bp(e,t){let i="",r=e[t+1];for(;(r===" "||r===" "||r===`
98
+ `||r==="\r")&&!(r==="\r"&&e[t+2]!==`
99
+ `);)r===`
100
100
  `&&(i+=`
101
- `),t+=1,n=e[t+1];return i||(i=" "),{fold:i,offset:t}}var Dp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Bp(e,t,i,n){let r=e.substr(t,i),o=r.length===i&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,i+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Yc.resolveFlowScalar=$p});var Zc=w(Qc=>{"use strict";var qe=R(),Xc=$(),qp=_a(),Vp=ja();function Wp(e,t,i,n){let{value:r,type:a,comment:o,range:s}=t.type==="block-scalar"?qp.resolveBlockScalar(e,t,n):Vp.resolveFlowScalar(t,e.options.strict,n),c=i?e.directives.tagName(i.source,f=>n(i,"TAG_RESOLVE_FAILED",f)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[qe.SCALAR]:c?l=zp(e.schema,r,c,i,n):t.type==="scalar"?l=Jp(e,r,t,n):l=e.schema[qe.SCALAR];let u;try{let f=l.resolve(r,d=>n(i??t,"TAG_RESOLVE_FAILED",d),e.options);u=qe.isScalar(f)?f:new Xc.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(i??t,"TAG_RESOLVE_FAILED",d),u=new Xc.Scalar(r)}return u.range=s,u.source=r,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function zp(e,t,i,n,r){if(i==="!")return e[qe.SCALAR];let a=[];for(let s of e.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(t))return s;let o=e.knownTags[i];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),e[qe.SCALAR])}function Jp({atKey:e,directives:t,schema:i},n,r,a){let o=i.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(n))||i[qe.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(n))??i[qe.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(r,"TAG_RESOLVE_FAILED",u,!0)}}return o}Qc.composeScalar=Wp});var tl=w(el=>{"use strict";function Gp(e,t,i){if(t){i??(i=t.length);for(let n=i-1;n>=0;--n){let r=t[n];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++n];r?.type==="space";)e+=r.source.length,r=t[++n];break}}return e}el.emptyScalarPosition=Gp});var rl=w($a=>{"use strict";var Kp=_t(),Up=R(),Yp=Gc(),il=Zc(),Xp=ht(),Qp=tl(),Zp={composeNode:nl,composeEmptyNode:Oa};function nl(e,t,i,n){let r=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,u=!0;switch(t.type){case"alias":l=em(e,t,n),(s||c)&&n(t,"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=il.composeScalar(e,t,c,n),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Yp.composeCollection(Zp,e,t,i,n),s&&(l.anchor=s.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(t,"RESOURCE_EXHAUSTION",d)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=Oa(e,t.offset,void 0,null,i,n)),s&&l.anchor===""&&n(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!Up.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Oa(e,t,i,n,{spaceBefore:r,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:Qp.emptyScalarPosition(t,i,n),indent:-1,source:""},f=il.composeScalar(e,u,s,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),a&&(f.comment=a,f.range[2]=c),f}function em({options:e},{offset:t,source:i,end:n},r){let a=new Kp.Alias(i.substring(1));a.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,s=Xp.resolveEnd(n,o,e.strict,r);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}$a.composeEmptyNode=Oa;$a.composeNode=nl});var sl=w(ol=>{"use strict";var tm=Gt(),al=rl(),im=ht(),nm=Xt();function rm(e,t,{offset:i,start:n,value:r,end:a},o){let s=Object.assign({_directives:t},e),c=new tm.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=nm.resolveProps(n,{indicator:"doc-start",next:r??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?al.composeNode(l,r,u,o):al.composeEmptyNode(l,u.end,n,null,u,o);let f=c.contents.range[2],d=im.resolveEnd(a,f,!1,o);return d.comment&&(c.comment=d.comment),c.range=[i,f,d.offset],c}ol.composeDoc=rm});var Ma=w(ul=>{"use strict";var am=Ii("process"),om=kr(),sm=Gt(),Qt=Yt(),cl=R(),cm=sl(),lm=ht();function Zt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function ll(e){let t="",i=!1,n=!1;for(let r=0;r<e.length;++r){let a=e[r];switch(a[0]){case"#":t+=(t===""?"":n?`
101
+ `),t+=1,r=e[t+1];return i||(i=" "),{fold:i,offset:t}}var kp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Sp(e,t,i,r){let n=e.substr(t,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,i+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}jc.resolveFlowScalar=gp});var Hc=g(Oc=>{"use strict";var We=P(),$c=j(),Ep=ya(),Pp=ba();function Rp(e,t,i,r){let{value:n,type:a,comment:o,range:s}=t.type==="block-scalar"?Ep.resolveBlockScalar(e,t,r):Pp.resolveFlowScalar(t,e.options.strict,r),c=i?e.directives.tagName(i.source,d=>r(i,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[We.SCALAR]:c?l=xp(e.schema,n,c,i,r):t.type==="scalar"?l=Cp(e,n,t,r):l=e.schema[We.SCALAR];let u;try{let d=l.resolve(n,f=>r(i??t,"TAG_RESOLVE_FAILED",f),e.options);u=We.isScalar(d)?d:new $c.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);r(i??t,"TAG_RESOLVE_FAILED",f),u=new $c.Scalar(n)}return u.range=s,u.source=n,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function xp(e,t,i,r,n){if(i==="!")return e[We.SCALAR];let a=[];for(let s of e.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(t))return s;let o=e.knownTags[i];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),e[We.SCALAR])}function Cp({atKey:e,directives:t,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(r))||i[We.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[We.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",u,!0)}}return o}Oc.composeScalar=Rp});var Bc=g(Dc=>{"use strict";function Ap(e,t,i){if(t){i??(i=t.length);for(let r=i-1;r>=0;--r){let n=t[r];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++r];n?.type==="space";)e+=n.source.length,n=t[++r];break}}return e}Dc.emptyScalarPosition=Ap});var Fc=g(Sa=>{"use strict";var _p=Ct(),Tp=P(),Ip=_c(),Lc=Hc(),jp=ct(),$p=Bc(),Op={composeNode:Mc,composeEmptyNode:ka};function Mc(e,t,i,r){let n=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,u=!0;switch(t.type){case"alias":l=Hp(e,t,r),(s||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Lc.composeScalar(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ip.composeCollection(Op,e,t,i,r),s&&(l.anchor=s.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);r(t,"RESOURCE_EXHAUSTION",f)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=ka(e,t.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!Tp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function ka(e,t,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:$p.emptyScalarPosition(t,i,r),indent:-1,source:""},d=Lc.composeScalar(e,u,s,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),a&&(d.comment=a,d.range[2]=c),d}function Hp({options:e},{offset:t,source:i,end:r},n){let a=new _p.Alias(i.substring(1));a.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,s=jp.resolveEnd(r,o,e.strict,n);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}Sa.composeEmptyNode=ka;Sa.composeNode=Mc});var Wc=g(qc=>{"use strict";var Dp=Wt(),Vc=Fc(),Bp=ct(),Lp=Ut();function Mp(e,t,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:t},e),c=new Dp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Lp.resolveProps(r,{indicator:"doc-start",next:n??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Vc.composeNode(l,n,u,o):Vc.composeEmptyNode(l,u.end,r,null,u,o);let d=c.contents.range[2],f=Bp.resolveEnd(a,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,d,f.offset],c}qc.composeDoc=Mp});var Pa=g(Gc=>{"use strict";var Fp=Ri("process"),Vp=un(),qp=Wt(),Kt=Gt(),zc=P(),Wp=Wc(),zp=ct();function Yt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function Jc(e){let t="",i=!1,r=!1;for(let n=0;n<e.length;++n){let a=e[n];switch(a[0]){case"#":t+=(t===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),i=!0,n=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:t,afterEmptyLine:n}}var Ha=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,n,r,a)=>{let o=Zt(i);a?this.warnings.push(new Qt.YAMLWarning(o,n,r)):this.errors.push(new Qt.YAMLParseError(o,n,r))},this.directives=new om.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:n,afterEmptyLine:r}=ll(this.prelude);if(n){let a=t.contents;if(i)t.comment=t.comment?`${t.comment}
106
- ${n}`:n;else if(r||t.directives.docStart||!a)t.commentBefore=n;else if(cl.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];cl.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${n}
107
- ${s}`:n}else{let o=a.commentBefore;a.commentBefore=o?`${n}
108
- ${o}`:n}}if(i){for(let a=0;a<this.errors.length;++a)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ll(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,n=-1){for(let r of t)yield*this.next(r);yield*this.end(i,n)}*next(t){switch(am.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,n,r)=>{let a=Zt(t);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",n,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=cm.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"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(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,n=new Qt.YAMLParseError(Zt(t),"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 Qt.YAMLParseError(Zt(t),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let i=lm.resolveEnd(t.end,t.offset+t.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 Qt.YAMLParseError(Zt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let n=Object.assign({_directives:this.directives},this.options),r=new sm.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}}};ul.Composer=Ha});var hl=w(En=>{"use strict";var um=_a(),fm=ja(),dm=Yt(),fl=Ht();function hm(e,t=!0,i){if(e){let n=(r,a,o)=>{let s=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(i)i(s,a,o);else throw new dm.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return fm.resolveFlowScalar(e,t,n);case"block-scalar":return um.resolveBlockScalar({options:{strict:t}},e,n)}}return null}function pm(e,t){let{implicitKey:i=!1,indent:n,inFlow:r=!1,offset:a=-1,type:o="PLAIN"}=t,s=fl.stringifyString({type:o,value:e},{implicitKey:i,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:n,source:`
105
+ `)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:t,afterEmptyLine:r}}var Ea=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=Yt(i);a?this.warnings.push(new Kt.YAMLWarning(o,r,n)):this.errors.push(new Kt.YAMLParseError(o,r,n))},this.directives=new Vp.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:r,afterEmptyLine:n}=Jc(this.prelude);if(r){let a=t.contents;if(i)t.comment=t.comment?`${t.comment}
106
+ ${r}`:r;else if(n||t.directives.docStart||!a)t.commentBefore=r;else if(zc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];zc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${r}
107
+ ${s}`:r}else{let o=a.commentBefore;a.commentBefore=o?`${r}
108
+ ${o}`:r}}if(i){for(let a=0;a<this.errors.length;++a)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Jc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,r=-1){for(let n of t)yield*this.next(n);yield*this.end(i,r)}*next(t){switch(Fp.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,r,n)=>{let a=Yt(t);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=Wp.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"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(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Kt.YAMLParseError(Yt(t),"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 Kt.YAMLParseError(Yt(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=zp.resolveEnd(t.end,t.offset+t.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 Kt.YAMLParseError(Yt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),n=new qp.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}}};Gc.Composer=Ea});var Yc=g(gr=>{"use strict";var Jp=ya(),Gp=ba(),Up=Gt(),Uc=jt();function Kp(e,t=!0,i){if(e){let r=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,a,o);else throw new Up.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Gp.resolveFlowScalar(e,t,r);case"block-scalar":return Jp.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function Yp(e,t){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=t,s=Uc.stringifyString({type:o,value:e},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
- `),u=s.substring(0,l),f=s.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:a,indent:n,source:u}];return dl(d,c)||d.push({type:"newline",offset:-1,indent:n,source:`
113
- `}),{type:"block-scalar",offset:a,indent:n,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:a,indent:n,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:n,source:s,end:c};default:return{type:"scalar",offset:a,indent:n,source:s,end:c}}}function mm(e,t,i={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:a=!1,type:o}=i,s="indent"in e?e.indent:null;if(n&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=fl.stringifyString({type:o,value:t},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":vm(e,c);break;case'"':Fa(e,c,"double-quoted-scalar");break;case"'":Fa(e,c,"single-quoted-scalar");break;default:Fa(e,c,"scalar")}}function vm(e,t){let i=t.indexOf(`
114
- `),n=t.substring(0,i),r=t.substring(i+1)+`
115
- `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,e.source=r}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:n}];dl(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:r})}}function dl(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function Fa(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let n=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let a of n)a.offset+=r;delete e.props,Object.assign(e,{type:i,source:t,end:n});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
- `};delete e.items,Object.assign(e,{type:i,source:t,end:[r]});break}default:{let n="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:i,indent:n,source:t,end:r})}}}En.createScalarToken=pm;En.resolveAsScalar=hm;En.setScalarValue=mm});var ml=w(pl=>{"use strict";var gm=e=>"type"in e?Cn(e):Rn(e);function Cn(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=Cn(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=Rn(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=Rn(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=Rn(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function Rn({start:e,key:t,sep:i,value:n}){let r="";for(let a of e)r+=a.source;if(t&&(r+=Cn(t)),i)for(let a of i)r+=a.source;return n&&(r+=Cn(n)),r}pl.stringify=gm});var yl=w(wl=>{"use strict";var La=Symbol("break visit"),wm=Symbol("skip children"),vl=Symbol("remove item");function Ve(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),gl(Object.freeze([]),e,t)}Ve.BREAK=La;Ve.SKIP=wm;Ve.REMOVE=vl;Ve.itemAtPath=(e,t)=>{let i=e;for(let[n,r]of t){let a=i?.[n];if(a&&"items"in a)i=a.items[r];else return}return i};Ve.parentCollection=(e,t)=>{let i=Ve.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],r=i?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function gl(e,t,i){let n=i(t,e);if(typeof n=="symbol")return n;for(let r of["key","value"]){let a=t[r];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=gl(Object.freeze(e.concat([[r,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===La)return La;s===vl&&(a.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(t,e))}}return typeof n=="function"?n(t,e):n}wl.visit=Ve});var Pn=w(W=>{"use strict";var Da=hl(),ym=ml(),Nm=yl(),Ba="\uFEFF",qa="",Va="",Wa="",bm=e=>!!e&&"items"in e,km=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Sm(e){switch(e){case Ba:return"<BOM>";case qa:return"<DOC>";case Va:return"<FLOW_END>";case Wa:return"<SCALAR>";default:return JSON.stringify(e)}}function Em(e){switch(e){case Ba:return"byte-order-mark";case qa:return"doc-mode";case Va:return"flow-error-end";case Wa:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
111
+ `),u=s.substring(0,l),d=s.substring(l+1)+`
112
+ `,f=[{type:"block-scalar-header",offset:a,indent:r,source:u}];return Kc(f,c)||f.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:a,indent:r,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:a,indent:r,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:r,source:s,end:c};default:return{type:"scalar",offset:a,indent:r,source:s,end:c}}}function Xp(e,t,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in e?e.indent:null;if(r&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Uc.stringifyString({type:o,value:t},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Qp(e,c);break;case'"':Ra(e,c,"double-quoted-scalar");break;case"'":Ra(e,c,"single-quoted-scalar");break;default:Ra(e,c,"scalar")}}function Qp(e,t){let i=t.indexOf(`
114
+ `),r=t.substring(0,i),n=t.substring(i+1)+`
115
+ `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,e.source=n}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];Kc(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
+ `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:n})}}function Kc(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function Ra(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let a of r)a.offset+=n;delete e.props,Object.assign(e,{type:i,source:t,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
+ `};delete e.items,Object.assign(e,{type:i,source:t,end:[n]});break}default:{let r="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:i,indent:r,source:t,end:n})}}}gr.createScalarToken=Yp;gr.resolveAsScalar=Kp;gr.setScalarValue=Xp});var Qc=g(Xc=>{"use strict";var Zp=e=>"type"in e?yr(e):wr(e);function yr(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=yr(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=wr(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=wr(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=wr(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function wr({start:e,key:t,sep:i,value:r}){let n="";for(let a of e)n+=a.source;if(t&&(n+=yr(t)),i)for(let a of i)n+=a.source;return r&&(n+=yr(r)),n}Xc.stringify=Zp});var il=g(tl=>{"use strict";var xa=Symbol("break visit"),em=Symbol("skip children"),Zc=Symbol("remove item");function ze(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),el(Object.freeze([]),e,t)}ze.BREAK=xa;ze.SKIP=em;ze.REMOVE=Zc;ze.itemAtPath=(e,t)=>{let i=e;for(let[r,n]of t){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};ze.parentCollection=(e,t)=>{let i=ze.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function el(e,t,i){let r=i(t,e);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=t[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=el(Object.freeze(e.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===xa)return xa;s===Zc&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}tl.visit=ze});var Nr=g(W=>{"use strict";var Ca=Yc(),tm=Qc(),im=il(),Aa="\uFEFF",_a="",Ta="",Ia="",rm=e=>!!e&&"items"in e,nm=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function am(e){switch(e){case Aa:return"<BOM>";case _a:return"<DOC>";case Ta:return"<FLOW_END>";case Ia:return"<SCALAR>";default:return JSON.stringify(e)}}function om(e){switch(e){case Aa:return"byte-order-mark";case _a:return"doc-mode";case Ta:return"flow-error-end";case Ia: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(e[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=Da.createScalarToken;W.resolveAsScalar=Da.resolveAsScalar;W.setScalarValue=Da.setScalarValue;W.stringify=ym.stringify;W.visit=Nm.visit;W.BOM=Ba;W.DOCUMENT=qa;W.FLOW_END=Va;W.SCALAR=Wa;W.isCollection=bm;W.isScalar=km;W.prettyToken=Sm;W.tokenType=Em});var Ga=w(bl=>{"use strict";var ei=Pn();function ne(e){switch(e){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var Nl=new Set("0123456789ABCDEFabcdef"),Rm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),An=new Set(",[]{}"),Cm=new Set(` ,[]{}
121
- \r `),za=e=>!e||Cm.has(e),Ja=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(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let n=this.next??"stream";for(;n&&(i||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];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(e[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=Ca.createScalarToken;W.resolveAsScalar=Ca.resolveAsScalar;W.setScalarValue=Ca.setScalarValue;W.stringify=tm.stringify;W.visit=im.visit;W.BOM=Aa;W.DOCUMENT=_a;W.FLOW_END=Ta;W.SCALAR=Ia;W.isCollection=rm;W.isScalar=nm;W.prettyToken=am;W.tokenType=om});var Oa=g(nl=>{"use strict";var Xt=Nr();function re(e){switch(e){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var rl=new Set("0123456789ABCDEFabcdef"),sm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),br=new Set(",[]{}"),cm=new Set(` ,[]{}
121
+ \r `),ja=e=>!e||cm.has(e),$a=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(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];return!i||i==="#"||i===`
122
122
  `?!0:i==="\r"?this.buffer[t+1]===`
123
- `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let i=this.buffer[t];if(this.indentNext>0){let n=0;for(;i===" ";)i=this.buffer[++n+t];if(i==="\r"){let r=this.buffer[n+t+1];if(r===`
124
- `||!r&&!this.atEnd)return t+n+1}return i===`
125
- `||n>=this.indentNext||!i&&!this.atEnd?t+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(t,3);if((n==="---"||n==="...")&&ne(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===ei.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let i=t.length,n=t.indexOf("#");for(;n!==-1;){let a=t[n-1];if(a===" "||a===" "){i=n-1;break}else n=t.indexOf("#",n+1)}for(;;){let a=t[i-1];if(a===" "||a===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-i),yield*this.pushNewline(),"stream"}return yield ei.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&ne(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&&!ne(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ne(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 t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.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(za),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,n=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=n=i):i=0,i+=yield*this.pushSpaces(!0);while(t+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("..."))&&ne(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield ei.FLOW_END,yield*this.parseLineStart();let a=0;for(;r[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),r[a]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-a),"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(za),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ne(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),i=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%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 a=this.continueScalar(r+1);if(a===-1)break;r=n.indexOf(`
128
- `,a)}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 t=this.pos;for(;;){let i=this.buffer[++t];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=>ne(i)||i==="#")}*parseBlockScalar(){let t=this.pos-1,i=0,n;e:for(let a=this.pos;n=this.buffer[a];++a)switch(n){case" ":i+=1;break;case`
123
+ `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let i=this.buffer[t];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+t];if(i==="\r"){let n=this.buffer[r+t+1];if(n===`
124
+ `||!n&&!this.atEnd)return t+r+1}return i===`
125
+ `||r>=this.indentNext||!i&&!this.atEnd?t+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&re(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Xt.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let i=t.length,r=t.indexOf("#");for(;r!==-1;){let a=t[r-1];if(a===" "||a===" "){i=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let a=t[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-i),yield*this.pushNewline(),"stream"}return yield Xt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&re(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&&!re(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&re(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 t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.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(ja),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,r=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(t+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("..."))&&re(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Xt.FLOW_END,yield*this.parseLineStart();let a=0;for(;n[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),n[a]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-a),"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(ja),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||re(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),i=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%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 a=this.continueScalar(n+1);if(a===-1)break;n=r.indexOf(`
128
+ `,a)}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 t=this.pos;for(;;){let i=this.buffer[++t];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=>re(i)||i==="#")}*parseBlockScalar(){let t=this.pos-1,i=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":i+=1;break;case`
129
129
  `:t=a,i=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
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 a=this.continueScalar(t+1);if(a===-1)break;t=this.buffer.indexOf(`
131
- `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
132
- `;)n=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let a=t-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
- `&&a>=this.pos&&a+1+i>s)t=a;else break}while(!0);return yield ei.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,i=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let a=this.buffer[n+1];if(ne(a)||t&&An.has(a))break;i=n}else if(ne(r)){let a=this.buffer[n+1];if(r==="\r"&&(a===`
134
- `?(n+=1,r=`
135
- `,a=this.buffer[n+1]):i=n),a==="#"||t&&An.has(a))break;if(r===`
136
- `){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(t&&An.has(r))break;i=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield ei.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let n=this.buffer.slice(this.pos,t);return n?(yield n,this.pos+=n.length,n.length):(i&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(za),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,n=this.charAt(1);if(ne(n)||i&&An.has(n)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!ne(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(Rm.has(i))i=this.buffer[++t];else if(i==="%"&&Nl.has(this.buffer[t+1])&&Nl.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
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 a=this.continueScalar(t+1);if(a===-1)break;t=this.buffer.indexOf(`
131
+ `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
+ `;)r=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let a=t-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
+ `&&a>=this.pos&&a+1+i>s)t=a;else break}while(!0);return yield Xt.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let a=this.buffer[r+1];if(re(a)||t&&br.has(a))break;i=r}else if(re(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
134
+ `?(r+=1,n=`
135
+ `,a=this.buffer[r+1]):i=r),a==="#"||t&&br.has(a))break;if(n===`
136
+ `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(t&&br.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Xt.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(i&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(ja),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(re(r)||i&&br.has(r)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!re(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(sm.has(i))i=this.buffer[++t];else if(i==="%"&&rl.has(this.buffer[t+1])&&rl.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
137
137
  `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||t&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(t){let i=this.pos,n=this.buffer[i];for(;!t(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};bl.Lexer=Ja});var Ua=w(kl=>{"use strict";var Ka=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,n=this.lineStarts.length;for(;i<n;){let a=i+n>>1;this.lineStarts[a]<t?i=a+1:n=a}if(this.lineStarts[i]===t)return{line:i+1,col:1};if(i===0)return{line:0,col:t};let r=this.lineStarts[i-1];return{line:i,col:t-r+1}}}};kl.LineCounter=Ka});var Xa=w(Pl=>{"use strict";var Pm=Ii("process"),Sl=Pn(),Am=Ga();function Ae(e,t){for(let i=0;i<e.length;++i)if(e[i].type===t)return!0;return!1}function El(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Cl(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function xn(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function pt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Tn(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let i=0;i<t.length;++i)e.push(t[i])}function Rl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ae(t.start,"explicit-key-ind")&&!Ae(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Cl(t.value)?t.value.end?Tn(t.value.end,t.sep):t.value.end=t.sep:Tn(t.start,t.sep),delete t.sep)}var Ya=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Am.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(t,i))yield*this.next(n);i||(yield*this.end())}*next(t){if(this.source=t,Pm.env.LOG_TOKENS&&console.log("|",Sl.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=Sl.tokenType(t);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+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let n=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.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(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??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"&&Rl(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&&El(r.start)===-1&&(i.indent===0||r.start.every(a=>a.type!=="comment"||a.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 t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{El(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let i=xn(this.peek(2)),n=pt(i),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:n,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||t&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(t){let i=this.pos,r=this.buffer[i];for(;!t(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};nl.Lexer=$a});var Da=g(al=>{"use strict";var Ha=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<t?i=a+1:r=a}if(this.lineStarts[i]===t)return{line:i+1,col:1};if(i===0)return{line:0,col:t};let n=this.lineStarts[i-1];return{line:i,col:t-n+1}}}};al.LineCounter=Ha});var La=g(ul=>{"use strict";var lm=Ri("process"),ol=Nr(),um=Oa();function Ae(e,t){for(let i=0;i<e.length;++i)if(e[i].type===t)return!0;return!1}function sl(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function ll(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function kr(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function lt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Sr(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let i=0;i<t.length;++i)e.push(t[i])}function cl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ae(t.start,"explicit-key-ind")&&!Ae(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,ll(t.value)?t.value.end?Sr(t.value.end,t.sep):t.value.end=t.sep:Sr(t.start,t.sep),delete t.sep)}var Ba=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new um.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,i))yield*this.next(r);i||(yield*this.end())}*next(t){if(this.source=t,lm.env.LOG_TOKENS&&console.log("|",ol.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=ol.tokenType(t);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+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.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(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??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"&&cl(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&&sl(n.start)===-1&&(i.indent===0||n.start.every(a=>a.type!=="comment"||a.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 t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{sl(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let i=kr(this.peek(2)),r=lt(i),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.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(t){let i=t.items[t.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):t.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)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Tn(r,i.start),r.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let n=!this.onKeyLine&&this.indent===t.indent,r=n&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(r&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||i.value?(a.push(this.sourceToken),t.items.push({start:a}),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?(a.push(this.sourceToken),t.items.push({start:a,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)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ae(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(Cl(i.key)&&!Ae(i.sep,"newline")){let o=pt(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:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(Ae(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=pt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||r?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ae(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 o=this.flowScalar(this.type);r||i.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ae(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&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.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):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Tn(r,i.start),r.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||Ae(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let n=this.startBlockValue(t);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.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(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.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?t.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?t.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":t.end.push(this.sourceToken);return}let n=this.startBlockValue(t);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===t.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=xn(n),a=pt(r);Rl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let i=this.source.indexOf(`
140
+ `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let i=t.items[t.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):t.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)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(a.push(this.sourceToken),t.items.push({start:a}),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?(a.push(this.sourceToken),t.items.push({start:a,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)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ae(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(ll(i.key)&&!Ae(i.sep,"newline")){let o=lt(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:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(Ae(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=lt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ae(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 o=this.flowScalar(this.type);n||i.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ae(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&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.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):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||Ae(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.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(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.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?t.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?t.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":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);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===t.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=kr(r),a=lt(n);cl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){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:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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=xn(t),n=pt(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=xn(t),n=pt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Pl.Parser=Ya});var Il=w(ii=>{"use strict";var Al=Ma(),xm=Gt(),ti=Yt(),Tm=$r(),_m=R(),Im=Ua(),xl=Xa();function Tl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Im.LineCounter||null,prettyErrors:t}}function jm(e,t={}){let{lineCounter:i,prettyErrors:n}=Tl(t),r=new xl.Parser(i?.addNewLine),a=new Al.Composer(t),o=Array.from(a.compose(r.parse(e)));if(n&&i)for(let s of o)s.errors.forEach(ti.prettifyError(e,i)),s.warnings.forEach(ti.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function _l(e,t={}){let{lineCounter:i,prettyErrors:n}=Tl(t),r=new xl.Parser(i?.addNewLine),a=new Al.Composer(t),o=null;for(let s of a.compose(r.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new ti.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(o.errors.forEach(ti.prettifyError(e,i)),o.warnings.forEach(ti.prettifyError(e,i))),o}function Om(e,t,i){let n;typeof t=="function"?n=t:i===void 0&&t&&typeof t=="object"&&(i=t);let r=_l(e,i);if(!r)return null;if(r.warnings.forEach(a=>Tm.warn(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},i))}function $m(e,t,i){let n=null;if(typeof t=="function"||Array.isArray(t)?n=t:i===void 0&&t&&(i=t),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(e===void 0){let{keepUndefined:r}=i??t??{};if(!r)return}return _m.isDocument(e)&&!n?e.toString(i):new xm.Document(e,n,i).toString(i)}ii.parse=Om;ii.parseAllDocuments=jm;ii.parseDocument=_l;ii.stringify=$m});var In=w(A=>{"use strict";var Hm=Ma(),Mm=Gt(),Fm=ga(),Qa=Yt(),Lm=_t(),xe=R(),Dm=Ee(),Bm=$(),qm=Ce(),Vm=Pe(),Wm=Pn(),zm=Ga(),Jm=Ua(),Gm=Xa(),_n=Il(),jl=Pt();A.Composer=Hm.Composer;A.Document=Mm.Document;A.Schema=Fm.Schema;A.YAMLError=Qa.YAMLError;A.YAMLParseError=Qa.YAMLParseError;A.YAMLWarning=Qa.YAMLWarning;A.Alias=Lm.Alias;A.isAlias=xe.isAlias;A.isCollection=xe.isCollection;A.isDocument=xe.isDocument;A.isMap=xe.isMap;A.isNode=xe.isNode;A.isPair=xe.isPair;A.isScalar=xe.isScalar;A.isSeq=xe.isSeq;A.Pair=Dm.Pair;A.Scalar=Bm.Scalar;A.YAMLMap=qm.YAMLMap;A.YAMLSeq=Vm.YAMLSeq;A.CST=Wm;A.Lexer=zm.Lexer;A.LineCounter=Jm.LineCounter;A.Parser=Gm.Parser;A.parse=_n.parse;A.parseAllDocuments=_n.parseAllDocuments;A.parseDocument=_n.parseDocument;A.stringify=_n.stringify;A.visit=jl.visit;A.visitAsync=jl.visitAsync});import vv from"path";var ri=wr(In(),1);import On from"path";var ai=64*1024,$n=1024,Hn=64,eo=5,Km=[".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/**"],J={include:["**/*"],exclude:[...Km],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},jn={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
143
- # ambient_resume: true | false`,native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs, changes, and runtime data.","native.language":`# Artifact language used by Native workflow documents.
144
- # language: en | zh-CN`,"native.clarification_mode":`# Controls whether Native asks one clarification at a time or every currently answerable question in a round.
145
- # clarification_mode: sequential | batch`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
146
- # archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed contract before Native stops the completion loop.","native.snapshot":"# Controls the auditable project scope and bounded work used by Native content snapshots.","native.snapshot.include":"# Selects the project-relative paths included in Native snapshots. Patterns use / and support *, **, and ?.","native.snapshot.exclude":"# Removes paths from the included scope. Exclusions are bound into each new change baseline.","native.snapshot.max_files":"# Bounds the number of files captured by one snapshot. Increase it for large monorepos.","native.snapshot.max_total_bytes":"# Bounds the total file content hashed by one snapshot. Content is streamed and does not depend on Git hashes.","native.snapshot.max_duration_ms":"# Bounds snapshot capture time in milliseconds. Increase it together with the byte budget on slower or larger repositories.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
142
+ `,i)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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=kr(t),r=lt(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=kr(t),r=lt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};ul.Parser=Ba});var ml=g(Zt=>{"use strict";var dl=Pa(),dm=Wt(),Qt=Gt(),fm=Sn(),hm=P(),pm=Da(),fl=La();function hl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new pm.LineCounter||null,prettyErrors:t}}function mm(e,t={}){let{lineCounter:i,prettyErrors:r}=hl(t),n=new fl.Parser(i?.addNewLine),a=new dl.Composer(t),o=Array.from(a.compose(n.parse(e)));if(r&&i)for(let s of o)s.errors.forEach(Qt.prettifyError(e,i)),s.warnings.forEach(Qt.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function pl(e,t={}){let{lineCounter:i,prettyErrors:r}=hl(t),n=new fl.Parser(i?.addNewLine),a=new dl.Composer(t),o=null;for(let s of a.compose(n.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Qt.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(Qt.prettifyError(e,i)),o.warnings.forEach(Qt.prettifyError(e,i))),o}function vm(e,t,i){let r;typeof t=="function"?r=t:i===void 0&&t&&typeof t=="object"&&(i=t);let n=pl(e,i);if(!n)return null;if(n.warnings.forEach(a=>fm.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:r},i))}function gm(e,t,i){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:i===void 0&&t&&(i=t),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(e===void 0){let{keepUndefined:n}=i??t??{};if(!n)return}return hm.isDocument(e)&&!r?e.toString(i):new dm.Document(e,r,i).toString(i)}Zt.parse=vm;Zt.parseAllDocuments=mm;Zt.parseDocument=pl;Zt.stringify=gm});var ut=g(x=>{"use strict";var wm=Pa(),ym=Wt(),Nm=aa(),Ma=Gt(),bm=Ct(),_e=P(),km=Pe(),Sm=j(),Em=xe(),Pm=Ce(),Rm=Nr(),xm=Oa(),Cm=Da(),Am=La(),Er=ml(),vl=Et();x.Composer=wm.Composer;x.Document=ym.Document;x.Schema=Nm.Schema;x.YAMLError=Ma.YAMLError;x.YAMLParseError=Ma.YAMLParseError;x.YAMLWarning=Ma.YAMLWarning;x.Alias=bm.Alias;x.isAlias=_e.isAlias;x.isCollection=_e.isCollection;x.isDocument=_e.isDocument;x.isMap=_e.isMap;x.isNode=_e.isNode;x.isPair=_e.isPair;x.isScalar=_e.isScalar;x.isSeq=_e.isSeq;x.Pair=km.Pair;x.Scalar=Sm.Scalar;x.YAMLMap=Em.YAMLMap;x.YAMLSeq=Pm.YAMLSeq;x.CST=Rm;x.Lexer=xm.Lexer;x.LineCounter=Cm.LineCounter;x.Parser=Am.Parser;x.parse=Er.parse;x.parseAllDocuments=Er.parseAllDocuments;x.parseDocument=Er.parseDocument;x.stringify=Er.stringify;x.visit=vl.visit;x.visitAsync=vl.visitAsync});import rv from"path";var ei=St(ut(),1);import Rr from"path";var ti=64*1024,xr=1024,Cr=64,Va=5,_m=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Tm=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Im=[..._m,...Tm].sort((e,t)=>e.localeCompare(t,"en"));var G={include:["**/*"],exclude:[...Im],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},Pr={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
143
+ # ambient_resume: true | false`,hook:"# Hook write policy shared by Native and Classic. Paths are project-relative.","hook.allow_paths":"# Project-relative directories allowed during guarded phases. Use one path per list item; empty by default.",native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs and changes. Runtime data stays under .comet.","native.language":`# Artifact language used by Native workflow documents.
144
+ # language: en | zh-CN`,"native.clarification_mode":`# Controls how Native asks clarifying questions: batch asks every currently answerable question per round (default), sequential asks one at a time.
145
+ # clarification_mode: batch | sequential`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
146
+ # archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed acceptance target before Native stops the completion loop.","native.snapshot":"# Controls the auditable project scope and bounded work used by Native content snapshots.","native.snapshot.include":"# Selects the project-relative paths included in Native snapshots. Patterns use / and support *, **, and ?.","native.snapshot.exclude":"# Removes paths from the included scope. Exclusions are bound into each new change baseline.","native.snapshot.max_files":"# Bounds the number of files captured by one snapshot. Increase it for large monorepos.","native.snapshot.max_total_bytes":"# Bounds the total file content hashed by one snapshot. Content is streamed and does not depend on Git hashes.","native.snapshot.max_duration_ms":"# Bounds snapshot capture time in milliseconds. Increase it together with the byte budget on slower or larger repositories.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
147
147
  # artifact_layout: legacy | docs`,"classic.language":`# Artifact language used by Classic workflow documents.
148
148
  # language: en | zh-CN`,"classic.context_compression":`# Controls beta context compression for new Classic changes.
149
149
  # context_compression: off | beta`,"classic.review_mode":`# Sets the default review depth for new Classic changes.
150
150
  # review_mode: off | standard | thorough`,"classic.auto_transition":`# Automatically enters the next Classic phase after a phase passes.
151
151
  # auto_transition: true | false`},"zh-CN":{schema:"# Comet 使用的配置格式版本,请勿修改此值。",default_workflow:"# `/comet` 默认进入的工作流;该值也必须出现在 workflows 中。",workflows:"# 此项目启用的工作流,可填写 native、classic 或同时启用两者。",ambient_resume:`# 是否启用只读的环境感知恢复探针,同时作用于 Native 和 Classic;设为 false 可关闭自动工作流恢复。
152
- # ambient_resume: true | false`,native:"# Native 工作流配置,不会改变 Classic 的状态或行为。","native.artifact_root":"# Native 产物的存放根目录,包括规格、change 和运行时数据。","native.language":`# Native 工作流文档使用的产物语言。
153
- # 可选值:en | zh-CN`,"native.clarification_mode":`# Native 每轮询问一个问题,或一次提出当前所有可回答的问题。
154
- # 可选值:sequential | batch`,"native.archive_confirmation":`# Native 归档预演成功后自动归档,或等待用户明确确认。
155
- # 可选值:automatic | required`,"native.max_verify_failures":"# 同一份已确认 contract 最多允许的 Verify 失败次数;达到上限后停止完成循环。","native.snapshot":"# Native 内容快照使用的可审计项目范围与有界工作预算。","native.snapshot.include":"# Native 快照纳入的项目相对路径;模式使用 /,支持 *、** 和 ?。","native.snapshot.exclude":"# 从纳入范围中排除路径;新 change 会把排除策略绑定到 baseline。","native.snapshot.max_files":"# 单次快照最多捕获的文件数;大型 monorepo 可按需提高。","native.snapshot.max_total_bytes":"# 单次快照最多哈希的文件内容总字节数;内容采用流式读取,不依赖 Git hash。","native.snapshot.max_duration_ms":"# 单次快照的最长执行时间(毫秒);较慢或更大的仓库应与字节预算一并提高。",classic:"# Classic 工作流配置,不会改变 Native 的状态或行为。","classic.artifact_layout":`# Classic 产物布局;默认使用 docs,update 检测到根目录 legacy 产物时予以保留。
152
+ # ambient_resume: true | false`,hook:"# Native 和 Classic 共享的 Hook 写入策略;路径必须是项目相对路径。","hook.allow_paths":"# 在受保护阶段允许写入的项目相对目录;每项填写一个目录,默认为空。",native:"# Native 工作流配置,不会改变 Classic 的状态或行为。","native.artifact_root":"# Native 规格和 change 的存放根目录;运行时数据始终位于 .comet。","native.language":`# Native 工作流文档使用的产物语言。
153
+ # 可选值:en | zh-CN`,"native.clarification_mode":`# Native 提问澄清问题的方式:batch 每轮一次提出当前所有可回答的问题(默认),sequential 每轮只问一个。
154
+ # 可选值:batch | sequential`,"native.archive_confirmation":`# Native 归档检查成功后自动归档,或等待用户明确确认。
155
+ # 可选值:automatic | required`,"native.max_verify_failures":"# 同一个已确认验收目标最多允许的 Verify 失败次数;达到上限后停止完成循环。","native.snapshot":"# Native 内容快照使用的可审计项目范围与有界工作预算。","native.snapshot.include":"# Native 快照纳入的项目相对路径;模式使用 /,支持 *、** 和 ?。","native.snapshot.exclude":"# 从纳入范围中排除路径;新 change 会把排除策略绑定到 baseline。","native.snapshot.max_files":"# 单次快照最多捕获的文件数;大型 monorepo 可按需提高。","native.snapshot.max_total_bytes":"# 单次快照最多哈希的文件内容总字节数;内容采用流式读取,不依赖 Git hash。","native.snapshot.max_duration_ms":"# 单次快照的最长执行时间(毫秒);较慢或更大的仓库应与字节预算一并提高。",classic:"# Classic 工作流配置,不会改变 Native 的状态或行为。","classic.artifact_layout":`# Classic 产物布局;默认使用 docs,update 检测到根目录 legacy 产物时予以保留。
156
156
  # 可选值:legacy | docs`,"classic.language":`# Classic 工作流文档使用的产物语言。
157
157
  # 可选值:en | zh-CN`,"classic.context_compression":`# 新建 Classic change 是否启用 beta 上下文压缩。
158
158
  # 可选值:off | beta`,"classic.review_mode":`# 新建 Classic change 默认使用的审查深度。
159
159
  # 可选值:off | standard | thorough`,"classic.auto_transition":`# Classic 阶段通过后是否自动进入下一阶段。
160
- # 可选值:true | false`}};function $l(e,t){return jn[t][e]}function Um(e,t,i){let n=/^(\s*)([a-z_]+):/u.exec(e);if(!n)return null;let r=n[1].length,a=n[2];if(r===0&&a in jn.en)return a;if(r===2&&t){let o=`${t}.${a}`;if(o in jn.en)return o}if(r===4&&t==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in jn.en)return o}return null}function oi(e,t){let i=[],n=null,r=null;for(let a of(0,ri.stringify)(e).trimEnd().split(`
161
- `)){let o=Um(a,n,r);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of $l(o,t).split(`
162
- `))i.push(`${s}${c}`)}i.push(a),/^[a-z_]+:/u.test(a)?(a.startsWith("native:")?n="native":a.startsWith("classic:")?n="classic":n=null,r=null):/^ {2}[a-z_]+:/u.test(a)&&n==="native"&&(r=a.startsWith(" snapshot:")?"snapshot":null)}return i.push(""),i.join(`
163
- `)}function Ym(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim();if(i.length===0||On.posix.isAbsolute(i)||On.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${t} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${t} must not contain empty or dot path segments`);return n}function We(e){let t=Ym(e,"native.artifact_root");return t.length===0?".":t.join("/")}function Hl(e,t="docs"){let i=e??t;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function to(e,t,i=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let n=e.trim().replaceAll("\\","/");if(n.length===0||On.posix.isAbsolute(n)||On.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${t} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${t} cannot contain wildcards`);return r.join("/")}function ni(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Ml(e,t,i){let n=e??t;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function Mn(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>$n)throw new Error(`${t} exceeds ${$n} characters`);let i=0;for(let n=0;n<e.length;n+=1)e[n]==="?"?i+=1:e[n]==="*"&&(i+=1,e[n+1]==="*"&&(n+=1));if(i>Hn)throw new Error(`${t} contains more than ${Hn} wildcard tokens`);return e}function Ol(e,t,i){if(e===void 0)return[...i];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(n=>Mn(n,t)))].sort((n,r)=>n.localeCompare(r,"en"))}function Za(e,t,i){let n=e??t;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Xm(e){if(e===void 0)return{...J,include:[...J.include],exclude:[...J.exclude]};let t=ni(e,"native.snapshot");return{include:Ol(t.include,"native.snapshot.include",J.include),exclude:Ol(t.exclude,"native.snapshot.exclude",J.exclude),max_files:Za(t.max_files,J.max_files,"native.snapshot.max_files"),max_total_bytes:Za(t.max_total_bytes,J.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Za(t.max_duration_ms,J.max_duration_ms,"native.snapshot.max_duration_ms")}}function Qm(e){if(e===void 0)return;let t=ni(e,"native.pending_root_move"),i=t.id,n=t.from_artifact_root,r=t.to_artifact_root,a=t.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(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(t.cleanup!==void 0){let s=ni(t.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=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 u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:i,fromArtifactRoot:We(n),toArtifactRoot:We(r),stage:a,...o?{cleanup:o}:{}}}function Zm(e,t={}){let i=ni(e,"native"),n=i.artifact_root??(t.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let r=i.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??eo;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Qm(i.pending_root_move);return{artifact_root:We(n),language:Ml(i.language,"en","native.language"),clarification_mode:r,archive_confirmation:a,max_verify_failures:o,snapshot:Xm(i.snapshot),...s?{pending_root_move:s}:{}}}function ev(e){let t=ni(e,"classic"),i=t.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let n=t.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=t.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Hl(t.artifact_layout),language:Ml(t.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function tv(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function iv(e,t,i,n,r){let a=e.schema!==void 0;if(!(a||e.default_workflow!==void 0||e.workflows!==void 0||!r.allowPartialProject&&e.native!==void 0)||r.allowPartialProject&&!a)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let s=e.workflows??[e.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(e.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!t)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:c,ambient_resume:n,...t?{native:t}:{},...i?{classic:i}:{}}}function vt(e,t={}){let i=(0,ri.parseDocument)(e,{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,a=tv(r.ambient_resume),o=r.native===void 0?void 0:Zm(r.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),s=r.classic===void 0?void 0:ev(r.classic),c=iv(r,o,s,a,{allowPartialProject:t.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function Fl(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function Ll(e){return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,snapshot:e.native.snapshot,...e.native.pending_root_move?{pending_root_move:Fl(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition}}:{}}}function mt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function si(e,t){let i=Ll(t),n=vt((0,ri.stringify)(i)).config;if(!n)throw new Error("Unsupported Comet project schema");let r={...e,schema:n.schema,default_workflow:n.default_workflow,workflows:n.workflows,ambient_resume:n.ambient_resume};if(n.native){let a=mt(e.native),o=mt(a.snapshot),s={...a,artifact_root:n.native.artifact_root,language:n.native.language,clarification_mode:n.native.clarification_mode,archive_confirmation:n.native.archive_confirmation,max_verify_failures:n.native.max_verify_failures,snapshot:{...o,...n.native.snapshot}};if(n.native.pending_root_move){let c=mt(a.pending_root_move),l=Fl(n.native.pending_root_move),u=mt(c.cleanup),f=mt(l.cleanup);s.pending_root_move={...c,...l,...l.cleanup?{cleanup:{...u,...f}}:{}}}else delete s.pending_root_move;r.native=s}return n.classic&&(r.classic={...mt(e.classic),artifact_layout:n.classic.artifact_layout,language:n.classic.language,context_compression:n.classic.context_compression,review_mode:n.classic.review_mode,auto_transition:n.classic.auto_transition}),r}function Fn(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:We(e),language:t,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:eo,snapshot:{...J,include:[...J.include],exclude:[...J.exclude]}}}}import{createHash as rv}from"crypto";import{promises as Bn}from"fs";import _e from"path";import{constants as Ln,promises as ze}from"fs";function Te(e){return e!==0&&e!==0n&&e!=="0"}function G(e,t){return Te(e.dev)&&Te(t.dev)&&Te(e.ino)&&Te(t.ino)}function I(e,t){let i=Te(e.dev)&&Te(t.dev);if(i&&e.dev!==t.dev)return!1;let n=Te(e.ino)&&Te(t.ino);return n&&e.ino!==t.ino?!1:i&&n?!0:e.birthtime===t.birthtime}var re=class extends Error{reason;constructor(t,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=t}};function io(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function Dl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function ci(e){return{dev:e.dev,ino:e.ino,birthtime:io(e)}}function Dn(e,t){let i=ci(e),n=ci(t);return G(i,n)?I(i,n):I(i,n)&&io(e)===io(t)&&Dl(e)===Dl(t)&&e.size===t.size}async function gt(e,t,i={}){if(!Number.isSafeInteger(t)||t<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,a=await ze.lstat(e,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new re("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new re("too-large",`${n} exceeds ${t} bytes`);let o=await ze.realpath(e);await i.verify?.("pre-open",{realPath:o,identity:ci(a)});let s=process.platform==="win32"?Ln.O_RDONLY:Ln.O_RDONLY|Ln.O_NOFOLLOW|Ln.O_NONBLOCK,c;try{c=await ze.open(e,s)}catch(l){throw l.code==="ELOOP"?new re("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:r}),ze.lstat(e,{bigint:r}),ze.realpath(e)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==o||!Dn(a,l)||!Dn(a,u))throw new re("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:f,identity:ci(l)}),await i.hooks?.afterOpen?.();let d=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let N=t+1-m,{bytesRead:k}=await c.read(g,0,Math.min(g.length,N),null);if(k===0)break;if(m+=k,m>t)throw new re("too-large",`${n} exceeds ${t} bytes`);d.push(Buffer.from(g.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),ze.lstat(e,{bigint:r}),ze.realpath(e)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!Dn(a,h)||!Dn(a,p))throw new re("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:ci(h)}),{bytes:Buffer.concat(d,m),stat:h,realPath:y}}finally{await c.close()}}function nv(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function no(e,t){let i=_e.relative(e,t);return i===""||!_e.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_e.sep}`)}async function Bl(e,t){let i=_e.resolve(e),n=await Bn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return Bn.realpath(i)}async function ql(e,t,i,n){let r=e;for(let a=0;a<i.length;a++){r=_e.join(r,i[a]);let o;try{o=await Bn.lstat(r)}catch(u){if(nv(u))return{exists:!1,kind:"missing"};throw u}let s=_e.relative(e,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${n.label} ancestor ${s} must be a real directory`);if(c&&(n.expected==="file"&&!o.isFile()||n.expected==="directory"&&!o.isDirectory()||n.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await Bn.realpath(r);if(!no(t,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function li(e,t,i){let n=to(t,i.label),r=_e.resolve(e),a=await Bl(r,i.label),o=n.split("/"),s=_e.resolve(r,...o);if(!no(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await ql(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function Je(e,t,i,n){let r=await li(e,t,{label:n.label,expected:"file"});if(!r.exists){let o=new Error(`${n.label} does not exist`);throw o.code="ENOENT",o}let a=await Bl(r.projectRoot,n.label);return gt(r.target,i,{...n,verify:async(o,s)=>{if(!no(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await ql(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var ui=".comet/config.yaml";function ro(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function av(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function ao(e,t={}){return(await fi(e,t)).document}async function Vl(e){try{return(await Je(e,ui,ai,{label:ui})).bytes}catch(t){if(av(t))return null;throw t}}function Wl(e){return e?{exists:!0,sha256:rv("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function qn(e){return Wl(await Vl(e))}async function fi(e,t={}){let i=await Vl(e);return{document:i?vt(i.toString("utf8"),t):null,identity:Wl(i)}}var eb=16*1024;async function oo(e,t){if(!t)return;let i=await qn(e);if(!ro(i,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as lv}from"crypto";import{promises as D}from"fs";import ae from"path";function co(e,t){let i=ae.relative(e,t);return i===""||!ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ae.sep}`)}function uv(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function so(e,t){let i={...e,birthtime:e.birthtimeMs},n={...t,birthtime:t.birthtimeMs};return G(i,n)?I(i,n):I(i,n)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function zl(e){let t=await D.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await D.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function di(e){for(let t of e){let i=await D.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!uv(t,i)||await D.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function fv(e,t){let i=ae.resolve(e),n=ae.resolve(t);if(!co(i,n))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let r=[await zl(i)],a=ae.relative(i,n).split(ae.sep).filter(Boolean),o=i;for(let s of a){await di(r),o=ae.join(o,s);try{await D.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await zl(o);if(!co(r[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await di(r),r}async function dv(e){let t;try{t=await D.open(e,"r"),await t.sync()}catch(i){let n=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw i}finally{await t?.close()}}async function Jl(e,t,i={}){let n=ae.dirname(e),r=i.containedRoot?await fv(i.containedRoot,n):null;r||await D.mkdir(n,{recursive:!0});let a=ae.join(n,`.${ae.basename(e)}.${lv()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await D.open(a,"wx"),s=await o.stat(),r){let[c,l]=await Promise.all([D.lstat(a),D.realpath(a)]);if(await di(r),!c.isFile()||c.isSymbolicLink()||!so(s,c)||!co(r[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),!so(s,await o.stat()))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await i.beforeCommit?.(),r){await di(r);let c=await D.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!so(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await D.link(a,e),await D.unlink(a)):await D.rename(a,e),await dv(n)}catch(c){if(await o?.close(),!r)await D.rm(a,{force:!0});else try{await di(r),await D.rm(a,{force:!0})}catch{}throw c}}async function he(e,t,i={}){await Jl(e,t,i)}async function Gl(e,t,i={}){await Jl(e,t,i)}async function oe(e,t,i={}){await he(e,JSON.stringify(t,null,2)+`
164
- `,i)}import{promises as wt}from"fs";import x from"path";import hv from"os";var Wn=".comet/config.yaml";async function lo(e){try{return await wt.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function pv(e){try{let t=await wt.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function hi(e,t){let i=x.relative(e,t);return i===""||!x.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${x.sep}`)}async function pi(e){let t=[],i=e;for(;!await lo(i);){let r=x.dirname(i);if(r===i)break;t.push(x.basename(i)),i=r}let n=await wt.realpath(i);return x.resolve(n,...t.reverse())}async function Kl(e){try{return(await wt.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function uo(e){let t=x.resolve(e);try{(await wt.stat(t)).isDirectory()||(t=x.dirname(t))}catch(r){if(r.code!=="ENOENT")throw r}let i=t,n=x.resolve(hv.homedir());for(;;){if(!(t===n&&i!==n)){let o=x.join(t,...Wn.split("/")),s=t===i||await pv(o);if(await lo(o)&&s)return t}if(await lo(x.join(t,".git")))return t;let a=x.dirname(t);if(a===t)return i;t=a}}function mi(e){return We(e)}async function mv(e,t){let i=mi(t),n=x.resolve(e,...i.split("/")),r=await wt.realpath(e),a=await pi(n);if(!hi(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function Ge(e,t){let i=mi(t),n=await mv(e,i),r=x.join(n,"comet");if(await Kl(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([pi(n),pi(r)]);if(!hi(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:x.resolve(e),configFile:x.join(e,...Wn.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:x.join(r,"specs"),changesDir:x.join(r,"changes"),archiveDir:x.join(r,"archive"),runtimeDir:x.join(r,"runtime"),locksDir:x.join(r,"runtime","locks"),transactionsDir:x.join(r,"runtime","transactions")}}function K(e,t){return hi(x.resolve(e),x.resolve(t))}async function O(e,t){let i=x.resolve(e),n=x.resolve(t);if(!hi(i,n))throw new Error(`Path is outside the Native root: ${t}`);if(await Kl(i))throw new Error(`Native root must not be a symbolic link: ${e}`);let[r,a]=await Promise.all([pi(i),pi(n)]);if(!hi(r,a))throw new Error(`Path resolves outside the Native root: ${t}`);return n}var zn=Mn;function Ul(e="docs",t="en"){return Fn(e,t)}async function Ie(e){let t=(await ao(e))?.config??null;return t?.native?t:null}async function yt(e,t,i={}){let n=await fi(e,{allowPartialProject:!0}),r=si(n.document?.value??{},t),a=vv.join(e,...Wn.split("/"));await he(a,oi(r,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await i.beforeCommit?.(),await oo(e,n.identity)}})}import{createHash as pw,randomUUID as mw}from"crypto";import{promises as Me}from"fs";import j from"path";var To=wr(In(),1);import{promises as Yg}from"fs";import tt from"path";import{createHash as Nv}from"node:crypto";import{promises as se}from"node:fs";import X from"node:path";import{TextDecoder as bv}from"node:util";var gv=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),wv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function yv(e){return e.toLowerCase().startsWith(".env")}function vi(e){let i=e.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>yv(n))?"environment-file":i.some(n=>wv.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>gv.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var Gn=1024*1024;function fo(e,t){let i=X.relative(e,t);return i===""||!X.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${X.sep}`)}function kv(e){let t=X.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||X.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let i=e.toLowerCase(),n=vi(e);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${e}`);return e}function Sv(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function Ev(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Jn(e,t){let i={...e,birthtime:e.birthtimeMs},n={...t,birthtime:t.birthtimeMs};return G(i,n)?I(i,n):I(i,n)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function Yl(e){let t=await se.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await se.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function Rv(e,t){let i=X.resolve(e),n=X.resolve(t);if(!fo(i,n))throw new Error("Native artifact path is outside its root");let r=[await Yl(i)],a=i;for(let o of X.relative(i,n).split(X.sep).filter(Boolean)){a=X.join(a,o);let s=await Yl(a);if(!fo(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function Xl(e){for(let t of e){let i=await se.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Ev(t,i)||await se.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function je(e){let t=kv(e.ref),i=Sv(e.maxBytes??Gn),n=X.resolve(e.root,...t.split("/")),r=await Rv(e.root,X.dirname(n));await e.hooks?.afterParentChainCaptured?.();let a=await se.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);let o=await se.realpath(n);if(!fo(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await se.open(n,"r");try{let[c,l,u]=await Promise.all([s.stat(),se.lstat(n),se.realpath(n)]);if(await Xl(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Jn(a,c)||!Jn(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let f=[],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: ${t}`);f.push(Buffer.from(m.subarray(0,S.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),se.lstat(n),se.realpath(n)]);if(await Xl(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Jn(c,g)||!Jn(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let y=Buffer.concat(f,d),N;try{N=new bv("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:k})}return{ref:t,size:d,hash:Nv("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}import{AsyncLocalStorage as Cv}from"async_hooks";import{randomUUID as eu}from"crypto";import{promises as Q}from"fs";import tu from"os";import B from"path";var Ql=16*1024,iu=".coordinator",Pv=5e3,Zl=new Cv,Kn=new Map;function Av(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function xv(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let i=e;if(typeof i.id!="string"||i.id.length===0||typeof i.pid!="number"||!Number.isSafeInteger(i.pid)||i.pid<1||typeof i.hostname!="string"||i.hostname.length===0||typeof i.createdAt!="string"||i.createdAt.length===0||typeof i.operation!="string"||i.operation.length===0)throw new Error(`Invalid Native lock metadata: ${t}`);return i}function nu(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function ho(e,t){let i={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},n={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return G(i,n)?I(i,n):I(i,n)&&e.size===t.size}function po(e,t){return ho(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Oe(e){let t,i;try{let n=await gt(e,Ql,{bigint:!0,label:"Native lock"});t=n.bytes,i=n.stat}catch(n){if(n.code==="ENOENT")return null;throw n instanceof re?n.reason==="too-large"?new Error(`Native lock metadata exceeds ${Ql} bytes: ${e}`,{cause:n}):n.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:n}):new Error(`Native lock changed while reading: ${e}`,{cause:n}):n}return{file:e,owner:xv(JSON.parse(t.toString("utf8")),e),identity:nu(i)}}async function Tv(e){return(await Oe(e))?.owner??null}function _v(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==tu.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=Mv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function Iv(e,t){try{await Q.lstat(t);return}catch(i){if(i.code!=="ENOENT")throw i}try{await Q.rename(e,t)}catch(i){if(i.code!=="ENOENT")throw i}}async function mo(e,t){let i=await Oe(e.file);if(!i)return"missing";if(i.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!po(i.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await Q.mkdir(t,{recursive:!0});let n=B.join(t,`${B.basename(e.file)}.${e.owner.id}.${eu()}.removed`);try{await Q.rename(e.file,n)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let r=await Oe(n);if(!r||r.owner.id!==e.owner.id||!ho(r.identity,e.identity))throw await Iv(n,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await Q.rm(n,{force:!0}),"removed"}function ru(e){return{id:eu(),pid:process.pid,hostname:tu.hostname(),createdAt:new Date().toISOString(),operation:e}}async function au(e,t){let i;try{i=await Q.open(e,"wx")}catch(n){if(n.code==="EEXIST"){let r=await Tv(e);throw new Error(`Native lock is already held: ${e}${r?` by pid ${r.pid} for ${r.operation}`:""}`,{cause:n})}throw n}try{return await i.writeFile(JSON.stringify(t,null,2)+`
165
- `,"utf8"),await i.sync(),nu(await i.stat({bigint:!0}))}finally{await i.close()}}async function jv(e,t){let i=await O(e.nativeRoot,e.locksDir);await Q.mkdir(i,{recursive:!0});let n=await O(e.nativeRoot,B.join(i,iu));await Q.mkdir(n,{recursive:!0});let r=ru(t),a=B.join(n,`.${r.id}.tmp`),o=B.join(n,`${r.id}.claim`);try{let s=await au(a,r);await Q.rename(a,o);let c=await Oe(o);if(!c||!ho(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.nativeRoot,locksDir:i,owner:r,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function Ov(e){let t=B.dirname(e.file),i=!1,n=B.basename(e.file);for(let r of await Q.readdir(t,{withFileTypes:!0})){if(!r.isFile()||r.isSymbolicLink()||!r.name.endsWith(".claim"))continue;let a=B.join(t,r.name);if(B.resolve(a)!==B.resolve(e.file))try{let o=await Oe(a),s=_v(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await mo(o,t);continue}r.name<n&&(i=!0)}catch{r.name<n&&(i=!0)}}return i}async function ou(e){let t=await Oe(e.file);if(t){if(t.owner.id!==e.owner.id||!po(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await mo(t,B.dirname(e.file))}}async function $v(e,t){let i=Date.now()+Pv;for(;;){let n=await jv(e,t);if(!await Ov(n))return n;if(await ou(n),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(r=>setTimeout(r,2+Math.floor(Math.random()*7)))}}async function Hv(e){let t=Kn.get(e)??Promise.resolve(),i,n=new Promise(a=>{i=a}),r=t.then(()=>n);return Kn.set(e,r),await t,()=>{i(),Kn.get(e)===r&&Kn.delete(e)}}async function su(e,t,i){let n=B.resolve(e.locksDir),r=Zl.getStore();if(r?.has(n))return i();let a=await Hv(n);try{let o=await $v(e,t),s=new Map(r??[]);return s.set(n,o),await Zl.run(s,async()=>{try{return await i()}finally{await ou(o)}})}finally{a()}}async function gi(e,t,i){return su(e,`acquire ${t}`,async()=>{let n=await O(e.nativeRoot,e.locksDir);await Q.mkdir(n,{recursive:!0});let r=await O(e.nativeRoot,B.join(n,Av(t))),a=ru(i),o=await au(r,a);return{file:r,nativeRoot:e.nativeRoot,locksDir:n,owner:a,identity:o}})}async function wi(e){await Oe(e.file)&&await su(e,`release ${B.basename(e.file)}`,async()=>{let t=await Oe(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!po(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let i=B.join(e.locksDir,iu);await mo(t,i)})}function Mv(e){try{return process.kill(e,0),!0}catch(t){let i=t.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{promises as Qn}from"fs";import ye from"path";import{TextDecoder as qv}from"util";import{createHash as Fv}from"node:crypto";import{constants as Un,promises as P}from"node:fs";import T from"node:path";import{TextDecoder as Lv}from"node:util";function pe(e,t){let i=T.relative(e,t);return i===""||!T.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${T.sep}`)}function cu(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Yn(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function lu(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function Nt(e,t){return I({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Ke(e,t){let i=await P.lstat(e);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await P.realpath(e),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function yi(e,t,i){let n=T.resolve(e),r=T.resolve(t);if(!pe(n,r))throw new Error(`${i} is outside its managed root`);let a=[await Ke(n,i)],o=n;for(let s of T.relative(n,r).split(T.sep).filter(Boolean)){await L(a,i),o=T.join(o,s);let c=await Ke(o,i);if(!pe(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,i),a}async function L(e,t){for(let i of e){let n=await P.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Yn(i,n)||await P.realpath(i.path)!==i.realPath)throw new Error(`${t} parent changed during I/O: ${i.path}`)}}async function Dv(e,t,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-r,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>t)throw new Error(`${i} exceeds ${t} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function q(e){let t=cu(e.maxBytes),i=T.resolve(e.file),n=await yi(e.root,T.dirname(i),e.label),r=await Promise.all((e.forbiddenRoots??[]).map(u=>Ke(T.resolve(u),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(n,e.label);let a=await P.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=lu(a),s=await P.realpath(i);if(!pe(n[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(r.some(u=>pe(u.realPath,s)))throw new Error(`${e.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 P.open(i,c);try{let u=await l.stat();await e.hooks?.afterOpen?.();let[f,d]=await Promise.all([P.lstat(i),P.realpath(i)]);if(await L(n,e.label),await L(r,e.label),!u.isFile()||!f.isFile()||f.isSymbolicLink()||d!==s||!Nt(o,u)||!Nt(o,f))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let m=await Dv(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),P.lstat(i),P.realpath(i)]);if(await L(n,e.label),await L(r,e.label),!h.isFile()||h.isSymbolicLink()||p!==s||!Nt(o,g)||!Nt(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:m,hash:Fv("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function uu(e){let t=await q(e),i;try{i=new Lv("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e.label} is not valid UTF-8`,{cause:n})}return{...t,text:i}}async function Ue(e){let t=await yi(e.root,e.directory,e.label),i;if(e.maxEntries===void 0)i=await P.readdir(e.directory,{withFileTypes:!0});else{let n=cu(e.maxEntries);i=[];let r=await P.opendir(e.directory);try{for await(let a of r)if(i.push(a),i.length>n)throw new Error(`${e.label} exceeds ${n} entries`)}finally{await r.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:i,verify:()=>L(t,e.label)}}async function Bv(e){let t=T.resolve(e.directory),i=T.resolve(e.quarantine);if(T.dirname(i)!==T.dirname(t)||!pe(T.resolve(e.root),i)||i===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let n=await yi(e.root,T.dirname(t),e.label),r=await Ke(t,e.label);if(!pe(n[0].realPath,r.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(n,e.label);let a=await P.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Yn(r,a)||await P.realpath(t)!==r.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await P.lstat(i),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await P.rename(t,i),await L(n,e.label);let o=await P.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Yn(r,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(i);try{throw await P.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:n,identity:r}}async function fu(e){await Bv(e)}async function vo(e){let t=T.resolve(e.file),i=await yi(e.root,T.dirname(t),e.label),n=await P.lstat(t);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let r=lu(n),a=await P.realpath(t);if(!pe(i[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await q({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([P.lstat(t),P.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Nt(r,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(i,e.label);let[l,u]=await Promise.all([P.lstat(t),P.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!Nt(r,l)||u!==a)throw new Error(`${e.label} changed before removal`);await P.rm(t),await L(i,e.label)}async function go(e){let t=T.resolve(e.directory),i=await yi(e.root,T.dirname(t),e.label),n=await Ke(t,e.label);if(!pe(i[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(i,e.label);let r=await P.lstat(t);if(!r.isDirectory()||r.isSymbolicLink()||!Yn(n,r)||await P.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before removal`);await P.rmdir(t),await L(i,e.label)}async function Ni(e){let t=T.resolve(e.root),i=T.resolve(e.directory);if(!pe(t,i))throw new Error(`${e.label} is outside its managed root`);let n=[await Ke(t,e.label)],r=t;for(let a of T.relative(t,i).split(T.sep).filter(Boolean)){await L(n,e.label),r=T.join(r,a);try{await P.mkdir(r)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Ke(r,e.label);if(!pe(n[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${r}`);n.push(o)}await L(n,e.label)}async function bi(e){let t=await q({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await Gl(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await P.lstat(e.target)}catch(r){if(r.code==="ENOENT")return;throw r}throw new Error(`${e.label} target changed before commit`)}if((await q({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let i=await q({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(i.hash!==t.hash||i.size!==t.size)throw new Error(`${e.label} target could not be verified`);return i}var Vv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),Wv=new Set(["id","type","source","target","staged","backup"]),zv=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),Jv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),Gv=new Set(["sequence","timestamp","type","operationId"]),pu=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),mu=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Kv=256*1024,Uv=1024*1024,vu=16*1024,Zn=1024,ak=64*1024*1024;var gu=new qv("utf-8",{fatal:!0});function ki(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function Si(e,t,i){let n=Object.keys(e).filter(r=>!t.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function kt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function wo(e,t){if(typeof e!="string"||e.length===0||ye.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Xn(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function du(e,t){if(wo(e,t),e.includes("\\")||e!==ye.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function Yv(e,t){let i=ki(e,`transaction operations[${t}]`);if(Si(i,Wv,`transaction operations[${t}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${t}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);wo(i.target,`transaction operation ${i.id} target`);for(let n of["source","staged","backup"])i[n]!==void 0&&wo(i[n],`transaction operation ${i.id} ${n}`);if(i.type==="write"){if(i.staged===void 0||i.source!==void 0)throw new Error(`write operation ${i.id} requires staged and forbids source`)}else if(i.type==="remove"){if(i.source!==void 0||i.staged!==void 0)throw new Error(`remove operation ${i.id} forbids source and staged`)}else if(i.source===void 0||i.staged!==void 0||i.backup!==void 0)throw new Error(`move operation ${i.id} requires source and forbids staged and backup`);return i}function wu(e){let t=ki(e,"Native Archive transaction journal");if(Si(t,zv,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!pu.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!kt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Xn(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=t.operations.map((s,c)=>{let l=ki(s,`Archive transaction operations[${c}]`);if(Si(l,Jv,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);du(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&du(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Xn(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Xn(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Xn(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),n=i.map(s=>s.id);if(new Set(n).size!==n.length)throw new Error("Native Archive transaction operation ids must be unique");let r=`runtime/transactions/${t.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.change}$`,"u").test(a[0].target)||i.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of i.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${r}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${r}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:i}}function yo(e){let t=ki(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return wu(t);if(Si(t,Vv,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!pu.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!ye.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!ye.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!kt(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let i=t.operations.map(Yv),n=i.map(r=>r.id);if(new Set(n).size!==n.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:i}}function yu(e,t){let i=ki(e,`Native transaction event at line ${t}`);if(Si(i,Gv,`Native transaction event at line ${t}`),i.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!kt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof i.type!="string"||!mu.has(i.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let n=i.type==="operation-started"||i.type==="operation-completed";if(n&&(typeof i.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.operationId)||Buffer.byteLength(i.operationId,"utf8")>256)||!n&&i.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Xv(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let n=0;n<e.length;n+=1){let r=t[n],a=e[n];if(r==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==r)return!1}let i=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[n,r,a,o]of i){if(e.length<=n)continue;let s=e.slice(n,Math.min(n+r,e.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(r,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!kt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||kt(e)}function bt(e,t){return e.length<t.length&&t.startsWith(e)}function Qv(e){let t='","operationId":"';if(bt(e,t))return!0;if(!e.startsWith(t))return!1;let i=e.slice(t.length),n=i.indexOf('"');if(n===-1)return i.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(i);let r=i.slice(0,n);return/^[a-z0-9][a-z0-9-]*$/u.test(r)?bt(i.slice(n),'"}'):!1}function Zv(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>vu)return!1;let i=`{"sequence":${t},"timestamp":"`;if(bt(e,i))return!0;if(!e.startsWith(i))return!1;let n=e.slice(i.length),r=n.slice(0,Math.min(24,n.length));if(!Xv(r))return!1;if(n.length<24)return!0;if(!kt(r))return!1;let a='","type":"',o=n.slice(24);if(bt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of mu){if(bt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Qv(l))return!0}else if(bt(l,'"}'))return!0}return!1}function eg(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>vu)throw new Error(`Native transaction event at line ${t} is too large`);return yu(JSON.parse(e),t)}function tg(e){let t=e.split(`
166
- `),i=t.at(-1)==="";if(i&&t.pop(),t.length>Zn)throw new Error(`Native transaction event log exceeds ${Zn} events`);let n=[];for(let r=0;r<t.length;r+=1){let a=r+1,o=t[r],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&r===t.length-1;try{n.push(eg(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&Zv(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return n}function Nu(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
160
+ # 可选值:true | false`}};function wl(e,t){return Pr[t][e]}function jm(e,t,i){let r=/^(\s*)([a-z_]+):/u.exec(e);if(!r)return null;let n=r[1].length,a=r[2];if(n===0&&a in Pr.en)return a;if(n===2&&t){let o=`${t}.${a}`;if(o in Pr.en)return o}if(n===2&&t===null&&a==="hook")return"hook";if(n===2&&t==="hook"&&a==="allow_paths")return"hook.allow_paths";if(n===4&&t==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in Pr.en)return o}return null}function ii(e,t){let i=[],r=null,n=null;for(let a of(0,ei.stringify)(e).trimEnd().split(`
161
+ `)){let o=jm(a,r,n);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of wl(o,t).split(`
162
+ `))i.push(`${s}${c}`)}i.push(a),/^[a-z_]+:/u.test(a)?(a.startsWith("native:")?r="native":a.startsWith("classic:")?r="classic":a.startsWith("hook:")?r="hook":r=null,n=null):/^ {2}[a-z_]+:/u.test(a)&&r==="native"&&(n=a.startsWith(" snapshot:")?"snapshot":null)}return i.push(""),i.join(`
163
+ `)}function $m(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim();if(i.length===0||Rr.posix.isAbsolute(i)||Rr.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${t} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${t} must not contain empty or dot path segments`);return r}function Je(e){let t=$m(e,"native.artifact_root");return t.length===0?".":t.join("/")}function yl(e,t="docs"){let i=e??t;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function Ar(e,t,i=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim().replaceAll("\\","/");if(r.length===0||Rr.posix.isAbsolute(r)||Rr.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${t} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${t} cannot contain wildcards`);return n.join("/")}function ft(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Nl(e,t,i){let r=e??t;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function qa(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>xr)throw new Error(`${t} exceeds ${xr} characters`);let i=0;for(let r=0;r<e.length;r+=1)e[r]==="?"?i+=1:e[r]==="*"&&(i+=1,e[r+1]==="*"&&(r+=1));if(i>Cr)throw new Error(`${t} contains more than ${Cr} wildcard tokens`);return e}function gl(e,t,i){if(e===void 0)return[...i];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(r=>qa(r,t)))].sort((r,n)=>r.localeCompare(n,"en"))}function Fa(e,t,i){let r=e??t;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function Om(e){if(e===void 0)return{...G,include:[...G.include],exclude:[...G.exclude]};let t=ft(e,"native.snapshot");return{include:gl(t.include,"native.snapshot.include",G.include),exclude:gl(t.exclude,"native.snapshot.exclude",G.exclude),max_files:Fa(t.max_files,G.max_files,"native.snapshot.max_files"),max_total_bytes:Fa(t.max_total_bytes,G.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Fa(t.max_duration_ms,G.max_duration_ms,"native.snapshot.max_duration_ms")}}function Hm(e){if(e===void 0)return;let t=ft(e,"native.pending_root_move"),i=t.id,r=t.from_artifact_root,n=t.to_artifact_root,a=t.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(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(t.cleanup!==void 0){let s=ft(t.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=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 u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:i,fromArtifactRoot:Je(r),toArtifactRoot:Je(n),stage:a,...o?{cleanup:o}:{}}}function Dm(e,t={}){let i=ft(e,"native"),r=i.artifact_root??(t.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??Va;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Hm(i.pending_root_move);return{artifact_root:Je(r),language:Nl(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:Om(i.snapshot),...s?{pending_root_move:s}:{}}}function Bm(e){let t=ft(e,"classic"),i=t.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=t.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=t.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:yl(t.artifact_layout),language:Nl(t.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function Lm(e){let i=ft(e,"hook").allow_paths??[];if(!Array.isArray(i))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(i.map((r,n)=>Ar(r,`hook.allow_paths[${n}]`)))]}}function Mm(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function Fm(e,t,i,r,n,a){let o=e.schema!==void 0;if(!(o||e.default_workflow!==void 0||e.workflows!==void 0||!a.allowPartialProject&&e.native!==void 0)||a.allowPartialProject&&!o)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let c=e.workflows??[e.default_workflow];if(!Array.isArray(c)||c.length===0||c.some(u=>u!=="native"&&u!=="classic"))throw new Error("workflows must contain native and/or classic");let l=[...new Set(c)];if(!l.includes(e.default_workflow))throw new Error("workflows must include default_workflow");if(l.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:l,ambient_resume:n,...t?{hook:t}:{},...i?{native:i}:{},...r?{classic:r}:{}}}function ht(e,t={}){let i=(0,ei.parseDocument)(e,{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,a=Mm(n.ambient_resume),o=n.hook===void 0?void 0:Lm(n.hook),s=n.native===void 0?void 0:Dm(n.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),c=n.classic===void 0?void 0:Bm(n.classic),l=Fm(n,o,s,c,a,{allowPartialProject:t.allowPartialProject??!1});return{value:n,config:l,ambient_resume:a,...o?{hook:o}:{},...s?{native:s}:{},...c?{classic:c}:{}}}function bl(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function kl(e){return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,...e.hook?{hook:{allow_paths:[...e.hook.allow_paths]}}:{},...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,...e.native.pending_root_move?{pending_root_move:bl(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition}}:{}}}function dt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ri(e,t){let i=kl(t),r=ht((0,ei.stringify)(i)).config;if(!r)throw new Error("Unsupported Comet project schema");let n={...e,schema:r.schema,default_workflow:r.default_workflow,workflows:r.workflows,ambient_resume:r.ambient_resume};if(r.hook&&(n.hook={...dt(e.hook),allow_paths:[...r.hook.allow_paths]}),r.native){let a=dt(e.native),o={...a,artifact_root:r.native.artifact_root,language:r.native.language,clarification_mode:r.native.clarification_mode,archive_confirmation:r.native.archive_confirmation,max_verify_failures:r.native.max_verify_failures};if(delete o.snapshot,r.native.pending_root_move){let s=dt(a.pending_root_move),c=bl(r.native.pending_root_move),l=dt(s.cleanup),u=dt(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...u}}:{}}}else delete o.pending_root_move;n.native=o}return r.classic&&(n.classic={...dt(e.classic),artifact_layout:r.classic.artifact_layout,language:r.classic.language,context_compression:r.classic.context_compression,review_mode:r.classic.review_mode,auto_transition:r.classic.auto_transition}),n}function _r(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Je(e),language:t,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Va,snapshot:{...G,include:[...G.include],exclude:[...G.exclude]}}}}import{createHash as qm}from"crypto";import{promises as jr}from"fs";import Ie from"path";import{constants as Tr,promises as Ge}from"fs";function Te(e){return e!==0&&e!==0n&&e!=="0"}function U(e,t){return Te(e.dev)&&Te(t.dev)&&Te(e.ino)&&Te(t.ino)}function T(e,t){let i=Te(e.dev)&&Te(t.dev);if(i&&e.dev!==t.dev)return!1;let r=Te(e.ino)&&Te(t.ino);return r&&e.ino!==t.ino?!1:i&&r?!0:e.birthtime===t.birthtime}var ne=class extends Error{reason;constructor(t,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=t}};function Wa(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function Sl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function ni(e){return{dev:e.dev,ino:e.ino,birthtime:Wa(e)}}function Ir(e,t){let i=ni(e),r=ni(t);return U(i,r)?T(i,r):T(i,r)&&Wa(e)===Wa(t)&&Sl(e)===Sl(t)&&e.size===t.size}async function pt(e,t,i={}){if(!Number.isSafeInteger(t)||t<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,a=await Ge.lstat(e,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new ne("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new ne("too-large",`${r} exceeds ${t} bytes`);let o=await Ge.realpath(e);await i.verify?.("pre-open",{realPath:o,identity:ni(a)});let s=process.platform==="win32"?Tr.O_RDONLY:Tr.O_RDONLY|Tr.O_NOFOLLOW|Tr.O_NONBLOCK,c;try{c=await Ge.open(e,s)}catch(l){throw l.code==="ELOOP"?new ne("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!Ir(a,l)||!Ir(a,u))throw new ne("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:d,identity:ni(l)}),await i.hooks?.afterOpen?.();let f=[],p=0,v=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let y=t+1-p,{bytesRead:b}=await c.read(v,0,Math.min(v.length,y),null);if(b===0)break;if(p+=b,p>t)throw new ne("too-large",`${r} exceeds ${t} bytes`);f.push(Buffer.from(v.subarray(0,b)))}await i.hooks?.beforeFinalCheck?.();let[h,m,w]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!Ir(a,h)||!Ir(a,m))throw new ne("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:w,identity:ni(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:w}}finally{await c.close()}}function Vm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function za(e,t){let i=Ie.relative(e,t);return i===""||!Ie.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Ie.sep}`)}async function El(e,t){let i=Ie.resolve(e),r=await jr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return jr.realpath(i)}async function Pl(e,t,i,r){let n=e;for(let a=0;a<i.length;a++){n=Ie.join(n,i[a]);let o;try{o=await jr.lstat(n)}catch(u){if(Vm(u))return{exists:!1,kind:"missing"};throw u}let s=Ie.relative(e,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!o.isFile()||r.expected==="directory"&&!o.isDirectory()||r.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await jr.realpath(n);if(!za(t,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function mt(e,t,i){let r=Ar(t,i.label),n=Ie.resolve(e),a=await El(n,i.label),o=r.split("/"),s=Ie.resolve(n,...o);if(!za(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await Pl(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function je(e,t,i,r){let n=await mt(e,t,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let a=await El(n.projectRoot,r.label);return pt(n.target,i,{...r,verify:async(o,s)=>{if(!za(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await Pl(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var ai=".comet/config.yaml";function Ja(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function Wm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function $r(e,t={}){return(await oi(e,t)).document}async function Rl(e){try{return(await je(e,ai,ti,{label:ai})).bytes}catch(t){if(Wm(t))return null;throw t}}function xl(e){return e?{exists:!0,sha256:qm("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function Or(e){return xl(await Rl(e))}async function oi(e,t={}){let i=await Rl(e);return{document:i?ht(i.toString("utf8"),t):null,identity:xl(i)}}async function Ga(e){return(await $r(e))?.config??null}var PN=16*1024;async function Ua(e,t){if(!t)return;let i=await Or(e);if(!Ja(i,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as Um}from"crypto";import{promises as M}from"fs";import ae from"path";function Ya(e,t){let i=ae.relative(e,t);return i===""||!ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ae.sep}`)}function Km(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Ka(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function Cl(e){let t=await M.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await M.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function ci(e){for(let t of e){let i=await M.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Km(t,i)||await M.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function Ym(e,t){let i=ae.resolve(e),r=ae.resolve(t);if(!Ya(i,r))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let n=[await Cl(i)],a=ae.relative(i,r).split(ae.sep).filter(Boolean),o=i;for(let s of a){await ci(n),o=ae.join(o,s);try{await M.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Cl(o);if(!Ya(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await ci(n),n}async function Xm(e){let t;try{t=await M.open(e,"r"),await t.sync()}catch(i){let r=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw i}finally{await t?.close()}}async function Al(e,t,i={}){let r=ae.dirname(e),n=i.containedRoot?await Ym(i.containedRoot,r):null;n||await M.mkdir(r,{recursive:!0});let a=ae.join(r,`.${ae.basename(e)}.${Um()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await M.open(a,"wx"),s=await o.stat(),n){let[c,l]=await Promise.all([M.lstat(a),M.realpath(a)]);if(await ci(n),!c.isFile()||c.isSymbolicLink()||!Ka(s,c)||!Ya(n[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),!Ka(s,await o.stat()))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await i.beforeCommit?.(),n){await ci(n);let c=await M.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!Ka(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await M.link(a,e),await M.unlink(a)):await M.rename(a,e),await Xm(r)}catch(c){if(await o?.close(),!n)await M.rm(a,{force:!0});else try{await ci(n),await M.rm(a,{force:!0})}catch{}throw c}}async function z(e,t,i={}){await Al(e,t,i)}async function _l(e,t,i={}){await Al(e,t,i)}async function X(e,t,i={}){await z(e,JSON.stringify(t,null,2)+`
164
+ `,i)}import{existsSync as Tl,promises as Ue}from"fs";import C from"path";import Qm from"os";var Hr=".comet/config.yaml",Zm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function Xa(e){try{return await Ue.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function ev(e){try{let t=await Ue.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function gt(e,t){let i=C.relative(e,t);return i===""||!C.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${C.sep}`)}async function vt(e){let t=[],i=e;for(;!await Xa(i);){let n=C.dirname(i);if(n===i)break;t.push(C.basename(i)),i=n}let r=await Ue.realpath(i);return C.resolve(r,...t.reverse())}async function Qa(e){try{return(await Ue.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Za(e){let t=C.resolve(e);try{(await Ue.stat(t)).isDirectory()||(t=C.dirname(t))}catch(n){if(n.code!=="ENOENT")throw n}let i=t,r=C.resolve(Qm.homedir());for(;;){if(!(t===r&&i!==r)){let o=C.join(t,...Hr.split("/")),s=t===i||await ev(o);if(await Xa(o)&&s)return t}if(await Xa(C.join(t,".git")))return t;let a=C.dirname(t);if(a===t)return i;t=a}}function li(e){return Je(e)}async function tv(e,t){let i=li(t),r=C.resolve(e,...i.split("/")),n=await Ue.realpath(e),a=await vt(r);if(!gt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function fe(e,t){let i=li(t),r=await tv(e,i),n=C.join(r,"comet");if(await Qa(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([vt(r),vt(n)]);if(!gt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=C.resolve(e),c=C.join(s,".comet","runtime","native");if(await Qa(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,u]=await Promise.all([Ue.realpath(s),vt(c)]);if(!gt(l,u))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:C.join(e,...Hr.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:C.join(n,"specs"),changesDir:C.join(n,"changes"),archiveDir:C.join(n,"archive"),runtimeDir:c,changesRuntimeDir:C.join(c,"changes"),locksDir:C.join(c,"locks"),transactionsDir:C.join(c,"transactions")}}function Il(e){if(!Zm.test(e))throw new Error(`Invalid Native change name: ${e}`)}function Dr(e,t){Il(t);let i=C.join(e.changesRuntimeDir,t);if(!F(e.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function iv(e,t){Il(t);let i=C.join(e.changesDir,t,"runtime");if(!F(e.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function he(e,t){let i=Dr(e,t);if(Tl(i))return i;let r=iv(e,t);return Tl(r)?r:i}function oe(e,t){let i=C.resolve(t);if(F(e.runtimeDir,i))return e.runtimeDir;if(F(e.nativeRoot,i))return e.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${t}`)}function F(e,t){return gt(C.resolve(e),C.resolve(t))}async function $(e,t){let i=C.resolve(e),r=C.resolve(t);if(!gt(i,r))throw new Error(`Path is outside the Native root: ${t}`);if(await Qa(i))throw new Error(`Native root must not be a symbolic link: ${e}`);let[n,a]=await Promise.all([vt(i),vt(r)]);if(!gt(n,a))throw new Error(`Path resolves outside the Native root: ${t}`);return r}function jl(e="docs",t="en"){return _r(e,t)}async function se(e){let t=(await $r(e))?.config??null;return t?.native?t:null}async function $e(e,t,i={}){let r=await oi(e,{allowPartialProject:!0}),n=ri(r.document?.value??{},t),a=rv.join(e,...Hr.split("/"));await z(a,ii(n,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await i.beforeCommit?.(),await Ua(e,r.identity)}})}import{createHash as xg,randomUUID as Cg}from"crypto";import{promises as Le}from"fs";import I from"path";import{AsyncLocalStorage as nv}from"async_hooks";import{randomUUID as Hl}from"crypto";import{promises as Q}from"fs";import Dl from"os";import V from"path";var $l=16*1024,Bl=".coordinator",av=5e3,Ol=new nv,Br=new Map;function ov(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function sv(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let i=e;if(typeof i.id!="string"||i.id.length===0||typeof i.pid!="number"||!Number.isSafeInteger(i.pid)||i.pid<1||typeof i.hostname!="string"||i.hostname.length===0||typeof i.createdAt!="string"||i.createdAt.length===0||typeof i.operation!="string"||i.operation.length===0)throw new Error(`Invalid Native lock metadata: ${t}`);return i}function Ll(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function eo(e,t){let i={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},r={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return U(i,r)?T(i,r):T(i,r)&&e.size===t.size}function to(e,t){return eo(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Oe(e){let t,i;try{let r=await pt(e,$l,{bigint:!0,label:"Native lock"});t=r.bytes,i=r.stat}catch(r){if(r.code==="ENOENT")return null;throw r instanceof ne?r.reason==="too-large"?new Error(`Native lock metadata exceeds ${$l} bytes: ${e}`,{cause:r}):r.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:r}):new Error(`Native lock changed while reading: ${e}`,{cause:r}):r}return{file:e,owner:sv(JSON.parse(t.toString("utf8")),e),identity:Ll(i)}}async function cv(e){return(await Oe(e))?.owner??null}function lv(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==Dl.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=mv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function uv(e,t){try{await Q.lstat(t);return}catch(i){if(i.code!=="ENOENT")throw i}try{await Q.rename(e,t)}catch(i){if(i.code!=="ENOENT")throw i}}async function io(e,t){let i=await Oe(e.file);if(!i)return"missing";if(i.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!to(i.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await Q.mkdir(t,{recursive:!0});let r=V.join(t,`${V.basename(e.file)}.${e.owner.id}.${Hl()}.removed`);try{await Q.rename(e.file,r)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await Oe(r);if(!n||n.owner.id!==e.owner.id||!eo(n.identity,e.identity))throw await uv(r,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await Q.rm(r,{force:!0}),"removed"}function Ml(e){return{id:Hl(),pid:process.pid,hostname:Dl.hostname(),createdAt:new Date().toISOString(),operation:e}}async function Fl(e,t){let i;try{i=await Q.open(e,"wx")}catch(r){if(r.code==="EEXIST"){let n=await cv(e);throw new Error(`Native lock is already held: ${e}${n?` by pid ${n.pid} for ${n.operation}`:""}`,{cause:r})}throw r}try{return await i.writeFile(JSON.stringify(t,null,2)+`
165
+ `,"utf8"),await i.sync(),Ll(await i.stat({bigint:!0}))}finally{await i.close()}}async function dv(e,t){let i=await $(e.runtimeDir,e.locksDir);await Q.mkdir(i,{recursive:!0});let r=await $(e.runtimeDir,V.join(i,Bl));await Q.mkdir(r,{recursive:!0});let n=Ml(t),a=V.join(r,`.${n.id}.tmp`),o=V.join(r,`${n.id}.claim`);try{let s=await Fl(a,n);await Q.rename(a,o);let c=await Oe(o);if(!c||!eo(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.runtimeDir,locksDir:i,owner:n,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function fv(e){let t=V.dirname(e.file),i=!1,r=V.basename(e.file);for(let n of await Q.readdir(t,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=V.join(t,n.name);if(V.resolve(a)!==V.resolve(e.file))try{let o=await Oe(a),s=lv(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await io(o,t);continue}n.name<r&&(i=!0)}catch{n.name<r&&(i=!0)}}return i}async function Vl(e){let t=await Oe(e.file);if(t){if(t.owner.id!==e.owner.id||!to(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await io(t,V.dirname(e.file))}}async function hv(e,t){let i=Date.now()+av;for(;;){let r=await dv(e,t);if(!await fv(r))return r;if(await Vl(r),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function pv(e){let t=Br.get(e)??Promise.resolve(),i,r=new Promise(a=>{i=a}),n=t.then(()=>r);return Br.set(e,n),await t,()=>{i(),Br.get(e)===n&&Br.delete(e)}}async function ql(e,t,i){let r=V.resolve(e.locksDir),n=Ol.getStore();if(n?.has(r))return i();let a=await pv(r);try{let o=await hv(e,t),s=new Map(n??[]);return s.set(r,o),await Ol.run(s,async()=>{try{return await i()}finally{await Vl(o)}})}finally{a()}}async function ui(e,t,i){return ql(e,`acquire ${t}`,async()=>{let r=await $(e.runtimeDir,e.locksDir);await Q.mkdir(r,{recursive:!0});let n=await $(e.runtimeDir,V.join(r,ov(t))),a=Ml(i),o=await Fl(n,a);return{file:n,nativeRoot:e.runtimeDir,locksDir:r,owner:a,identity:o}})}async function di(e){await Oe(e.file)&&await ql({runtimeDir:e.nativeRoot,locksDir:e.locksDir},`release ${V.basename(e.file)}`,async()=>{let t=await Oe(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!to(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let i=V.join(e.locksDir,Bl);await io(t,i)})}function mv(e){try{return process.kill(e,0),!0}catch(t){let i=t.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{createHash as vv}from"node:crypto";import{constants as Lr,promises as R}from"node:fs";import _ from"node:path";function pe(e,t){let i=_.relative(e,t);return i===""||!_.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_.sep}`)}function Wl(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Mr(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function zl(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function wt(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Ke(e,t){let i=await R.lstat(e);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await R.realpath(e),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function fi(e,t,i){let r=_.resolve(e),n=_.resolve(t);if(!pe(r,n))throw new Error(`${i} is outside its managed root`);let a=[await Ke(r,i)],o=r;for(let s of _.relative(r,n).split(_.sep).filter(Boolean)){await L(a,i),o=_.join(o,s);let c=await Ke(o,i);if(!pe(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,i),a}async function L(e,t){for(let i of e){let r=await R.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Mr(i,r)||await R.realpath(i.path)!==i.realPath)throw new Error(`${t} parent changed during I/O: ${i.path}`)}}async function gv(e,t,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-n,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>t)throw new Error(`${i} exceeds ${t} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function J(e){let t=Wl(e.maxBytes),i=_.resolve(e.file),r=await fi(e.root,_.dirname(i),e.label),n=await Promise.all((e.forbiddenRoots??[]).map(u=>Ke(_.resolve(u),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(r,e.label);let a=await R.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=zl(a),s=await R.realpath(i);if(!pe(r[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(n.some(u=>pe(u.realPath,s)))throw new Error(`${e.label} resolves inside an excluded root`);let c=process.platform==="win32"?Lr.O_RDONLY:Lr.O_RDONLY|Lr.O_NOFOLLOW|Lr.O_NONBLOCK,l=await R.open(i,c);try{let u=await l.stat();await e.hooks?.afterOpen?.();let[d,f]=await Promise.all([R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!u.isFile()||!d.isFile()||d.isSymbolicLink()||f!==s||!wt(o,u)||!wt(o,d))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let p=await gv(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([l.stat(),R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!h.isFile()||h.isSymbolicLink()||m!==s||!wt(o,v)||!wt(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:p,hash:vv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function Ye(e){let t=await fi(e.root,e.directory,e.label),i;if(e.maxEntries===void 0)i=await R.readdir(e.directory,{withFileTypes:!0});else{let r=Wl(e.maxEntries);i=[];let n=await R.opendir(e.directory);try{for await(let a of n)if(i.push(a),i.length>r)throw new Error(`${e.label} exceeds ${r} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:i,verify:()=>L(t,e.label)}}async function wv(e){let t=_.resolve(e.directory),i=_.resolve(e.quarantine);if(_.dirname(i)!==_.dirname(t)||!pe(_.resolve(e.root),i)||i===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let r=await fi(e.root,_.dirname(t),e.label),n=await Ke(t,e.label);if(!pe(r[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(r,e.label);let a=await R.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Mr(n,a)||await R.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await R.lstat(i),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await R.rename(t,i),await L(r,e.label);let o=await R.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Mr(n,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(i);try{throw await R.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:r,identity:n}}async function Jl(e){await wv(e)}async function ro(e){let t=_.resolve(e.file),i=await fi(e.root,_.dirname(t),e.label),r=await R.lstat(t);if(!r.isFile()||r.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let n=zl(r),a=await R.realpath(t);if(!pe(i[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await J({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!wt(n,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(i,e.label);let[l,u]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!wt(n,l)||u!==a)throw new Error(`${e.label} changed before removal`);await R.rm(t),await L(i,e.label)}async function no(e){let t=_.resolve(e.directory),i=await fi(e.root,_.dirname(t),e.label),r=await Ke(t,e.label);if(!pe(i[0].realPath,r.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(i,e.label);let n=await R.lstat(t);if(!n.isDirectory()||n.isSymbolicLink()||!Mr(r,n)||await R.realpath(t)!==r.realPath)throw new Error(`${e.label} changed before removal`);await R.rmdir(t),await L(i,e.label)}async function hi(e){let t=_.resolve(e.root),i=_.resolve(e.directory);if(!pe(t,i))throw new Error(`${e.label} is outside its managed root`);let r=[await Ke(t,e.label)],n=t;for(let a of _.relative(t,i).split(_.sep).filter(Boolean)){await L(r,e.label),n=_.join(n,a);try{await R.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Ke(n,e.label);if(!pe(r[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${n}`);r.push(o)}await L(r,e.label)}async function pi(e){let t=await J({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await _l(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await R.lstat(e.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${e.label} target changed before commit`)}if((await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let i=await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(i.hash!==t.hash||i.size!==t.size)throw new Error(`${e.label} target could not be verified`);return i}import{promises as Vr}from"fs";import ye from"path";import{TextDecoder as yv}from"util";var Nv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),bv=new Set(["id","type","source","target","staged","backup"]),kv=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),Sv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),Ev=new Set(["sequence","timestamp","type","operationId"]),Kl=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),Yl=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Pv=256*1024,Rv=1024*1024,Xl=16*1024,qr=1024,kb=64*1024*1024;var Ql=new yv("utf-8",{fatal:!0});function mi(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function vi(e,t,i){let r=Object.keys(e).filter(n=>!t.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function Nt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function ao(e,t){if(typeof e!="string"||e.length===0||ye.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Fr(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function Gl(e,t){if(ao(e,t),e.includes("\\")||e!==ye.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function xv(e,t){let i=mi(e,`transaction operations[${t}]`);if(vi(i,bv,`transaction operations[${t}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${t}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);ao(i.target,`transaction operation ${i.id} target`);for(let r of["source","staged","backup"])i[r]!==void 0&&ao(i[r],`transaction operation ${i.id} ${r}`);if(i.type==="write"){if(i.staged===void 0||i.source!==void 0)throw new Error(`write operation ${i.id} requires staged and forbids source`)}else if(i.type==="remove"){if(i.source!==void 0||i.staged!==void 0)throw new Error(`remove operation ${i.id} forbids source and staged`)}else if(i.source===void 0||i.staged!==void 0||i.backup!==void 0)throw new Error(`move operation ${i.id} requires source and forbids staged and backup`);return i}function Zl(e){let t=mi(e,"Native Archive transaction journal");if(vi(t,kv,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!Kl.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!Nt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Fr(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=t.operations.map((s,c)=>{let l=mi(s,`Archive transaction operations[${c}]`);if(vi(l,Sv,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);Gl(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&Gl(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Fr(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Fr(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Fr(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),r=i.map(s=>s.id);if(new Set(r).size!==r.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${t.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.change}$`,"u").test(a[0].target)||i.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of i.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:i}}function oo(e){let t=mi(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return Zl(t);if(vi(t,Nv,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!Kl.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!ye.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!ye.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!Nt(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let i=t.operations.map(xv),r=i.map(n=>n.id);if(new Set(r).size!==r.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:i}}function eu(e,t){let i=mi(e,`Native transaction event at line ${t}`);if(vi(i,Ev,`Native transaction event at line ${t}`),i.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!Nt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof i.type!="string"||!Yl.has(i.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let r=i.type==="operation-started"||i.type==="operation-completed";if(r&&(typeof i.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.operationId)||Buffer.byteLength(i.operationId,"utf8")>256)||!r&&i.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Cv(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let r=0;r<e.length;r+=1){let n=t[r],a=e[r];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let i=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[r,n,a,o]of i){if(e.length<=r)continue;let s=e.slice(r,Math.min(r+n,e.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!Nt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||Nt(e)}function yt(e,t){return e.length<t.length&&t.startsWith(e)}function Av(e){let t='","operationId":"';if(yt(e,t))return!0;if(!e.startsWith(t))return!1;let i=e.slice(t.length),r=i.indexOf('"');if(r===-1)return i.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(i);let n=i.slice(0,r);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?yt(i.slice(r),'"}'):!1}function _v(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>Xl)return!1;let i=`{"sequence":${t},"timestamp":"`;if(yt(e,i))return!0;if(!e.startsWith(i))return!1;let r=e.slice(i.length),n=r.slice(0,Math.min(24,r.length));if(!Cv(n))return!1;if(r.length<24)return!0;if(!Nt(n))return!1;let a='","type":"',o=r.slice(24);if(yt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of Yl){if(yt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Av(l))return!0}else if(yt(l,'"}'))return!0}return!1}function Tv(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>Xl)throw new Error(`Native transaction event at line ${t} is too large`);return eu(JSON.parse(e),t)}function Iv(e){let t=e.split(`
166
+ `),i=t.at(-1)==="";if(i&&t.pop(),t.length>qr)throw new Error(`Native transaction event log exceeds ${qr} events`);let r=[];for(let n=0;n<t.length;n+=1){let a=n+1,o=t[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&n===t.length-1;try{r.push(Tv(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&_v(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return r}function tu(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
167
167
  `)}
168
- `}function ig(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return ye.join(e.transactionsDir,t)}function er(e,t){let i=ig(e,t);return{directory:i,journal:ye.join(i,"transaction.json"),events:ye.join(i,"events.jsonl"),staged:ye.join(i,"staged"),backups:ye.join(i,"backups")}}async function Ye(e,t){let i=er(e,t);return await Promise.all(Object.values(i).map(n=>O(e.nativeRoot,n))),i}async function bu(e,t,i={}){let n=await Ye(e,t);try{await Qn.lstat(n.events)}catch(r){if(r.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw r}try{let r=await q({root:e.nativeRoot,file:n.events,maxBytes:Uv,label:`Native transaction event log ${t}`,hooks:i.hooks}),a;try{a=gu.decode(r.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=tg(a),s=Nu(o);return{exists:!0,hash:r.hash,size:r.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(r){throw r.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:r}):r}}async function hu(e,t,i){let n=await bu(e,t);if(n.exists!==i.exists||n.hash!==i.hash||n.size!==i.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function No(e,t,i,n){let r=await Ye(e,t),a=await bu(e,t),o=a.events.find(c=>c.type===i&&c.operationId===n);if(o)return a.needsRepair&&await he(r.events,a.canonicalSource,{containedRoot:e.nativeRoot,beforeCommit:()=>hu(e,t,a)}),o;if(a.events.length>=Zn)throw new Error(`Native transaction event log ${t} exceeds ${Zn} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...n?{operationId:n}:{}};return yu(s,s.sequence),await Qn.mkdir(r.directory,{recursive:!0}),await he(r.events,Nu([...a.events,s]),{containedRoot:e.nativeRoot,beforeCommit:()=>hu(e,t,a)}),s}async function ku(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=yo(t);let i=await Ye(e,t.id);await Qn.mkdir(i.staged,{recursive:!0}),await Qn.mkdir(i.backups,{recursive:!0}),await oe(i.journal,t),await No(e,t.id,"prepared")}async function Ei(e,t,i={}){let n=await Ye(e,t),r=await q({root:e.nativeRoot,file:n.journal,maxBytes:Kv,label:`Native transaction journal ${t}`,hooks:i.hooks}),a=JSON.parse(gu.decode(r.bytes)),o=yo(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function ng(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let n=yo({...t,status:i});return await oe((await Ye(e,t.id)).journal,n),n}async function bo(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await No(e,t.id,i),i==="commit"?ng(e,t,"committed"):t}import ir from"path";import{createHash as rg}from"crypto";function Z(e){return rg("sha256").update(e).digest("hex")}var Sk={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},og=1e3,sg=8*1024*1024,cg=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,lg=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),ug=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),fg=new Set(["schema","include","exclude","hash"]),dg=new Set(["provider","gitSelection","physicalSelection","projection"]),hg=new Set(["provider","selection"]),pg=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),mg=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),vg=new Set(["schema","status","before","after"]),gg=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),wg=new Set(["path","hash","size","type","gitObjectId"]),yg=new Set(["path","size","type","reason"]),Ng=new Set(["ref","hash","count"]),bg=new Set(["change-created","legacy-migration","explicit"]),kg=new Set(["file","directory","other"]),Sg=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"]),nr=/^[a-f0-9]{64}$/u,Eg=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var Ek=64*1024,Rk=64*1024;var Ck={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Pk={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function tr(e,t){return e.hash===t.hash&&e.recordCount===t.recordCount&&e.storedRecordCount===t.storedRecordCount&&e.stdoutBytes===t.stdoutBytes&&e.overflow===t.overflow}var Ak=(1n<<256n)-1n;function Rg(e,t){return e.hash===t.hash&&e.visitedNodeCount===t.visitedNodeCount&&e.recordCount===t.recordCount&&e.storedRecordCount===t.storedRecordCount&&e.encodedBytes===t.encodedBytes&&e.overflow===t.overflow&&e.unstable===t.unstable}function Cg(e){return Buffer.byteLength(JSON.stringify(e,null,2)+`
169
- `)}function Pg(e,t){return Z(`comet.native.snapshot-policy.v1
170
- ${JSON.stringify({include:e,exclude:t,hash:"sha256"})}`)}function ko(e,t,i){let n=new Set(t),r=[...t];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=e[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!n.has(a+1)&&(n.add(a+1),r.push(a+1))}return n}function Ag(e){let t=0;return()=>t>0?(t-=1,!0):e()?(t=63,!0):!1}function Eu(e){let t=zn(e,"Native snapshot pattern"),i=[];for(let n=0;n<t.length;n+=1){let r=t[n];r==="*"&&t[n+1]==="*"?(n+=1,t[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 a=r?Ag(r):void 0;if(a&&!a())return!1;let o=ko(i,new Set([0]),a);if(o===null)return!1;for(let s of n){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let u=i[l];u&&(u.kind==="literal"&&u.value===s||u.kind==="question"&&s!=="/"?c.add(l+1):u.kind==="star"&&s!=="/"||u.kind==="globstar"?c.add(l):u.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=ko(i,c,a),o===null||o.size===0)return!1}return ko(i,o,a)?.has(i.length)??!1}}function xg(e){if(e===void 0)return;let t=[...new Set(e.include.map(r=>zn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(e.exclude.map(r=>zn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(t.length===0)throw new Error("Native snapshot policy include must not be empty");let n=Pg(t,i);if("hash"in e&&e.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:t,exclude:i,hash:n},includeMatchers:t.map(Eu),excludeMatchers:i.map(Eu),excludedDirectoryPrefixes:i.flatMap(r=>{if(!r.endsWith("/**"))return[];let a=r.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((r,a)=>r.localeCompare(a,"en"))}}function ee(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function te(e,t,i){let n=Object.keys(e).find(r=>!t.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function Et(e,t){if(!Number.isSafeInteger(e)||e<1)throw new Error(`${t} must be a positive integer`);return e}function me(e,t){if(!Number.isSafeInteger(e)||e<0)throw new Error(`${t} must be a non-negative integer`);return e}function Pu(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0"))throw new Error(`${t} must be a normalized project-relative path`);let i=ir.posix.normalize(e);if(i!==e||ir.posix.isAbsolute(e)||i===".."||i.startsWith("../"))throw new Error(`${t} must stay inside the project root`);return e}function Tg(e,t){let i=ee(e,`Native snapshot entry ${t}`);te(i,wg,`Native snapshot entry ${t}`);let n=Pu(i.path,`Native snapshot entry ${t} path`);if(typeof i.hash!="string"||!nr.test(i.hash))throw new Error(`Native snapshot entry ${t} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${t} type is invalid`);let r={path:n,hash:i.hash,size:me(i.size,`Native snapshot entry ${t} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!Eg.test(i.gitObjectId))throw new Error(`Native snapshot entry ${t} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function _g(e,t){let i=ee(e,`Native snapshot omission ${t}`);if(te(i,yg,`Native snapshot omission ${t}`),!kg.has(i.type))throw new Error(`Native snapshot omission ${t} type is invalid`);if(!Sg.has(i.reason))throw new Error(`Native snapshot omission ${t} reason is invalid`);return{path:Pu(i.path,`Native snapshot omission ${t} path`),size:i.size===null?null:me(i.size,`Native snapshot omission ${t} size`),type:i.type,reason:i.reason}}function Ig(e){let t=ee(e,"Native snapshot omission overflow");if(te(t,Ng,"Native snapshot omission overflow"),typeof t.hash!="string"||!nr.test(t.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${t.hash}`;if(t.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:t.hash,count:Et(t.count,"Native snapshot omission overflow count")}}function St(e,t){let i=ee(e,t);if(te(i,mg,t),typeof i.hash!="string"||!nr.test(i.hash))throw new Error(`${t} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${t} overflow flag is invalid`);let n=me(i.recordCount,`${t} recordCount`),r=me(i.storedRecordCount,`${t} storedRecordCount`),a=me(i.stdoutBytes,`${t} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${t} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function Ru(e){let t=ee(e,"Native Git selection evidence");if(te(t,pg,"Native Git selection evidence"),t.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(t.status!=="overflow"&&t.status!=="changed"&&t.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=St(t.stageBefore,"Native Git selection stageBefore"),n=St(t.combined,"Native Git selection combined"),r=St(t.stageAfter,"Native Git selection stageAfter"),a=St(t.finalStageBefore,"Native Git selection finalStageBefore"),o=St(t.finalCombined,"Native Git selection finalCombined"),s=St(t.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(f=>f.overflow),l=!tr(i,r)||!tr(r,a)||!tr(n,o)||!tr(a,s),u=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(t.status!==u)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:u,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function Cu(e,t){let i=ee(e,t);if(te(i,gg,t),typeof i.hash!="string"||!nr.test(i.hash))throw new Error(`${t} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${t} flags are invalid`);let n=me(i.visitedNodeCount,`${t} visitedNodeCount`),r=me(i.recordCount,`${t} recordCount`),a=me(i.storedRecordCount,`${t} storedRecordCount`),o=me(i.encodedBytes,`${t} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${t} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function jg(e){let t=ee(e,"Native physical selection evidence");if(te(t,vg,"Native physical selection evidence"),t.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(t.status!=="overflow"&&t.status!=="changed"&&t.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Cu(t.before,"Native physical selection before"),n=Cu(t.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!Rg(i,n);if(!r&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=r&&a?"overflow-and-changed":r?"overflow":"changed";if(t.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:n}}function Au(e){let t=ee(e,"Native content snapshot manifest");if(te(t,lg,"Native content snapshot manifest"),t.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!bg.has(t.origin))throw new Error("Native content snapshot origin is invalid");let i;if(t.capture!==void 0){let v=ee(t.capture,"Native content snapshot capture");if(te(v,dg,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let C=v.gitSelection===void 0?void 0:Ru(v.gitSelection),b=v.physicalSelection===void 0?void 0:jg(v.physicalSelection),_=null;if(v.projection!==void 0){let z=ee(v.projection,"Native content snapshot projection");if(te(z,hg,"Native content snapshot projection"),z.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");_={provider:"git",...z.selection===void 0?{}:{selection:Ru(z.selection)}}}if(v.provider==="git"){if(b||_)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...C?{gitSelection:C}:{}}}else{if(C)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&_)throw new Error("Native physical-tree capture cannot combine selection and projection");i=_?{provider:"physical-tree",projection:_}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof t.createdAt!="string"||Number.isNaN(Date.parse(t.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof t.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=ee(t.limits,"Native content snapshot limits");te(n,ug,"Native content snapshot limits");let r={maxFiles:Et(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:Et(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:Et(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:Et(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:Et(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(t.policy!==void 0){let v=ee(t.policy,"Native snapshot policy");if(te(v,fg,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=xg({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(t.entries)||!Array.isArray(t.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=t.entries.map(Tg),s=t.omitted.map(_g),c=me(t.omittedCount,"Native content snapshot omittedCount"),l=t.omissionOverflow===void 0?void 0:Ig(t.omissionOverflow);if(o.length>r.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>r.maxFileBytes)||o.reduce((v,C)=>v+C.size,0)>r.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>og||c<s.length)throw new Error("Native content snapshot omission count is invalid");let u=c-s.length;if(u===0&&l||u>0&&l?.count!==u)throw new Error("Native content snapshot omission overflow is inconsistent");if(t.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let f=s.filter(v=>v.reason==="git-enumeration-limit"),d=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...f,...d])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(f.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,g=m?.status==="overflow"||m?.status==="overflow-and-changed",h=m?.status==="changed"||m?.status==="overflow-and-changed";if(g!==(f.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(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...y])if(v.path!=="."||v.size!==null||v.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 N=i?.physicalSelection,k=N?.status==="overflow"||N?.status==="overflow-and-changed",S=N?.status==="changed"||N?.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:t.origin,...i?{capture:i}:{},createdAt:t.createdAt,complete:t.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(Cg(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function Og(e,t){if(!cg.test(t))throw new Error(`Invalid Native change name: ${t}`);let i=ir.join(e.changesDir,t);if(!K(e.changesDir,i))throw new Error("Native change path escaped");return ir.join(i,"runtime","baseline-manifest.json")}async function xu(e,t){let i=Og(e,t);await O(e.nativeRoot,i);try{let n=await uu({root:e.nativeRoot,file:i,maxBytes:sg,label:"Native baseline snapshot manifest"});return Au(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var Dg=wr(In(),1);var xS=256*1024;var qS={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 Wg}from"node:crypto";import{promises as ar}from"node:fs";import $e from"node:path";import{execFileSync as qg}from"child_process";import rr from"path";function So(e,t){return qg("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Vg(e,t){let i=rr.normalize(e),n=rr.normalize(t);return process.platform==="win32"?i.toLowerCase()===n.toLowerCase():i===n}function _u(e){try{let t=rr.resolve(So(e,["rev-parse","--show-toplevel"])),n=So(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),r=n?rr.resolve(n.slice(9)):t,a=null;try{a=So(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Vg(t,r),currentWorktreeRoot:t,primaryWorktreeRoot:r,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}var Ri=/^[a-f0-9]{64}$/u,zg=16*1024,Eo=process.platform;function $u(e,t){let i=$e.relative(e,t);return $e.isAbsolute(i)||i===".."||i.startsWith(`..${$e.sep}`)?null:i.replaceAll("\\","/")||"."}function Hu(e){return Array.from(e).some(t=>{let i=t.codePointAt(0)??0;return i<=31||i===127})}function Mu(e,t){if(e.length===0||Hu(e)||e.includes("\\")||$e.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let i=$e.posix.normalize(e);if(i!==e||i===".."||i.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return i}function Ro(e,t){return Wg("sha256").update(`${e}
171
- ${t}`).digest("hex")}async function Iu(e,t){let i=await ar.realpath(t),n=await ar.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=Eo==="win32"?$e.normalize(i).toLowerCase():i;return Ro(e,`${r}
172
- ${n.dev}
173
- ${n.ino}
174
- ${n.birthtimeMs}`)}async function ju(e,t){let i=await ar.realpath(t),n=await ar.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=Eo==="win32"?$e.normalize(i).toLowerCase():i;return Ro(e,r)}function Jg(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function Ou(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||Hu(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Fu(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(Ou(e.changeBranch,"Native workspace change branch"),Ou(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function or(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","isolation","changeBranch","targetBranch","finish"]),n=Object.keys(t).filter(o=>!i.has(o));if(n.length>0)throw new Error(`Native workspace identity has unknown field(s): ${n.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!Ri.test(String(t.projectRootId))||!Ri.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");Jg(t.capturedAt),Mu(t.nativeRootRef,"Native workspace root ref");let r=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(r!==a)throw new Error("Native workspace path identities must be provided together");if(r&&!Ri.test(String(t.projectRootPathId))||a&&!Ri.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!Ri.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Fu(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function Lu(e,t){return $e.join(e.changesDir,t,"runtime","workspace.json")}function Gg(e,t){let i=$u(e.nativeRoot,Lu(e,t));if(!i||i===".")throw new Error("Native workspace file escaped its root");return Mu(i,"Native workspace file ref")}async function Kg(e,t){try{let i=await je({root:e.nativeRoot,ref:Gg(e,t),maxBytes:zg});return JSON.parse(i.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function Du(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=$u(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let[i,n,r,a]=await Promise.all([Iu("comet.native.workspace-project-root.v2",e.paths.projectRoot),Iu("comet.native.workspace-native-root.v2",e.paths.nativeRoot),ju("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),ju("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),o=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Fu(e.binding);let s={capturedAt:o,capturedRevision:e.revision,nativeRootRef:t,projectRootId:i,nativeRootId:n,projectRootPathId:r,nativeRootPathId:a,...e.sessionId?{sessionHash:Ro("comet.native.workspace-session.v2",`${i}
175
- ${n}
176
- ${e.sessionId}`)}:{}},c=e.binding?{schema:"comet.native.workspace.v3",...s,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...s};return or(c),c}async function sr(e){let t=await Du(e),i=Lu(e.paths,e.name);return await O(e.paths.nativeRoot,i),await oe(i,t,{containedRoot:e.paths.nativeRoot}),t}async function Rt(e,t){let i=await Kg(e,t);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(or(i),i)}async function cr(e){or(e.identity);let t=await Du({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),i=[],n=[];return t.nativeRootRef!==e.identity.nativeRootRef&&i.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&i.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&i.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&i.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&i.push("native-root-legacy-identity")),Eo==="win32"&&i.length>0&&i.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?n.push("workspace-inspection-unavailable"):i.length>0&&n.push("workspace-root-changed"),{state:n.length===0?"aligned":n.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:n,driftComponents:i}}async function Co(e){if(or(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await cr(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=_u(e.paths.projectRoot);return e.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!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:e.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"}}var Qe="comet.native.v3",Ze="comet.native.v2",et="comet.native.v1";var Bu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Xg=new Set(Bu),qu=new Set([...Bu,"minimum_runtime_version","revision"]),Qg=new Set([...qu,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Zg=new Set(["capability","operation","source","base_hash"]),ew=new Set(["shape","build","verify","archive"]),tw=new Set(["implicit","confirmed"]),iw=new Set(["pending","pass","fail"]),it="comet-state.yaml",Ao=/^[a-f0-9]{64}$/u,Vu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,nw=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,xo=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"},Ct=class extends Error{constructor(i,n){super(i!==Qe||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"},lr=class extends Error{constructor(i,n,r){super(`Native change ${i} revision conflict: expected ${n}, actual ${r}`);this.change=i;this.expectedRevision=n;this.actualRevision=r;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},ur=class extends Error{constructor(i,n){super(`Native working directory already contains active change${n.length===1?"":"s"} ${n.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=n;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},fr=class extends Error{constructor(i,n,r,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${n} omitted entr${n===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=n;this.omittedByReason=r;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},TE=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
177
- `);function Pi(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Wu(e,t,i){let n=Object.keys(e).filter(r=>!t.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function _o(e){if(!Vu.test(e))throw new Error(`Invalid Native change name: ${e}`)}function rw(e){if(!Vu.test(e))throw new Error(`Invalid Native capability id: ${e}`)}function zu(e,t){if(e.length===0||tt.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native change`)}function aw(e,t){let i=Pi(e,`spec_changes[${t}]`);if(Wu(i,Zg,`spec_changes[${t}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(rw(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"&&zu(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"||!Ao.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"||!Ao.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 ow(e){return/^\d{4}-\d{2}-\d{2}$/u.test(e)?new Date(`${e}T00:00:00.000Z`).toISOString().slice(0,10)===e:!1}function Io(e,t){if(Wu(e,t,it),typeof e.name!="string")throw new Error("Native change name is required");if(_o(e.name),e.language!=="en"&&e.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof e.phase!="string"||!ew.has(e.phase))throw new Error("Native change phase is invalid");if(e.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(e.approval!==null&&!tw.has(e.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(e.spec_changes))throw new Error("Native spec_changes must be an array");let i=e.spec_changes.map(aw),n=i.map(r=>r.capability).filter((r,a,o)=>o.indexOf(r)!==a);if(n.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(n)].join(", ")}`);if(typeof e.verification_result!="string"||!iw.has(e.verification_result))throw new Error("Native verification_result is invalid");if(e.verification_report!==null&&typeof e.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof e.verification_report=="string"&&zu(e.verification_report,"Native verification_report"),typeof e.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof e.created_at!="string"||!ow(e.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(e.run_id!==null&&(typeof e.run_id!="string"||e.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:e.name,language:e.language,phase:e.phase,brief:"brief.md",approval:e.approval,spec_changes:i,verification_result:e.verification_result,verification_report:e.verification_report,archived:e.archived,created_at:e.created_at,run_id:e.run_id}}function jo(e){let t=Pi(e,it);if(t.schema!==et)throw new Error(`Expected ${et}`);return{schema:et,...Io(t,Xg)}}function Ci(e,t){if(!Number.isSafeInteger(e)||e<1)throw new Error(`${t} must be a positive integer`);return e}function Po(e,t,i){if(e===null)return null;let n=typeof e=="string"?nw.exec(e):null;if(!n||n[1]!==i)throw new Error(`${t} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return e}function sw(e){if(e==null)return null;if(typeof e!="string"||!Ao.test(e))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return e}function cw(e){if(e===void 0)return"legacy-v1";if(e!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return e}function Oo(e){let t=Pi(e,it);if(t.schema!==Ze)throw new Error(`Expected ${Ze}`);if(Ci(t.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Ze} minimum_runtime_version must be 2`);return{schema:Ze,minimum_runtime_version:2,revision:Ci(t.revision,"Native v2 revision"),...Io(t,qu)}}function $o(e){let t=Pi(e,it);if(t.schema!==Qe){if(t.schema===et||t.schema===Ze){let o=t.schema===et?jo(t):Oo(t);throw new xo(o.name,o.schema)}throw new Ct(typeof t.schema=="string"?t.schema:"(missing)",typeof t.minimum_runtime_version=="number"?t.minimum_runtime_version:null)}let i=Ci(t.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Ct(t.schema,i);if(i!==3)throw new Error(`Native ${t.schema} minimum_runtime_version must be ${3}`);let n=Ci(t.revision,"Native revision"),r=Io(t,Qg),a=sw(t.approved_contract_hash);if(r.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Qe,minimum_runtime_version:3,revision:n,verification_protocol:cw(t.verification_protocol),...r,approved_contract_hash:a,implementation_scope:Po(t.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:Po(t.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:Po(t.partial_allowance,"Native partial_allowance","allowances")}}function lw(e){let t=Pi(e,it);if(t.schema===et){let r=jo(t);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${Qe}`}}if(t.schema===Ze){let r=Oo(t);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${Qe}`}}if(t.schema!==Qe){let r=typeof t.minimum_runtime_version=="number"&&Number.isSafeInteger(t.minimum_runtime_version)?t.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof t.schema=="string"?t.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new Ct(typeof t.schema=="string"?t.schema:"(missing)",r).message}}let i=Ci(t.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:t.schema,minimumRuntimeVersion:i,state:null,message:new Ct(t.schema,i).message};let n=$o(t);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function ce(e,t){_o(t);let i=tt.join(e.changesDir,t);if(!K(e.changesDir,i))throw new Error("Native change path escaped");return i}async function Ho(e,t){let i=tt.join(ce(e,t),"runtime","schema-migration.json");await O(e.nativeRoot,i);try{return await Yg.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var uw=256*1024;async function fw(e,t=tt.dirname(e)){let i=tt.relative(t,e).split(tt.sep).join("/"),n=await je({root:t,ref:i,maxBytes:uw}),r=(0,To.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${e}: ${r.errors[0].message}`);return r.toJS()}async function Ju(e,t){let i=tt.join(ce(e,t),it);await O(e.nativeRoot,i);let n=lw(await fw(i,e.nativeRoot));if(n.state&&n.state.name!==t)throw new Error(`Native change directory/name mismatch: ${t}`);return await Ho(e,t)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${t}; run doctor --repair`}:(n.status==="current"&&n.state&&await dw(e,n.state),n)}async function dw(e,t){if(await xu(e,t.name)!==null&&t.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${t.verification_protocol}`)}var Fo=64*1024*1024,VE=256*1024,Yu=16*1024*1024;async function U(e){try{return await Me.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function vw(e){let t;try{t=await Me.readdir(e.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t){if(!i.isDirectory()||i.isSymbolicLink())continue;let n;try{n=await Ei(e,i.name)}catch(r){throw r.code==="ENOENT"?new Error(`Native transaction ${i.name} has no journal; run doctor before moving`,{cause:r}):r}if(n.status!=="committed"&&n.status!=="rolled-back")throw new Error(`Native transaction ${n.id} is unfinished; recover it before moving`)}}async function gw(e,t){for(let i of await Me.readdir(e.locksDir,{withFileTypes:!0})){let n=j.join(e.locksDir,i.name);if(j.resolve(n)!==j.resolve(t)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${n}`)}}async function ww(e){let t;try{t=await Me.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((n,r)=>n.name.localeCompare(r.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let n=await Rt(e,i.name);if(n){await sr({paths:e,name:i.name,revision:n.capturedRevision,...n.schema==="comet.native.workspace.v3"?{binding:{isolation:n.isolation,changeBranch:n.changeBranch,targetBranch:n.targetBranch},...n.finish?{finish:n.finish}:{}}:{}});continue}let r;try{r=await Ju(e,i.name)}catch{continue}r.status!=="current"||!r.state||!("revision"in r.state)||await sr({paths:e,name:i.name,revision:r.state.revision})}}async function yw(e){let t;try{t=await Me.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((n,r)=>n.name.localeCompare(r.name)))if(!(!i.isDirectory()||i.isSymbolicLink()))try{let n=await Rt(e,i.name);if(n?.schema==="comet.native.workspace.v3"){let r=await Co({paths:e,identity:n});if(r.state!=="aligned")throw new Error(r.message??"workspace binding is not aligned")}else if(n){let r=await cr({paths:e,identity:n});if(r.state!=="aligned")throw new Error(`legacy workspace ownership is ${r.state}`)}}catch(n){throw new Error(`Native workspace identity for ${i.name} must be aligned and repaired before moving the root`,{cause:n})}}async function xi(e,t){let i=[];async function n(r){let a=await Ue({root:e,directory:r,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=j.join(r,s.name);if(t.excludedFiles?.has(j.resolve(c))){await a.verify();continue}let l=await Me.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:j.relative(e,c).split(j.sep).join("/"),type:"directory"}),await n(c);else if(s.isFile()&&l.isFile()){let u=await q({root:e,file:c,maxBytes:Fo,label:`Native root file ${j.relative(e,c)}`});i.push({ref:j.relative(e,c).split(j.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await n(e),i.sort((r,a)=>r.ref.localeCompare(a.ref))}async function Nw(e,t,i,n){await Ni({root:n,directory:t,label:"Native root move staging directory"});async function r(a,o){let s=await Ue({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=j.join(a,l.name);if(j.resolve(u)===j.resolve(i)){await s.verify();continue}let f=await Me.lstat(u);if(l.isSymbolicLink()||f.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let d=j.join(o,l.name);if(l.isDirectory()&&f.isDirectory())await Ni({root:n,directory:d,label:"Native root move staging directory"}),await r(u,d);else if(l.isFile()&&f.isFile())await bi({sourceRoot:e,source:u,targetRoot:n,target:d,maxBytes:Fo,label:`Native root move file ${j.relative(e,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await r(e,t)}async function dr(e,t,i,n){let r=await xi(e,{rejectSymlinks:!0,excludedFiles:i?new Set([j.resolve(i)]):void 0}),a=await xi(t,{rejectSymlinks:!0,excludedFiles:n?new Set([j.resolve(n)]):void 0});if(JSON.stringify(r)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function bw(e,t){return j.join(e.artifactRoot,`.comet-native-move-${t}`)}function kw(e,t){return j.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function Sw(e){return`${e}.removing`}function Xu(e,t,i){return j.join(er(e,t).directory,`root-move-cleanup-${i}.json`)}function Ew(e){return JSON.stringify(e,null,2)+`
178
- `}function Rw(e){return pw("sha256").update(e).digest("hex")}function Cw(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let i=e,n=Object.keys(i).sort(),r=i.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(n)!==JSON.stringify(r))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof i.ref!="string"||i.ref.length===0||i.ref.includes("\\")||j.posix.normalize(i.ref)!==i.ref||i.ref.startsWith("/")||i.ref.split("/").includes("..")||Buffer.byteLength(i.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(i.type==="directory")return{ref:i.ref,type:"directory"};if(i.type!=="file"||typeof i.size!="number"||!Number.isSafeInteger(i.size)||i.size<0||typeof i.hash!="string"||!/^[a-f0-9]{64}$/u.test(i.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function Pw(e,t,i){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let n=e;if(JSON.stringify(Object.keys(n).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||n.schema!=="comet.native.root-move-cleanup.v1"||n.transactionId!==t||n.kind!==i||!Array.isArray(n.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let r=n.entries.map(Cw);for(let a=0;a<r.length;a+=1){if(a>0&&r[a-1].ref.localeCompare(r[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=j.posix.dirname(r[a].ref);if(o!=="."&&!r.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:i,entries:r}}async function Aw(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},i=Ew(t);if(Buffer.byteLength(i,"utf8")>Yu)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await he(Xu(e.paths,e.id,e.kind),i,{containedRoot:e.paths.nativeRoot}),Rw(i)}async function xw(e){let t=await q({root:e.paths.nativeRoot,file:Xu(e.paths,e.id,e.cleanup.kind),maxBytes:Yu,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return Pw(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function Mo(e){let t=await xi(e.quarantine,{rejectSymlinks:!0}),i=new Map(e.manifest.entries.map(n=>[n.ref,n]));for(let n of t){let r=i.get(n.ref);if(!r||JSON.stringify(r)!==JSON.stringify(n))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${n.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function Gu(e){return e.ref.split("/").length}async function Tw(e){let i=[...await Mo({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((r,a)=>Gu(a)-Gu(r)||(r.type===a.type?a.ref.localeCompare(r.ref):r.type==="file"?-1:1)),n=0;for(let r of i){let a=j.join(e.quarantine,...r.ref.split("/"));r.type==="file"?await vo({root:e.projectRoot,file:a,maxBytes:Fo,expectedHash:r.hash,expectedSize:r.size,label:`Native root-move cleanup file ${r.ref}`}):await go({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${r.ref}`}),n+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,r.ref,n)}await Mo({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await go({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function hr(e,t,i=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:i,pending_root_move:t}}}function _w(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function Ku(e){let t=hr(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await yt(e.projectRoot,t),t}async function Ai(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=hr(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await yt(e.projectRoot,i),i}async function Uu(e){let t=e.config,i=t.native.pending_root_move;if(!i||i.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let n=i.cleanup;if(n&&n.kind!==e.kind)throw new Error(`Native root move has unfinished ${n.kind} cleanup; cannot start ${e.kind}`);let r=await U(e.target),a=await U(e.quarantine);if(r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!n){if(!r&&!a)return t;if(!r&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await Aw({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await xi(e.target,{rejectSymlinks:!0})});n={kind:e.kind,state:"prepared",manifestHash:s},t=await Ai({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:n})}let o=await xw({paths:e.stablePaths,id:e.id,cleanup:n});if(r=await U(e.target),a=await U(e.quarantine),r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(r){if(n.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await fu({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(n.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return Ai({projectRoot:e.projectRoot,config:t,id:e.id})}return await Mo({quarantine:e.quarantine,manifest:o,exact:n.state!=="deleting"}),n.state==="prepared"&&(n={...n,state:"quarantined"},t=await Ai({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:n})),n.state==="quarantined"&&(n={...n,state:"deleting"},t=await Ai({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:n})),await Tw({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),Ai({projectRoot:e.projectRoot,config:t,id:e.id})}async function Iw(e){let t=e.config,i=t.native.pending_root_move.stage;if(i==="copying"){if(!await U(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=Sw(e.staging);t=await Uu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await xi(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([j.resolve(e.lockFile)])}),await Nw(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await dr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await Ku({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),i="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(i==="ready"){if(await U(e.destinationPaths.nativeRoot)){if(await U(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await dr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await U(e.staging))throw new Error("Native move staging tree is missing");await dr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await Me.rename(e.staging,e.destinationPaths.nativeRoot)}t=await Ku({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),i="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await U(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let n=kw(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await U(e.sourcePaths.nativeRoot)&&await dr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Uu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:n,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await ww(e.destinationPaths);let r=await Ei(e.destinationPaths,e.pending.id);await bo(e.destinationPaths,r,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await yt(e.projectRoot,o),o}async function Qu(e){let t=await Ie(e.projectRoot)??Ul("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let i=mi(e.toArtifactRoot);if(i===t.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let n=await Ge(e.projectRoot,t.native.artifact_root),r=await Ge(e.projectRoot,i);if(K(n.nativeRoot,r.nativeRoot)||K(r.nativeRoot,n.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await U(n.nativeRoot))throw new Error(`Native source root does not exist: ${n.nativeRoot}`);if(await vw(n),await U(r.nativeRoot))throw new Error(`Native destination is occupied: ${r.nativeRoot}`);let a=await gi(n,"root-move",`move root to ${i}`),o=mw(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=_w({id:o,paths:n,now:e.now??new Date}),l=bw(r,o);try{if(await gw(n,a.file),await yw(n),await U(l))throw new Error(`Native move staging path is occupied: ${l}`);return await yt(e.projectRoot,hr(t,s)),await ku(n,c),await e.hooks?.afterRootMoveStage?.("copying",c),await Iw({projectRoot:e.projectRoot,config:hr(t,s),pending:s,sourcePaths:n,destinationPaths:r,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:n.nativeRoot,toNativeRoot:r.nativeRoot,transactionId:o}}finally{await wi(a)}}import hy from"path";var Ow=["Outcome","Scope","Non-goals","Acceptance examples"],rR=[...Ow,"Constraints and invariants","Decisions","Open questions","Verification expectations"];import{createHash as $w}from"crypto";function le(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function Hw(e,t){t.has(e)&&le("cyclic structures are not supported"),t.add(e);try{let i=Object.keys(e);for(let n=0;n<e.length;n+=1)Object.prototype.hasOwnProperty.call(e,n)||le("sparse arrays are not supported");return(i.length!==e.length||i.some((n,r)=>n!==String(r)))&&le("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),`[${e.map(n=>Lo(n,t)).join(",")}]`}finally{t.delete(e)}}function Mw(e,t){let i=Object.getPrototypeOf(e);i!==Object.prototype&&i!==null&&le("only plain objects are supported"),t.has(e)&&le("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),t.add(e);try{let n=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=n[o];return(!s||!("value"in s))&&le("accessor properties are not supported"),`${JSON.stringify(o)}:${Lo(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function Lo(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||le("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?Hw(e,t):Mw(e,t);case"bigint":case"function":case"symbol":case"undefined":return le(`${typeof e} values are not supported`)}return le("unsupported value type")}function Do(e){return Lo(e,new Set)}function ue(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return $w("sha256").update(`${e}
179
- ${Do(t)}`).digest("hex")}var Fw=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var Zu=1024*1024;var tf="scoped-text-safety",Lw=1,Dw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Bw="comet.native.checker-policy.v1";var kR=ue(Bw,{policy:tf,version:Lw,limits:Dw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var qw=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],SR=new Set(qw);var Ww=Zu,BR=3*Ww;var nf={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},zw=Z("comet-native-runtime:v3:semantic-repair-budget"),mC=[{skillVersion:"2",skillHash:Z("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:Z("comet-native-runtime:v1")}];var af=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],UC=new Set(af),Xw=new Set([...af,"minimum_runtime_version","revision"]),YC=new Set([...Xw,"operation"]),XC=512*1024,Qw=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),QC=new Set([...Qw,"implementationScopeHash","repairScopeHash","repairStagnation"]);var tP=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),of=Object.freeze({maxCriteria:1024});var cP={maxAcceptanceCriteria:of.maxCriteria};var hP={maxSpecs:64,maxFileBytes:Gn,maxTotalBytes:4*1024*1024};import{execFile as sy,spawn as tA}from"node:child_process";import{promisify as cy}from"node:util";var EP={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var JP=512*1024;var _i=class extends Error{recovery;constructor(t,i){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var vA=64*1024;var gA=3600*1e3;var wA=cy(sy);var yA=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_NATIVE_COMMAND_PAYLOAD","Remove-Item Env:COMET_NATIVE_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");var mr=class extends Error{details;constructor(t){let i=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(n=>`${n.ref}${n.acceptanceId?`[${n.acceptanceId}]`:""} -> ${n.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=t}};var ax={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var px=16*1024*1024,mx=256*1024,vx=16*1024;var yx=16*1024;var Tx=16*1024;var mT=16*1024*1024,vr=class extends Error{constructor(i,n,r,a){super(`Canonical spec conflict for ${i}: expected ${n??"(missing)"}, actual ${r??"(missing)"}`);this.capability=i;this.expectedHash=n;this.actualHash=r;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},gr=class extends Error{constructor(i,n=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(n);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var CT=10*1024*1024,ve=class extends Error{};function cf(e,t){let i=e.flatMap((n,r)=>n===t?[r]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);return i.length===0?!1:(e.splice(i[0],1),!0)}function lf(e,t){let i=e.flatMap((a,o)=>a===t?[o]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);if(i.length===0)return;let n=i[0],r=e[n+1];if(r===void 0||r.startsWith("--"))throw new ve(`${t} requires a value`);return e.splice(n,2),r}function Bo(e){if(e.length>0)throw new ve(`Unexpected argument: ${e[0]}`)}function qo(e,t){let i=e.shift();if(!i||i.startsWith("--"))throw new ve(`${t} is required`);return i}async function uf(e){return e?hy.resolve(e):uo(process.cwd())}function Vo(e,t,i){return{command:e,exitCode:0,data:t,text:i??JSON.stringify(t,null,2)+`
180
- `}}function ff(e,t){if(t instanceof ve)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof vr)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof gr)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof lr)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof ur)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof fr)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:t.message}};if(t instanceof mr)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof _i)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let i=t.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let n=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:n?73:65,error:{code:n?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function df(e,t){return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
181
- `}:e.error?{exitCode:e.exitCode,stderr:e.error.message}:{exitCode:e.exitCode,stdout:e.text}}async function hf(e,t){let i=qo(e,"root subcommand");if(i==="show"){Bo(e);let n=await Ie(t);if(!n)throw new Error(".comet/config.yaml was not found");let r=await Ge(t,n.native.artifact_root);return Vo("root show",{projectRoot:t,artifactRoot:n.native.artifact_root,language:n.native.language,nativeRoot:r.nativeRoot,pendingRootMove:n.native.pending_root_move??null})}if(i==="move"){let n=qo(e,"artifact root");Bo(e);let r=await Qu({projectRoot:t,toArtifactRoot:n});return Vo("root move",r,`Moved Comet Native to ${r.toNativeRoot}
182
- `)}throw new ve(`Unknown root command: ${i}`)}function py(e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
183
- `}}async function pf(e,t,i=process.argv.slice(2)){let n=i.indexOf("--"),r=n<0?[...i]:i.slice(0,n),a=n<0?[]:i.slice(n),o=r.includes("--json"),s,c;try{cf(r,"--json"),s=lf(r,"--project-root");let u=[...r,...a],f=await uf(s);c=await t(u,f)}catch(u){c=ff(e,u)}let l=o?py(c):df(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
168
+ `}function jv(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return ye.join(e.transactionsDir,t)}function Wr(e,t){let i=jv(e,t);return{directory:i,journal:ye.join(i,"transaction.json"),events:ye.join(i,"events.jsonl"),staged:ye.join(i,"staged"),backups:ye.join(i,"backups")}}async function Xe(e,t){let i=Wr(e,t);return await Promise.all(Object.values(i).map(r=>$(e.runtimeDir,r))),i}async function iu(e,t,i={}){let r=await Xe(e,t);try{await Vr.lstat(r.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await J({root:e.runtimeDir,file:r.events,maxBytes:Rv,label:`Native transaction event log ${t}`,hooks:i.hooks}),a;try{a=Ql.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=Iv(a),s=tu(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:n}):n}}async function Ul(e,t,i){let r=await iu(e,t);if(r.exists!==i.exists||r.hash!==i.hash||r.size!==i.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function so(e,t,i,r){let n=await Xe(e,t),a=await iu(e,t),o=a.events.find(c=>c.type===i&&c.operationId===r);if(o)return a.needsRepair&&await z(n.events,a.canonicalSource,{containedRoot:e.runtimeDir,beforeCommit:()=>Ul(e,t,a)}),o;if(a.events.length>=qr)throw new Error(`Native transaction event log ${t} exceeds ${qr} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...r?{operationId:r}:{}};return eu(s,s.sequence),await Vr.mkdir(n.directory,{recursive:!0}),await z(n.events,tu([...a.events,s]),{containedRoot:e.runtimeDir,beforeCommit:()=>Ul(e,t,a)}),s}async function ru(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=oo(t);let i=await Xe(e,t.id);await Vr.mkdir(i.staged,{recursive:!0}),await Vr.mkdir(i.backups,{recursive:!0}),await X(i.journal,t,{containedRoot:e.runtimeDir}),await so(e,t.id,"prepared")}async function gi(e,t,i={}){let r=await Xe(e,t),n=await J({root:e.runtimeDir,file:r.journal,maxBytes:Pv,label:`Native transaction journal ${t}`,hooks:i.hooks}),a=JSON.parse(Ql.decode(n.bytes)),o=oo(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function $v(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let r=oo({...t,status:i});return await X((await Xe(e,t.id)).journal,r,{containedRoot:e.runtimeDir}),r}async function co(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await so(e,t.id,i),i==="commit"?$v(e,t,"committed"):t}import{createHash as Ng}from"node:crypto";import{promises as Qr}from"node:fs";import Be from"node:path";import{execFileSync as Ov}from"child_process";import Jr from"path";function zr(e,t){return Ov("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Hv(e,t){let i=Jr.normalize(e),r=Jr.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function He(e){try{let t=Jr.resolve(zr(e,["rev-parse","--show-toplevel"])),r=zr(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?Jr.resolve(r.slice(9)):t,a=null;try{a=zr(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Hv(t,n),currentWorktreeRoot:t,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function lo(e,t){try{let i=zr(e,["rev-parse","--verify",`${t}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(i)?i:null}catch{return null}}import{createHash as Mv}from"node:crypto";import{promises as ce}from"node:fs";import Z from"node:path";import{TextDecoder as Fv}from"node:util";var Dv=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),Bv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function Lv(e){return e.toLowerCase().startsWith(".env")}function wi(e){let i=e.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>Lv(r))?"environment-file":i.some(r=>Bv.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>Dv.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var Ur=1024*1024;function uo(e,t){let i=Z.relative(e,t);return i===""||!Z.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Z.sep}`)}function Vv(e){let t=Z.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||Z.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let i=e.toLowerCase(),r=wi(e);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${e}`);return e}function qv(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function Wv(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Gr(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function nu(e){let t=await ce.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await ce.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function zv(e,t){let i=Z.resolve(e),r=Z.resolve(t);if(!uo(i,r))throw new Error("Native artifact path is outside its root");let n=[await nu(i)],a=i;for(let o of Z.relative(i,r).split(Z.sep).filter(Boolean)){a=Z.join(a,o);let s=await nu(a);if(!uo(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function au(e){for(let t of e){let i=await ce.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Wv(t,i)||await ce.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function me(e){let t=Vv(e.ref),i=e.maxBytes===null?null:qv(e.maxBytes??Ur),r=Z.resolve(e.root,...t.split("/")),n=await zv(e.root,Z.dirname(r));await e.hooks?.afterParentChainCaptured?.();let a=await ce.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);let o=await ce.realpath(r);if(!uo(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await ce.open(r,"r");try{let[c,l,u]=await Promise.all([s.stat(),ce.lstat(r),ce.realpath(r)]);if(await au(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Gr(a,c)||!Gr(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let d=[],f=0,p=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let b=i===null?p.length:i+1-f,k=await s.read(p,0,Math.min(p.length,b),null);if(k.bytesRead===0)break;if(f+=k.bytesRead,i!==null&&f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);d.push(Buffer.from(p.subarray(0,k.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([s.stat(),ce.lstat(r),ce.realpath(r)]);if(await au(n),!h.isFile()||h.isSymbolicLink()||m!==o||!Gr(c,v)||!Gr(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let w=Buffer.concat(d,f),y;try{y=new Fv("utf-8",{fatal:!0}).decode(w)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:b})}return{ref:t,size:f,hash:e.includeHash===!1?null:Mv("sha256").update(w).digest("hex"),text:y}}finally{await s.close()}}var uu=St(ut(),1);import{createHash as Jv}from"crypto";function ee(e){return Jv("sha256").update(e).digest("hex")}var Gb={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024};var Ub=8*1024*1024;var Kb=64*1024,Yb=64*1024;var Xb={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Qb={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};var Zb=(1n<<256n)-1n;var Zv=St(ut(),1);var mk=4*1024*1024;var eg=null;function tg(e,t){let i=e;for(let r of t)i+="\0"+(typeof r=="string"?r:JSON.stringify(r));return i}function ou(e,t){return(...i)=>{let r=eg;if(r===null)return t(...i);let n=tg(`async:${e}`,i),a=r.entries.get(n);if(a)return a.value;let o=t(...i).catch(s=>{throw r.entries.delete(n),s});return r.entries.set(n,{value:o}),o}}var Nk=ou("hookWritePolicy",async e=>(await Ga(e))?.hook??{allow_paths:[]});var hS=256*1024;var RS={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 du=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],ZS=new Set(du),cg=new Set([...du,"minimum_runtime_version","revision"]),eE=new Set([...cg,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]);var Kr=class extends Error{constructor(i,r,n){super(`Native change ${i} revision conflict: expected ${r}, actual ${n}`);this.change=i;this.expectedRevision=r;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},yi=class extends Error{constructor(i,r){super(`Native working directory already contains active change${r.length===1?"":"s"} ${r.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=r;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},Yr=class extends Error{constructor(i,r,n,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${r} omitted entr${r===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=r;this.omittedByReason=n;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},tE=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
169
+ `);var iE=256*1024;import{createHash as lg}from"crypto";function le(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function ug(e,t){t.has(e)&&le("cyclic structures are not supported"),t.add(e);try{let i=Object.keys(e);for(let r=0;r<e.length;r+=1)Object.prototype.hasOwnProperty.call(e,r)||le("sparse arrays are not supported");return(i.length!==e.length||i.some((r,n)=>r!==String(n)))&&le("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),`[${e.map(r=>po(r,t)).join(",")}]`}finally{t.delete(e)}}function dg(e,t){let i=Object.getPrototypeOf(e);i!==Object.prototype&&i!==null&&le("only plain objects are supported"),t.has(e)&&le("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),t.add(e);try{let r=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&le("accessor properties are not supported"),`${JSON.stringify(o)}:${po(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function po(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||le("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?ug(e,t):dg(e,t);case"bigint":case"function":case"symbol":case"undefined":return le(`${typeof e} values are not supported`)}return le("unsupported value type")}function mo(e){return po(e,new Set)}function te(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return lg("sha256").update(`${e}
170
+ ${mo(t)}`).digest("hex")}var lE=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),fu=Object.freeze({maxCriteria:1024});var hu=St(ut(),1);var gu="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",TE=new RegExp(`^portable-archive-(${gu})\\.json$`,"u"),IE=new RegExp(`^portable-migration-(${gu})\\.json$`,"u");var Ni=/^[a-f0-9]{64}$/u,wu=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,bg=16*1024,go=process.platform;function bu(e,t){let i=Be.relative(e,t);return Be.isAbsolute(i)||i===".."||i.startsWith(`..${Be.sep}`)?null:i.replaceAll("\\","/")||"."}function ku(e){return Array.from(e).some(t=>{let i=t.codePointAt(0)??0;return i<=31||i===127})}function Su(e,t){if(e.length===0||ku(e)||e.includes("\\")||Be.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let i=Be.posix.normalize(e);if(i!==e||i===".."||i.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return i}function wo(e,t){return Ng("sha256").update(`${e}
171
+ ${t}`).digest("hex")}async function yu(e,t){let i=await Qr.realpath(t),r=await Qr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=go==="win32"?Be.normalize(i).toLowerCase():i;return wo(e,`${n}
172
+ ${r.dev}
173
+ ${r.ino}
174
+ ${r.birthtimeMs}`)}async function Nu(e,t){let i=await Qr.realpath(t),r=await Qr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=go==="win32"?Be.normalize(i).toLowerCase():i;return wo(e,n)}function kg(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function vo(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||ku(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Eu(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(vo(e.changeBranch,"Native workspace change branch"),vo(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function Sg(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace Git provenance must be an object");let t=e,i=new Set(["provider","baseCommit","targetBranch","targetCommit"]),r=Object.keys(t).filter(n=>!i.has(n));if(r.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${r.join(", ")}`);if(t.provider!=="git"||typeof t.baseCommit!="string"||!wu.test(t.baseCommit)||typeof t.targetCommit!="string"||!wu.test(t.targetCommit))throw new Error("Native workspace Git provenance is invalid");vo(t.targetBranch,"Native workspace Git target branch")}function Zr(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),r=Object.keys(t).filter(o=>!i.has(o));if(r.length>0)throw new Error(`Native workspace identity has unknown field(s): ${r.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!Ni.test(String(t.projectRootId))||!Ni.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");kg(t.capturedAt),Su(t.nativeRootRef,"Native workspace root ref");let n=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!Ni.test(String(t.projectRootPathId))||a&&!Ni.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!Ni.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.git!==void 0&&Sg(t.git),t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Eu(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function Pu(e,t){return Be.join(he(e,t),"workspace.json")}function Eg(e,t){let i=Pu(e,t),r=oe(e,i),n=bu(r,i);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:r,ref:Su(n,"Native workspace file ref")}}async function Pg(e,t){try{let i=Eg(e,t),r=await me({root:i.root,ref:i.ref,maxBytes:bg});return JSON.parse(r.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function Ru(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=bu(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let i=He(e.paths.projectRoot),r=i.isGitWorktree?lo(e.paths.projectRoot,"HEAD"):null,n=e.binding?.targetBranch??i.currentBranch,a=n==null?null:lo(e.paths.projectRoot,n),o=r!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:r,targetBranch:n,targetCommit:a}:void 0,[s,c,l,u]=await Promise.all([yu("comet.native.workspace-project-root.v2",e.paths.projectRoot),yu("comet.native.workspace-native-root.v2",e.paths.nativeRoot),Nu("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),Nu("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),d=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Eu(e.binding);let f={capturedAt:d,capturedRevision:e.revision,nativeRootRef:t,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:u,...o?{git:o}:{},...e.sessionId?{sessionHash:wo("comet.native.workspace-session.v2",`${s}
175
+ ${c}
176
+ ${e.sessionId}`)}:{}},p=e.binding?{schema:"comet.native.workspace.v3",...f,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...f};return Zr(p),p}async function fo(e){let t=await Ru(e),i=Pu(e.paths,e.name),r=oe(e.paths,i);return await $(r,i),await X(i,t,{containedRoot:r}),t}async function bt(e,t){let i=await Pg(e,t);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(Zr(i),i)}async function Xr(e){Zr(e.identity);let t=await Ru({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),i=[],r=[];return t.nativeRootRef!==e.identity.nativeRootRef&&i.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&i.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&i.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&i.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&i.push("native-root-legacy-identity")),go==="win32"&&i.length>0&&i.every(a=>a==="project-root-legacy-identity"||a==="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 ho(e){if(Zr(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await Xr(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=He(e.paths.projectRoot);return e.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!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:e.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"}}var No=64*1024*1024,cP=256*1024,_u=16*1024*1024;async function K(e){try{return await Le.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Ag(e){let t;try{t=await Le.readdir(e.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t){if(!i.isDirectory()||i.isSymbolicLink())continue;let r;try{r=await gi(e,i.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${i.name} has no journal; run doctor before moving`,{cause:n}):n}if(r.status!=="committed"&&r.status!=="rolled-back")throw new Error(`Native transaction ${r.id} is unfinished; recover it before moving`)}}async function _g(e,t){for(let i of await Le.readdir(e.locksDir,{withFileTypes:!0})){let r=I.join(e.locksDir,i.name);if(I.resolve(r)!==I.resolve(t)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${r}`)}}async function Tg(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let r=await bt(e,i.name);if(r){await fo({paths:e,name:i.name,revision:r.capturedRevision,...r.schema==="comet.native.workspace.v3"?{binding:{isolation:r.isolation,changeBranch:r.changeBranch,targetBranch:r.targetBranch},...r.finish?{finish:r.finish}:{}}:{}});continue}}}async function Ig(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name)))if(!(!i.isDirectory()||i.isSymbolicLink()))try{let r=await bt(e,i.name);if(r?.schema==="comet.native.workspace.v3"){let n=await ho({paths:e,identity:r});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(r){let n=await Xr({paths:e,identity:r});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(r){throw new Error(`Native workspace identity for ${i.name} must be aligned and repaired before moving the root`,{cause:r})}}async function ki(e,t){let i=[];async function r(n){let a=await Ye({root:e,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=I.join(n,s.name);if(t.excludedFiles?.has(I.resolve(c))){await a.verify();continue}let l=await Le.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"directory"}),await r(c);else if(s.isFile()&&l.isFile()){let u=await J({root:e,file:c,maxBytes:No,label:`Native root file ${I.relative(e,c)}`});i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await r(e),i.sort((n,a)=>n.ref.localeCompare(a.ref))}async function jg(e,t,i,r){await hi({root:r,directory:t,label:"Native root move staging directory"});async function n(a,o){let s=await Ye({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=I.join(a,l.name);if(I.resolve(u)===I.resolve(i)){await s.verify();continue}let d=await Le.lstat(u);if(l.isSymbolicLink()||d.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let f=I.join(o,l.name);if(l.isDirectory()&&d.isDirectory())await hi({root:r,directory:f,label:"Native root move staging directory"}),await n(u,f);else if(l.isFile()&&d.isFile())await pi({sourceRoot:e,source:u,targetRoot:r,target:f,maxBytes:No,label:`Native root move file ${I.relative(e,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await n(e,t)}async function en(e,t,i,r){let n=await ki(e,{rejectSymlinks:!0,excludedFiles:i?new Set([I.resolve(i)]):void 0}),a=await ki(t,{rejectSymlinks:!0,excludedFiles:r?new Set([I.resolve(r)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function $g(e,t){return I.join(e.artifactRoot,`.comet-native-move-${t}`)}function Og(e,t){return I.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function Hg(e){return`${e}.removing`}function Tu(e,t,i){return I.join(Wr(e,t).directory,`root-move-cleanup-${i}.json`)}function Dg(e){return JSON.stringify(e,null,2)+`
177
+ `}function Bg(e){return xg("sha256").update(e).digest("hex")}function Lg(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let i=e,r=Object.keys(i).sort(),n=i.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(r)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof i.ref!="string"||i.ref.length===0||i.ref.includes("\\")||I.posix.normalize(i.ref)!==i.ref||i.ref.startsWith("/")||i.ref.split("/").includes("..")||Buffer.byteLength(i.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(i.type==="directory")return{ref:i.ref,type:"directory"};if(i.type!=="file"||typeof i.size!="number"||!Number.isSafeInteger(i.size)||i.size<0||typeof i.hash!="string"||!/^[a-f0-9]{64}$/u.test(i.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function Mg(e,t,i){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let r=e;if(JSON.stringify(Object.keys(r).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||r.schema!=="comet.native.root-move-cleanup.v1"||r.transactionId!==t||r.kind!==i||!Array.isArray(r.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=r.entries.map(Lg);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=I.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:i,entries:n}}async function Fg(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},i=Dg(t);if(Buffer.byteLength(i,"utf8")>_u)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await z(Tu(e.paths,e.id,e.kind),i,{containedRoot:e.paths.runtimeDir}),Bg(i)}async function Vg(e){let t=await J({root:e.paths.runtimeDir,file:Tu(e.paths,e.id,e.cleanup.kind),maxBytes:_u,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return Mg(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function yo(e){let t=await ki(e.quarantine,{rejectSymlinks:!0}),i=new Map(e.manifest.entries.map(r=>[r.ref,r]));for(let r of t){let n=i.get(r.ref);if(!n||JSON.stringify(n)!==JSON.stringify(r))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${r.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function xu(e){return e.ref.split("/").length}async function qg(e){let i=[...await yo({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((n,a)=>xu(a)-xu(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),r=0;for(let n of i){let a=I.join(e.quarantine,...n.ref.split("/"));n.type==="file"?await ro({root:e.projectRoot,file:a,maxBytes:No,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await no({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),r+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,n.ref,r)}await yo({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await no({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function tn(e,t,i=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:i,pending_root_move:t}}}function Wg(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function Cu(e){let t=tn(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await $e(e.projectRoot,t),t}async function bi(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=tn(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await $e(e.projectRoot,i),i}async function Au(e){let t=e.config,i=t.native.pending_root_move;if(!i||i.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let r=i.cleanup;if(r&&r.kind!==e.kind)throw new Error(`Native root move has unfinished ${r.kind} cleanup; cannot start ${e.kind}`);let n=await K(e.target),a=await K(e.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!r){if(!n&&!a)return t;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await Fg({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await ki(e.target,{rejectSymlinks:!0})});r={kind:e.kind,state:"prepared",manifestHash:s},t=await bi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})}let o=await Vg({paths:e.stablePaths,id:e.id,cleanup:r});if(n=await K(e.target),a=await K(e.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(n){if(r.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await Jl({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(r.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return bi({projectRoot:e.projectRoot,config:t,id:e.id})}return await yo({quarantine:e.quarantine,manifest:o,exact:r.state!=="deleting"}),r.state==="prepared"&&(r={...r,state:"quarantined"},t=await bi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),r.state==="quarantined"&&(r={...r,state:"deleting"},t=await bi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),await qg({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),bi({projectRoot:e.projectRoot,config:t,id:e.id})}async function zg(e){let t=e.config,i=t.native.pending_root_move.stage;if(i==="copying"){if(!await K(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=Hg(e.staging);t=await Au({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await ki(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([I.resolve(e.lockFile)])}),await jg(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await en(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await Cu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),i="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(i==="ready"){if(await K(e.destinationPaths.nativeRoot)){if(await K(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await en(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await K(e.staging))throw new Error("Native move staging tree is missing");await en(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await Le.rename(e.staging,e.destinationPaths.nativeRoot)}t=await Cu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),i="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await K(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let r=Og(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await K(e.sourcePaths.nativeRoot)&&await en(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Au({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:r,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await Tg(e.destinationPaths);let n=await gi(e.destinationPaths,e.pending.id);await co(e.destinationPaths,n,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await $e(e.projectRoot,o),o}async function Iu(e){let t=await se(e.projectRoot)??jl("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let i=li(e.toArtifactRoot);if(i===t.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let r=await fe(e.projectRoot,t.native.artifact_root),n=await fe(e.projectRoot,i);if(F(r.nativeRoot,n.nativeRoot)||F(n.nativeRoot,r.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await K(r.nativeRoot))throw new Error(`Native source root does not exist: ${r.nativeRoot}`);if(await Ag(r),await K(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await ui(r,"root-move",`move root to ${i}`),o=Cg(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=Wg({id:o,paths:r,now:e.now??new Date}),l=$g(n,o);try{if(await _g(r,a.file),await Ig(r),await K(l))throw new Error(`Native move staging path is occupied: ${l}`);return await $e(e.projectRoot,tn(t,s)),await ru(r,c),await e.hooks?.afterRootMoveStage?.("copying",c),await zg({projectRoot:e.projectRoot,config:tn(t,s),pending:s,sourcePaths:r,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:r.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await di(a)}}import So from"path";var Gg=["Outcome","Scope","Non-goals","Acceptance examples"],SP=[...Gg,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var Ug=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var ju=1024*1024;var Ou="scoped-text-safety",Kg=1,Yg=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Xg="comet.native.checker-policy.v1";var MP=te(Xg,{policy:Ou,version:Kg,limits:Yg,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Qg=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],FP=new Set(Qg);var tw=ju,nR=3*tw;var Hu={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},rw=ee("comet-native-runtime:v3:scope-reopen"),TR=[{skillVersion:"3",skillHash:ee("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:ee("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:ee("comet-native-runtime:v1")}];var Bu=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],dx=new Set(Bu),uw=new Set([...Bu,"minimum_runtime_version","revision"]),fx=new Set([...uw,"operation"]),hx=512*1024,dw=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),px=new Set([...dw,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var wx={maxAcceptanceCriteria:fu.maxCriteria};var Sx={maxSpecs:64,maxFileBytes:Ur,maxTotalBytes:4*1024*1024};import{execFile as kw}from"node:child_process";import{promisify as Sw}from"node:util";var Px=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");var Hx={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var rC=512*1024;var Pi=class extends Error{recovery;constructor(t,i){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var RC=64*1024;var xC=3600*1e3;var CC=Sw(kw);var rn=class extends Error{details;constructor(t){let i=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=t}};var hA={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var kA=16*1024*1024,SA=256*1024,EA=16*1024;var AA=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var IA=16*1024;var Tw=St(ut(),1);var $A=8*1024*1024;var ST=16*1024;var fI=16*1024*1024,nn=class extends Error{constructor(i,r,n,a){super(`Canonical spec conflict for ${i}: expected ${r??"(missing)"}, actual ${n??"(missing)"}`);this.capability=i;this.expectedHash=r;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},an=class extends Error{constructor(i,r=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(r);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var on=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var Fu=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--help Show help without requiring an initialized project."],ko=Object.freeze({"":{usage:"comet native <command> [options]",purpose:"Create, inspect, recover, and archive portable Native changes through Runtime-enforced, skill-coordinated steps.",subcommands:["init Initialize Native project configuration.","root show Inspect the configured artifact root.","root move <artifact-root> Move the configured artifact root.","new <change-name> Create a change and prepare its workspace.","spec remove Record a complete capability removal intent.","show <change-name> Read formal artifacts and portable state.","status [<change-name>] Discover stable boundaries and Runner actions.","select <change-name> Select a change in its bound workspace.","next <change-name> Confirm or recover a stable workflow boundary.","archive <change-name> Preview and execute Archive plus workspace finish.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:Fu,output:"Human-readable text by default; use --json for a structured command envelope.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN","comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:"comet native spec remove <change-name> <capability>",purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["remove <change-name> <capability> Record a capability removal."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"The portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries, parent child readiness, or the exact next Runner action.",options:["--cursor <token> Continue a status-list page.","--details Include acceptance, Spec, workspace, and report details."],output:"A v2 status page or one portable Loop projection with local execution availability and continuation.runnerAction; parent changes also expose children and readyChildren.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--confirmed|--return-to-build|--retry-verifier|--resolve-verifier-blocker]
178
+ comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm Shape, a completed skill-coordinated pass, or an explicitly degraded verifier-unavailable fallback before Archive.","--return-to-build Return Verify or Archive to Build after invalidation or user choice.","--retry-verifier Retry a blocked Verifier execution when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, verifier-response, verifier-execution-error, or verifier-unavailable. Identity/provider/execution/candidate fields are rejected."," builder-handoff fields: kind, summary, addressed_acceptance_ids, checks, known_limits."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," verifier-response fields: kind, response (request-checks or final-result)."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."],output:"The portable state, explicit skill-coordinated label, Runtime-owned check results, complete verifierDispatch, bounded request-check response, continuation.runnerAction, and machine-readable continuation.inputOptions. This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.",examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed','comet native next session-timeout --summary "Implementation changed" --return-to-build','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep]
179
+ comet native archive <change-name> [--confirmed] [--serial-first <current-change>]`,purpose:"Preview or execute deterministic Archive after the portable state reaches archive-ready.",options:["--dry-run Inspect readiness without rerunning verification.","--finish <action> Persist merge, push, pull-request, or keep for an isolated workspace.","--serial-first <current-change> During execution only, confirm that this change archives before detected capability peers; the value must equal <change-name>.","--confirmed Confirm Archive when project policy requires it."],output:"Readiness plus continuation, or the completed Archive transaction and workspace finish result; Archive does not repeat verification."},doctor:{usage:"comet native doctor [<change-name>] [--repair]",purpose:"Inspect portable state, migrate a legacy active change, or rebuild its local execution overlay.",options:["--repair Apply deterministic migration or rebuild from the portable stable boundary."],output:"Health, migration or recovery details, and the continuation with the next Runner action."}});function bo(e,t){return`${e}:
180
+ ${t.map(i=>` ${i}`).join(`
181
+ `)}`}function Ow(e){let t=e.filter(r=>r!=="--help");if(t.length===0)return"";let i=t.slice(0,2).join(" ");return ko[i]||t.length>1&&ko[t[0]]?.subcommands?i:t[0]}function Hw(e=[]){let t=Ow(e),i=ko[t];if(!i)throw new Error(`Unknown Native help topic: ${t}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",bo("Commands",i.subcommands));let n=t===""?i.options:[...i.options??[],...Fu];return n&&n.length>0&&r.push("",bo("Options",n)),r.push("",`Output:
182
+ ${i.output}`),i.examples&&r.push("",bo("Examples",i.examples)),t===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:t,usage:`${r.join(`
183
+ `)}
184
+ `}}var Dw=Hw().usage;var HI=10*1024*1024,ve=class extends Error{};function qu(e,t){let i=e.flatMap((r,n)=>r===t?[n]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);return i.length===0?!1:(e.splice(i[0],1),!0)}function Wu(e,t){let i=e.flatMap((a,o)=>a===t?[o]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);if(i.length===0)return;let r=i[0],n=e[r+1];if(n===void 0||n.startsWith("--"))throw new ve(`${t} requires a value`);return e.splice(r,2),n}function Eo(e){if(e.length>0)throw new ve(`Unexpected argument: ${e[0]}`)}function Po(e,t){let i=e.shift();if(!i||i.startsWith("--"))throw new ve(`${t} is required`);return i}function Vu(e,t){let i=So.normalize(e),r=So.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function Bw(e){let t=So.resolve(e),i=He(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return t;let r=He(t);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!Vu(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||Vu(i.currentWorktreeRoot,r.currentWorktreeRoot)?t:i.currentWorktreeRoot}async function zu(e){return e?Bw(e):Za(process.cwd())}function Ro(e,t,i){return{command:e,exitCode:0,data:t,text:i??JSON.stringify(t,null,2)+`
185
+ `}}function Ju(e,t){if(t instanceof ve)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof nn)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof an)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof Kr)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof yi)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof on)return{command:e,exitCode:73,data:{preparation:t.preparation},error:{code:"workspace-preparation-incomplete",message:t.message}};if(t instanceof Yr)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:t.message}};if(t instanceof rn)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof Pi)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let i=t.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function Gu(e,t){return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
186
+ `}:e.error?{exitCode:e.exitCode,stderr:e.error.message}:{exitCode:e.exitCode,stdout:e.text}}async function Uu(e,t){let i=Po(e,"root subcommand");if(i==="show"){Eo(e);let r=await se(t);if(!r)throw new Error(".comet/config.yaml was not found");let n=await fe(t,r.native.artifact_root);return Ro("root show",{projectRoot:t,artifactRoot:r.native.artifact_root,language:r.native.language,nativeRoot:n.nativeRoot,pendingRootMove:r.native.pending_root_move??null})}if(i==="move"){let r=Po(e,"artifact root");Eo(e);let n=await Iu({projectRoot:t,toArtifactRoot:r});return Ro("root move",n,`Moved Comet Native to ${n.toNativeRoot}
187
+ `)}throw new ve(`Unknown root command: ${i}`)}function Lw(e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
188
+ `}}async function Ku(e,t,i=process.argv.slice(2)){let r=i.indexOf("--"),n=r<0?[...i]:i.slice(0,r),a=r<0?[]:i.slice(r),o=n.includes("--json"),s,c;try{qu(n,"--json"),s=Wu(n,"--project-root");let u=[...n,...a],d=await zu(s);c=await t(u,d)}catch(u){c=Ju(e,u)}let l=o?Lw(c):Gu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
184
189
  `)?"":`
185
- `)),l.exitCode}process.exitCode=await pf("root",hf);
190
+ `)),l.exitCode}process.exitCode=await Ku("root",Uu);