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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +13 -1
  3. package/assets/manifest.json +1 -1
  4. package/assets/skills/comet/SKILL.md +6 -5
  5. package/assets/skills/comet/reference/subagent-dispatch.md +2 -4
  6. package/assets/skills/comet/rules/comet-phase-guard.en.md +4 -3
  7. package/assets/skills/comet/rules/comet-phase-guard.md +4 -3
  8. package/assets/skills/comet/rules/comet-workflow-guard.en.md +1 -1
  9. package/assets/skills/comet/rules/comet-workflow-guard.md +1 -1
  10. package/assets/skills/comet/scripts/comet-archive.mjs +85 -85
  11. package/assets/skills/comet/scripts/comet-guard.mjs +111 -111
  12. package/assets/skills/comet/scripts/comet-handoff.mjs +85 -85
  13. package/assets/skills/comet/scripts/comet-hook-guard.mjs +91 -89
  14. package/assets/skills/comet/scripts/comet-hook-router.mjs +124 -116
  15. package/assets/skills/comet/scripts/comet-resume-probe.mjs +77 -77
  16. package/assets/skills/comet/scripts/comet-runtime.mjs +188 -185
  17. package/assets/skills/comet/scripts/comet-state.mjs +108 -107
  18. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +95 -95
  19. package/assets/skills/comet-any/SKILL.md +1 -1
  20. package/assets/skills/comet-any/reference/authoring-subagents.md +3 -11
  21. package/assets/skills/comet-any/reference/subagents/pause-points-author.md +1 -4
  22. package/assets/skills/comet-any/reference/subagents/reference-author.md +1 -4
  23. package/assets/skills/comet-any/reference/subagents/script-author.md +1 -4
  24. package/assets/skills/comet-any/reference/subagents/skill-core-author.md +1 -4
  25. package/assets/skills/comet-any/reference/subagents/skill-reviewer.md +1 -4
  26. package/assets/skills/comet-any/reference/subagents/workflow-entry-author.md +1 -4
  27. package/assets/skills/comet-build/SKILL.md +2 -2
  28. package/assets/skills/comet-native/SKILL.md +85 -11
  29. package/assets/skills/comet-native/reference/artifacts.md +3 -1
  30. package/assets/skills/comet-native/reference/commands.md +15 -6
  31. package/assets/skills/comet-native/reference/recovery.md +12 -1
  32. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +124 -118
  33. package/assets/skills/comet-native/scripts/comet-native-check.mjs +116 -110
  34. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +110 -110
  35. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +121 -121
  36. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +83 -83
  37. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +88 -82
  38. package/assets/skills/comet-native/scripts/comet-native-init.mjs +85 -85
  39. package/assets/skills/comet-native/scripts/comet-native-new.mjs +114 -114
  40. package/assets/skills/comet-native/scripts/comet-native-next.mjs +122 -122
  41. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +124 -116
  42. package/assets/skills/comet-native/scripts/comet-native-root.mjs +110 -110
  43. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +154 -152
  44. package/assets/skills/comet-native/scripts/comet-native-select.mjs +110 -110
  45. package/assets/skills/comet-native/scripts/comet-native-show.mjs +80 -80
  46. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +112 -112
  47. package/assets/skills/comet-native/scripts/comet-native-status.mjs +107 -107
  48. package/assets/skills-zh/comet/SKILL.md +3 -3
  49. package/assets/skills-zh/comet/reference/subagent-dispatch.md +2 -4
  50. package/assets/skills-zh/comet-any/SKILL.md +1 -1
  51. package/assets/skills-zh/comet-any/reference/authoring-subagents.md +3 -14
  52. package/assets/skills-zh/comet-any/reference/subagents/pause-points-author.md +1 -4
  53. package/assets/skills-zh/comet-any/reference/subagents/reference-author.md +1 -4
  54. package/assets/skills-zh/comet-any/reference/subagents/script-author.md +1 -4
  55. package/assets/skills-zh/comet-any/reference/subagents/skill-core-author.md +1 -4
  56. package/assets/skills-zh/comet-any/reference/subagents/skill-reviewer.md +1 -4
  57. package/assets/skills-zh/comet-any/reference/subagents/workflow-entry-author.md +1 -4
  58. package/assets/skills-zh/comet-build/SKILL.md +2 -2
  59. package/assets/skills-zh/comet-native/SKILL.md +86 -12
  60. package/assets/skills-zh/comet-native/reference/artifacts.md +3 -1
  61. package/assets/skills-zh/comet-native/reference/commands.md +17 -8
  62. package/assets/skills-zh/comet-native/reference/recovery.md +14 -3
  63. package/bin/fast-runtime-router.js +1 -0
  64. package/dist/app/cli/index.js +1 -0
  65. package/dist/app/cli/index.js.map +1 -1
  66. package/dist/app/commands/doctor.d.ts.map +1 -1
  67. package/dist/app/commands/doctor.js +138 -37
  68. package/dist/app/commands/doctor.js.map +1 -1
  69. package/dist/app/commands/init.d.ts.map +1 -1
  70. package/dist/app/commands/init.js +43 -12
  71. package/dist/app/commands/init.js.map +1 -1
  72. package/dist/app/commands/update.d.ts.map +1 -1
  73. package/dist/app/commands/update.js +42 -9
  74. package/dist/app/commands/update.js.map +1 -1
  75. package/dist/app/commands/workflow.d.ts +1 -0
  76. package/dist/app/commands/workflow.d.ts.map +1 -1
  77. package/dist/app/commands/workflow.js +9 -2
  78. package/dist/app/commands/workflow.js.map +1 -1
  79. package/dist/domains/comet-classic/classic-hook-guard.d.ts +5 -1
  80. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  81. package/dist/domains/comet-classic/classic-hook-guard.js +104 -20
  82. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  83. package/dist/domains/comet-classic/classic-plan-readiness.d.ts +12 -0
  84. package/dist/domains/comet-classic/classic-plan-readiness.d.ts.map +1 -0
  85. package/dist/domains/comet-classic/classic-plan-readiness.js +26 -0
  86. package/dist/domains/comet-classic/classic-plan-readiness.js.map +1 -0
  87. package/dist/domains/comet-classic/classic-project-config.d.ts +1 -0
  88. package/dist/domains/comet-classic/classic-project-config.d.ts.map +1 -1
  89. package/dist/domains/comet-classic/classic-project-config.js +13 -7
  90. package/dist/domains/comet-classic/classic-project-config.js.map +1 -1
  91. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  92. package/dist/domains/comet-classic/classic-state-command.js +58 -7
  93. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  94. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  95. package/dist/domains/comet-entry/hook-adapter.js +15 -2
  96. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  97. package/dist/domains/comet-entry/hook-project-root.d.ts +3 -0
  98. package/dist/domains/comet-entry/hook-project-root.d.ts.map +1 -0
  99. package/dist/domains/comet-entry/hook-project-root.js +62 -0
  100. package/dist/domains/comet-entry/hook-project-root.js.map +1 -0
  101. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -1
  102. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  103. package/dist/domains/comet-entry/hook-router-entry.js +6 -4
  104. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  105. package/dist/domains/comet-entry/hook-router.d.ts +2 -0
  106. package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
  107. package/dist/domains/comet-entry/hook-router.js +45 -9
  108. package/dist/domains/comet-entry/hook-router.js.map +1 -1
  109. package/dist/domains/comet-entry/hook-types.d.ts +1 -0
  110. package/dist/domains/comet-entry/hook-types.d.ts.map +1 -1
  111. package/dist/domains/comet-entry/project-activation.d.ts +12 -0
  112. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -0
  113. package/dist/domains/comet-entry/project-activation.js +109 -0
  114. package/dist/domains/comet-entry/project-activation.js.map +1 -0
  115. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  116. package/dist/domains/comet-entry/resume-probe.js +47 -26
  117. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  118. package/dist/domains/comet-entry/types.d.ts +1 -1
  119. package/dist/domains/comet-entry/types.d.ts.map +1 -1
  120. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-archive-command.js +43 -1
  122. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  123. package/dist/domains/comet-native/native-archive-inspection.d.ts.map +1 -1
  124. package/dist/domains/comet-native/native-archive-inspection.js +11 -0
  125. package/dist/domains/comet-native/native-archive-inspection.js.map +1 -1
  126. package/dist/domains/comet-native/native-archive-preflight.d.ts +10 -0
  127. package/dist/domains/comet-native/native-archive-preflight.d.ts.map +1 -1
  128. package/dist/domains/comet-native/native-archive-preflight.js +44 -0
  129. package/dist/domains/comet-native/native-archive-preflight.js.map +1 -1
  130. package/dist/domains/comet-native/native-change.d.ts +18 -1
  131. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  132. package/dist/domains/comet-native/native-change.js +72 -3
  133. package/dist/domains/comet-native/native-change.js.map +1 -1
  134. package/dist/domains/comet-native/native-check.d.ts.map +1 -1
  135. package/dist/domains/comet-native/native-check.js +13 -1
  136. package/dist/domains/comet-native/native-check.js.map +1 -1
  137. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  138. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  139. package/dist/domains/comet-native/native-cli-shared.js +24 -3
  140. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  141. package/dist/domains/comet-native/native-conflict-inspection.d.ts +3 -1
  142. package/dist/domains/comet-native/native-conflict-inspection.d.ts.map +1 -1
  143. package/dist/domains/comet-native/native-conflict-inspection.js +20 -10
  144. package/dist/domains/comet-native/native-conflict-inspection.js.map +1 -1
  145. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  146. package/dist/domains/comet-native/native-continuation.js +16 -0
  147. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  148. package/dist/domains/comet-native/native-diagnostics.d.ts +2 -0
  149. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  150. package/dist/domains/comet-native/native-diagnostics.js +43 -32
  151. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  152. package/dist/domains/comet-native/native-evidence-storage.d.ts +6 -0
  153. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  154. package/dist/domains/comet-native/native-evidence-storage.js +24 -0
  155. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  156. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  157. package/dist/domains/comet-native/native-findings.js +36 -0
  158. package/dist/domains/comet-native/native-findings.js.map +1 -1
  159. package/dist/domains/comet-native/native-hook-guard.js +2 -2
  160. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  161. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  162. package/dist/domains/comet-native/native-new-command.js +22 -7
  163. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  164. package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -1
  165. package/dist/domains/comet-native/native-receipt-command.js +14 -1
  166. package/dist/domains/comet-native/native-receipt-command.js.map +1 -1
  167. package/dist/domains/comet-native/native-receipt-errors.d.ts +23 -0
  168. package/dist/domains/comet-native/native-receipt-errors.d.ts.map +1 -0
  169. package/dist/domains/comet-native/native-receipt-errors.js +9 -0
  170. package/dist/domains/comet-native/native-receipt-errors.js.map +1 -0
  171. package/dist/domains/comet-native/native-receipt-refresh.d.ts +3 -0
  172. package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -1
  173. package/dist/domains/comet-native/native-receipt-refresh.js +13 -2
  174. package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -1
  175. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  176. package/dist/domains/comet-native/native-root-move.js +54 -1
  177. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  178. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  179. package/dist/domains/comet-native/native-snapshot.js +71 -14
  180. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  181. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  182. package/dist/domains/comet-native/native-transitions.js +74 -42
  183. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  184. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +37 -4
  185. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  186. package/dist/domains/comet-native/native-verification-receipt-runtime.js +192 -4
  187. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  188. package/dist/domains/comet-native/native-verification-runtime.d.ts +27 -1
  189. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  190. package/dist/domains/comet-native/native-verification-runtime.js +29 -6
  191. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  192. package/dist/domains/comet-native/native-workspace.d.ts +39 -3
  193. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  194. package/dist/domains/comet-native/native-workspace.js +200 -8
  195. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  196. package/dist/domains/dashboard/collector.d.ts +26 -1
  197. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  198. package/dist/domains/dashboard/collector.js +381 -1
  199. package/dist/domains/dashboard/collector.js.map +1 -1
  200. package/dist/domains/dashboard/native-adapter.d.ts +15 -0
  201. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  202. package/dist/domains/dashboard/native-adapter.js +1 -1
  203. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  204. package/dist/domains/dashboard/native-collector.d.ts +26 -1
  205. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  206. package/dist/domains/dashboard/native-collector.js +284 -5
  207. package/dist/domains/dashboard/native-collector.js.map +1 -1
  208. package/dist/domains/dashboard/server.d.ts.map +1 -1
  209. package/dist/domains/dashboard/server.js +92 -3
  210. package/dist/domains/dashboard/server.js.map +1 -1
  211. package/dist/domains/dashboard/types.d.ts +41 -1
  212. package/dist/domains/dashboard/types.d.ts.map +1 -1
  213. package/dist/domains/dashboard/verify-parser.d.ts +1 -0
  214. package/dist/domains/dashboard/verify-parser.d.ts.map +1 -1
  215. package/dist/domains/dashboard/verify-parser.js +8 -4
  216. package/dist/domains/dashboard/verify-parser.js.map +1 -1
  217. package/dist/domains/dashboard/web/assets/{arc-mNt_SS1l.js → arc-ClrSujVb.js} +1 -1
  218. package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-Bc5akVD6.js → architectureDiagram-3BPJPVTR-B4A_t84A.js} +1 -1
  219. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-C43zhVBe.js → blockDiagram-GPEHLZMM-D72u2953.js} +1 -1
  220. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-dToETarK.js → c4Diagram-AAUBKEIU-Ca5zba3N.js} +1 -1
  221. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +1 -0
  222. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-C0oO137R.js → chunk-2J33WTMH-CCVPBm0J.js} +1 -1
  223. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-CGms1fgI.js → chunk-4BX2VUAB-JYluRsP-.js} +1 -1
  224. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-Bugl8v6f.js → chunk-55IACEB6-DfYm7pN7.js} +1 -1
  225. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-8ATNMlBG.js → chunk-727SXJPM-CwghIMO9.js} +1 -1
  226. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-BNYjSSqU.js → chunk-AQP2D5EJ-BA_zgMXZ.js} +1 -1
  227. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-_nJAqSbe.js → chunk-FMBD7UC4-BAJLB5V6.js} +1 -1
  228. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-lyxYm5NX.js → chunk-ND2GUHAM-Bj6HWRwi.js} +1 -1
  229. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-PUMVeWpd.js → chunk-QZHKN3VN-B1kXfg5N.js} +1 -1
  230. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +1 -0
  231. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +1 -0
  232. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-DzMqjexn.js → cose-bilkent-S5V4N54A-BBrkuiAU.js} +1 -1
  233. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-B67ET0eq.js → cynefin-VYW2F7L2-DlFhgQHt.js} +1 -1
  234. package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-CQPMvRLK.js → dagre-BM42HDAG-B0Bk5oiP.js} +1 -1
  235. package/dist/domains/dashboard/web/assets/{demo-BuVau32v.js → demo-DZYPLZpF.js} +2 -2
  236. package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-BRpLrFHM.js → diagram-2AECGRRQ-tvTUiBA2.js} +1 -1
  237. package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-CPGWuGrE.js → diagram-5GNKFQAL-BZfcK29q.js} +1 -1
  238. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-D2wpX2iO.js → diagram-KO2AKTUF-BQahyP-C.js} +1 -1
  239. package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-D54mAbDu.js → diagram-LMA3HP47-D5bJnW2C.js} +1 -1
  240. package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-ZGQDpSs_.js → diagram-OG6HWLK6-DTwWdzWJ.js} +1 -1
  241. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-C3qDo7sd.js → erDiagram-TEJ5UH35-BbvrdCp9.js} +1 -1
  242. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-B7hStPd9.js → flowDiagram-I6XJVG4X-DgbR7Tcc.js} +1 -1
  243. package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-IqcLFbTK.js → ganttDiagram-6RSMTGT7-wWMOA7F4.js} +1 -1
  244. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-YrMZpzUu.js → gitGraphDiagram-PVQCEYII-DCxvMAUJ.js} +1 -1
  245. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +1 -0
  246. package/dist/domains/dashboard/web/assets/{index-icxk8_BP.js → index-Blit0P5Z.js} +1 -1
  247. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +257 -0
  248. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-CcIgGK_7.js → infoDiagram-5YYISTIA-9qXEkzDe.js} +1 -1
  249. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-1x3rNjGP.js → ishikawaDiagram-YF4QCWOH-Dkf5othW.js} +1 -1
  250. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-B2XiqMNP.js → journeyDiagram-JHISSGLW-C2_IkO4s.js} +1 -1
  251. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-x46cGuo3.js → kanban-definition-UN3LZRKU-BxWgu4DL.js} +1 -1
  252. package/dist/domains/dashboard/web/assets/{linear-DFLqGZWl.js → linear-Dkr6p-Ro.js} +1 -1
  253. package/dist/domains/dashboard/web/assets/{mermaid.core-g3J6BACc.js → mermaid.core-DZUcsoG4.js} +4 -4
  254. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CTdeKmcX.js → mindmap-definition-RKZ34NQL-C9xyxGfa.js} +1 -1
  255. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-C_obwjIf.js → pieDiagram-4H26LBE5-Dn67tdOF.js} +1 -1
  256. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-B6Gnfz9M.js → quadrantDiagram-W4KKPZXB-Cy6iOcxc.js} +1 -1
  257. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-nX4PObnB.js → requirementDiagram-4Y6WPE33-B_gZONhx.js} +1 -1
  258. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-QjDwwHgl.js → sankeyDiagram-5OEKKPKP-C3u-4dOk.js} +1 -1
  259. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-BEEe0j6B.js → sequenceDiagram-3UESZ5HK-Xd3ByTVF.js} +1 -1
  260. package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CXfAaBgM.js → stateDiagram-AJRCARHV-CJGHL7Up.js} +1 -1
  261. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +1 -0
  262. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-BOzX2EnD.js → timeline-definition-PNZ67QCA-DvONX2YQ.js} +1 -1
  263. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-C40vhXRq.js → vennDiagram-CIIHVFJN-B-L4qWy4.js} +1 -1
  264. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-B1rm89JH.js → wardleyDiagram-YWT4CUSO-cf39WX2o.js} +1 -1
  265. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-BlMr59qK.js → xychartDiagram-2RQKCTM6-Dk1vcm3u.js} +1 -1
  266. package/dist/domains/dashboard/web/index.html +16 -16
  267. package/dist/domains/skill/hook-lifecycle.d.ts +9 -0
  268. package/dist/domains/skill/hook-lifecycle.d.ts.map +1 -0
  269. package/dist/domains/skill/hook-lifecycle.js +48 -0
  270. package/dist/domains/skill/hook-lifecycle.js.map +1 -0
  271. package/dist/domains/skill/platform-inspect.d.ts +2 -0
  272. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  273. package/dist/domains/skill/platform-inspect.js +170 -32
  274. package/dist/domains/skill/platform-inspect.js.map +1 -1
  275. package/dist/domains/skill/platform-install.d.ts +21 -1
  276. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  277. package/dist/domains/skill/platform-install.js +142 -31
  278. package/dist/domains/skill/platform-install.js.map +1 -1
  279. package/dist/domains/skill/project-hook-projection.d.ts +14 -0
  280. package/dist/domains/skill/project-hook-projection.d.ts.map +1 -0
  281. package/dist/domains/skill/project-hook-projection.js +41 -0
  282. package/dist/domains/skill/project-hook-projection.js.map +1 -0
  283. package/dist/domains/skill/project-instructions.d.ts +3 -0
  284. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  285. package/dist/domains/skill/project-instructions.js +8 -0
  286. package/dist/domains/skill/project-instructions.js.map +1 -1
  287. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  288. package/dist/domains/skill/uninstall.js +50 -11
  289. package/dist/domains/skill/uninstall.js.map +1 -1
  290. package/dist/domains/workflow-contract/global-config.d.ts +10 -0
  291. package/dist/domains/workflow-contract/global-config.d.ts.map +1 -0
  292. package/dist/domains/workflow-contract/global-config.js +117 -0
  293. package/dist/domains/workflow-contract/global-config.js.map +1 -0
  294. package/dist/domains/workflow-contract/hook-target-scope.d.ts +6 -0
  295. package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -0
  296. package/dist/domains/workflow-contract/hook-target-scope.js +51 -0
  297. package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -0
  298. package/dist/domains/workflow-contract/index.d.ts +1 -0
  299. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  300. package/dist/domains/workflow-contract/index.js +1 -0
  301. package/dist/domains/workflow-contract/index.js.map +1 -1
  302. package/dist/domains/workflow-contract/types.d.ts +3 -0
  303. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  304. package/dist/platform/paths/git-worktree.d.ts +4 -1
  305. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  306. package/dist/platform/paths/git-worktree.js +34 -1
  307. package/dist/platform/paths/git-worktree.js.map +1 -1
  308. package/eval/local/tests/scaffold/test_utils.py +74 -0
  309. package/eval/pyproject.toml +4 -4
  310. package/eval/scaffold/shell/docker.sh +5 -0
  311. package/package.json +1 -1
  312. package/dist/domains/dashboard/web/assets/channel-b2wWDG4F.js +0 -1
  313. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-B9SWZywo.js +0 -1
  314. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-B9SWZywo.js +0 -1
  315. package/dist/domains/dashboard/web/assets/index-DhtBssCt.js +0 -257
  316. package/dist/domains/dashboard/web/assets/index-pr3axVDI.css +0 -1
  317. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-CD3nS4cC.js +0 -1
@@ -1,77 +1,77 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Xu=Object.create;var $o=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var ef=Object.getPrototypeOf,tf=Object.prototype.hasOwnProperty;var Pi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var nf=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Zu(e))!tf.call(t,r)&&r!==i&&$o(t,r,{get:()=>e[r],enumerable:!(n=Qu(e,r))||n.enumerable});return t};var Ho=(t,e,i)=>(i=t!=null?Xu(ef(t)):{},nf(e||!t||!t.__esModule?$o(i,"default",{value:t,enumerable:!0}):i,t));var R=w(L=>{"use strict";var cr=Symbol.for("yaml.alias"),Mo=Symbol.for("yaml.document"),Ai=Symbol.for("yaml.map"),Lo=Symbol.for("yaml.pair"),lr=Symbol.for("yaml.scalar"),xi=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),rf=t=>!!t&&typeof t=="object"&&t[ge]===cr,af=t=>!!t&&typeof t=="object"&&t[ge]===Mo,of=t=>!!t&&typeof t=="object"&&t[ge]===Ai,sf=t=>!!t&&typeof t=="object"&&t[ge]===Lo,Do=t=>!!t&&typeof t=="object"&&t[ge]===lr,cf=t=>!!t&&typeof t=="object"&&t[ge]===xi;function Fo(t){if(t&&typeof t=="object")switch(t[ge]){case Ai:case xi:return!0}return!1}function lf(t){if(t&&typeof t=="object")switch(t[ge]){case cr:case Ai:case lr:case xi:return!0}return!1}var uf=t=>(Do(t)||Fo(t))&&!!t.anchor;L.ALIAS=cr;L.DOC=Mo;L.MAP=Ai;L.NODE_TYPE=ge;L.PAIR=Lo;L.SCALAR=lr;L.SEQ=xi;L.hasAnchor=uf;L.isAlias=rf;L.isCollection=Fo;L.isDocument=af;L.isMap=of;L.isNode=lf;L.isPair=sf;L.isScalar=Do;L.isSeq=cf});var Et=w(ur=>{"use strict";var M=R(),V=Symbol("break visit"),Bo=Symbol("skip children"),fe=Symbol("remove node");function Ti(t,e){let i=qo(e);M.isDocument(t)?it(null,t.contents,i,Object.freeze([t]))===fe&&(t.contents=null):it(null,t,i,Object.freeze([]))}Ti.BREAK=V;Ti.SKIP=Bo;Ti.REMOVE=fe;function it(t,e,i,n){let r=Vo(t,e,i,n);if(M.isNode(r)||M.isPair(r))return zo(t,n,r),it(t,r,i,n);if(typeof r!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=it(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(e.items.splice(a,1),a-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let a=it("key",e.key,i,n);if(a===V)return V;a===fe&&(e.key=null);let o=it("value",e.value,i,n);if(o===V)return V;o===fe&&(e.value=null)}}return r}async function _i(t,e){let i=qo(e);M.isDocument(t)?await nt(null,t.contents,i,Object.freeze([t]))===fe&&(t.contents=null):await nt(null,t,i,Object.freeze([]))}_i.BREAK=V;_i.SKIP=Bo;_i.REMOVE=fe;async function nt(t,e,i,n){let r=await Vo(t,e,i,n);if(M.isNode(r)||M.isPair(r))return zo(t,n,r),nt(t,r,i,n);if(typeof r!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=await nt(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(e.items.splice(a,1),a-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let a=await nt("key",e.key,i,n);if(a===V)return V;a===fe&&(e.key=null);let o=await nt("value",e.value,i,n);if(o===V)return V;o===fe&&(e.value=null)}}return r}function qo(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Vo(t,e,i,n){if(typeof i=="function")return i(t,e,n);if(M.isMap(e))return i.Map?.(t,e,n);if(M.isSeq(e))return i.Seq?.(t,e,n);if(M.isPair(e))return i.Pair?.(t,e,n);if(M.isScalar(e))return i.Scalar?.(t,e,n);if(M.isAlias(e))return i.Alias?.(t,e,n)}function zo(t,e,i){let n=e[e.length-1];if(M.isCollection(n))n.items[t]=i;else if(M.isPair(n))t==="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`)}}ur.visit=Ti;ur.visitAsync=_i});var fr=w(Jo=>{"use strict";var Wo=R(),ff=Et(),df={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},hf=t=>t.replace(/[!,[\]{}]/g,e=>df[e]),Rt=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[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(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||i(`The ${e} 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==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,n]of Object.entries(this.tags))if(e.startsWith(n))return i+hf(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Wo.isNode(e.contents)){let a={};ff.visit(e.contents,(o,s)=>{Wo.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:"||(!e||r.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
- `)}};Rt.defaultYaml={explicit:!1,version:"1.2"};Rt.defaultTags={"!!":"tag:yaml.org,2002:"};Jo.Directives=Rt});var Ii=w(Ct=>{"use strict";var Ko=R(),pf=Et();function mf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function Uo(t){let e=new Set;return pf.visit(t,{Value(i,n){n.anchor&&e.add(n.anchor)}}),e}function Go(t,e){for(let i=1;;++i){let n=`${t}${i}`;if(!e.has(n))return n}}function vf(t,e){let i=[],n=new Map,r=null;return{onAnchor:a=>{i.push(a),r??(r=Uo(t));let o=Go(e,r);return r.add(o),o},setAnchors:()=>{for(let a of i){let o=n.get(a);if(typeof o=="object"&&o.anchor&&(Ko.isScalar(o.node)||Ko.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}}Ct.anchorIsValid=mf;Ct.anchorNames=Uo;Ct.createNodeAnchors=vf;Ct.findNewAnchor=Go});var dr=w(Yo=>{"use strict";function Pt(t,e,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=Pt(t,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=Pt(t,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=Pt(t,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=Pt(t,n,r,a);o===void 0?delete n[r]:o!==a&&(n[r]=o)}return t.call(e,i,n)}Yo.applyReviver=Pt});var Ne=w(Qo=>{"use strict";var gf=R();function Xo(t,e,i){if(Array.isArray(t))return t.map((n,r)=>Xo(n,String(r),i));if(t&&typeof t.toJSON=="function"){if(!i||!gf.hasAnchor(t))return t.toJSON(e,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(t,n),i.onCreate=a=>{n.res=a,delete i.onCreate};let r=t.toJSON(e,i);return i.onCreate&&i.onCreate(r),r}return typeof t=="bigint"&&!i?.keep?Number(t):t}Qo.toJS=Xo});var ji=w(es=>{"use strict";var wf=dr(),Zo=R(),yf=Ne(),hr=class{constructor(e){Object.defineProperty(this,Zo.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:a}={}){if(!Zo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=yf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof a=="function"?wf.applyReviver(a,{"":s},"",s):s}};es.NodeBase=hr});var At=w(ts=>{"use strict";var Nf=Ii(),bf=Et(),rt=R(),Sf=ji(),kf=Ne(),pr=class extends Sf.NodeBase{constructor(e){super(rt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;i?.aliasResolveCache?n=i.aliasResolveCache:(n=[],bf.visit(e,{Node:(a,o)=>{(rt.isAlias(o)||rt.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(e,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||(kf.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=Oi(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(e,i,n){let r=`*${this.source}`;if(e){if(Nf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${r} `}return r}};function Oi(t,e,i){if(rt.isAlias(e)){let n=e.resolve(t),r=i&&n&&i.get(n);return r?r.count*r.aliasCount:0}else if(rt.isCollection(e)){let n=0;for(let r of e.items){let a=Oi(t,r,i);a>n&&(n=a)}return n}else if(rt.isPair(e)){let n=Oi(t,e.key,i),r=Oi(t,e.value,i);return Math.max(n,r)}return 1}ts.Alias=pr});var $=w(mr=>{"use strict";var Ef=R(),Rf=ji(),Cf=Ne(),Pf=t=>!t||typeof t!="function"&&typeof t!="object",be=class extends Rf.NodeBase{constructor(e){super(Ef.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:Cf.toJS(this.value,e,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";mr.Scalar=be;mr.isScalarValue=Pf});var xt=w(ns=>{"use strict";var Af=At(),He=R(),is=$(),xf="tag:yaml.org,2002:";function Tf(t,e,i){if(e){let n=i.filter(a=>a.tag===e),r=n.find(a=>!a.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return i.find(n=>n.identify?.(t)&&!n.format)}function _f(t,e,i){if(He.isDocument(t)&&(t=t.contents),He.isNode(t))return t;if(He.isPair(t)){let f=i.schema[He.MAP].createNode?.(i.schema,null,i);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:r,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(n&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=r(t)),new Af.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=xf+e.slice(2));let l=Tf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new is.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?o[He.MAP]:Symbol.iterator in Object(t)?o[He.SEQ]:o[He.MAP]}a&&(a(l),delete i.onTagObj);let u=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new is.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}ns.createNode=_f});var Hi=w($i=>{"use strict";var If=xt(),de=R(),jf=ji();function vr(t,e,i){let n=i;for(let r=e.length-1;r>=0;--r){let a=e[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=n,n=o}else n=new Map([[a,n]])}return If.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var rs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,gr=class extends jf.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(n=>de.isNode(n)||de.isPair(n)?n.clone(e):n),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(rs(e))this.add(i);else{let[n,...r]=e,a=this.get(n,!0);if(de.isCollection(a))a.addIn(r,i);else if(a===void 0&&this.schema)this.set(n,vr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[i,...n]=e;if(n.length===0)return this.delete(i);let r=this.get(i,!0);if(de.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}getIn(e,i){let[n,...r]=e,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(e){return this.items.every(i=>{if(!de.isPair(i))return!1;let n=i.value;return n==null||e&&de.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[i,...n]=e;if(n.length===0)return this.has(i);let r=this.get(i,!0);return de.isCollection(r)?r.hasIn(n):!1}setIn(e,i){let[n,...r]=e;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,vr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};$i.Collection=gr;$i.collectionFromPath=vr;$i.isEmptyPath=rs});var Tt=w(Mi=>{"use strict";var Of=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function wr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var $f=(t,e,i)=>t.endsWith(`
6
- `)?wr(i,e):i.includes(`
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(`
7
7
  `)?`
8
- `+wr(i,e):(t.endsWith(" ")?"":" ")+i;Mi.indentComment=wr;Mi.lineComment=$f;Mi.stringifyComment=Of});var os=w(_t=>{"use strict";var Hf="flow",yr="block",Li="quoted";function Mf(t,e,i="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!r||r<0)return t;r<a&&(a=0);let c=Math.max(1+a,1+r-e.length);if(t.length<=c)return t;let l=[],u={},f=r-e.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===yr&&(h=as(t,h,e.length),h!==-1&&(f=h+c));for(let S;S=t[h+=1];){if(i===Li&&S==="\\"){switch(p=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(S===`
9
- `)i===yr&&(h=as(t,h,e.length)),f=h+e.length+c,d=void 0;else{if(S===" "&&m&&m!==" "&&m!==`
10
- `&&m!==" "){let k=t[h+1];k&&k!==" "&&k!==`
11
- `&&k!==" "&&(d=h)}if(h>=f)if(d)l.push(d),f=d+c,d=void 0;else if(i===Li){for(;m===" "||m===" ";)m=S,S=t[h+=1],g=!0;let k=h>y+1?h-2:p-1;if(u[k])return t;l.push(k),u[k]=!0,f=k+c,d=void 0}else g=!0}m=S}if(g&&s&&s(),l.length===0)return t;o&&o();let N=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let k=l[S],E=l[S+1]||t.length;k===0?N=`
12
- ${e}${t.slice(0,E)}`:(i===Li&&u[k]&&(N+=`${t[k]}\\`),N+=`
13
- ${e}${t.slice(k+1,E)}`)}return N}function as(t,e,i){let n=e,r=e+1,a=t[r];for(;a===" "||a===" ";)if(e<r+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
14
- `);n=e,r=e+1,a=t[r]}return n}_t.FOLD_BLOCK=yr;_t.FOLD_FLOW=Hf;_t.FOLD_QUOTED=Li;_t.foldFlowLines=Mf});var jt=w(ss=>{"use strict";var ie=$(),Se=os(),Fi=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Bi=t=>/^(%|---|\.\.\.)/m.test(t);function Lf(t,e,i){if(!e||e<0)return!1;let n=e-i,r=t.length;if(r<=n)return!1;for(let a=0,o=0;a<r;++a)if(t[a]===`
15
- `){if(a-o>n)return!0;if(o=a+1,r-o<=n)return!1}return!0}function It(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Bi(t)?" ":""),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
+ `+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)+`
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:Se.foldFlowLines(o,a,Se.FOLD_QUOTED,Fi(e,!1))}function Nr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return It(t,e);let i=e.indent||(Bi(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${i}`)+"'";return e.implicitKey?n:Se.foldFlowLines(n,i,Se.FOLD_FLOW,Fi(e,!1))}function at(t,e){let{singleQuote:i}=e.options,n;if(i===!1)n=It;else{let r=t.includes('"'),a=t.includes("'");r&&!a?n=Nr:a&&!r?n=It:n=i?Nr:It}return n(t,e)}var br;try{br=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,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(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{br=/\n+(?!\n|$)/g}function Di({comment:t,type:e,value:i},n,r,a){let{blockQuote:o,commentString:s,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(i))return at(i,n);let l=n.indent||(n.forceBlockIndent||Bi(i)?" ":""),u=o==="literal"?!0:o==="folded"||e===ie.Scalar.BLOCK_FOLDED?!1:e===ie.Scalar.BLOCK_LITERAL?!0:!Lf(i,c,l.length);if(!i)return u?`|
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?`|
24
24
  `:`>
25
25
  `;let f,d;for(d=i.length;d>0;--d){let E=i[d-1];if(E!==`
26
26
  `&&E!==" "&&E!==" ")break}let m=i.substring(d),g=m.indexOf(`
27
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(br,`$&${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 k=(h?l?"2":"1":"")+f;if(t&&(k+=" "+s(t.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=Fi(n,!0);o!=="folded"&&e!==ie.Scalar.BLOCK_FOLDED&&(C.onOverflow=()=>{v=!0});let b=Se.foldFlowLines(`${N}${E}${m}`,l,Se.FOLD_BLOCK,C);if(!v)return`>${k}
31
- ${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${k}
32
- ${l}${N}${i}${m}`}function Df(t,e,i,n){let{type:r,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=e;if(s&&a.includes(`
33
- `)||u&&/[[\]{},]/.test(a))return at(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
- `)?at(a,e):Di(t,e,i,n);if(!s&&!u&&r!==ie.Scalar.PLAIN&&a.includes(`
35
- `))return Di(t,e,i,n);if(Bi(a)){if(c==="")return e.forceBlockIndent=!0,Di(t,e,i,n);if(s&&c===l)return at(a,e)}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}=e.doc.schema;if(g.some(d)||m?.some(d))return at(a,e)}return s?f:Se.foldFlowLines(f,c,Se.FOLD_FLOW,Fi(e,!1))}function Ff(t,e,i,n){let{implicitKey:r,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;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?at(o.value,e):Di(o,e,i,n);case ie.Scalar.QUOTE_DOUBLE:return It(o.value,e);case ie.Scalar.QUOTE_SINGLE:return Nr(o.value,e);case ie.Scalar.PLAIN:return Df(o,e,i,n);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=r&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}ss.stringifyString=Ff});var Ot=w(Sr=>{"use strict";var Bf=Ii(),ke=R(),qf=Tt(),Vf=jt();function zf(t,e){let i=Object.assign({blockQuote:!0,commentString:qf.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(i.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:n,options:i}}function Wf(t,e){if(e.tag){let r=t.filter(a=>a.tag===e.tag);if(r.length>0)return r.find(a=>a.format===e.format)??r[0]}let i,n;if(ke.isScalar(e)){n=e.value;let r=t.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===e.format)??r.find(a=>!a.format)}else n=e,i=t.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!i){let r=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${r} value`)}return i}function Jf(t,e,{anchors:i,doc:n}){if(!n.directives)return"";let r=[],a=(ke.isScalar(t)||ke.isCollection(t))&&t.anchor;a&&Bf.anchorIsValid(a)&&(i.add(a),r.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function Kf(t,e,i,n){if(ke.isPair(t))return t.toString(e,i,n);if(ke.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,a=ke.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Wf(e.doc.schema.tags,a));let o=Jf(a,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof r.stringify=="function"?r.stringify(a,e,i,n):ke.isScalar(a)?Vf.stringifyString(a,e,i,n):a.toString(e,i,n);return o?ke.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${e.indent}${s}`:s}Sr.createStringifyContext=zf;Sr.stringify=Kf});var fs=w(us=>{"use strict";var we=R(),cs=$(),ls=Ot(),$t=Tt();function Uf({key:t,value:e},i,n,r){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=i,d=we.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let m=!f&&(!t||d&&e==null&&!i.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===cs.Scalar.BLOCK_FOLDED||t.type===cs.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(f||!a),indent:s+c});let g=!1,h=!1,p=ls.stringify(t,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||e==null)return g&&n&&n(),p===""?"?":m?`? ${p}`:p}else if(a&&!f||e==null&&m)return p=`? ${p}`,d&&!g?p+=$t.lineComment(p,i.indent,l(d)):h&&r&&r(),p;g&&(d=null),m?(d&&(p+=$t.lineComment(p,i.indent,l(d))),p=`? ${p}
38
- ${s}:`):(p=`${p}:`,d&&(p+=$t.lineComment(p,i.indent,l(d))));let y,N,S;we.isNode(e)?(y=!!e.spaceBefore,N=e.commentBefore,S=e.comment):(y=!1,N=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!m&&!d&&we.isScalar(e)&&(i.indentAtStart=p.length+1),h=!1,!u&&c.length>=2&&!i.inFlow&&!m&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let k=!1,E=ls.stringify(e,i,()=>k=!0,()=>h=!0),v=" ";if(d||y||N){if(v=y?`
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
39
  `:"",N){let C=l(N);v+=`
40
- ${$t.indentComment(C,i.indent)}`}E===""&&!i.inFlow?v===`
41
- `&&S&&(v=`
40
+ ${Ft.indentComment(C,i.indent)}`}E===""&&!i.inFlow?v===`
41
+ `&&k&&(v=`
42
42
 
43
43
  `):v+=`
44
- ${i.indent}`}else if(!m&&we.isCollection(e)){let C=E[0],b=E.indexOf(`
45
- `),_=b!==-1,W=i.inFlow??e.flow??e.items.length===0;if(_||!W){let tt=!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)&&(tt=!0)}tt||(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
46
  ${i.indent}`)}}else(E===""||E[0]===`
47
- `)&&(v="");return p+=v+E,i.inFlow?k&&n&&n():S&&!k?p+=$t.lineComment(p,i.indent,l(S)):h&&r&&r(),p}us.stringifyPair=Uf});var Er=w(kr=>{"use strict";var ds=Pi("process");function Gf(t,...e){t==="debug"&&console.log(...e)}function Yf(t,e){(t==="debug"||t==="warn")&&(typeof ds.emitWarning=="function"?ds.emitWarning(e):console.warn(e))}kr.debug=Gf;kr.warn=Yf});var Ji=w(Wi=>{"use strict";var zi=R(),hs=$(),qi="<<",Vi={identify:t=>t===qi||typeof t=="symbol"&&t.description===qi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new hs.Scalar(Symbol(qi)),{addToJSMap:ps}),stringify:()=>qi},Xf=(t,e)=>(Vi.identify(e)||zi.isScalar(e)&&(!e.type||e.type===hs.Scalar.PLAIN)&&Vi.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Vi.tag&&i.default);function ps(t,e,i){let n=ms(t,i);if(zi.isSeq(n))for(let r of n.items)Rr(t,e,r);else if(Array.isArray(n))for(let r of n)Rr(t,e,r);else Rr(t,e,n)}function Rr(t,e,i){let n=ms(t,i);if(!zi.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,t,Map);for(let[a,o]of r)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function ms(t,e){return t&&zi.isAlias(e)?e.resolve(t.doc,t):e}Wi.addMergeToJSMap=ps;Wi.isMergeKey=Xf;Wi.merge=Vi});var Pr=w(ws=>{"use strict";var Qf=Er(),vs=Ji(),Zf=Ot(),gs=R(),Cr=Ne();function ed(t,e,{key:i,value:n}){if(gs.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,n);else if(vs.isMergeKey(t,i))vs.addMergeToJSMap(t,e,n);else{let r=Cr.toJS(i,"",t);if(e instanceof Map)e.set(r,Cr.toJS(n,r,t));else if(e instanceof Set)e.add(r);else{let a=td(i,r,t),o=Cr.toJS(n,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function td(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(gs.isNode(t)&&i?.doc){let n=Zf.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=t.toString(n);if(!i.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),Qf.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(e)}ws.addPairToJSMap=ed});var Ee=w(Ar=>{"use strict";var ys=xt(),id=fs(),nd=Pr(),Ki=R();function rd(t,e,i){let n=ys.createNode(t,void 0,i),r=ys.createNode(e,void 0,i);return new Ui(n,r)}var Ui=class t{constructor(e,i=null){Object.defineProperty(this,Ki.NODE_TYPE,{value:Ki.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:n}=this;return Ki.isNode(i)&&(i=i.clone(e)),Ki.isNode(n)&&(n=n.clone(e)),new t(i,n)}toJSON(e,i){let n=i?.mapAsMap?new Map:{};return nd.addPairToJSMap(i,n,this)}toString(e,i,n){return e?.doc?id.stringifyPair(this,e,i,n):JSON.stringify(this)}};Ar.Pair=Ui;Ar.createPair=rd});var xr=w(bs=>{"use strict";var Me=R(),Ns=Ot(),Gi=Tt();function ad(t,e,i){return(e.inFlow??t.flow?sd:od)(t,e,i)}function od({comment:t,items:e},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<e.length;++g){let h=e[g],p=null;if(Me.isNode(h))!f&&h.spaceBefore&&d.push(""),Yi(i,d,h.commentBefore,f),h.comment&&(p=h.comment);else if(Me.isPair(h)){let N=Me.isNode(h.key)?h.key:null;N&&(!f&&N.spaceBefore&&d.push(""),Yi(i,d,N.commentBefore,f))}f=!1;let y=Ns.stringify(h,u,()=>p=null,()=>f=!0);p&&(y+=Gi.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?`
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?`
48
48
  ${c}${h}`:`
49
- `}}return t?(m+=`
50
- `+Gi.indentComment(l(t),c),s&&s()):f&&o&&o(),m}function sd({items:t},e,{flowChars:i,itemIndent:n}){let{indent:r,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;n+=a;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<t.length;++g){let h=t[g],p=null;if(Me.isNode(h))h.spaceBefore&&f.push(""),Yi(e,f,h.commentBefore,!1),h.comment&&(p=h.comment);else if(Me.isPair(h)){let N=Me.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&f.push(""),Yi(e,f,N.commentBefore,!1),N.comment&&(l=!0));let S=Me.isNode(h.value)?h.value:null;S?(S.comment&&(p=S.comment),S.commentBefore&&(l=!0)):h.value==null&&N?.comment&&(p=N.comment)}p&&(l=!0);let y=Ns.stringify(h,c,()=>p=null);l||(l=f.length>u||y.includes(`
51
- `)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((N,S)=>N+S.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),p&&(y+=Gi.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=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let h of f)g+=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
52
  ${a}${r}${h}`:`
53
53
  `;return`${g}
54
- ${r}${m}`}else return`${d}${o}${f.join(" ")}${o}${m}`}function Yi({indent:t,options:{commentString:e}},i,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let a=Gi.indentComment(e(n),t);i.push(a.trimStart())}}bs.stringifyCollection=ad});var Ce=w(_r=>{"use strict";var cd=xr(),ld=Pr(),ud=Hi(),Re=R(),Xi=Ee(),fd=$();function Ht(t,e){let i=Re.isScalar(e)?e.value:e;for(let n of t)if(Re.isPair(n)&&(n.key===e||n.key===i||Re.isScalar(n.key)&&n.key.value===i))return n}var Tr=class extends ud.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Re.MAP,e),this.items=[]}static from(e,i,n){let{keepUndefined:r,replacer:a}=n,o=new this(e),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(Xi.createPair(c,l,n))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let n;Re.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Xi.Pair(e,e?.value):n=new Xi.Pair(e.key,e.value);let r=Ht(this.items,n.key),a=this.schema?.sortMapEntries;if(r){if(!i)throw new Error(`Key ${n.key} already set`);Re.isScalar(r.value)&&fd.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(e){let i=Ht(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let r=Ht(this.items,e)?.value;return(!i&&Re.isScalar(r)?r.value:r)??void 0}has(e){return!!Ht(this.items,e)}set(e,i){this.add(new Xi.Pair(e,i),!0)}toJSON(e,i,n){let r=n?new n:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(r);for(let a of this.items)ld.addPairToJSMap(i,r,a);return r}toString(e,i,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Re.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),cd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:i})}};_r.YAMLMap=Tr;_r.findPair=Ht});var ot=w(ks=>{"use strict";var dd=R(),Ss=Ce(),hd={collection:"map",default:!0,nodeClass:Ss.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return dd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>Ss.YAMLMap.from(t,e,i)};ks.map=hd});var Pe=w(Es=>{"use strict";var pd=xt(),md=xr(),vd=Hi(),Zi=R(),gd=$(),wd=Ne(),Ir=class extends vd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Zi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=Qi(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let n=Qi(e);if(typeof n!="number")return;let r=this.items[n];return!i&&Zi.isScalar(r)?r.value:r}has(e){let i=Qi(e);return typeof i=="number"&&i<this.items.length}set(e,i){let n=Qi(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Zi.isScalar(r)&&gd.isScalarValue(i)?r.value=i:this.items[n]=i}toJSON(e,i){let n=[];i?.onCreate&&i.onCreate(n);let r=0;for(let a of this.items)n.push(wd.toJS(a,String(r++),i));return n}toString(e,i,n){return e?md.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:i}):JSON.stringify(this)}static from(e,i,n){let{replacer:r}=n,a=new this(e);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(pd.createNode(s,void 0,n))}}return a}};function Qi(t){let e=Zi.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Es.YAMLSeq=Ir});var st=w(Cs=>{"use strict";var yd=R(),Rs=Pe(),Nd={collection:"seq",default:!0,nodeClass:Rs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return yd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>Rs.YAMLSeq.from(t,e,i)};Cs.seq=Nd});var Mt=w(Ps=>{"use strict";var bd=jt(),Sd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,n){return e=Object.assign({actualString:!0},e),bd.stringifyString(t,e,i,n)}};Ps.string=Sd});var en=w(Ts=>{"use strict";var As=$(),xs={identify:t=>t==null,createNode:()=>new As.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new As.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&xs.test.test(t)?t:e.options.nullStr};Ts.nullTag=xs});var jr=w(Is=>{"use strict";var kd=$(),_s={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new kd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&_s.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?i.options.trueStr:i.options.falseStr}};Is.boolTag=_s});var ct=w(js=>{"use strict";function Ed({format:t,minFractionDigits:e,tag:i,value:n}){if(typeof n=="bigint")return String(n);let r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let a=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!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=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}js.stringifyNumber=Ed});var $r=w(tn=>{"use strict";var Rd=$(),Or=ct(),Cd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Or.stringifyNumber},Pd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Or.stringifyNumber(t)}},Ad={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Rd.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:Or.stringifyNumber};tn.float=Ad;tn.floatExp=Pd;tn.floatNaN=Cd});var Mr=w(rn=>{"use strict";var Os=ct(),nn=t=>typeof t=="bigint"||Number.isInteger(t),Hr=(t,e,i,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),i);function $s(t,e,i){let{value:n}=t;return nn(n)&&n>=0?i+n.toString(e):Os.stringifyNumber(t)}var xd={identify:t=>nn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>Hr(t,2,8,i),stringify:t=>$s(t,8,"0o")},Td={identify:nn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>Hr(t,0,10,i),stringify:Os.stringifyNumber},_d={identify:t=>nn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>Hr(t,2,16,i),stringify:t=>$s(t,16,"0x")};rn.int=Td;rn.intHex=_d;rn.intOct=xd});var Ms=w(Hs=>{"use strict";var Id=ot(),jd=en(),Od=st(),$d=Mt(),Hd=jr(),Lr=$r(),Dr=Mr(),Md=[Id.map,Od.seq,$d.string,jd.nullTag,Hd.boolTag,Dr.intOct,Dr.int,Dr.intHex,Lr.floatNaN,Lr.floatExp,Lr.float];Hs.schema=Md});var Fs=w(Ds=>{"use strict";var Ld=$(),Dd=ot(),Fd=st();function Ls(t){return typeof t=="bigint"||Number.isInteger(t)}var an=({value:t})=>JSON.stringify(t),Bd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:an},{identify:t=>t==null,createNode:()=>new Ld.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:an},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:an},{identify:Ls,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ls(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:an}],qd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Vd=[Dd.map,Fd.seq].concat(Bd,qd);Ds.schema=Vd});var Br=w(Bs=>{"use strict";var Lt=Pi("buffer"),Fr=$(),zd=jt(),Wd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Lt.Buffer=="function")return Lt.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(i.length);for(let r=0;r<i.length;++r)n[r]=i.charCodeAt(r);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},n,r,a){if(!i)return"";let o=i,s;if(typeof Lt.Buffer=="function")s=o instanceof Lt.Buffer?o.toString("base64"):Lt.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(e??(e=Fr.Scalar.BLOCK_LITERAL),e!==Fr.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(e===Fr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return zd.stringifyString({comment:t,type:e,value:s},n,r,a)}};Bs.binary=Wd});var cn=w(sn=>{"use strict";var on=R(),qr=Ee(),Jd=$(),Kd=Pe();function qs(t,e){if(on.isSeq(t))for(let i=0;i<t.items.length;++i){let n=t.items[i];if(!on.isPair(n)){if(on.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let r=n.items[0]||new qr.Pair(new Jd.Scalar(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
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
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}t.items[i]=on.isPair(n)?n:new qr.Pair(n)}}else e("Expected a sequence for this tag");return t}function Vs(t,e,i){let{replacer:n}=i,r=new Kd.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,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(qr.createPair(s,c,i))}return r}var Ud={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:qs,createNode:Vs};sn.createPairs=Vs;sn.pairs=Ud;sn.resolvePairs=qs});var Wr=w(zr=>{"use strict";var zs=R(),Vr=Ne(),Dt=Ce(),Gd=Pe(),Ws=cn(),Le=class t extends Gd.YAMLSeq{constructor(){super(),this.add=Dt.YAMLMap.prototype.add.bind(this),this.delete=Dt.YAMLMap.prototype.delete.bind(this),this.get=Dt.YAMLMap.prototype.get.bind(this),this.has=Dt.YAMLMap.prototype.has.bind(this),this.set=Dt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(zs.isPair(r)?(a=Vr.toJS(r.key,"",i),o=Vr.toJS(r.value,a,i)):a=Vr.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(e,i,n){let r=Ws.createPairs(e,i,n),a=new this;return a.items=r.items,a}};Le.tag="tag:yaml.org,2002:omap";var Yd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Le,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Ws.resolvePairs(t,e),n=[];for(let{key:r}of i.items)zs.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Le,i)},createNode:(t,e,i)=>Le.from(t,e,i)};zr.YAMLOMap=Le;zr.omap=Yd});var Ys=w(Jr=>{"use strict";var Js=$();function Ks({value:t,source:e},i){return e&&(t?Us:Gs).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Us={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Js.Scalar(!0),stringify:Ks},Gs={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Js.Scalar(!1),stringify:Ks};Jr.falseTag=Gs;Jr.trueTag=Us});var Xs=w(ln=>{"use strict";var Xd=$(),Kr=ct(),Qd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Kr.stringifyNumber},Zd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Kr.stringifyNumber(t)}},eh={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Xd.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let n=t.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Kr.stringifyNumber};ln.float=eh;ln.floatExp=Zd;ln.floatNaN=Qd});var Zs=w(Bt=>{"use strict";var Qs=ct(),Ft=t=>typeof t=="bigint"||Number.isInteger(t);function un(t,e,i,{intAsBigInt:n}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return r==="-"?-1*a:a}function Ur(t,e,i){let{value:n}=t;if(Ft(n)){let r=n.toString(e);return n<0?"-"+i+r.substr(1):i+r}return Qs.stringifyNumber(t)}var th={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>un(t,2,2,i),stringify:t=>Ur(t,2,"0b")},ih={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>un(t,1,8,i),stringify:t=>Ur(t,8,"0")},nh={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>un(t,0,10,i),stringify:Qs.stringifyNumber},rh={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>un(t,2,16,i),stringify:t=>Ur(t,16,"0x")};Bt.int=nh;Bt.intBin=th;Bt.intHex=rh;Bt.intOct=ih});var Yr=w(Gr=>{"use strict";var hn=R(),fn=Ee(),dn=Ce(),De=class t extends dn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;hn.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new fn.Pair(e.key,null):i=new fn.Pair(e,null),dn.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let n=dn.findPair(this.items,e);return!i&&hn.isPair(n)?hn.isScalar(n.key)?n.key.value:n.key:n}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=dn.findPair(this.items,e);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new fn.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(fn.createPair(o,null,n));return a}};De.tag="tag:yaml.org,2002:set";var ah={collection:"map",identify:t=>t instanceof Set,nodeClass:De,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>De.from(t,e,i),resolve(t,e){if(hn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new De,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Gr.YAMLSet=De;Gr.set=ah});var Qr=w(pn=>{"use strict";var oh=ct();function Xr(t,e){let i=t[0],n=i==="-"||i==="+"?t.substring(1):t,r=o=>e?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 ec(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return oh.stringifyNumber(t);let n="";e<0&&(n="-",e*=i(-1));let r=i(60),a=[e%r];return e<60?a.unshift(0):(e=(e-a[0])/r,a.unshift(e%r),e>=60&&(e=(e-a[0])/r,a.unshift(e))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var sh={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:i})=>Xr(t,i),stringify:ec},ch={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Xr(t,!1),stringify:ec},tc={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(tc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),u=e[8];if(u&&u!=="Z"){let f=Xr(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};pn.floatTime=ch;pn.intTime=sh;pn.timestamp=tc});var rc=w(nc=>{"use strict";var lh=ot(),uh=en(),fh=st(),dh=Mt(),hh=Br(),ic=Ys(),Zr=Xs(),mn=Zs(),ph=Ji(),mh=Wr(),vh=cn(),gh=Yr(),ea=Qr(),wh=[lh.map,fh.seq,dh.string,uh.nullTag,ic.trueTag,ic.falseTag,mn.intBin,mn.intOct,mn.int,mn.intHex,Zr.floatNaN,Zr.floatExp,Zr.float,hh.binary,ph.merge,mh.omap,vh.pairs,gh.set,ea.intTime,ea.floatTime,ea.timestamp];nc.schema=wh});var pc=w(na=>{"use strict";var cc=ot(),yh=en(),lc=st(),Nh=Mt(),bh=jr(),ta=$r(),ia=Mr(),Sh=Ms(),kh=Fs(),uc=Br(),qt=Ji(),fc=Wr(),dc=cn(),ac=rc(),hc=Yr(),vn=Qr(),oc=new Map([["core",Sh.schema],["failsafe",[cc.map,lc.seq,Nh.string]],["json",kh.schema],["yaml11",ac.schema],["yaml-1.1",ac.schema]]),sc={binary:uc.binary,bool:bh.boolTag,float:ta.float,floatExp:ta.floatExp,floatNaN:ta.floatNaN,floatTime:vn.floatTime,int:ia.int,intHex:ia.intHex,intOct:ia.intOct,intTime:vn.intTime,map:cc.map,merge:qt.merge,null:yh.nullTag,omap:fc.omap,pairs:dc.pairs,seq:lc.seq,set:hc.set,timestamp:vn.timestamp},Eh={"tag:yaml.org,2002:binary":uc.binary,"tag:yaml.org,2002:merge":qt.merge,"tag:yaml.org,2002:omap":fc.omap,"tag:yaml.org,2002:pairs":dc.pairs,"tag:yaml.org,2002:set":hc.set,"tag:yaml.org,2002:timestamp":vn.timestamp};function Rh(t,e,i){let n=oc.get(e);if(n&&!t)return i&&!n.includes(qt.merge)?n.concat(qt.merge):n.slice();let r=n;if(!r)if(Array.isArray(t))r=[];else{let a=Array.from(oc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)r=r.concat(a);else typeof t=="function"&&(r=t(r.slice()));return i&&(r=r.concat(qt.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?sc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(sc).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},[])}na.coreKnownTags=Eh;na.getTags=Rh});var oa=w(mc=>{"use strict";var ra=R(),Ch=ot(),Ph=st(),Ah=Mt(),gn=pc(),xh=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,aa=class t{constructor({compat:e,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?gn.getTags(e,"compat"):e?gn.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?gn.coreKnownTags:{},this.tags=gn.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,ra.MAP,{value:Ch.map}),Object.defineProperty(this,ra.SCALAR,{value:Ah.string}),Object.defineProperty(this,ra.SEQ,{value:Ph.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?xh:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};mc.Schema=aa});var gc=w(vc=>{"use strict";var Th=R(),sa=Ot(),Vt=Tt();function _h(t,e){let i=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&i.push("---");let r=sa.createStringifyContext(t,e),{commentString:a}=r.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(Vt.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(Th.isNode(t.contents)){if(t.contents.spaceBefore&&n&&i.push(""),t.contents.commentBefore){let u=a(t.contents.commentBefore);i.push(Vt.indentComment(u,""))}r.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=sa.stringify(t.contents,r,()=>s=null,c);s&&(l+=Vt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(sa.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
58
- `)?(i.push("..."),i.push(Vt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Vt.indentComment(a(c),"")))}return i.join(`
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(`
59
59
  `)+`
60
- `}vc.stringifyDocument=_h});var zt=w(wc=>{"use strict";var Ih=At(),lt=Hi(),Y=R(),jh=Ee(),Oh=Ne(),$h=oa(),Hh=gc(),ca=Ii(),Mh=dr(),Lh=xt(),la=fr(),ua=class t{constructor(e,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 la.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let e=Object.create(t.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Y.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ut(this.contents)&&this.contents.add(e)}addIn(e,i){ut(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let n=ca.anchorNames(this);e.anchor=!i||n.has(i)?ca.findNewAnchor(i||"a",n):i}return new Ih.Alias(e.anchor)}createNode(e,i,n){let r;if(typeof i=="function")e=i.call({"":e},"",e),r=i;else if(Array.isArray(i)){let 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}=ca.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},h=Lh.createNode(e,u,g);return s&&Y.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,i,n={}){let r=this.createNode(e,null,n),a=this.createNode(i,null,n);return new jh.Pair(r,a)}delete(e){return ut(this.contents)?this.contents.delete(e):!1}deleteIn(e){return lt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ut(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return Y.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return lt.isEmptyPath(e)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return Y.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return lt.isEmptyPath(e)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=lt.collectionFromPath(this.schema,[e],i):ut(this.contents)&&this.contents.set(e,i)}setIn(e,i){lt.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=lt.collectionFromPath(this.schema,Array.from(e),i):ut(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new la.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new la.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(n)this.schema=new $h.Schema(Object.assign(n,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:n,maxAliasCount:r,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Oh.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"?Mh.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Hh.stringifyDocument(this,e)}};function ut(t){if(Y.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}wc.Document=ua});var Kt=w(Jt=>{"use strict";var Wt=class extends Error{constructor(e,i,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=i}},fa=class extends Wt{constructor(e,i,n){super("YAMLParseError",e,i,n)}},da=class extends Wt{constructor(e,i,n){super("YAMLWarning",e,i,n)}},Dh=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:n,col:r}=i.linePos[0];i.message+=` at line ${n}, column ${r}`;let a=r-1,o=t.substring(e.lineStarts[n-1],e.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=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);s.length>80&&(s=s.substring(0,79)+`…
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
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+=`:
62
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};Jt.YAMLError=Wt;Jt.YAMLParseError=fa;Jt.YAMLWarning=da;Jt.prettifyError=Dh});var Ut=w(yc=>{"use strict";function Fh(t,{flow:e,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,S=null,k=null,E=null;for(let b of t)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":!e&&(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:(!k||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`),k&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),k=b,l=i==="seq-item-ind"||i==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=b,l=!1,u=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,u=!1}let v=t[t.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:S,found:k,spaceBefore:c,comment:f,hasNewline:m,anchor:p,tag:y,newlineAfterProp:N,end:C,start:E??C}}yc.resolveProps=Fh});var wn=w(Nc=>{"use strict";function ha(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
- `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(ha(e.key)||ha(e.value))return!0}return!1;default:return!0}}Nc.containsNewline=ha});var pa=w(bc=>{"use strict";var Bh=wn();function qh(t,e,i){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Bh.containsNewline(e)&&i(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}bc.flowIndentCheck=qh});var ma=w(kc=>{"use strict";var Sc=R();function Vh(t,e,i){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let r=typeof n=="function"?n:(a,o)=>a===o||Sc.isScalar(a)&&Sc.isScalar(o)&&a.value===o.value;return e.some(a=>r(a.key,i))}kc.mapIncludes=Vh});var xc=w(Ac=>{"use strict";var Ec=Ee(),zh=Ce(),Rc=Ut(),Wh=wn(),Cc=pa(),Jh=ma(),Pc="All mapping items must start at the same column";function Kh({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??zh.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=Rc.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",Pc)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(s.comment?s.comment+=`
67
- `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Wh.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",Pc);i.atKey=!0;let y=h.end,N=d?t(i,d,h,r):e(i,y,f,null,h,r);i.schema.compat&&Cc.flowIndentCheck(n.indent,d,r),i.atKey=!1,Jh.mapIncludes(i,s.items,N)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let S=Rc.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=S.end,S.found){p&&(g?.type==="block-map"&&!S.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<S.found.offset-1024&&r(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=g?t(i,g,S,r):e(i,c,m,null,S,r);i.schema.compat&&Cc.flowIndentCheck(n.indent,g,r),c=k.range[2];let E=new Ec.Pair(N,k);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"),S.comment&&(N.comment?N.comment+=`
68
- `+S.comment:N.comment=S.comment);let k=new Ec.Pair(N);i.options.keepSourceTokens&&(k.srcToken=u),s.items.push(k)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[n.offset,c,l??c],s}Ac.resolveBlockMap=Kh});var _c=w(Tc=>{"use strict";var Uh=Pe(),Gh=Ut(),Yh=pa();function Xh({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??Uh.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=Gh.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?t(i,f,d,r):e(i,d.end,u,null,d,r);i.schema.compat&&Yh.flowIndentCheck(n.indent,f,r),c=m.range[2],s.items.push(m)}return s.range=[n.offset,c,l??c],s}Tc.resolveBlockSeq=Xh});var ft=w(Ic=>{"use strict";function Qh(t,e,i,n){let r="";if(t){let a=!1,o="";for(let s of t){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`)}e+=c.length}}return{comment:r,offset:e}}Ic.resolveEnd=Qh});var Hc=w($c=>{"use strict";var Zh=R(),ep=Ee(),jc=Ce(),tp=Pe(),ip=ft(),Oc=Ut(),np=wn(),rp=ma(),va="Block collections are not allowed within flow collections",ga=t=>t&&(t.type==="block-map"||t.type==="block-seq");function ap({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=n.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?jc.YAMLMap:tp.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:S,sep:k,value:E}=y,v=Oc.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:S??k?.[0],offset:f,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!k&&!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(S)&&r(S,"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];Zh.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&&!k&&!v.found){let C=E?t(i,E,v,r):e(i,v.end,k,null,v,r);l.items.push(C),f=C.range[2],ga(E)&&r(C.range,"BLOCK_IN_FLOW",va)}else{i.atKey=!0;let C=v.end,b=S?t(i,S,v,r):e(i,C,N,null,v,r);ga(S)&&r(b.range,"BLOCK_IN_FLOW",va),i.atKey=!1;let _=Oc.resolveProps(k??[],{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(k)for(let H of k){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 W=E?t(i,E,_,r):_.found?e(i,_.end,k,null,_,r):null;W?ga(E)&&r(W.range,"BLOCK_IN_FLOW",va):_.comment&&(b.comment?b.comment+=`
71
- `+_.comment:b.comment=_.comment);let tt=new ep.Pair(b,W);if(i.options.keepSourceTokens&&(tt.srcToken=y),o){let H=l;rp.mapIncludes(i,H.items,b)&&r(C,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(tt)}else{let H=new jc.YAMLMap(i.schema);H.flow=!0,H.items.push(tt);let Oo=(W??b).range;H.range=[b.range[0],Oo[1],Oo[2]],l.items.push(H)}f=W?W.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=ip.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}$c.resolveFlowCollection=ap});var Lc=w(Mc=>{"use strict";var op=R(),sp=$(),cp=Ce(),lp=Pe(),up=xc(),fp=_c(),dp=Hc();function wa(t,e,i,n,r,a){let o=i.type==="block-map"?up.resolveBlockMap(t,e,i,n,a):i.type==="block-seq"?fp.resolveBlockSeq(t,e,i,n,a):dp.resolveFlowCollection(t,e,i,n,a),s=o.constructor;return r==="!"||r===s.tagName?(o.tag=s.tagName,o):(r&&(o.tag=r),o)}function hp(t,e,i,n,r){let a=n.tag,o=a?e.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===cp.YAMLMap.tagName&&s==="map"||o===lp.YAMLSeq.tagName&&s==="seq")return wa(t,e,i,r,o);let c=e.schema.tags.find(d=>d.tag===o&&d.collection===s);if(!c){let d=e.schema.knownTags[o];if(d?.collection===s)e.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),wa(t,e,i,r,o)}let l=wa(t,e,i,r,o,c),u=c.resolve?.(l,d=>r(a,"TAG_RESOLVE_FAILED",d),e.options)??l,f=op.isNode(u)?u:new sp.Scalar(u);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}Mc.composeCollection=hp});var Na=w(Dc=>{"use strict";var ya=$();function pp(t,e,i){let n=e.offset,r=mp(e,t.options.strict,i);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let a=r.mode===">"?ya.Scalar.BLOCK_FOLDED:ya.Scalar.BLOCK_LITERAL,o=e.source?vp(e.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 e.source&&(p+=e.source.length),{value:h,type:a,comment:r.comment,range:[n,p,p]}}let c=e.indent+r.indent,l=e.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&&!t.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 k=`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",k),p=""}a===ya.Scalar.BLOCK_LITERAL?(f+=d+p.slice(c)+y,d=`
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
75
  `):p.length>c||y[0]===" "?(d===" "?d=`
76
76
  `:!m&&d===`
77
77
  `&&(d=`
@@ -84,62 +84,62 @@ ${l}
84
84
  `+o[h][0].slice(c);f[f.length-1]!==`
85
85
  `&&(f+=`
86
86
  `);break;default:f+=`
87
- `}let g=n+r.length+e.source.length;return{value:f,type:a,comment:r.comment,range:[n,g,g]}}function mp({offset:t,props:e},i,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],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=t+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<e.length;++d){let m=e[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 vp(t){let e=t.split(/\n( *)/),i=e[0],n=i.match(/^( *)/),a=[n?.[1]?[n[1],i.slice(n[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}Dc.resolveBlockScalar=pp});var Sa=w(Bc=>{"use strict";var ba=$(),gp=ft();function wp(t,e,i){let{offset:n,type:r,source:a,end:o}=t,s,c,l=(d,m,g)=>i(n+d,m,g);switch(r){case"scalar":s=ba.Scalar.PLAIN,c=yp(a,l);break;case"single-quoted-scalar":s=ba.Scalar.QUOTE_SINGLE,c=Np(a,l);break;case"double-quoted-scalar":s=ba.Scalar.QUOTE_DOUBLE,c=bp(a,l);break;default:return i(t,"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=gp.resolveEnd(o,u,e,i);return{value:c,type:s,comment:f.comment,range:[n,u,f.offset]}}function yp(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Fc(t)}function Np(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Fc(t.slice(1,-1)).replace(/''/g,"'")}function Fc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
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?
88
88
  `,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let r=n[1],a=" ",o=e.lastIndex;for(i.lastIndex=o;n=i.exec(t);)n[1]===""?a===`
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
90
  `?r+=a:a=`
91
- `:(r+=a+n[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,n=s.exec(t),r+a+(n?.[1]??"")}function bp(t,e){let i="";for(let n=1;n<t.length-1;++n){let r=t[n];if(!(r==="\r"&&t[n+1]===`
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
92
  `))if(r===`
93
- `){let{fold:a,offset:o}=Sp(t,n);i+=a,n=o}else if(r==="\\"){let a=t[++n],o=kp[a];if(o)i+=o;else if(a===`
94
- `)for(a=t[n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="\r"&&t[n+1]===`
95
- `)for(a=t[++n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Ep(t,n+1,s,e),n+=s}else{let s=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(r===" "||r===" "){let a=n,o=t[n+1];for(;o===" "||o===" ";)o=t[++n+1];o!==`
96
- `&&!(o==="\r"&&t[n+2]===`
97
- `)&&(i+=n>a?t.slice(a,n+1):r)}else i+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function Sp(t,e){let i="",n=t[e+1];for(;(n===" "||n===" "||n===`
98
- `||n==="\r")&&!(n==="\r"&&t[e+2]!==`
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
99
  `);)n===`
100
100
  `&&(i+=`
101
- `),e+=1,n=t[e+1];return i||(i=" "),{fold:i,offset:e}}var kp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ep(t,e,i,n){let r=t.substr(e,i),o=r.length===i&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Bc.resolveFlowScalar=wp});var zc=w(Vc=>{"use strict";var Fe=R(),qc=$(),Rp=Na(),Cp=Sa();function Pp(t,e,i,n){let{value:r,type:a,comment:o,range:s}=e.type==="block-scalar"?Rp.resolveBlockScalar(t,e,n):Cp.resolveFlowScalar(e,t.options.strict,n),c=i?t.directives.tagName(i.source,f=>n(i,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Fe.SCALAR]:c?l=Ap(t.schema,r,c,i,n):e.type==="scalar"?l=xp(t,r,e,n):l=t.schema[Fe.SCALAR];let u;try{let f=l.resolve(r,d=>n(i??e,"TAG_RESOLVE_FAILED",d),t.options);u=Fe.isScalar(f)?f:new qc.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(i??e,"TAG_RESOLVE_FAILED",d),u=new qc.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 Ap(t,e,i,n,r){if(i==="!")return t[Fe.SCALAR];let a=[];for(let s of t.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(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.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"),t[Fe.SCALAR])}function xp({atKey:t,directives:e,schema:i},n,r,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(n))||i[Fe.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(n))??i[Fe.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(r,"TAG_RESOLVE_FAILED",u,!0)}}return o}Vc.composeScalar=Pp});var Jc=w(Wc=>{"use strict";function Tp(t,e,i){if(e){i??(i=e.length);for(let n=i-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++n];r?.type==="space";)t+=r.source.length,r=e[++n];break}}return t}Wc.emptyScalarPosition=Tp});var Gc=w(Ea=>{"use strict";var _p=At(),Ip=R(),jp=Lc(),Kc=zc(),Op=ft(),$p=Jc(),Hp={composeNode:Uc,composeEmptyNode:ka};function Uc(t,e,i,n){let r=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,u=!0;switch(e.type){case"alias":l=Mp(t,e,n),(s||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Kc.composeScalar(t,e,c,n),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=jp.composeCollection(Hp,t,e,i,n),s&&(l.anchor=s.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=ka(t,e.offset,void 0,null,i,n)),s&&l.anchor===""&&n(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!Ip.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function ka(t,e,i,n,{spaceBefore:r,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:$p.emptyScalarPosition(e,i,n),indent:-1,source:""},f=Kc.composeScalar(t,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 Mp({options:t},{offset:e,source:i,end:n},r){let a=new _p.Alias(i.substring(1));a.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=Op.resolveEnd(n,o,t.strict,r);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}Ea.composeEmptyNode=ka;Ea.composeNode=Uc});var Qc=w(Xc=>{"use strict";var Lp=zt(),Yc=Gc(),Dp=ft(),Fp=Ut();function Bp(t,e,{offset:i,start:n,value:r,end:a},o){let s=Object.assign({_directives:e},t),c=new Lp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Fp.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?Yc.composeNode(l,r,u,o):Yc.composeEmptyNode(l,u.end,n,null,u,o);let f=c.contents.range[2],d=Dp.resolveEnd(a,f,!1,o);return d.comment&&(c.comment=d.comment),c.range=[i,f,d.offset],c}Xc.composeDoc=Bp});var Ca=w(tl=>{"use strict";var qp=Pi("process"),Vp=fr(),zp=zt(),Gt=Kt(),Zc=R(),Wp=Qc(),Jp=ft();function Yt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function el(t){let e="",i=!1,n=!1;for(let r=0;r<t.length;++r){let a=t[r];switch(a[0]){case"#":e+=(e===""?"":n?`
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?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),i=!0,n=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:e,afterEmptyLine:n}}var Ra=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,n,r,a)=>{let o=Yt(i);a?this.warnings.push(new Gt.YAMLWarning(o,n,r)):this.errors.push(new Gt.YAMLParseError(o,n,r))},this.directives=new Vp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:n,afterEmptyLine:r}=el(this.prelude);if(n){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
106
- ${n}`:n;else if(r||e.directives.docStart||!a)e.commentBefore=n;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?`${n}
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
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)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:el(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(i,n)}*next(e){switch(qp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,n,r)=>{let a=Yt(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=Wp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Gt.YAMLParseError(Yt(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Gt.YAMLParseError(Yt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let i=Jp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
109
- ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Gt.YAMLParseError(Yt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),r=new zp.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}}};tl.Composer=Ra});var rl=w(yn=>{"use strict";var Kp=Na(),Up=Sa(),Gp=Kt(),il=jt();function Yp(t,e=!0,i){if(t){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 Gp.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Up.resolveFlowScalar(t,e,n);case"block-scalar":return Kp.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Xp(t,e){let{implicitKey:i=!1,indent:n,inFlow:r=!1,offset:a=-1,type:o="PLAIN"}=e,s=il.stringifyString({type:o,value:t},{implicitKey:i,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
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:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
111
  `),u=s.substring(0,l),f=s.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:a,indent:n,source:u}];return nl(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 Qp(t,e,i={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(n&&typeof s=="number"&&(s+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=il.stringifyString({type:o,value:e},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Zp(t,c);break;case'"':Pa(t,c,"double-quoted-scalar");break;case"'":Pa(t,c,"single-quoted-scalar");break;default:Pa(t,c,"scalar")}}function Zp(t,e){let i=e.indexOf(`
114
- `),n=e.substring(0,i),r=e.substring(i+1)+`
115
- `;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,t.source=r}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:n}];nl(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:r})}}function nl(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function Pa(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let a of n)a.offset+=r;delete t.props,Object.assign(t,{type:i,source:e,end:n});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:i,source:e,end:[r]});break}default:{let n="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:n,source:e,end:r})}}}yn.createScalarToken=Xp;yn.resolveAsScalar=Yp;yn.setScalarValue=Qp});var ol=w(al=>{"use strict";var em=t=>"type"in t?bn(t):Nn(t);function bn(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=bn(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=Nn(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=Nn(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=Nn(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function Nn({start:t,key:e,sep:i,value:n}){let r="";for(let a of t)r+=a.source;if(e&&(r+=bn(e)),i)for(let a of i)r+=a.source;return n&&(r+=bn(n)),r}al.stringify=em});var ul=w(ll=>{"use strict";var Aa=Symbol("break visit"),tm=Symbol("skip children"),sl=Symbol("remove item");function Be(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),cl(Object.freeze([]),t,e)}Be.BREAK=Aa;Be.SKIP=tm;Be.REMOVE=sl;Be.itemAtPath=(t,e)=>{let i=t;for(let[n,r]of e){let a=i?.[n];if(a&&"items"in a)i=a.items[r];else return}return i};Be.parentCollection=(t,e)=>{let i=Be.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],r=i?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function cl(t,e,i){let n=i(e,t);if(typeof n=="symbol")return n;for(let r of["key","value"]){let a=e[r];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=cl(Object.freeze(t.concat([[r,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===Aa)return Aa;s===sl&&(a.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}ll.visit=Be});var Sn=w(z=>{"use strict";var xa=rl(),im=ol(),nm=ul(),Ta="\uFEFF",_a="",Ia="",ja="",rm=t=>!!t&&"items"in t,am=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function om(t){switch(t){case Ta:return"<BOM>";case _a:return"<DOC>";case Ia:return"<FLOW_END>";case ja:return"<SCALAR>";default:return JSON.stringify(t)}}function sm(t){switch(t){case Ta:return"byte-order-mark";case _a:return"doc-mode";case Ia:return"flow-error-end";case ja:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}z.createScalarToken=xa.createScalarToken;z.resolveAsScalar=xa.resolveAsScalar;z.setScalarValue=xa.setScalarValue;z.stringify=im.stringify;z.visit=nm.visit;z.BOM=Ta;z.DOCUMENT=_a;z.FLOW_END=Ia;z.SCALAR=ja;z.isCollection=rm;z.isScalar=am;z.prettyToken=om;z.tokenType=sm});var Ha=w(dl=>{"use strict";var Xt=Sn();function ne(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var fl=new Set("0123456789ABCDEFabcdef"),cm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),kn=new Set(",[]{}"),lm=new Set(` ,[]{}
121
- \r `),Oa=t=>!t||lm.has(t),$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(e,i=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!i;let n=this.next??"stream";for(;n&&(i||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
122
- `?!0:i==="\r"?this.buffer[e+1]===`
123
- `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let n=0;for(;i===" ";)i=this.buffer[++n+e];if(i==="\r"){let r=this.buffer[n+e+1];if(r===`
124
- `||!r&&!this.atEnd)return e+n+1}return i===`
125
- `||n>=this.indentNext||!i&&!this.atEnd?e+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&ne(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Xt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,n=e.indexOf("#");for(;n!==-1;){let a=e[n-1];if(a===" "||a===" "){i=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield Xt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&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[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&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 e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Oa),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,n=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=n=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&ne(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Xt.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(Oa),"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 e=this.charAt(0),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let 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(`
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===`
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
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 e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>ne(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,n;e:for(let a=this.pos;n=this.buffer[a];++a)switch(n){case" ":i+=1;break;case`
129
- `:e=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(e+1);if(a===-1)break;e=this.buffer.indexOf(`
131
- `,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
132
- `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let a=e-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)e=a;else break}while(!0);return yield Xt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let a=this.buffer[n+1];if(ne(a)||e&&kn.has(a))break;i=n}else if(ne(r)){let a=this.buffer[n+1];if(r==="\r"&&(a===`
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`
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
134
  `?(n+=1,r=`
135
- `,a=this.buffer[n+1]):i=n),a==="#"||e&&kn.has(a))break;if(r===`
136
- `){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&kn.has(r))break;i=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Xt.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(i&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Oa),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,n=this.charAt(1);if(ne(n)||i&&kn.has(n)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,i=this.buffer[e];for(;!ne(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(cm.has(i))i=this.buffer[++e];else if(i==="%"&&fl.has(this.buffer[e+1])&&fl.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
- `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||e&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(e){let i=this.pos,n=this.buffer[i];for(;!e(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};dl.Lexer=$a});var La=w(hl=>{"use strict";var Ma=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,n=this.lineStarts.length;for(;i<n;){let a=i+n>>1;this.lineStarts[a]<e?i=a+1:n=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let r=this.lineStarts[i-1];return{line:i,col:e-r+1}}}};hl.LineCounter=Ma});var Fa=w(wl=>{"use strict";var um=Pi("process"),pl=Sn(),fm=Ha();function Ae(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function ml(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function gl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function En(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function dt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Rn(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function vl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ae(e.start,"explicit-key-ind")&&!Ae(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,gl(e.value)?e.value.end?Rn(e.value.end,e.sep):e.value.end=e.sep:Rn(e.start,e.sep),delete e.sep)}var Da=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new fm.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,i))yield*this.next(n);i||(yield*this.end())}*next(e){if(this.source=e,um.env.LOG_TOKENS&&console.log("|",pl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=pl.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let n=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in n?n.indent:0:i.type==="flow-collection"&&n.type==="document"&&(i.indent=0),i.type==="flow-collection"&&vl(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&&ml(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 e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{ml(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let i=En(this.peek(2)),n=dt(i),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
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===`
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(`
139
139
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
140
- `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Rn(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",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>e.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),e.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),e.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)e.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(gl(i.key)&&!Ae(i.sep,"newline")){let o=dt(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=dt(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?e.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?(e.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(e);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&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Rn(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||Ae(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:r,sep:[]}):i.sep?this.stack.push(r):Object.assign(i,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=En(n),a=dt(r);vl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
140
+ `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(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(`
141
141
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
142
- `,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=En(e),n=dt(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=En(e),n=dt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};wl.Parser=Da});var kl=w(Zt=>{"use strict";var yl=Ca(),dm=zt(),Qt=Kt(),hm=Er(),pm=R(),mm=La(),Nl=Fa();function bl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new mm.LineCounter||null,prettyErrors:e}}function vm(t,e={}){let{lineCounter:i,prettyErrors:n}=bl(e),r=new Nl.Parser(i?.addNewLine),a=new yl.Composer(e),o=Array.from(a.compose(r.parse(t)));if(n&&i)for(let s of o)s.errors.forEach(Qt.prettifyError(t,i)),s.warnings.forEach(Qt.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function Sl(t,e={}){let{lineCounter:i,prettyErrors:n}=bl(e),r=new Nl.Parser(i?.addNewLine),a=new yl.Composer(e),o=null;for(let s of a.compose(r.parse(t),!0,t.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 n&&i&&(o.errors.forEach(Qt.prettifyError(t,i)),o.warnings.forEach(Qt.prettifyError(t,i))),o}function gm(t,e,i){let n;typeof e=="function"?n=e:i===void 0&&e&&typeof e=="object"&&(i=e);let r=Sl(t,i);if(!r)return null;if(r.warnings.forEach(a=>hm.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 wm(t,e,i){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let r=Math.round(i);i=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=i??e??{};if(!r)return}return pm.isDocument(t)&&!n?t.toString(i):new dm.Document(t,n,i).toString(i)}Zt.parse=gm;Zt.parseAllDocuments=vm;Zt.parseDocument=Sl;Zt.stringify=wm});var qa=w(A=>{"use strict";var ym=Ca(),Nm=zt(),bm=oa(),Ba=Kt(),Sm=At(),xe=R(),km=Ee(),Em=$(),Rm=Ce(),Cm=Pe(),Pm=Sn(),Am=Ha(),xm=La(),Tm=Fa(),Cn=kl(),El=Et();A.Composer=ym.Composer;A.Document=Nm.Document;A.Schema=bm.Schema;A.YAMLError=Ba.YAMLError;A.YAMLParseError=Ba.YAMLParseError;A.YAMLWarning=Ba.YAMLWarning;A.Alias=Sm.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=km.Pair;A.Scalar=Em.Scalar;A.YAMLMap=Rm.YAMLMap;A.YAMLSeq=Cm.YAMLSeq;A.CST=Pm;A.Lexer=Am.Lexer;A.LineCounter=xm.LineCounter;A.Parser=Tm.Parser;A.parse=Cn.parse;A.parseAllDocuments=Cn.parseAllDocuments;A.parseDocument=Cn.parseDocument;A.stringify=Cn.stringify;A.visit=El.visit;A.visitAsync=El.visitAsync});import Zm from"path";var ti=Ho(qa(),1);import An from"path";var _n=64*1024,xn=1024,Tn=64,za=5,_m=[".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:[..._m],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},Pn={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.
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
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
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
145
  # clarification_mode: sequential | batch`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
@@ -157,29 +157,29 @@ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.pus
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 Cl(t,e){return Pn[e][t]}function Im(t,e,i){let n=/^(\s*)([a-z_]+):/u.exec(t);if(!n)return null;let r=n[1].length,a=n[2];if(r===0&&a in Pn.en)return a;if(r===2&&e){let o=`${e}.${a}`;if(o in Pn.en)return o}if(r===4&&e==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in Pn.en)return o}return null}function In(t,e){let i=[],n=null,r=null;for(let a of(0,ti.stringify)(t).trimEnd().split(`
161
- `)){let o=Im(a,n,r);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of Cl(o,e).split(`
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
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 jm(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||An.posix.isAbsolute(i)||An.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function qe(t){let e=jm(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Pl(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function Wa(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||An.posix.isAbsolute(n)||An.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function ei(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Al(t,e,i){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function jn(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>xn)throw new Error(`${e} exceeds ${xn} characters`);let i=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?i+=1:t[n]==="*"&&(i+=1,t[n+1]==="*"&&(n+=1));if(i>Tn)throw new Error(`${e} contains more than ${Tn} wildcard tokens`);return t}function Rl(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>jn(n,e)))].sort((n,r)=>n.localeCompare(r,"en"))}function Va(t,e,i){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Om(t){if(t===void 0)return{...J,include:[...J.include],exclude:[...J.exclude]};let e=ei(t,"native.snapshot");return{include:Rl(e.include,"native.snapshot.include",J.include),exclude:Rl(e.exclude,"native.snapshot.exclude",J.exclude),max_files:Va(e.max_files,J.max_files,"native.snapshot.max_files"),max_total_bytes:Va(e.max_total_bytes,J.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Va(e.max_duration_ms,J.max_duration_ms,"native.snapshot.max_duration_ms")}}function $m(t){if(t===void 0)return;let e=ei(t,"native.pending_root_move"),i=e.id,n=e.from_artifact_root,r=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=ei(e.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:qe(n),toArtifactRoot:qe(r),stage:a,...o?{cleanup:o}:{}}}function Hm(t,e={}){let i=ei(t,"native"),n=i.artifact_root??(e.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??za;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=$m(i.pending_root_move);return{artifact_root:qe(n),language:Al(i.language,"en","native.language"),clarification_mode:r,archive_confirmation:a,max_verify_failures:o,snapshot:Om(i.snapshot),...s?{pending_root_move:s}:{}}}function Mm(t){let e=ei(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Pl(e.artifact_layout),language:Al(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function Lm(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Dm(t,e,i,n,r){let a=t.schema!==void 0;if(!(a||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!a)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:n,...e?{native:e}:{},...i?{classic:i}:{}}}function ii(t,e={}){let i=(0,ti.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let n=i.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=n,a=Lm(r.ambient_resume),o=r.native===void 0?void 0:Hm(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),s=r.classic===void 0?void 0:Mm(r.classic),c=Dm(r,o,s,a,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function xl(t){return{id:t.id,from_artifact_root:t.fromArtifactRoot,to_artifact_root:t.toArtifactRoot,stage:t.stage,...t.cleanup?{cleanup:{kind:t.cleanup.kind,state:t.cleanup.state,manifest_hash:t.cleanup.manifestHash}}:{}}}function Tl(t){return{schema:t.schema,default_workflow:t.default_workflow,workflows:t.workflows??[t.default_workflow],ambient_resume:t.ambient_resume,...t.native?{native:{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,...t.native.pending_root_move?{pending_root_move:xl(t.native.pending_root_move)}:{}}}:{},...t.classic?{classic:{artifact_layout:t.classic.artifact_layout,language:t.classic.language,context_compression:t.classic.context_compression,review_mode:t.classic.review_mode,auto_transition:t.classic.auto_transition}}:{}}}function ht(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function On(t,e){let i=Tl(e),n=ii((0,ti.stringify)(i)).config;if(!n)throw new Error("Unsupported Comet project schema");let r={...t,schema:n.schema,default_workflow:n.default_workflow,workflows:n.workflows,ambient_resume:n.ambient_resume};if(n.native){let a=ht(t.native),o=ht(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=ht(a.pending_root_move),l=xl(n.native.pending_root_move),u=ht(c.cleanup),f=ht(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={...ht(t.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 Ja(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:qe(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:za,snapshot:{...J,include:[...J.include],exclude:[...J.exclude]}}}}import{createHash as Bm}from"crypto";import{promises as Mn}from"fs";import _e from"path";import{constants as $n,promises as Ve}from"fs";function Te(t){return t!==0&&t!==0n&&t!=="0"}function K(t,e){return Te(t.dev)&&Te(e.dev)&&Te(t.ino)&&Te(e.ino)}function I(t,e){let i=Te(t.dev)&&Te(e.dev);if(i&&t.dev!==e.dev)return!1;let n=Te(t.ino)&&Te(e.ino);return n&&t.ino!==e.ino?!1:i&&n?!0:t.birthtime===e.birthtime}var re=class extends Error{reason;constructor(e,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=e}};function Ka(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function _l(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ni(t){return{dev:t.dev,ino:t.ino,birthtime:Ka(t)}}function Hn(t,e){let i=ni(t),n=ni(e);return K(i,n)?I(i,n):I(i,n)&&Ka(t)===Ka(e)&&_l(t)===_l(e)&&t.size===e.size}async function pt(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,a=await Ve.lstat(t,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new re("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new re("too-large",`${n} exceeds ${e} bytes`);let o=await Ve.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:ni(a)});let s=process.platform==="win32"?$n.O_RDONLY:$n.O_RDONLY|$n.O_NOFOLLOW|$n.O_NONBLOCK,c;try{c=await Ve.open(t,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}),Ve.lstat(t,{bigint:r}),Ve.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==o||!Hn(a,l)||!Hn(a,u))throw new re("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:f,identity:ni(l)}),await i.hooks?.afterOpen?.();let d=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-m,{bytesRead:S}=await c.read(g,0,Math.min(g.length,N),null);if(S===0)break;if(m+=S,m>e)throw new re("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),Ve.lstat(t,{bigint:r}),Ve.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!Hn(a,h)||!Hn(a,p))throw new re("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:ni(h)}),{bytes:Buffer.concat(d,m),stat:h,realPath:y}}finally{await c.close()}}function Fm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ua(t,e){let i=_e.relative(t,e);return i===""||!_e.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_e.sep}`)}async function Il(t,e){let i=_e.resolve(t),n=await Mn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Mn.realpath(i)}async function jl(t,e,i,n){let r=t;for(let a=0;a<i.length;a++){r=_e.join(r,i[a]);let o;try{o=await Mn.lstat(r)}catch(u){if(Fm(u))return{exists:!1,kind:"missing"};throw u}let s=_e.relative(t,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 Mn.realpath(r);if(!Ua(e,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 ri(t,e,i){let n=Wa(e,i.label),r=_e.resolve(t),a=await Il(r,i.label),o=n.split("/"),s=_e.resolve(r,...o);if(!Ua(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await jl(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function mt(t,e,i,n){let r=await ri(t,e,{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 Il(r.projectRoot,n.label);return pt(r.target,i,{...n,verify:async(o,s)=>{if(!Ua(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await jl(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var ai=".comet/config.yaml";function Ga(t,e){return t.exists===e.exists&&t.sha256===e.sha256}function qm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ya(t,e={}){return(await oi(t,e)).document}async function Ol(t){try{return(await mt(t,ai,_n,{label:ai})).bytes}catch(e){if(qm(e))return null;throw e}}function $l(t){return t?{exists:!0,sha256:Bm("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ln(t){return $l(await Ol(t))}async function oi(t,e={}){let i=await Ol(t);return{document:i?ii(i.toString("utf8"),e):null,identity:$l(i)}}var $N=16*1024;async function Qa(t,e){if(!e)return;let i=await Ln(t);if(!Ga(i,e))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as Jm}from"crypto";import{promises as F}from"fs";import ae from"path";function eo(t,e){let i=ae.relative(t,e);return i===""||!ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ae.sep}`)}function Km(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Za(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return K(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Hl(t){let e=await F.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await F.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function si(t){for(let e of t){let i=await F.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!Km(e,i)||await F.realpath(e.path)!==e.realPath)throw new Error(`Native atomic write parent changed before commit: ${e.path}`)}}async function Um(t,e){let i=ae.resolve(t),n=ae.resolve(e);if(!eo(i,n))throw new Error(`Native atomic write parent is outside its managed root: ${e}`);let r=[await Hl(i)],a=ae.relative(i,n).split(ae.sep).filter(Boolean),o=i;for(let s of a){await si(r),o=ae.join(o,s);try{await F.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Hl(o);if(!eo(r[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await si(r),r}async function Gm(t){let e;try{e=await F.open(t,"r"),await e.sync()}catch(i){let n=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw i}finally{await e?.close()}}async function Ml(t,e,i={}){let n=ae.dirname(t),r=i.containedRoot?await Um(i.containedRoot,n):null;r||await F.mkdir(n,{recursive:!0});let a=ae.join(n,`.${ae.basename(t)}.${Jm()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await F.open(a,"wx"),s=await o.stat(),r){let[c,l]=await Promise.all([F.lstat(a),F.realpath(a)]);if(await si(r),!c.isFile()||c.isSymbolicLink()||!Za(s,c)||!eo(r[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),!Za(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 si(r);let c=await F.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!Za(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await F.link(a,t),await F.unlink(a)):await F.rename(a,t),await Gm(n)}catch(c){if(await o?.close(),!r)await F.rm(a,{force:!0});else try{await si(r),await F.rm(a,{force:!0})}catch{}throw c}}async function he(t,e,i={}){await Ml(t,e,i)}async function Ll(t,e,i={}){await Ml(t,e,i)}async function oe(t,e,i={}){await he(t,JSON.stringify(e,null,2)+`
164
- `,i)}import{promises as vt}from"fs";import x from"path";import Ym from"os";var Dn=".comet/config.yaml";async function to(t){try{return await vt.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Xm(t){try{let e=await vt.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function ci(t,e){let i=x.relative(t,e);return i===""||!x.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${x.sep}`)}async function li(t){let e=[],i=t;for(;!await to(i);){let r=x.dirname(i);if(r===i)break;e.push(x.basename(i)),i=r}let n=await vt.realpath(i);return x.resolve(n,...e.reverse())}async function Dl(t){try{return(await vt.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function io(t){let e=x.resolve(t);try{(await vt.stat(e)).isDirectory()||(e=x.dirname(e))}catch(r){if(r.code!=="ENOENT")throw r}let i=e,n=x.resolve(Ym.homedir());for(;;){if(!(e===n&&i!==n)){let o=x.join(e,...Dn.split("/")),s=e===i||await Xm(o);if(await to(o)&&s)return e}if(await to(x.join(e,".git")))return e;let a=x.dirname(e);if(a===e)return i;e=a}}function ui(t){return qe(t)}async function Qm(t,e){let i=ui(e),n=x.resolve(t,...i.split("/")),r=await vt.realpath(t),a=await li(n);if(!ci(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function ze(t,e){let i=ui(e),n=await Qm(t,i),r=x.join(n,"comet");if(await Dl(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([li(n),li(r)]);if(!ci(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:x.resolve(t),configFile:x.join(t,...Dn.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 U(t,e){return ci(x.resolve(t),x.resolve(e))}async function O(t,e){let i=x.resolve(t),n=x.resolve(e);if(!ci(i,n))throw new Error(`Path is outside the Native root: ${e}`);if(await Dl(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[r,a]=await Promise.all([li(i),li(n)]);if(!ci(r,a))throw new Error(`Path resolves outside the Native root: ${e}`);return n}var Fn=jn;function Fl(t="docs",e="en"){return Ja(t,e)}async function Ie(t){let e=(await Ya(t))?.config??null;return e?.native?e:null}async function fi(t,e,i={}){let n=await oi(t,{allowPartialProject:!0}),r=On(n.document?.value??{},e),a=Zm.join(t,...Dn.split("/"));await he(a,In(r,e.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:t,beforeCommit:async()=>{await i.beforeCommit?.(),await Qa(t,n.identity)}})}import{createHash as Xg,randomUUID as Qg}from"crypto";import{promises as et}from"fs";import j from"path";var No=Ho(qa(),1);import{promises as jg}from"fs";import Qe from"path";import{createHash as nv}from"node:crypto";import{promises as se}from"node:fs";import X from"node:path";import{TextDecoder as rv}from"node:util";var ev=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),tv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function iv(t){return t.toLowerCase().startsWith(".env")}function di(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>iv(n))?"environment-file":i.some(n=>tv.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>ev.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var qn=1024*1024;function no(t,e){let i=X.relative(t,e);return i===""||!X.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${X.sep}`)}function av(t){let e=X.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||X.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),n=di(t);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${t}`);return t}function ov(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function sv(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Bn(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return K(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Bl(t){let e=await se.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await se.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function cv(t,e){let i=X.resolve(t),n=X.resolve(e);if(!no(i,n))throw new Error("Native artifact path is outside its root");let r=[await Bl(i)],a=i;for(let o of X.relative(i,n).split(X.sep).filter(Boolean)){a=X.join(a,o);let s=await Bl(a);if(!no(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function ql(t){for(let e of t){let i=await se.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!sv(e,i)||await se.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function We(t){let e=av(t.ref),i=ov(t.maxBytes??qn),n=X.resolve(t.root,...e.split("/")),r=await cv(t.root,X.dirname(n));await t.hooks?.afterParentChainCaptured?.();let a=await se.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await se.realpath(n);if(!no(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);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 ql(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Bn(a,c)||!Bn(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let f=[],d=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let S=i+1-d,k=await s.read(m,0,Math.min(m.length,S),null);if(k.bytesRead===0)break;if(d+=k.bytesRead,d>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);f.push(Buffer.from(m.subarray(0,k.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),se.lstat(n),se.realpath(n)]);if(await ql(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Bn(c,g)||!Bn(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(f,d),N;try{N=new rv("utf-8",{fatal:!0}).decode(y)}catch(S){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:S})}return{ref:e,size:d,hash:nv("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}import{AsyncLocalStorage as lv}from"async_hooks";import{randomUUID as Wl}from"crypto";import{promises as Q}from"fs";import Jl from"os";import B from"path";var Vl=16*1024,Kl=".coordinator",uv=5e3,zl=new lv,Vn=new Map;function fv(t){if(!/^[a-z][a-z0-9-]*$/u.test(t))throw new Error(`Invalid Native lock name: ${t}`);return`${t}.lock`}function dv(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid Native lock metadata: ${e}`);let i=t;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: ${e}`);return i}function Ul(t){return{device:t.dev.toString(),inode:t.ino.toString(),size:t.size.toString(),birthtimeNs:t.birthtimeNs.toString(),ctimeNs:t.ctimeNs.toString(),mtimeNs:t.mtimeNs.toString()}}function ro(t,e){let i={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs},n={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs};return K(i,n)?I(i,n):I(i,n)&&t.size===e.size}function ao(t,e){return ro(t,e)&&t.size===e.size&&t.birthtimeNs===e.birthtimeNs&&t.ctimeNs===e.ctimeNs&&t.mtimeNs===e.mtimeNs}async function je(t){let e,i;try{let n=await pt(t,Vl,{bigint:!0,label:"Native lock"});e=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 ${Vl} bytes: ${t}`,{cause:n}):n.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${t}`,{cause:n}):new Error(`Native lock changed while reading: ${t}`,{cause:n}):n}return{file:t,owner:dv(JSON.parse(e.toString("utf8")),t),identity:Ul(i)}}async function hv(t){return(await je(t))?.owner??null}function pv(t){if(!t)return{status:"missing",owner:null,identity:null};if(t.owner.hostname!==Jl.hostname())return{status:"unknown",owner:t.owner,identity:t.identity};let e=Nv(t.owner.pid);return{status:e===!0?"active":e===!1?"stale":"unknown",owner:t.owner,identity:t.identity}}async function mv(t,e){try{await Q.lstat(e);return}catch(i){if(i.code!=="ENOENT")throw i}try{await Q.rename(t,e)}catch(i){if(i.code!=="ENOENT")throw i}}async function oo(t,e){let i=await je(t.file);if(!i)return"missing";if(i.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!ao(i.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);await Q.mkdir(e,{recursive:!0});let n=B.join(e,`${B.basename(t.file)}.${t.owner.id}.${Wl()}.removed`);try{await Q.rename(t.file,n)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let r=await je(n);if(!r||r.owner.id!==t.owner.id||!ro(r.identity,t.identity))throw await mv(n,t.file),new Error(`Native lock changed before quarantine: ${t.file}`);return await Q.rm(n,{force:!0}),"removed"}function Gl(t){return{id:Wl(),pid:process.pid,hostname:Jl.hostname(),createdAt:new Date().toISOString(),operation:t}}async function Yl(t,e){let i;try{i=await Q.open(t,"wx")}catch(n){if(n.code==="EEXIST"){let r=await hv(t);throw new Error(`Native lock is already held: ${t}${r?` by pid ${r.pid} for ${r.operation}`:""}`,{cause:n})}throw n}try{return await i.writeFile(JSON.stringify(e,null,2)+`
165
- `,"utf8"),await i.sync(),Ul(await i.stat({bigint:!0}))}finally{await i.close()}}async function vv(t,e){let i=await O(t.nativeRoot,t.locksDir);await Q.mkdir(i,{recursive:!0});let n=await O(t.nativeRoot,B.join(i,Kl));await Q.mkdir(n,{recursive:!0});let r=Gl(e),a=B.join(n,`.${r.id}.tmp`),o=B.join(n,`${r.id}.claim`);try{let s=await Yl(a,r);await Q.rename(a,o);let c=await je(o);if(!c||!ro(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:t.nativeRoot,locksDir:i,owner:r,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function gv(t){let e=B.dirname(t.file),i=!1,n=B.basename(t.file);for(let r of await Q.readdir(e,{withFileTypes:!0})){if(!r.isFile()||r.isSymbolicLink()||!r.name.endsWith(".claim"))continue;let a=B.join(e,r.name);if(B.resolve(a)!==B.resolve(t.file))try{let o=await je(a),s=pv(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await oo(o,e);continue}r.name<n&&(i=!0)}catch{r.name<n&&(i=!0)}}return i}async function Xl(t){let e=await je(t.file);if(e){if(e.owner.id!==t.owner.id||!ao(e.identity,t.identity))throw new Error(`Native lock coordinator ownership changed: ${t.file}`);await oo(e,B.dirname(t.file))}}async function wv(t,e){let i=Date.now()+uv;for(;;){let n=await vv(t,e);if(!await gv(n))return n;if(await Xl(n),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${t.locksDir}`);await new Promise(r=>setTimeout(r,2+Math.floor(Math.random()*7)))}}async function yv(t){let e=Vn.get(t)??Promise.resolve(),i,n=new Promise(a=>{i=a}),r=e.then(()=>n);return Vn.set(t,r),await e,()=>{i(),Vn.get(t)===r&&Vn.delete(t)}}async function Ql(t,e,i){let n=B.resolve(t.locksDir),r=zl.getStore();if(r?.has(n))return i();let a=await yv(n);try{let o=await wv(t,e),s=new Map(r??[]);return s.set(n,o),await zl.run(s,async()=>{try{return await i()}finally{await Xl(o)}})}finally{a()}}async function hi(t,e,i){return Ql(t,`acquire ${e}`,async()=>{let n=await O(t.nativeRoot,t.locksDir);await Q.mkdir(n,{recursive:!0});let r=await O(t.nativeRoot,B.join(n,fv(e))),a=Gl(i),o=await Yl(r,a);return{file:r,nativeRoot:t.nativeRoot,locksDir:n,owner:a,identity:o}})}async function pi(t){await je(t.file)&&await Ql(t,`release ${B.basename(t.file)}`,async()=>{let e=await je(t.file);if(!e)return;if(e.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!ao(e.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);let i=B.join(t.locksDir,Kl);await oo(e,i)})}function Nv(t){try{return process.kill(t,0),!0}catch(e){let i=e.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{promises as Kn}from"fs";import ye from"path";import{TextDecoder as Rv}from"util";import{createHash as bv}from"node:crypto";import{constants as zn,promises as P}from"node:fs";import T from"node:path";import{TextDecoder as Sv}from"node:util";function pe(t,e){let i=T.relative(t,e);return i===""||!T.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${T.sep}`)}function Zl(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Wn(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function eu(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function gt(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Je(t,e){let i=await P.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await P.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function mi(t,e,i){let n=T.resolve(t),r=T.resolve(e);if(!pe(n,r))throw new Error(`${i} is outside its managed root`);let a=[await Je(n,i)],o=n;for(let s of T.relative(n,r).split(T.sep).filter(Boolean)){await D(a,i),o=T.join(o,s);let c=await Je(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 D(a,i),a}async function D(t,e){for(let i of t){let n=await P.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Wn(i,n)||await P.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function kv(t,e,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-r,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>e)throw new Error(`${i} exceeds ${e} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function q(t){let e=Zl(t.maxBytes),i=T.resolve(t.file),n=await mi(t.root,T.dirname(i),t.label),r=await Promise.all((t.forbiddenRoots??[]).map(u=>Je(T.resolve(u),t.label)));await t.hooks?.afterParentChainCaptured?.(),await D(n,t.label);let a=await P.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=eu(a),s=await P.realpath(i);if(!pe(n[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(r.some(u=>pe(u.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?zn.O_RDONLY:zn.O_RDONLY|zn.O_NOFOLLOW|zn.O_NONBLOCK,l=await P.open(i,c);try{let u=await l.stat();await t.hooks?.afterOpen?.();let[f,d]=await Promise.all([P.lstat(i),P.realpath(i)]);if(await D(n,t.label),await D(r,t.label),!u.isFile()||!f.isFile()||f.isSymbolicLink()||d!==s||!gt(o,u)||!gt(o,f))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await kv(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),P.lstat(i),P.realpath(i)]);if(await D(n,t.label),await D(r,t.label),!h.isFile()||h.isSymbolicLink()||p!==s||!gt(o,g)||!gt(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:bv("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function tu(t){let e=await q(t),i;try{i=new Sv("utf-8",{fatal:!0}).decode(e.bytes)}catch(n){throw new Error(`${t.label} is not valid UTF-8`,{cause:n})}return{...e,text:i}}async function Ke(t){let e=await mi(t.root,t.directory,t.label),i;if(t.maxEntries===void 0)i=await P.readdir(t.directory,{withFileTypes:!0});else{let n=Zl(t.maxEntries);i=[];let r=await P.opendir(t.directory);try{for await(let a of r)if(i.push(a),i.length>n)throw new Error(`${t.label} exceeds ${n} entries`)}finally{await r.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await D(e,t.label),{entries:i,verify:()=>D(e,t.label)}}async function Ev(t){let e=T.resolve(t.directory),i=T.resolve(t.quarantine);if(T.dirname(i)!==T.dirname(e)||!pe(T.resolve(t.root),i)||i===e)throw new Error(`${t.label} quarantine must be a distinct sibling inside its root`);let n=await mi(t.root,T.dirname(e),t.label),r=await Je(e,t.label);if(!pe(n[0].realPath,r.realPath))throw new Error(`${t.label} resolves outside its managed root`);await t.beforeQuarantine?.(),await D(n,t.label);let a=await P.lstat(e);if(!a.isDirectory()||a.isSymbolicLink()||!Wn(r,a)||await P.realpath(e)!==r.realPath)throw new Error(`${t.label} changed before quarantine`);try{throw await P.lstat(i),new Error(`${t.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await P.rename(e,i),await D(n,t.label);let o=await P.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Wn(r,o))throw new Error(`${t.label} changed while quarantining`);await t.afterQuarantine?.(i);try{throw await P.lstat(e),new Error(`${t.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:n,identity:r}}async function iu(t){await Ev(t)}async function so(t){let e=T.resolve(t.file),i=await mi(t.root,T.dirname(e),t.label),n=await P.lstat(e);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);let r=eu(n),a=await P.realpath(e);if(!pe(i[0].realPath,a))throw new Error(`${t.label} resolves outside its managed root`);let o=await q({root:t.root,file:e,maxBytes:t.maxBytes,label:t.label});if(o.hash!==t.expectedHash||o.size!==t.expectedSize)throw new Error(`${t.label} changed before removal`);let[s,c]=await Promise.all([P.lstat(e),P.realpath(e)]);if(!s.isFile()||s.isSymbolicLink()||!gt(r,s)||c!==a)throw new Error(`${t.label} changed while verifying removal`);await t.beforeRemove?.(),await D(i,t.label);let[l,u]=await Promise.all([P.lstat(e),P.realpath(e)]);if(!l.isFile()||l.isSymbolicLink()||!gt(r,l)||u!==a)throw new Error(`${t.label} changed before removal`);await P.rm(e),await D(i,t.label)}async function co(t){let e=T.resolve(t.directory),i=await mi(t.root,T.dirname(e),t.label),n=await Je(e,t.label);if(!pe(i[0].realPath,n.realPath))throw new Error(`${t.label} resolves outside its managed root`);await t.beforeRemove?.(),await D(i,t.label);let r=await P.lstat(e);if(!r.isDirectory()||r.isSymbolicLink()||!Wn(n,r)||await P.realpath(e)!==n.realPath)throw new Error(`${t.label} changed before removal`);await P.rmdir(e),await D(i,t.label)}async function vi(t){let e=T.resolve(t.root),i=T.resolve(t.directory);if(!pe(e,i))throw new Error(`${t.label} is outside its managed root`);let n=[await Je(e,t.label)],r=e;for(let a of T.relative(e,i).split(T.sep).filter(Boolean)){await D(n,t.label),r=T.join(r,a);try{await P.mkdir(r)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Je(r,t.label);if(!pe(n[0].realPath,o.realPath))throw new Error(`${t.label} resolves outside its managed root: ${r}`);n.push(o)}await D(n,t.label)}async function gi(t){let e=await q({root:t.sourceRoot,file:t.source,maxBytes:t.maxBytes,label:t.label,hooks:t.hooks,forbiddenRoots:t.forbiddenRoots});if(t.expectedHash!==void 0&&e.hash!==t.expectedHash)throw new Error(`${t.label} content changed before copy`);await Ll(t.target,e.bytes,{containedRoot:t.targetRoot,exclusive:t.exclusive,beforeCommit:async()=>{if(await t.hooks?.beforeTargetCommit?.(),t.expectedTargetHash===void 0)return;if(t.expectedTargetHash===null){try{await P.lstat(t.target)}catch(r){if(r.code==="ENOENT")return;throw r}throw new Error(`${t.label} target changed before commit`)}if((await q({root:t.targetRoot,file:t.target,maxBytes:t.maxBytes,label:`${t.label} existing target`})).hash!==t.expectedTargetHash)throw new Error(`${t.label} target changed before commit`)}});let i=await q({root:t.targetRoot,file:t.target,maxBytes:t.maxBytes,label:`${t.label} target`});if(i.hash!==e.hash||i.size!==e.size)throw new Error(`${t.label} target could not be verified`);return i}var Cv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),Pv=new Set(["id","type","source","target","staged","backup"]),Av=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),xv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),Tv=new Set(["sequence","timestamp","type","operationId"]),au=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),ou=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),_v=256*1024,Iv=1024*1024,su=16*1024,Un=1024,Fb=64*1024*1024;var cu=new Rv("utf-8",{fatal:!0});function wi(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function yi(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function yt(t){if(typeof t!="string")return!1;let e=new Date(t);return!Number.isNaN(e.valueOf())&&e.toISOString()===t}function lo(t,e){if(typeof t!="string"||t.length===0||ye.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native root`)}function Jn(t,e){if(typeof t!="string"||!/^[a-f0-9]{64}$/u.test(t))throw new Error(`${e} must be a SHA-256 hash`)}function nu(t,e){if(lo(t,e),t.includes("\\")||t!==ye.posix.normalize(t)||t.split("/").includes(".")||t.endsWith("/")||Buffer.byteLength(t,"utf8")>1024)throw new Error(`${e} must be a normalized Native-relative ref`)}function jv(t,e){let i=wi(t,`transaction operations[${e}]`);if(yi(i,Pv,`transaction operations[${e}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${e}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);lo(i.target,`transaction operation ${i.id} target`);for(let n of["source","staged","backup"])i[n]!==void 0&&lo(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 lu(t){let e=wi(t,"Native Archive transaction journal");if(yi(e,Av,"Native Archive transaction journal"),e.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native Archive transaction id is invalid");if(e.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof e.status!="string"||!au.has(e.status))throw new Error("Native Archive transaction status is invalid");if(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change))throw new Error("Native Archive transaction change name is invalid");if(!yt(e.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Jn(e.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(e.operations)||e.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=e.operations.map((s,c)=>{let l=wi(s,`Archive transaction operations[${c}]`);if(yi(l,xv,`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`);nu(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&nu(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Jn(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(Jn(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`);Jn(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/${e.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${e.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${e.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:e.id,kind:"archive",status:e.status,change:e.change,createdAt:e.createdAt,preflightHash:e.preflightHash,operations:i}}function uo(t){let e=wi(t,"Native transaction journal");if(e.schema==="comet.native.transaction.v2")return lu(e);if(yi(e,Cv,"Native transaction journal"),e.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native transaction id is invalid");if(e.kind!=="archive"&&e.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof e.status!="string"||!au.has(e.status))throw new Error("Native transaction status is invalid");if(typeof e.projectRoot!="string"||!ye.isAbsolute(e.projectRoot)||typeof e.nativeRoot!="string"||!ye.isAbsolute(e.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(e.change!==void 0&&(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change)))throw new Error("Native transaction change name is invalid");if(!yt(e.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(e.operations))throw new Error("Native transaction operations must be an array");let i=e.operations.map(jv),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:e.id,kind:e.kind,status:e.status,projectRoot:e.projectRoot,nativeRoot:e.nativeRoot,...typeof e.change=="string"?{change:e.change}:{},createdAt:e.createdAt,operations:i}}function uu(t,e){let i=wi(t,`Native transaction event at line ${e}`);if(yi(i,Tv,`Native transaction event at line ${e}`),i.sequence!==e)throw new Error(`Native transaction event sequence at line ${e} must be ${e}`);if(!yt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${e} is invalid`);if(typeof i.type!="string"||!ou.has(i.type))throw new Error(`Native transaction event type at line ${e} 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 ${e} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Ov(t){if(t.length>24)return!1;let e="0000-00-00T00:00:00.000Z";for(let n=0;n<t.length;n+=1){let r=e[n],a=t[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(t.length<=n)continue;let s=t.slice(n,Math.min(n+r,t.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(r,"0")).some(l=>l.startsWith(s)))return!1}return t.length>=10&&!yt(`${t.slice(0,10)}T00:00:00.000Z`)?!1:t.length<24||yt(t)}function wt(t,e){return t.length<e.length&&e.startsWith(t)}function $v(t){let e='","operationId":"';if(wt(t,e))return!0;if(!t.startsWith(e))return!1;let i=t.slice(e.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)?wt(i.slice(n),'"}'):!1}function Hv(t,e){if(t.length===0||Buffer.byteLength(t,"utf8")>su)return!1;let i=`{"sequence":${e},"timestamp":"`;if(wt(t,i))return!0;if(!t.startsWith(i))return!1;let n=t.slice(i.length),r=n.slice(0,Math.min(24,n.length));if(!Ov(r))return!1;if(n.length<24)return!0;if(!yt(r))return!1;let a='","type":"',o=n.slice(24);if(wt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of ou){if(wt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if($v(l))return!0}else if(wt(l,'"}'))return!0}return!1}function Mv(t,e){if(t.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(t,"utf8")>su)throw new Error(`Native transaction event at line ${e} is too large`);return uu(JSON.parse(t),e)}function Lv(t){let e=t.split(`
166
- `),i=e.at(-1)==="";if(i&&e.pop(),e.length>Un)throw new Error(`Native transaction event log exceeds ${Un} events`);let n=[];for(let r=0;r<e.length;r+=1){let a=r+1,o=e[r],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&r===e.length-1;try{n.push(Mv(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&Hv(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return n}function fu(t){return t.length===0?"":`${t.map(e=>JSON.stringify(e)).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(`
167
167
  `)}
168
- `}function Dv(t,e){if(!/^[a-f0-9-]{8,}$/u.test(e))throw new Error(`Invalid Native transaction id: ${e}`);return ye.join(t.transactionsDir,e)}function Gn(t,e){let i=Dv(t,e);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 Ue(t,e){let i=Gn(t,e);return await Promise.all(Object.values(i).map(n=>O(t.nativeRoot,n))),i}async function du(t,e,i={}){let n=await Ue(t,e);try{await Kn.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:t.nativeRoot,file:n.events,maxBytes:Iv,label:`Native transaction event log ${e}`,hooks:i.hooks}),a;try{a=cu.decode(r.bytes)}catch(c){throw new Error(`Native transaction event log ${e} is not valid UTF-8`,{cause:c})}let o=Lv(a),s=fu(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 ${e} changed while reading`,{cause:r}):r}}async function ru(t,e,i){let n=await du(t,e);if(n.exists!==i.exists||n.hash!==i.hash||n.size!==i.size)throw new Error(`Native transaction event log ${e} changed before append`)}async function fo(t,e,i,n){let r=await Ue(t,e),a=await du(t,e),o=a.events.find(c=>c.type===i&&c.operationId===n);if(o)return a.needsRepair&&await he(r.events,a.canonicalSource,{containedRoot:t.nativeRoot,beforeCommit:()=>ru(t,e,a)}),o;if(a.events.length>=Un)throw new Error(`Native transaction event log ${e} exceeds ${Un} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...n?{operationId:n}:{}};return uu(s,s.sequence),await Kn.mkdir(r.directory,{recursive:!0}),await he(r.events,fu([...a.events,s]),{containedRoot:t.nativeRoot,beforeCommit:()=>ru(t,e,a)}),s}async function hu(t,e){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");e=uo(e);let i=await Ue(t,e.id);await Kn.mkdir(i.staged,{recursive:!0}),await Kn.mkdir(i.backups,{recursive:!0}),await oe(i.journal,e),await fo(t,e.id,"prepared")}async function Ni(t,e,i={}){let n=await Ue(t,e),r=await q({root:t.nativeRoot,file:n.journal,maxBytes:_v,label:`Native transaction journal ${e}`,hooks:i.hooks}),a=JSON.parse(cu.decode(r.bytes)),o=uo(a);if(o.id!==e)throw new Error(`Invalid Native transaction journal: ${e}`);return o}async function Fv(t,e,i){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let n=uo({...e,status:i});return await oe((await Ue(t,e.id)).journal,n),n}async function ho(t,e,i){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await fo(t,e.id,i),i==="commit"?Fv(t,e,"committed"):e}import Xn from"path";import{createHash as Bv}from"crypto";function Z(t){return Bv("sha256").update(t).digest("hex")}var rS={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},Vv=1e3,zv=8*1024*1024,Wv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Jv=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),Kv=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),Uv=new Set(["schema","include","exclude","hash"]),Gv=new Set(["provider","gitSelection","physicalSelection","projection"]),Yv=new Set(["provider","selection"]),Xv=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),Qv=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),Zv=new Set(["schema","status","before","after"]),eg=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),tg=new Set(["path","hash","size","type","gitObjectId"]),ig=new Set(["path","size","type","reason"]),ng=new Set(["ref","hash","count"]),rg=new Set(["change-created","legacy-migration","explicit"]),ag=new Set(["file","directory","other"]),og=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"]),Qn=/^[a-f0-9]{64}$/u,sg=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var aS=64*1024,oS=64*1024;var sS={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},cS={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function Yn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var lS=(1n<<256n)-1n;function cg(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function lg(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
169
- `)}function ug(t,e){return Z(`comet.native.snapshot-policy.v1
170
- ${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function po(t,e,i){let n=new Set(e),r=[...e];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=t[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 fg(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function mu(t){let e=Fn(t,"Native snapshot pattern"),i=[];for(let n=0;n<e.length;n+=1){let r=e[n];r==="*"&&e[n+1]==="*"?(n+=1,e[n+1]==="/"?(n+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):r==="*"?i.push({kind:"star"}):r==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:r})}return(n,r)=>{let a=r?fg(r):void 0;if(a&&!a())return!1;let o=po(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=po(i,c,a),o===null||o.size===0)return!1}return po(i,o,a)?.has(i.length)??!1}}function dg(t){if(t===void 0)return;let e=[...new Set(t.include.map(r=>Fn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(t.exclude.map(r=>Fn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let n=ug(e,i);if("hash"in t&&t.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:n},includeMatchers:e.map(mu),excludeMatchers:i.map(mu),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(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function te(t,e,i){let n=Object.keys(t).find(r=>!e.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function bt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function me(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function wu(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=Xn.posix.normalize(t);if(i!==t||Xn.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function hg(t,e){let i=ee(t,`Native snapshot entry ${e}`);te(i,tg,`Native snapshot entry ${e}`);let n=wu(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!Qn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let r={path:n,hash:i.hash,size:me(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!sg.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function pg(t,e){let i=ee(t,`Native snapshot omission ${e}`);if(te(i,ig,`Native snapshot omission ${e}`),!ag.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!og.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:wu(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:me(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function mg(t){let e=ee(t,"Native snapshot omission overflow");if(te(e,ng,"Native snapshot omission overflow"),typeof e.hash!="string"||!Qn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:bt(e.count,"Native snapshot omission overflow count")}}function Nt(t,e){let i=ee(t,e);if(te(i,Qv,e),typeof i.hash!="string"||!Qn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let n=me(i.recordCount,`${e} recordCount`),r=me(i.storedRecordCount,`${e} storedRecordCount`),a=me(i.stdoutBytes,`${e} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function vu(t){let e=ee(t,"Native Git selection evidence");if(te(e,Xv,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=Nt(e.stageBefore,"Native Git selection stageBefore"),n=Nt(e.combined,"Native Git selection combined"),r=Nt(e.stageAfter,"Native Git selection stageAfter"),a=Nt(e.finalStageBefore,"Native Git selection finalStageBefore"),o=Nt(e.finalCombined,"Native Git selection finalCombined"),s=Nt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(f=>f.overflow),l=!Yn(i,r)||!Yn(r,a)||!Yn(n,o)||!Yn(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(e.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 gu(t,e){let i=ee(t,e);if(te(i,eg,e),typeof i.hash!="string"||!Qn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let n=me(i.visitedNodeCount,`${e} visitedNodeCount`),r=me(i.recordCount,`${e} recordCount`),a=me(i.storedRecordCount,`${e} storedRecordCount`),o=me(i.encodedBytes,`${e} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function vg(t){let e=ee(t,"Native physical selection evidence");if(te(e,Zv,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=gu(e.before,"Native physical selection before"),n=gu(e.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!cg(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(e.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 yu(t){let e=ee(t,"Native content snapshot manifest");if(te(e,Jv,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!rg.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=ee(e.capture,"Native content snapshot capture");if(te(v,Gv,"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:vu(v.gitSelection),b=v.physicalSelection===void 0?void 0:vg(v.physicalSelection),_=null;if(v.projection!==void 0){let W=ee(v.projection,"Native content snapshot projection");if(te(W,Yv,"Native content snapshot projection"),W.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");_={provider:"git",...W.selection===void 0?{}:{selection:vu(W.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 e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=ee(e.limits,"Native content snapshot limits");te(n,Kv,"Native content snapshot limits");let r={maxFiles:bt(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:bt(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:bt(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:bt(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:bt(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=ee(e.policy,"Native snapshot policy");if(te(v,Uv,"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=dg({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(hg),s=e.omitted.map(pg),c=me(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:mg(e.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>Vv||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(e.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,S=N?.status==="overflow"||N?.status==="overflow-and-changed",k=N?.status==="changed"||N?.status==="overflow-and-changed";if(S!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(k!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(lg(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function gg(t,e){if(!Wv.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=Xn.join(t.changesDir,e);if(!U(t.changesDir,i))throw new Error("Native change path escaped");return Xn.join(i,"runtime","baseline-manifest.json")}async function Nu(t,e){let i=gg(t,e);await O(t.nativeRoot,i);try{let n=await tu({root:t.nativeRoot,file:i,maxBytes:zv,label:"Native baseline snapshot manifest"});return yu(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var ZS=256*1024;var dk={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 Eg}from"node:crypto";import{promises as Zn}from"node:fs";import Oe from"node:path";var bi=/^[a-f0-9]{64}$/u,Pk=16*1024;function Rg(t,e){let i=Oe.relative(t,e);return Oe.isAbsolute(i)||i===".."||i.startsWith(`..${Oe.sep}`)?null:i.replaceAll("\\","/")||"."}function Cg(t){return Array.from(t).some(e=>{let i=e.codePointAt(0)??0;return i<=31||i===127})}function Pg(t,e){if(t.length===0||Cg(t)||t.includes("\\")||Oe.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes(".."))throw new Error(`${e} must be a portable project-relative path`);let i=Oe.posix.normalize(t);if(i!==t||i===".."||i.startsWith("../"))throw new Error(`${e} must be a normalized project-relative path`);return i}function mo(t,e){return Eg("sha256").update(`${t}
171
- ${e}`).digest("hex")}async function Su(t,e){let i=await Zn.realpath(e),n=await Zn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=process.platform==="win32"?Oe.normalize(i).toLowerCase():i;return mo(t,`${r}
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
172
  ${n.dev}
173
173
  ${n.ino}
174
- ${n.birthtimeMs}`)}async function ku(t,e){let i=await Zn.realpath(e),n=await Zn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=process.platform==="win32"?Oe.normalize(i).toLowerCase():i;return mo(t,r)}function Ag(t){if(typeof t!="string")throw new Error("Native workspace capturedAt is invalid");let e=new Date(t);if(!Number.isFinite(e.getTime())||e.toISOString()!==t)throw new Error("Native workspace capturedAt is invalid");return t}function xg(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace identity must be an object");let e=t,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash"]),n=Object.keys(e).filter(o=>!i.has(o));if(n.length>0)throw new Error(`Native workspace identity has unknown field(s): ${n.join(", ")}`);if(e.schema!=="comet.native.workspace.v2")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(e.capturedRevision)||e.capturedRevision<1||typeof e.nativeRootRef!="string"||!bi.test(String(e.projectRootId))||!bi.test(String(e.nativeRootId)))throw new Error("Native workspace identity is invalid");Ag(e.capturedAt),Pg(e.nativeRootRef,"Native workspace root ref");let r=e.projectRootPathId!==void 0,a=e.nativeRootPathId!==void 0;if(r!==a)throw new Error("Native workspace path identities must be provided together");if(r&&!bi.test(String(e.projectRootPathId))||a&&!bi.test(String(e.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(e.sessionHash!==void 0&&!bi.test(String(e.sessionHash)))throw new Error("Native workspace session hash is invalid")}function Tg(t,e){return Oe.join(t.changesDir,e,"runtime","workspace.json")}async function _g(t){if(!Number.isSafeInteger(t.revision)||t.revision<1)throw new Error("Native workspace revision must be a positive integer");let e=Rg(t.paths.projectRoot,t.paths.nativeRoot);if(!e)throw new Error("Native root is outside the project root");let[i,n,r,a]=await Promise.all([Su("comet.native.workspace-project-root.v2",t.paths.projectRoot),Su("comet.native.workspace-native-root.v2",t.paths.nativeRoot),ku("comet.native.workspace-project-root-path.v2",t.paths.projectRoot),ku("comet.native.workspace-native-root-path.v2",t.paths.nativeRoot)]),s={schema:"comet.native.workspace.v2",capturedAt:(t.now??new Date).toISOString(),capturedRevision:t.revision,nativeRootRef:e,projectRootId:i,nativeRootId:n,projectRootPathId:r,nativeRootPathId:a,...t.sessionId?{sessionHash:mo("comet.native.workspace-session.v2",`${i}
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
175
  ${n}
176
- ${t.sessionId}`)}:{}};return xg(s),s}async function vo(t){let e=await _g(t),i=Tg(t.paths,t.name);return await O(t.paths.nativeRoot,i),await oe(i,e,{containedRoot:t.paths.nativeRoot}),e}var Ge="comet.native.v3",Ye="comet.native.v2",Xe="comet.native.v1";var Eu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Og=new Set(Eu),Ru=new Set([...Eu,"minimum_runtime_version","revision"]),$g=new Set([...Ru,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Hg=new Set(["capability","operation","source","base_hash"]),Mg=new Set(["shape","build","verify","archive"]),Lg=new Set(["implicit","confirmed"]),Dg=new Set(["pending","pass","fail"]),Ze="comet-state.yaml",wo=/^[a-f0-9]{64}$/u,Cu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Fg=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,yo=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"},kt=class extends Error{constructor(i,n){super(i!==Ge||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"},er=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"},tr=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"},Kk=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
177
- `);function ki(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Pu(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function bo(t){if(!Cu.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Bg(t){if(!Cu.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Au(t,e){if(t.length===0||Qe.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function qg(t,e){let i=ki(t,`spec_changes[${e}]`);if(Pu(i,Hg,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(Bg(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"&&Au(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"||!wo.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"||!wo.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 Vg(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function So(t,e){if(Pu(t,e,Ze),typeof t.name!="string")throw new Error("Native change name is required");if(bo(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!Mg.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Lg.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(qg),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 t.verification_result!="string"||!Dg.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Au(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!Vg(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function ko(t){let e=ki(t,Ze);if(e.schema!==Xe)throw new Error(`Expected ${Xe}`);return{schema:Xe,...So(e,Og)}}function Si(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function go(t,e,i){if(t===null)return null;let n=typeof t=="string"?Fg.exec(t):null;if(!n||n[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function zg(t){if(t==null)return null;if(typeof t!="string"||!wo.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function Wg(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function Eo(t){let e=ki(t,Ze);if(e.schema!==Ye)throw new Error(`Expected ${Ye}`);if(Si(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Ye} minimum_runtime_version must be 2`);return{schema:Ye,minimum_runtime_version:2,revision:Si(e.revision,"Native v2 revision"),...So(e,Ru)}}function Ro(t){let e=ki(t,Ze);if(e.schema!==Ge){if(e.schema===Xe||e.schema===Ye){let o=e.schema===Xe?ko(e):Eo(e);throw new yo(o.name,o.schema)}throw new kt(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=Si(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new kt(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let n=Si(e.revision,"Native revision"),r=So(e,$g),a=zg(e.approved_contract_hash);if(r.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Ge,minimum_runtime_version:3,revision:n,verification_protocol:Wg(e.verification_protocol),...r,approved_contract_hash:a,implementation_scope:go(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:go(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:go(e.partial_allowance,"Native partial_allowance","allowances")}}function Jg(t){let e=ki(t,Ze);if(e.schema===Xe){let r=ko(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${Ge}`}}if(e.schema===Ye){let r=Eo(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${Ge}`}}if(e.schema!==Ge){let r=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new kt(typeof e.schema=="string"?e.schema:"(missing)",r).message}}let i=Si(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new kt(e.schema,i).message};let n=Ro(e);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function ce(t,e){bo(e);let i=Qe.join(t.changesDir,e);if(!U(t.changesDir,i))throw new Error("Native change path escaped");return i}async function Co(t,e){let i=Qe.join(ce(t,e),"runtime","schema-migration.json");await O(t.nativeRoot,i);try{return await jg.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Kg=256*1024;async function Ug(t,e=Qe.dirname(t)){let i=Qe.relative(e,t).split(Qe.sep).join("/"),n=await We({root:e,ref:i,maxBytes:Kg}),r=(0,No.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${r.errors[0].message}`);return r.toJS()}async function xu(t,e){let i=Qe.join(ce(t,e),Ze);await O(t.nativeRoot,i);let n=Jg(await Ug(i,t.nativeRoot));if(n.state&&n.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await Co(t,e)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(n.status==="current"&&n.state&&await Gg(t,n.state),n)}async function Gg(t,e){if(await Nu(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}var Ao=64*1024*1024,oE=256*1024,ju=16*1024*1024;async function G(t){try{return await et.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Zg(t){let e;try{e=await et.readdir(t.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of e){if(!i.isDirectory()||i.isSymbolicLink())continue;let n;try{n=await Ni(t,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 ew(t,e){for(let i of await et.readdir(t.locksDir,{withFileTypes:!0})){let n=j.join(t.locksDir,i.name);if(j.resolve(n)!==j.resolve(e)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${n}`)}}async function tw(t){let e;try{e=await et.readdir(t.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of e.sort((n,r)=>n.name.localeCompare(r.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let n;try{n=await xu(t,i.name)}catch{continue}n.status!=="current"||!n.state||!("revision"in n.state)||await vo({paths:t,name:i.name,revision:n.state.revision})}}async function Ri(t,e){let i=[];async function n(r){let a=await Ke({root:t,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(e.excludedFiles?.has(j.resolve(c))){await a.verify();continue}let l=await et.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(e.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:j.relative(t,c).split(j.sep).join("/"),type:"directory"}),await n(c);else if(s.isFile()&&l.isFile()){let u=await q({root:t,file:c,maxBytes:Ao,label:`Native root file ${j.relative(t,c)}`});i.push({ref:j.relative(t,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(t),i.sort((r,a)=>r.ref.localeCompare(a.ref))}async function iw(t,e,i,n){await vi({root:n,directory:e,label:"Native root move staging directory"});async function r(a,o){let s=await Ke({root:t,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 et.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 vi({root:n,directory:d,label:"Native root move staging directory"}),await r(u,d);else if(l.isFile()&&f.isFile())await gi({sourceRoot:t,source:u,targetRoot:n,target:d,maxBytes:Ao,label:`Native root move file ${j.relative(t,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await r(t,e)}async function ir(t,e,i,n){let r=await Ri(t,{rejectSymlinks:!0,excludedFiles:i?new Set([j.resolve(i)]):void 0}),a=await Ri(e,{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: ${t} and ${e}`)}function nw(t,e){return j.join(t.artifactRoot,`.comet-native-move-${e}`)}function rw(t,e){return j.join(t.artifactRoot,`.comet-native-source-${e}.removing`)}function aw(t){return`${t}.removing`}function Ou(t,e,i){return j.join(Gn(t,e).directory,`root-move-cleanup-${i}.json`)}function ow(t){return JSON.stringify(t,null,2)+`
178
- `}function sw(t){return Xg("sha256").update(t).digest("hex")}function cw(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Native root-move cleanup manifest entry ${e} must be an object`);let i=t,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 ${e} 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 ${e} 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 ${e} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function lw(t,e,i){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native root-move cleanup manifest must be an object");let n=t;if(JSON.stringify(Object.keys(n).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||n.schema!=="comet.native.root-move-cleanup.v1"||n.transactionId!==e||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:e,kind:i,entries:r}}async function uw(t){let e={schema:"comet.native.root-move-cleanup.v1",transactionId:t.id,kind:t.kind,entries:t.entries},i=ow(e);if(Buffer.byteLength(i,"utf8")>ju)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await he(Ou(t.paths,t.id,t.kind),i,{containedRoot:t.paths.nativeRoot}),sw(i)}async function fw(t){let e=await q({root:t.paths.nativeRoot,file:Ou(t.paths,t.id,t.cleanup.kind),maxBytes:ju,label:`Native root-move cleanup manifest ${t.cleanup.kind}`});if(e.hash!==t.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return lw(JSON.parse(e.bytes.toString("utf8")),t.id,t.cleanup.kind)}async function Po(t){let e=await Ri(t.quarantine,{rejectSymlinks:!0}),i=new Map(t.manifest.entries.map(n=>[n.ref,n]));for(let n of e){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(t.exact&&e.length!==t.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return e}function Tu(t){return t.ref.split("/").length}async function dw(t){let i=[...await Po({quarantine:t.quarantine,manifest:t.manifest,exact:!1})].sort((r,a)=>Tu(a)-Tu(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(t.quarantine,...r.ref.split("/"));r.type==="file"?await so({root:t.projectRoot,file:a,maxBytes:Ao,expectedHash:r.hash,expectedSize:r.size,label:`Native root-move cleanup file ${r.ref}`}):await co({root:t.projectRoot,directory:a,label:`Native root-move cleanup directory ${r.ref}`}),n+=1,await t.hooks?.afterRootMoveCleanupEntryRemoved?.(t.manifest.kind,r.ref,n)}await Po({quarantine:t.quarantine,manifest:t.manifest,exact:!1}),await co({root:t.projectRoot,directory:t.quarantine,label:`Native root-move cleanup quarantine ${t.manifest.kind}`})}function nr(t,e,i=t.native.artifact_root){return{...t,native:{...t.native,artifact_root:i,pending_root_move:e}}}function hw(t){return{schema:"comet.native.transaction.v1",id:t.id,kind:"root-move",status:"prepared",projectRoot:t.paths.projectRoot,nativeRoot:t.paths.nativeRoot,createdAt:t.now.toISOString(),operations:[]}}async function _u(t){let e=nr(t.config,{...t.pending,stage:t.stage},t.activeArtifactRoot);return await fi(t.projectRoot,e),e}async function Ei(t){let e=t.config.native.pending_root_move;if(!e||e.id!==t.id)throw new Error(`Native root-move cleanup ${t.id} lost its pending configuration`);let i=nr(t.config,{id:e.id,fromArtifactRoot:e.fromArtifactRoot,toArtifactRoot:e.toArtifactRoot,stage:e.stage,...t.cleanup?{cleanup:t.cleanup}:{}},t.config.native.artifact_root);return await fi(t.projectRoot,i),i}async function Iu(t){let e=t.config,i=e.native.pending_root_move;if(!i||i.id!==t.id)throw new Error(`Native root-move cleanup ${t.id} lost its pending configuration`);let n=i.cleanup;if(n&&n.kind!==t.kind)throw new Error(`Native root move has unfinished ${n.kind} cleanup; cannot start ${t.kind}`);let r=await G(t.target),a=await G(t.quarantine);if(r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${t.kind}`);if(!n){if(!r&&!a)return e;if(!r&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${t.kind}`);let s=await uw({paths:t.stablePaths,id:t.id,kind:t.kind,entries:await Ri(t.target,{rejectSymlinks:!0})});n={kind:t.kind,state:"prepared",manifestHash:s},e=await Ei({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:n})}let o=await fw({paths:t.stablePaths,id:t.id,cleanup:n});if(r=await G(t.target),a=await G(t.quarantine),r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${t.kind}`);if(r){if(n.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${t.kind}`);await iu({root:t.projectRoot,directory:t.target,quarantine:t.quarantine,label:t.label,beforeQuarantine:t.beforeQuarantine,afterQuarantine:t.afterQuarantine}),a=!0}if(!a){if(n.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${t.kind}`);return Ei({projectRoot:t.projectRoot,config:e,id:t.id})}return await Po({quarantine:t.quarantine,manifest:o,exact:n.state!=="deleting"}),n.state==="prepared"&&(n={...n,state:"quarantined"},e=await Ei({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:n})),n.state==="quarantined"&&(n={...n,state:"deleting"},e=await Ei({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:n})),await dw({projectRoot:t.projectRoot,quarantine:t.quarantine,manifest:o,hooks:t.hooks}),Ei({projectRoot:t.projectRoot,config:e,id:t.id})}async function pw(t){let e=t.config,i=e.native.pending_root_move.stage;if(i==="copying"){if(!await G(t.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${t.sourcePaths.nativeRoot}`);let s=aw(t.staging);e=await Iu({projectRoot:t.projectRoot,config:e,id:t.pending.id,kind:"restart-staging",stablePaths:t.sourcePaths,target:t.staging,quarantine:s,label:"Native root move stale staging removal",hooks:t.hooks}),await Ri(t.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([j.resolve(t.lockFile)])}),await iw(t.sourcePaths.nativeRoot,t.staging,t.lockFile,t.destinationPaths.projectRoot),await ir(t.sourcePaths.nativeRoot,t.staging,t.lockFile),e=await _u({projectRoot:t.projectRoot,config:e,pending:t.pending,stage:"ready"}),i="ready",await t.hooks?.afterRootMoveStage?.("ready",t.journal)}if(i==="ready"){if(await G(t.destinationPaths.nativeRoot)){if(await G(t.staging))throw new Error(`Native destination is occupied: ${t.destinationPaths.nativeRoot}`);await ir(t.sourcePaths.nativeRoot,t.destinationPaths.nativeRoot,t.lockFile)}else{if(!await G(t.staging))throw new Error("Native move staging tree is missing");await ir(t.sourcePaths.nativeRoot,t.staging,t.lockFile),await et.rename(t.staging,t.destinationPaths.nativeRoot)}e=await _u({projectRoot:t.projectRoot,config:e,pending:t.pending,stage:"switched",activeArtifactRoot:t.pending.toArtifactRoot}),i="switched",await t.hooks?.afterRootMoveStage?.("switched",t.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await G(t.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${t.destinationPaths.nativeRoot}`);let n=rw(t.sourcePaths,t.pending.id);!e.native.pending_root_move?.cleanup&&await G(t.sourcePaths.nativeRoot)&&await ir(t.sourcePaths.nativeRoot,t.destinationPaths.nativeRoot,t.lockFile),e=await Iu({projectRoot:t.projectRoot,config:e,id:t.pending.id,kind:"forward-source",stablePaths:t.destinationPaths,target:t.sourcePaths.nativeRoot,quarantine:n,label:"Native root move source removal",beforeQuarantine:()=>t.hooks?.beforeRootMoveSourceRemove?.(t.sourcePaths.nativeRoot),afterQuarantine:s=>t.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:t.hooks}),await tw(t.destinationPaths);let r=await Ni(t.destinationPaths,t.pending.id);await ho(t.destinationPaths,r,"commit");let a={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},o={...e,native:{...a,artifact_root:t.pending.toArtifactRoot}};return await fi(t.projectRoot,o),o}async function $u(t){let e=await Ie(t.projectRoot)??Fl("docs");if(e.native.pending_root_move)throw new Error(`Native root move ${e.native.pending_root_move.id} is already incomplete`);let i=ui(t.toArtifactRoot);if(i===e.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let n=await ze(t.projectRoot,e.native.artifact_root),r=await ze(t.projectRoot,i);if(U(n.nativeRoot,r.nativeRoot)||U(r.nativeRoot,n.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await G(n.nativeRoot))throw new Error(`Native source root does not exist: ${n.nativeRoot}`);if(await Zg(n),await G(r.nativeRoot))throw new Error(`Native destination is occupied: ${r.nativeRoot}`);let a=await hi(n,"root-move",`move root to ${i}`),o=Qg(),s={id:o,fromArtifactRoot:e.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=hw({id:o,paths:n,now:t.now??new Date}),l=nw(r,o);try{if(await ew(n,a.file),await G(l))throw new Error(`Native move staging path is occupied: ${l}`);return await fi(t.projectRoot,nr(e,s)),await hu(n,c),await t.hooks?.afterRootMoveStage?.("copying",c),await pw({projectRoot:t.projectRoot,config:nr(e,s),pending:s,sourcePaths:n,destinationPaths:r,staging:l,journal:c,lockFile:a.file,hooks:t.hooks}),{fromNativeRoot:n.nativeRoot,toNativeRoot:r.nativeRoot,transactionId:o}}finally{await pi(a)}}import Uw from"path";var vw=["Outcome","Scope","Non-goals","Acceptance examples"],bE=[...vw,"Constraints and invariants","Decisions","Open questions","Verification expectations"];import{createHash as gw}from"crypto";function le(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function ww(t,e){e.has(t)&&le("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let n=0;n<t.length;n+=1)Object.prototype.hasOwnProperty.call(t,n)||le("sparse arrays are not supported");return(i.length!==t.length||i.some((n,r)=>n!==String(r)))&&le("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&le("symbol properties are not supported"),`[${t.map(n=>xo(n,e)).join(",")}]`}finally{e.delete(t)}}function yw(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&le("only plain objects are supported"),e.has(t)&&le("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&le("symbol properties are not supported"),e.add(t);try{let n=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=n[o];return(!s||!("value"in s))&&le("accessor properties are not supported"),`${JSON.stringify(o)}:${xo(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function xo(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||le("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?ww(t,e):yw(t,e);case"bigint":case"function":case"symbol":case"undefined":return le(`${typeof t} values are not supported`)}return le("unsupported value type")}function To(t){return xo(t,new Set)}function ue(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return gw("sha256").update(`${t}
179
- ${To(e)}`).digest("hex")}var Nw=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 Hu=1024*1024;var Lu="scoped-text-safety",bw=1,Sw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var kw="comet.native.checker-policy.v1";var DE=ue(kw,{policy:Lu,version:bw,limits:Sw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Ew=["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"],FE=new Set(Ew);var Cw=Hu,rR=3*Cw;var Du={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:[]},Pw=Z("comet-native-runtime:v3:semantic-repair-budget"),jR=[{skillVersion:"2",skillHash:Z("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:Z("comet-native-runtime:v1")}];var Bu=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],hC=new Set(Bu),jw=new Set([...Bu,"minimum_runtime_version","revision"]),pC=new Set([...jw,"operation"]),mC=512*1024,Ow=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),vC=new Set([...Ow,"implementationScopeHash","repairScopeHash","repairStagnation"]);var yC=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),qu=Object.freeze({maxCriteria:1024});var CC={maxAcceptanceCriteria:qu.maxCriteria};var _C={maxSpecs:64,maxFileBytes:qn,maxTotalBytes:4*1024*1024};import{execFile as qw,spawn as gP}from"node:child_process";import{promisify as Vw}from"node:util";var qC={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var uP=512*1024;var _P=64*1024;var IP=3600*1e3;var jP=Vw(qw);var OP=["$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 ar=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(n=>`${n.ref}${n.acceptanceId?`[${n.acceptanceId}]`:""} -> ${n.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var NA={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var xA=16*1024*1024,TA=256*1024,_A=16*1024;var OA=16*1024;var WA=16*1024;var Tx=16*1024*1024,or=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"},sr=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 Fx=10*1024*1024,ve=class extends Error{};function zu(t,e){let i=t.flatMap((n,r)=>n===e?[r]:[]);if(i.length>1)throw new ve(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function Wu(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new ve(`${e} may only be provided once`);if(i.length===0)return;let n=i[0],r=t[n+1];if(r===void 0||r.startsWith("--"))throw new ve(`${e} requires a value`);return t.splice(n,2),r}function _o(t){if(t.length>0)throw new ve(`Unexpected argument: ${t[0]}`)}function Io(t,e){let i=t.shift();if(!i||i.startsWith("--"))throw new ve(`${e} is required`);return i}async function Ju(t){return t?Uw.resolve(t):io(process.cwd())}function jo(t,e,i){return{command:t,exitCode:0,data:e,text:i??JSON.stringify(e,null,2)+`
180
- `}}function Ku(t,e){if(e instanceof ve)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof or)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof sr)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof er)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof tr)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.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:e.message}};if(e instanceof ar)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let n=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:n?73:65,error:{code:n?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function Uu(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
181
- `}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function Gu(t,e){let i=Io(t,"root subcommand");if(i==="show"){_o(t);let n=await Ie(e);if(!n)throw new Error(".comet/config.yaml was not found");let r=await ze(e,n.native.artifact_root);return jo("root show",{projectRoot:e,artifactRoot:n.native.artifact_root,language:n.native.language,nativeRoot:r.nativeRoot,pendingRootMove:n.native.pending_root_move??null})}if(i==="move"){let n=Io(t,"artifact root");_o(t);let r=await $u({projectRoot:e,toArtifactRoot:n});return jo("root move",r,`Moved Comet Native to ${r.toNativeRoot}
182
- `)}throw new ve(`Unknown root command: ${i}`)}function Gw(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
183
- `}}async function Yu(t,e,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{zu(r,"--json"),s=Wu(r,"--project-root");let u=[...r,...a],f=await Ju(s);c=await e(u,f)}catch(u){c=Ku(t,u)}let l=o?Gw(c):Uu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
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(`
184
184
  `)?"":`
185
- `)),l.exitCode}process.exitCode=await Yu("root",Gu);
185
+ `)),l.exitCode}process.exitCode=await pf("root",hf);