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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (371) hide show
  1. package/README.md +49 -24
  2. package/assets/manifest.json +2 -1
  3. package/assets/skills/comet/scripts/comet-archive.mjs +128 -128
  4. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +78 -78
  5. package/assets/skills/comet/scripts/comet-guard.mjs +144 -144
  6. package/assets/skills/comet/scripts/comet-handoff.mjs +109 -109
  7. package/assets/skills/comet/scripts/comet-hook-guard.mjs +130 -130
  8. package/assets/skills/comet/scripts/comet-hook-router.mjs +115 -115
  9. package/assets/skills/comet/scripts/comet-resume-probe.mjs +85 -85
  10. package/assets/skills/comet/scripts/comet-runtime.mjs +188 -187
  11. package/assets/skills/comet/scripts/comet-state.mjs +117 -117
  12. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +71 -71
  13. package/assets/skills/comet-build/SKILL.md +15 -56
  14. package/assets/skills/comet-classic/SKILL.md +14 -8
  15. package/assets/skills/comet-classic/reference/comet-yaml-fields.md +1 -1
  16. package/assets/skills/comet-classic/reference/scripts.md +3 -1
  17. package/assets/skills/comet-classic/reference/workspace.md +23 -0
  18. package/assets/skills/comet-native/SKILL.md +13 -10
  19. package/assets/skills/comet-native/reference/artifacts.md +3 -2
  20. package/assets/skills/comet-native/reference/commands.md +1 -1
  21. package/assets/skills/comet-native/reference/recovery.md +1 -1
  22. package/assets/skills/comet-native/reference/workspace.md +4 -4
  23. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +97 -97
  24. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +146 -146
  25. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +100 -100
  26. package/assets/skills/comet-native/scripts/comet-native-init.mjs +85 -85
  27. package/assets/skills/comet-native/scripts/comet-native-new.mjs +115 -115
  28. package/assets/skills/comet-native/scripts/comet-native-next.mjs +118 -118
  29. package/assets/skills/comet-native/scripts/comet-native-root.mjs +107 -107
  30. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +154 -154
  31. package/assets/skills/comet-native/scripts/comet-native-select.mjs +133 -133
  32. package/assets/skills/comet-native/scripts/comet-native-show.mjs +109 -109
  33. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +87 -87
  34. package/assets/skills/comet-native/scripts/comet-native-status.mjs +109 -109
  35. package/assets/skills/comet-open/SKILL.md +24 -5
  36. package/assets/skills-zh/comet-build/SKILL.md +15 -56
  37. package/assets/skills-zh/comet-classic/SKILL.md +14 -8
  38. package/assets/skills-zh/comet-classic/reference/comet-yaml-fields.md +1 -1
  39. package/assets/skills-zh/comet-classic/reference/scripts.md +3 -1
  40. package/assets/skills-zh/comet-classic/reference/workspace.md +23 -0
  41. package/assets/skills-zh/comet-native/SKILL.md +13 -10
  42. package/assets/skills-zh/comet-native/reference/artifacts.md +3 -2
  43. package/assets/skills-zh/comet-native/reference/commands.md +1 -1
  44. package/assets/skills-zh/comet-native/reference/recovery.md +1 -1
  45. package/assets/skills-zh/comet-native/reference/workspace.md +4 -4
  46. package/assets/skills-zh/comet-open/SKILL.md +24 -5
  47. package/dist/app/cli/index.js +20 -1
  48. package/dist/app/cli/index.js.map +1 -1
  49. package/dist/app/commands/classic.d.ts.map +1 -1
  50. package/dist/app/commands/classic.js +2 -0
  51. package/dist/app/commands/classic.js.map +1 -1
  52. package/dist/app/commands/eval.d.ts +9 -2
  53. package/dist/app/commands/eval.d.ts.map +1 -1
  54. package/dist/app/commands/eval.js +293 -48
  55. package/dist/app/commands/eval.js.map +1 -1
  56. package/dist/app/commands/init.d.ts.map +1 -1
  57. package/dist/app/commands/init.js +2 -1
  58. package/dist/app/commands/init.js.map +1 -1
  59. package/dist/app/commands/update.d.ts.map +1 -1
  60. package/dist/app/commands/update.js +4 -1
  61. package/dist/app/commands/update.js.map +1 -1
  62. package/dist/domains/comet-classic/classic-cli.d.ts +1 -1
  63. package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
  64. package/dist/domains/comet-classic/classic-cli.js +3 -0
  65. package/dist/domains/comet-classic/classic-cli.js.map +1 -1
  66. package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
  67. package/dist/domains/comet-classic/classic-current-change.js +29 -3
  68. package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
  69. package/dist/domains/comet-classic/classic-guard.js +2 -2
  70. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  71. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  72. package/dist/domains/comet-classic/classic-hook-guard.js +14 -1
  73. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  74. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  75. package/dist/domains/comet-classic/classic-state-command.js +31 -8
  76. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  77. package/dist/domains/comet-classic/classic-workspace-command.d.ts +3 -0
  78. package/dist/domains/comet-classic/classic-workspace-command.d.ts.map +1 -0
  79. package/dist/domains/comet-classic/classic-workspace-command.js +45 -0
  80. package/dist/domains/comet-classic/classic-workspace-command.js.map +1 -0
  81. package/dist/domains/comet-classic/classic-workspace.d.ts +38 -0
  82. package/dist/domains/comet-classic/classic-workspace.d.ts.map +1 -0
  83. package/dist/domains/comet-classic/classic-workspace.js +315 -0
  84. package/dist/domains/comet-classic/classic-workspace.js.map +1 -0
  85. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  86. package/dist/domains/comet-entry/hook-adapter.js +1 -0
  87. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  88. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -0
  89. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  90. package/dist/domains/comet-entry/hook-router-entry.js +21 -1
  91. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  92. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  93. package/dist/domains/comet-entry/init-workflow.js +13 -5
  94. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  95. package/dist/domains/comet-native/index.d.ts +1 -0
  96. package/dist/domains/comet-native/index.d.ts.map +1 -1
  97. package/dist/domains/comet-native/index.js +1 -0
  98. package/dist/domains/comet-native/index.js.map +1 -1
  99. package/dist/domains/comet-native/native-children.d.ts +49 -0
  100. package/dist/domains/comet-native/native-children.d.ts.map +1 -0
  101. package/dist/domains/comet-native/native-children.js +388 -0
  102. package/dist/domains/comet-native/native-children.js.map +1 -0
  103. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
  104. package/dist/domains/comet-native/native-cli-help.js +3 -3
  105. package/dist/domains/comet-native/native-cli-help.js.map +1 -1
  106. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  107. package/dist/domains/comet-native/native-doctor-command.js +10 -5
  108. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  109. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  110. package/dist/domains/comet-native/native-hook-guard.js +41 -2
  111. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  112. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  113. package/dist/domains/comet-native/native-next-command.js +85 -5
  114. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  115. package/dist/domains/comet-native/native-portable-continuation.d.ts +3 -2
  116. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
  117. package/dist/domains/comet-native/native-portable-continuation.js +63 -1
  118. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
  119. package/dist/domains/comet-native/native-portable-runtime.d.ts +5 -0
  120. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -1
  121. package/dist/domains/comet-native/native-portable-runtime.js +110 -4
  122. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -1
  123. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
  124. package/dist/domains/comet-native/native-portable-state.js +13 -0
  125. package/dist/domains/comet-native/native-portable-state.js.map +1 -1
  126. package/dist/domains/comet-native/native-portable-status.d.ts +3 -0
  127. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -1
  128. package/dist/domains/comet-native/native-portable-status.js +9 -1
  129. package/dist/domains/comet-native/native-portable-status.js.map +1 -1
  130. package/dist/domains/comet-native/native-portable-types.d.ts +1 -0
  131. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
  132. package/dist/domains/comet-native/native-portable-types.js.map +1 -1
  133. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
  134. package/dist/domains/comet-native/native-show-command.js +2 -1
  135. package/dist/domains/comet-native/native-show-command.js.map +1 -1
  136. package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -1
  137. package/dist/domains/comet-native/native-workspace-preparation.js +192 -133
  138. package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -1
  139. package/dist/domains/dashboard/collector.d.ts +1 -1
  140. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  141. package/dist/domains/dashboard/collector.js +102 -87
  142. package/dist/domains/dashboard/collector.js.map +1 -1
  143. package/dist/domains/dashboard/native-adapter.d.ts +20 -0
  144. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  145. package/dist/domains/dashboard/native-adapter.js +11 -0
  146. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  147. package/dist/domains/dashboard/native-collector.d.ts +1 -0
  148. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  149. package/dist/domains/dashboard/native-collector.js +304 -55
  150. package/dist/domains/dashboard/native-collector.js.map +1 -1
  151. package/dist/domains/dashboard/native-legacy-adapter.d.ts +12 -5
  152. package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -1
  153. package/dist/domains/dashboard/native-legacy-adapter.js +12 -0
  154. package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -1
  155. package/dist/domains/dashboard/server.d.ts.map +1 -1
  156. package/dist/domains/dashboard/server.js +5 -3
  157. package/dist/domains/dashboard/server.js.map +1 -1
  158. package/dist/domains/dashboard/types.d.ts +5 -0
  159. package/dist/domains/dashboard/types.d.ts.map +1 -1
  160. package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-B5cFR6hS.js +1 -0
  161. package/dist/domains/dashboard/web/assets/arc-CVQDtMsu.js +1 -0
  162. package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-C0v0kULK.js +36 -0
  163. package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-DpHLuxu4.js +132 -0
  164. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-BL17BIb8.js → c4Diagram-5PPSVZJV-BHnFxUs1.js} +1 -1
  165. package/dist/domains/dashboard/web/assets/channel-eM0x3m1G.js +1 -0
  166. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-XWLMOyd4.js → chunk-2GRJ4B5K-CGC9gh5n.js} +1 -1
  167. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-4drjXzHQ.js → chunk-2Q5K7J3B-l4puLU_O.js} +1 -1
  168. package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-ls9jQHZc.js +231 -0
  169. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-CQXqBSqQ.js → chunk-5VM5RSS4-BVavmTEq.js} +1 -1
  170. package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-Dungt2g9.js +88 -0
  171. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-pMreYMW7.js → chunk-GF5L2VYU-BidXO_ZP.js} +5 -5
  172. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-vQyyh3eG.js → chunk-JWPE2WC7-57L5Up5X.js} +1 -1
  173. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-B_DDS2IK.js → chunk-KBJHAD2P-C5u5vbwr.js} +1 -1
  174. package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-CvLz21I2.js +1 -0
  175. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-Cug8J1Qa.js → chunk-XXDRQBXY-D5nJpckG.js} +1 -1
  176. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-CEFhao2K.js +1 -0
  177. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-CEFhao2K.js +1 -0
  178. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-IQKP-hgj.js → cose-bilkent-JH36ORCC-Dp0JAGyE.js} +1 -1
  179. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-CvvRO4J2.js → cynefin-VYW2F7L2-EjC54l1g.js} +2 -2
  180. package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-CpYrW3w3.js +62 -0
  181. package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-h5K39rCk.js +4 -0
  182. package/dist/domains/dashboard/web/assets/{demo-CeIDHUFJ.js → demo-BfLsKrIL.js} +26 -5
  183. package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-CKQj9O4H.js +30 -0
  184. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-CN_LYqvT.js → diagram-B4RE2ZJO-DXRIYcnW.js} +3 -3
  185. package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-wWutQYmv.js +24 -0
  186. package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-EgXLJQYi.js +24 -0
  187. package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-CsQRXDQZ.js +41 -0
  188. package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-gm328Eho.js +1 -0
  189. package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-BbbMVUx_.js +85 -0
  190. package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-1Y7scCns.js +156 -0
  191. package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-BAoBqczv.js +292 -0
  192. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-CaWEk3PM.js → gitGraphDiagram-DS77QQ5N-CMUAyEzl.js} +3 -3
  193. package/dist/domains/dashboard/web/assets/{graph--OzhPTMs.js → graph-DOmOIIwC.js} +1 -1
  194. package/dist/domains/dashboard/web/assets/{index-BNyOfAhu.js → index-CCApJ0Yr.js} +1 -1
  195. package/dist/domains/dashboard/web/assets/index-DWdm_XBi.js +257 -0
  196. package/dist/domains/dashboard/web/assets/{index-BFwKBVTJ.css → index-DhhbseFJ.css} +1 -1
  197. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-BK07mNG0.js → infoDiagram-6WML65LV-BaCdtYYC.js} +1 -1
  198. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-mWnmaWfZ.js → ishikawaDiagram-WSZJBQD7-DQQlNnjU.js} +4 -4
  199. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-BPy-P7xx.js → journeyDiagram-NVQOT4AX-DW9wUMqn.js} +1 -1
  200. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-3Jq9c_lo.js → kanban-definition-27J2QSJJ-C_ITaZ0q.js} +7 -7
  201. package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +1 -0
  202. package/dist/domains/dashboard/web/assets/{linear-kQyEW-4G.js → linear-DXOo6ZRT.js} +1 -1
  203. package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +1 -0
  204. package/dist/domains/dashboard/web/assets/mermaid.core-ol-0NI97.js +306 -0
  205. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CyyurUpv.js → mindmap-definition-FAOFIHXS-CHF_HOLV.js} +1 -1
  206. package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-wQEvkNF8.js +1 -0
  207. package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-C3H3kiIP.js +39 -0
  208. package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +3 -0
  209. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CpayUMjH.js → quadrantDiagram-CIZ2JOQS-S0FdVzJb.js} +4 -4
  210. package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-DCDXDaVg.js +1 -0
  211. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-Bi8YpfnA.js → requirementDiagram-LRYGKXZP-BW8J4gO_.js} +1 -1
  212. package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-DQQBmLoy.js +40 -0
  213. package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-2tDcli0Y.js +162 -0
  214. package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-4sEZLBKb.js +1 -0
  215. package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-OgPb8pyR.js +1 -0
  216. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-CiDNPr4P.js +1 -0
  217. package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-DR7lwtxd.js +2 -0
  218. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-DggHFP9q.js +8 -0
  219. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-aHrrtV-b.js → timeline-definition-Z64GVDOM-DNIJVlQV.js} +4 -4
  220. package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-CClhw4QZ.js +34 -0
  221. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-RVQbcySh.js → wardleyDiagram-T6FBY63Y-DzR3aFPS.js} +3 -3
  222. package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DZhq0ZRj.js +7 -0
  223. package/dist/domains/dashboard/web/index.html +2 -2
  224. package/dist/domains/dashboard/workspace.d.ts +24 -0
  225. package/dist/domains/dashboard/workspace.d.ts.map +1 -0
  226. package/dist/domains/dashboard/workspace.js +87 -0
  227. package/dist/domains/dashboard/workspace.js.map +1 -0
  228. package/dist/domains/eval/index.d.ts +3 -0
  229. package/dist/domains/eval/index.d.ts.map +1 -1
  230. package/dist/domains/eval/index.js +3 -0
  231. package/dist/domains/eval/index.js.map +1 -1
  232. package/dist/domains/eval/standalone-context.d.ts +19 -0
  233. package/dist/domains/eval/standalone-context.d.ts.map +1 -0
  234. package/dist/domains/eval/standalone-context.js +107 -0
  235. package/dist/domains/eval/standalone-context.js.map +1 -0
  236. package/dist/domains/eval/standalone-static-collect.d.ts +22 -0
  237. package/dist/domains/eval/standalone-static-collect.d.ts.map +1 -0
  238. package/dist/domains/eval/standalone-static-collect.js +779 -0
  239. package/dist/domains/eval/standalone-static-collect.js.map +1 -0
  240. package/dist/domains/eval/user-environment.d.ts +6 -0
  241. package/dist/domains/eval/user-environment.d.ts.map +1 -0
  242. package/dist/domains/eval/user-environment.js +73 -0
  243. package/dist/domains/eval/user-environment.js.map +1 -0
  244. package/dist/domains/integrations/openspec.d.ts +1 -1
  245. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  246. package/dist/domains/integrations/openspec.js +110 -26
  247. package/dist/domains/integrations/openspec.js.map +1 -1
  248. package/dist/domains/integrations/superpowers.d.ts +5 -1
  249. package/dist/domains/integrations/superpowers.d.ts.map +1 -1
  250. package/dist/domains/integrations/superpowers.js +21 -2
  251. package/dist/domains/integrations/superpowers.js.map +1 -1
  252. package/dist/domains/skill/platform-install.d.ts +1 -1
  253. package/dist/domains/skill/platform-install.js +1 -1
  254. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  255. package/dist/domains/skill/project-instructions.js +5 -3
  256. package/dist/domains/skill/project-instructions.js.map +1 -1
  257. package/dist/domains/workflow-contract/hook-write-policy.d.ts +9 -0
  258. package/dist/domains/workflow-contract/hook-write-policy.d.ts.map +1 -0
  259. package/dist/domains/workflow-contract/hook-write-policy.js +52 -0
  260. package/dist/domains/workflow-contract/hook-write-policy.js.map +1 -0
  261. package/dist/domains/workflow-contract/index.d.ts +2 -0
  262. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  263. package/dist/domains/workflow-contract/index.js +1 -0
  264. package/dist/domains/workflow-contract/index.js.map +1 -1
  265. package/dist/domains/workflow-contract/project-config.d.ts +2 -2
  266. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  267. package/dist/domains/workflow-contract/project-config.js +42 -2
  268. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  269. package/dist/domains/workflow-contract/protected-project-path.d.ts +13 -0
  270. package/dist/domains/workflow-contract/protected-project-path.d.ts.map +1 -1
  271. package/dist/domains/workflow-contract/protected-project-path.js +83 -0
  272. package/dist/domains/workflow-contract/protected-project-path.js.map +1 -1
  273. package/dist/domains/workflow-contract/types.d.ts +4 -0
  274. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  275. package/dist/platform/install/platforms.d.ts.map +1 -1
  276. package/dist/platform/install/platforms.js +13 -2
  277. package/dist/platform/install/platforms.js.map +1 -1
  278. package/dist/platform/paths/git-worktree.d.ts +7 -1
  279. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  280. package/dist/platform/paths/git-worktree.js +28 -7
  281. package/dist/platform/paths/git-worktree.js.map +1 -1
  282. package/eval/.env.example +115 -0
  283. package/eval/README.md +237 -14
  284. package/eval/langfuse/.env.example +9 -0
  285. package/eval/langfuse/tests/conftest.py +146 -0
  286. package/eval/langfuse/tests/tasks/test_tasks.py +109 -0
  287. package/eval/langfuse/tests/test_adapter.py +272 -0
  288. package/eval/langsmith/.env.example +16 -0
  289. package/eval/langsmith/tests/conftest.py +10 -1
  290. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +4 -2
  291. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -2
  292. package/eval/local/tests/conftest.py +701 -80
  293. package/eval/local/tests/scaffold/fixtures/custom-agent/adapter.yaml +19 -0
  294. package/eval/local/tests/scaffold/test_agents.py +76 -0
  295. package/eval/local/tests/scaffold/test_aligned_comparison.py +70 -0
  296. package/eval/local/tests/scaffold/test_auto_tasks.py +350 -0
  297. package/eval/local/tests/scaffold/test_conftest_helpers.py +267 -18
  298. package/eval/local/tests/scaffold/test_custom_agents.py +174 -0
  299. package/eval/local/tests/scaffold/test_eval_context.py +217 -0
  300. package/eval/local/tests/scaffold/test_execution.py +364 -0
  301. package/eval/local/tests/scaffold/test_inline_tasks.py +56 -0
  302. package/eval/local/tests/scaffold/test_langfuse_trajectory.py +263 -0
  303. package/eval/local/tests/scaffold/test_langsmith_conftest.py +63 -0
  304. package/eval/local/tests/scaffold/test_logging.py +162 -0
  305. package/eval/local/tests/scaffold/test_manifest_tasks.py +76 -0
  306. package/eval/local/tests/scaffold/test_manifests.py +396 -0
  307. package/eval/local/tests/scaffold/test_native_aligned_eval.py +17 -0
  308. package/eval/local/tests/scaffold/test_profiles.py +64 -6
  309. package/eval/local/tests/scaffold/test_task_resolution.py +212 -0
  310. package/eval/local/tests/scaffold/test_utils.py +480 -4
  311. package/eval/local/tests/tasks/test_tasks.py +216 -14
  312. package/eval/pyproject.toml +5 -0
  313. package/eval/scaffold/__init__.py +6 -0
  314. package/eval/scaffold/docker/agent-overlay.Dockerfile +41 -0
  315. package/eval/scaffold/python/__init__.py +128 -20
  316. package/eval/scaffold/python/agents.py +239 -0
  317. package/eval/scaffold/python/aligned_comparison.py +156 -27
  318. package/eval/scaffold/python/auto_tasks.py +700 -0
  319. package/eval/scaffold/python/custom_agents.py +172 -0
  320. package/eval/scaffold/python/eval_context.py +236 -0
  321. package/eval/scaffold/python/eval_schema.py +135 -0
  322. package/eval/scaffold/python/execution.py +544 -0
  323. package/eval/scaffold/python/generated_task_cache.py +230 -0
  324. package/eval/scaffold/python/generic_llm_judge.py +41 -14
  325. package/eval/scaffold/python/inline_tasks.py +118 -0
  326. package/eval/scaffold/python/judge_config.py +158 -37
  327. package/eval/scaffold/python/langfuse_adapter.py +1023 -0
  328. package/eval/scaffold/python/llm_judge.py +68 -11
  329. package/eval/scaffold/python/logging.py +157 -17
  330. package/eval/scaffold/python/manifest_tasks.py +69 -0
  331. package/eval/scaffold/python/manifests.py +443 -22
  332. package/eval/scaffold/python/paths.py +11 -1
  333. package/eval/scaffold/python/task_resolution.py +176 -0
  334. package/eval/scaffold/python/tasks.py +17 -4
  335. package/eval/scaffold/python/utils.py +167 -11
  336. package/eval/scaffold/python/validation/core.py +48 -2
  337. package/eval/scaffold/python/validation/generic_rubric.py +9 -0
  338. package/eval/scaffold/python/validation/native_workflow.py +6 -1
  339. package/eval/scaffold/python/validation/rubric.py +16 -1
  340. package/eval/scaffold/shell/agent-runtime-config.sh +88 -0
  341. package/eval/scaffold/shell/docker.sh +534 -33
  342. package/eval/scaffold/shell/run-agent-runtime.sh +49 -0
  343. package/eval/scaffold/shell/run-claude-loop.sh +153 -14
  344. package/eval/schemas/comet.eval/v1alpha1.schema.json +244 -0
  345. package/package.json +8 -3
  346. package/dist/domains/dashboard/web/assets/arc-CkuYweSh.js +0 -1
  347. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR--tTGrKam.js +0 -36
  348. package/dist/domains/dashboard/web/assets/blockDiagram-GPEHLZMM-DLKYOixs.js +0 -132
  349. package/dist/domains/dashboard/web/assets/channel-Cg__FSMr.js +0 -1
  350. package/dist/domains/dashboard/web/assets/chunk-AQP2D5EJ-BUkV_rb7.js +0 -231
  351. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CsC-pvu9.js +0 -1
  352. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CsC-pvu9.js +0 -1
  353. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-DeOQo7bP.js +0 -4
  354. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-IQd_jQwB.js +0 -43
  355. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-Dllkdt0m.js +0 -10
  356. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-DK36WkNN.js +0 -24
  357. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-iqUnMYEh.js +0 -24
  358. package/dist/domains/dashboard/web/assets/erDiagram-TEJ5UH35-Bc64lzy8.js +0 -85
  359. package/dist/domains/dashboard/web/assets/flowDiagram-I6XJVG4X-UfOqef9j.js +0 -162
  360. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-D-u6Aauc.js +0 -292
  361. package/dist/domains/dashboard/web/assets/index-COZ_03uK.js +0 -257
  362. package/dist/domains/dashboard/web/assets/layout-SsrduOYp.js +0 -1
  363. package/dist/domains/dashboard/web/assets/mermaid.core-COBBjtVH.js +0 -301
  364. package/dist/domains/dashboard/web/assets/pieDiagram-4H26LBE5-CJro_XKk.js +0 -30
  365. package/dist/domains/dashboard/web/assets/purify.es-VaSPOPhr.js +0 -3
  366. package/dist/domains/dashboard/web/assets/sankeyDiagram-5OEKKPKP-Wx60WwHe.js +0 -40
  367. package/dist/domains/dashboard/web/assets/sequenceDiagram-3UESZ5HK-BiMsRFbc.js +0 -162
  368. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-BrURMY0R.js +0 -1
  369. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-BpEE-yEg.js +0 -1
  370. package/dist/domains/dashboard/web/assets/vennDiagram-CIIHVFJN-DGB16bvR.js +0 -34
  371. package/dist/domains/dashboard/web/assets/xychartDiagram-2RQKCTM6-DMzzwDVX.js +0 -7
@@ -1,146 +1,146 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Ju=Object.create;var xo=Object.defineProperty;var Gu=Object.getOwnPropertyDescriptor;var Uu=Object.getOwnPropertyNames;var Ku=Object.getPrototypeOf,Yu=Object.prototype.hasOwnProperty;var Pi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Xu=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Uu(t))!Yu.call(e,n)&&n!==i&&xo(e,n,{get:()=>t[n],enumerable:!(r=Gu(t,n))||r.enumerable});return e};var Ri=(e,t,i)=>(i=e!=null?Ju(Ku(e)):{},Xu(t||!e||!e.__esModule?xo(i,"default",{value:e,enumerable:!0}):i,e));var P=g(B=>{"use strict";var an=Symbol.for("yaml.alias"),Co=Symbol.for("yaml.document"),xi=Symbol.for("yaml.map"),Ao=Symbol.for("yaml.pair"),on=Symbol.for("yaml.scalar"),Ci=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),Qu=e=>!!e&&typeof e=="object"&&e[me]===an,Zu=e=>!!e&&typeof e=="object"&&e[me]===Co,ed=e=>!!e&&typeof e=="object"&&e[me]===xi,td=e=>!!e&&typeof e=="object"&&e[me]===Ao,_o=e=>!!e&&typeof e=="object"&&e[me]===on,id=e=>!!e&&typeof e=="object"&&e[me]===Ci;function To(e){if(e&&typeof e=="object")switch(e[me]){case xi:case Ci:return!0}return!1}function rd(e){if(e&&typeof e=="object")switch(e[me]){case an:case xi:case on:case Ci:return!0}return!1}var nd=e=>(_o(e)||To(e))&&!!e.anchor;B.ALIAS=an;B.DOC=Co;B.MAP=xi;B.NODE_TYPE=me;B.PAIR=Ao;B.SCALAR=on;B.SEQ=Ci;B.hasAnchor=nd;B.isAlias=Qu;B.isCollection=To;B.isDocument=Zu;B.isMap=ed;B.isNode=rd;B.isPair=td;B.isScalar=_o;B.isSeq=id});var Nt=g(sn=>{"use strict";var D=P(),q=Symbol("break visit"),Io=Symbol("skip children"),le=Symbol("remove node");function Ai(e,t){let i=jo(t);D.isDocument(e)?Ze(null,e.contents,i,Object.freeze([e]))===le&&(e.contents=null):Ze(null,e,i,Object.freeze([]))}Ai.BREAK=q;Ai.SKIP=Io;Ai.REMOVE=le;function Ze(e,t,i,r){let n=$o(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Oo(e,r,n),Ze(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=Ze(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===le&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=Ze("key",t.key,i,r);if(a===q)return q;a===le&&(t.key=null);let o=Ze("value",t.value,i,r);if(o===q)return q;o===le&&(t.value=null)}}return n}async function _i(e,t){let i=jo(t);D.isDocument(e)?await et(null,e.contents,i,Object.freeze([e]))===le&&(e.contents=null):await et(null,e,i,Object.freeze([]))}_i.BREAK=q;_i.SKIP=Io;_i.REMOVE=le;async function et(e,t,i,r){let n=await $o(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Oo(e,r,n),et(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=await et(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===le&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=await et("key",t.key,i,r);if(a===q)return q;a===le&&(t.key=null);let o=await et("value",t.value,i,r);if(o===q)return q;o===le&&(t.value=null)}}return n}function jo(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 $o(e,t,i,r){if(typeof i=="function")return i(e,t,r);if(D.isMap(t))return i.Map?.(e,t,r);if(D.isSeq(t))return i.Seq?.(e,t,r);if(D.isPair(t))return i.Pair?.(e,t,r);if(D.isScalar(t))return i.Scalar?.(e,t,r);if(D.isAlias(t))return i.Alias?.(e,t,r)}function Oo(e,t,i){let r=t[t.length-1];if(D.isCollection(r))r.items[e]=i;else if(D.isPair(r))e==="key"?r.key=i:r.value=i;else if(D.isDocument(r))r.contents=i;else{let n=D.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}sn.visit=Ai;sn.visitAsync=_i});var cn=g(Do=>{"use strict";var Ho=P(),ad=Nt(),od={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sd=e=>e.replace(/[!,[\]{}]/g,t=>od[t]),bt=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[a,o]=r;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=t.match(/^(.*!)([^!]*)$/s);n||i(`The ${t} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(n)}catch(o){return i(String(o)),null}return r==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,r]of Object.entries(this.tags))if(t.startsWith(r))return i+sd(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(t&&r.length>0&&Ho.isNode(t.contents)){let a={};ad.visit(t.contents,(o,s)=>{Ho.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of r)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
- `)}};bt.defaultYaml={explicit:!1,version:"1.2"};bt.defaultTags={"!!":"tag:yaml.org,2002:"};Do.Directives=bt});var Ti=g(kt=>{"use strict";var Bo=P(),cd=Nt();function ld(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 Lo(e){let t=new Set;return cd.visit(e,{Value(i,r){r.anchor&&t.add(r.anchor)}}),t}function Mo(e,t){for(let i=1;;++i){let r=`${e}${i}`;if(!t.has(r))return r}}function ud(e,t){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=Lo(e));let o=Mo(t,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&(Bo.isScalar(o.node)||Bo.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:r}}kt.anchorIsValid=ld;kt.anchorNames=Lo;kt.createNodeAnchors=ud;kt.findNewAnchor=Mo});var ln=g(Fo=>{"use strict";function St(e,t,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,a=r.length;n<a;++n){let o=r[n],s=St(e,r,String(n),o);s===void 0?delete r[n]:s!==o&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let a=r.get(n),o=St(e,r,n,a);o===void 0?r.delete(n):o!==a&&r.set(n,o)}else if(r instanceof Set)for(let n of Array.from(r)){let a=St(e,r,n,n);a===void 0?r.delete(n):a!==n&&(r.delete(n),r.add(a))}else for(let[n,a]of Object.entries(r)){let o=St(e,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return e.call(t,i,r)}Fo.applyReviver=St});var Ne=g(qo=>{"use strict";var dd=P();function Vo(e,t,i){if(Array.isArray(e))return e.map((r,n)=>Vo(r,String(n),i));if(e&&typeof e.toJSON=="function"){if(!i||!dd.hasAnchor(e))return e.toJSON(t,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(e,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=e.toJSON(t,i);return i.onCreate&&i.onCreate(n),n}return typeof e=="bigint"&&!i?.keep?Number(e):e}qo.toJS=Vo});var Ii=g(zo=>{"use strict";var fd=ln(),Wo=P(),hd=Ne(),un=class{constructor(t){Object.defineProperty(this,Wo.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!Wo.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=hd.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?fd.applyReviver(a,{"":s},"",s):s}};zo.NodeBase=un});var Et=g(Jo=>{"use strict";var pd=Ti(),md=Nt(),tt=P(),vd=Ii(),gd=Ne(),dn=class extends vd.NodeBase{constructor(t){super(tt.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],md.visit(t,{Node:(a,o)=>{(tt.isAlias(o)||tt.hasAnchor(o))&&r.push(o)}}),i&&(i.aliasResolveCache=r));let n;for(let a of r){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(t,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:a}=i,o=this.resolve(n,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(o);if(s||(gd.toJS(o,null,i),s=r.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ji(n,o,r)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,i,r){let n=`*${this.source}`;if(t){if(pd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${n} `}return n}};function ji(e,t,i){if(tt.isAlias(t)){let r=t.resolve(e),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(tt.isCollection(t)){let r=0;for(let n of t.items){let a=ji(e,n,i);a>r&&(r=a)}return r}else if(tt.isPair(t)){let r=ji(e,t.key,i),n=ji(e,t.value,i);return Math.max(r,n)}return 1}Jo.Alias=dn});var j=g(fn=>{"use strict";var wd=P(),yd=Ii(),Nd=Ne(),bd=e=>!e||typeof e!="function"&&typeof e!="object",be=class extends yd.NodeBase{constructor(t){super(wd.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Nd.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";fn.Scalar=be;fn.isScalarValue=bd});var Pt=g(Uo=>{"use strict";var kd=Et(),Me=P(),Go=j(),Sd="tag:yaml.org,2002:";function Ed(e,t,i){if(t){let r=i.filter(a=>a.tag===t),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return i.find(r=>r.identify?.(e)&&!r.format)}function Pd(e,t,i){if(Me.isDocument(e)&&(e=e.contents),Me.isNode(e))return e;if(Me.isPair(e)){let u=i.schema[Me.MAP].createNode?.(i.schema,null,i);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=n(e)),new kd.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=Sd+t.slice(2));let l=Ed(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new Go.Scalar(e);return c&&(c.node=u),u}l=e instanceof Map?o[Me.MAP]:Symbol.iterator in Object(e)?o[Me.SEQ]:o[Me.MAP]}a&&(a(l),delete i.onTagObj);let d=l?.createNode?l.createNode(i.schema,e,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,e,i):new Go.Scalar(e);return t?d.tag=t:l.default||(d.tag=l.tag),c&&(c.node=d),d}Uo.createNode=Pd});var Oi=g($i=>{"use strict";var Rd=Pt(),ue=P(),xd=Ii();function hn(e,t,i){let r=i;for(let n=t.length-1;n>=0;--n){let a=t[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return Rd.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Ko=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,pn=class extends xd.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(r=>ue.isNode(r)||ue.isPair(r)?r.clone(t):r),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(Ko(t))this.add(i);else{let[r,...n]=t,a=this.get(r,!0);if(ue.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,hn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(t){let[i,...r]=t;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(ue.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(t,i){let[r,...n]=t,a=this.get(r,!0);return n.length===0?!i&&ue.isScalar(a)?a.value:a:ue.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!ue.isPair(i))return!1;let r=i.value;return r==null||t&&ue.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[i,...r]=t;if(r.length===0)return this.has(i);let n=this.get(i,!0);return ue.isCollection(n)?n.hasIn(r):!1}setIn(t,i){let[r,...n]=t;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(ue.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,hn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};$i.Collection=pn;$i.collectionFromPath=hn;$i.isEmptyPath=Ko});var Rt=g(Hi=>{"use strict";var Cd=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function mn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Ad=(e,t,i)=>e.endsWith(`
6
- `)?mn(i,t):i.includes(`
4
+ var Yu=Object.create;var Co=Object.defineProperty;var Xu=Object.getOwnPropertyDescriptor;var Qu=Object.getOwnPropertyNames;var Zu=Object.getPrototypeOf,ed=Object.prototype.hasOwnProperty;var Ri=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var td=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Qu(t))!ed.call(e,n)&&n!==i&&Co(e,n,{get:()=>t[n],enumerable:!(r=Xu(t,n))||r.enumerable});return e};var St=(e,t,i)=>(i=e!=null?Yu(Zu(e)):{},td(t||!e||!e.__esModule?Co(i,"default",{value:e,enumerable:!0}):i,e));var P=g(B=>{"use strict";var sn=Symbol.for("yaml.alias"),Ao=Symbol.for("yaml.document"),xi=Symbol.for("yaml.map"),_o=Symbol.for("yaml.pair"),cn=Symbol.for("yaml.scalar"),Ci=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),id=e=>!!e&&typeof e=="object"&&e[ge]===sn,rd=e=>!!e&&typeof e=="object"&&e[ge]===Ao,nd=e=>!!e&&typeof e=="object"&&e[ge]===xi,ad=e=>!!e&&typeof e=="object"&&e[ge]===_o,To=e=>!!e&&typeof e=="object"&&e[ge]===cn,od=e=>!!e&&typeof e=="object"&&e[ge]===Ci;function Io(e){if(e&&typeof e=="object")switch(e[ge]){case xi:case Ci:return!0}return!1}function sd(e){if(e&&typeof e=="object")switch(e[ge]){case sn:case xi:case cn:case Ci:return!0}return!1}var cd=e=>(To(e)||Io(e))&&!!e.anchor;B.ALIAS=sn;B.DOC=Ao;B.MAP=xi;B.NODE_TYPE=ge;B.PAIR=_o;B.SCALAR=cn;B.SEQ=Ci;B.hasAnchor=cd;B.isAlias=id;B.isCollection=Io;B.isDocument=rd;B.isMap=nd;B.isNode=sd;B.isPair=ad;B.isScalar=To;B.isSeq=od});var Et=g(ln=>{"use strict";var D=P(),q=Symbol("break visit"),jo=Symbol("skip children"),ue=Symbol("remove node");function Ai(e,t){let i=$o(t);D.isDocument(e)?Ze(null,e.contents,i,Object.freeze([e]))===ue&&(e.contents=null):Ze(null,e,i,Object.freeze([]))}Ai.BREAK=q;Ai.SKIP=jo;Ai.REMOVE=ue;function Ze(e,t,i,r){let n=Oo(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Ho(e,r,n),Ze(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=Ze(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ue&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=Ze("key",t.key,i,r);if(a===q)return q;a===ue&&(t.key=null);let o=Ze("value",t.value,i,r);if(o===q)return q;o===ue&&(t.value=null)}}return n}async function _i(e,t){let i=$o(t);D.isDocument(e)?await et(null,e.contents,i,Object.freeze([e]))===ue&&(e.contents=null):await et(null,e,i,Object.freeze([]))}_i.BREAK=q;_i.SKIP=jo;_i.REMOVE=ue;async function et(e,t,i,r){let n=await Oo(e,t,i,r);if(D.isNode(n)||D.isPair(n))return Ho(e,r,n),et(e,n,i,r);if(typeof n!="symbol"){if(D.isCollection(t)){r=Object.freeze(r.concat(t));for(let a=0;a<t.items.length;++a){let o=await et(a,t.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===q)return q;o===ue&&(t.items.splice(a,1),a-=1)}}}else if(D.isPair(t)){r=Object.freeze(r.concat(t));let a=await et("key",t.key,i,r);if(a===q)return q;a===ue&&(t.key=null);let o=await et("value",t.value,i,r);if(o===q)return q;o===ue&&(t.value=null)}}return n}function $o(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Oo(e,t,i,r){if(typeof i=="function")return i(e,t,r);if(D.isMap(t))return i.Map?.(e,t,r);if(D.isSeq(t))return i.Seq?.(e,t,r);if(D.isPair(t))return i.Pair?.(e,t,r);if(D.isScalar(t))return i.Scalar?.(e,t,r);if(D.isAlias(t))return i.Alias?.(e,t,r)}function Ho(e,t,i){let r=t[t.length-1];if(D.isCollection(r))r.items[e]=i;else if(D.isPair(r))e==="key"?r.key=i:r.value=i;else if(D.isDocument(r))r.contents=i;else{let n=D.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}ln.visit=Ai;ln.visitAsync=_i});var un=g(Bo=>{"use strict";var Do=P(),ld=Et(),ud={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dd=e=>e.replace(/[!,[\]{}]/g,t=>ud[t]),Pt=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[a,o]=r;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=t.match(/^(.*!)([^!]*)$/s);n||i(`The ${t} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(n)}catch(o){return i(String(o)),null}return r==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,r]of Object.entries(this.tags))if(t.startsWith(r))return i+dd(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(t&&r.length>0&&Do.isNode(t.contents)){let a={};ld.visit(t.contents,(o,s)=>{Do.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of r)a==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
5
+ `)}};Pt.defaultYaml={explicit:!1,version:"1.2"};Pt.defaultTags={"!!":"tag:yaml.org,2002:"};Bo.Directives=Pt});var Ti=g(Rt=>{"use strict";var Lo=P(),fd=Et();function hd(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function Mo(e){let t=new Set;return fd.visit(e,{Value(i,r){r.anchor&&t.add(r.anchor)}}),t}function Fo(e,t){for(let i=1;;++i){let r=`${e}${i}`;if(!t.has(r))return r}}function pd(e,t){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=Mo(e));let o=Fo(t,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&(Lo.isScalar(o.node)||Lo.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:r}}Rt.anchorIsValid=hd;Rt.anchorNames=Mo;Rt.createNodeAnchors=pd;Rt.findNewAnchor=Fo});var dn=g(Vo=>{"use strict";function xt(e,t,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,a=r.length;n<a;++n){let o=r[n],s=xt(e,r,String(n),o);s===void 0?delete r[n]:s!==o&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let a=r.get(n),o=xt(e,r,n,a);o===void 0?r.delete(n):o!==a&&r.set(n,o)}else if(r instanceof Set)for(let n of Array.from(r)){let a=xt(e,r,n,n);a===void 0?r.delete(n):a!==n&&(r.delete(n),r.add(a))}else for(let[n,a]of Object.entries(r)){let o=xt(e,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return e.call(t,i,r)}Vo.applyReviver=xt});var be=g(Wo=>{"use strict";var md=P();function qo(e,t,i){if(Array.isArray(e))return e.map((r,n)=>qo(r,String(n),i));if(e&&typeof e.toJSON=="function"){if(!i||!md.hasAnchor(e))return e.toJSON(t,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(e,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=e.toJSON(t,i);return i.onCreate&&i.onCreate(n),n}return typeof e=="bigint"&&!i?.keep?Number(e):e}Wo.toJS=qo});var Ii=g(Jo=>{"use strict";var vd=dn(),zo=P(),gd=be(),fn=class{constructor(t){Object.defineProperty(this,zo.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!zo.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=gd.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?vd.applyReviver(a,{"":s},"",s):s}};Jo.NodeBase=fn});var Ct=g(Go=>{"use strict";var wd=Ti(),yd=Et(),tt=P(),Nd=Ii(),bd=be(),hn=class extends Nd.NodeBase{constructor(t){super(tt.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],yd.visit(t,{Node:(a,o)=>{(tt.isAlias(o)||tt.hasAnchor(o))&&r.push(o)}}),i&&(i.aliasResolveCache=r));let n;for(let a of r){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(t,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:a}=i,o=this.resolve(n,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(o);if(s||(bd.toJS(o,null,i),s=r.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ji(n,o,r)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(t,i,r){let n=`*${this.source}`;if(t){if(wd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${n} `}return n}};function ji(e,t,i){if(tt.isAlias(t)){let r=t.resolve(e),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(tt.isCollection(t)){let r=0;for(let n of t.items){let a=ji(e,n,i);a>r&&(r=a)}return r}else if(tt.isPair(t)){let r=ji(e,t.key,i),n=ji(e,t.value,i);return Math.max(r,n)}return 1}Go.Alias=hn});var j=g(pn=>{"use strict";var kd=P(),Sd=Ii(),Ed=be(),Pd=e=>!e||typeof e!="function"&&typeof e!="object",ke=class extends Sd.NodeBase{constructor(t){super(kd.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:Ed.toJS(this.value,t,i)}toString(){return String(this.value)}};ke.BLOCK_FOLDED="BLOCK_FOLDED";ke.BLOCK_LITERAL="BLOCK_LITERAL";ke.PLAIN="PLAIN";ke.QUOTE_DOUBLE="QUOTE_DOUBLE";ke.QUOTE_SINGLE="QUOTE_SINGLE";pn.Scalar=ke;pn.isScalarValue=Pd});var At=g(Ko=>{"use strict";var Rd=Ct(),Me=P(),Uo=j(),xd="tag:yaml.org,2002:";function Cd(e,t,i){if(t){let r=i.filter(a=>a.tag===t),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return i.find(r=>r.identify?.(e)&&!r.format)}function Ad(e,t,i){if(Me.isDocument(e)&&(e=e.contents),Me.isNode(e))return e;if(Me.isPair(e)){let d=i.schema[Me.MAP].createNode?.(i.schema,null,i);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&e&&typeof e=="object"){if(c=s.get(e),c)return c.anchor??(c.anchor=n(e)),new Rd.Alias(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith("!!")&&(t=xd+t.slice(2));let l=Cd(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new Uo.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?o[Me.MAP]:Symbol.iterator in Object(e)?o[Me.SEQ]:o[Me.MAP]}a&&(a(l),delete i.onTagObj);let u=l?.createNode?l.createNode(i.schema,e,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,e,i):new Uo.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}Ko.createNode=Ad});var Oi=g($i=>{"use strict";var _d=At(),de=P(),Td=Ii();function mn(e,t,i){let r=i;for(let n=t.length-1;n>=0;--n){let a=t[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return _d.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Yo=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,vn=class extends Td.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(r=>de.isNode(r)||de.isPair(r)?r.clone(t):r),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(Yo(t))this.add(i);else{let[r,...n]=t,a=this.get(r,!0);if(de.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,mn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(t){let[i,...r]=t;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(de.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(t,i){let[r,...n]=t,a=this.get(r,!0);return n.length===0?!i&&de.isScalar(a)?a.value:a:de.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!de.isPair(i))return!1;let r=i.value;return r==null||t&&de.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[i,...r]=t;if(r.length===0)return this.has(i);let n=this.get(i,!0);return de.isCollection(n)?n.hasIn(r):!1}setIn(t,i){let[r,...n]=t;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(de.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,mn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};$i.Collection=vn;$i.collectionFromPath=mn;$i.isEmptyPath=Yo});var _t=g(Hi=>{"use strict";var Id=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function gn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var jd=(e,t,i)=>e.endsWith(`
6
+ `)?gn(i,t):i.includes(`
7
7
  `)?`
8
- `+mn(i,t):(e.endsWith(" ")?"":" ")+i;Hi.indentComment=mn;Hi.lineComment=Ad;Hi.stringifyComment=Cd});var Xo=g(xt=>{"use strict";var _d="flow",vn="block",Di="quoted";function Td(e,t,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return e;n<a&&(a=0);let c=Math.max(1+a,1+n-t.length);if(e.length<=c)return e;let l=[],d={},u=n-t.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):u=n-r);let f,p,v=!1,h=-1,m=-1,w=-1;i===vn&&(h=Yo(e,h,t.length),h!==-1&&(u=h+c));for(let b;b=e[h+=1];){if(i===Di&&b==="\\"){switch(m=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
9
- `)i===vn&&(h=Yo(e,h,t.length)),u=h+t.length+c,f=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
8
+ `+gn(i,t):(e.endsWith(" ")?"":" ")+i;Hi.indentComment=gn;Hi.lineComment=jd;Hi.stringifyComment=Id});var Qo=g(Tt=>{"use strict";var $d="flow",wn="block",Di="quoted";function Od(e,t,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return e;n<a&&(a=0);let c=Math.max(1+a,1+n-t.length);if(e.length<=c)return e;let l=[],u={},d=n-t.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):d=n-r);let f,p,v=!1,h=-1,m=-1,w=-1;i===wn&&(h=Xo(e,h,t.length),h!==-1&&(d=h+c));for(let b;b=e[h+=1];){if(i===Di&&b==="\\"){switch(m=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
9
+ `)i===wn&&(h=Xo(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
10
10
  `&&p!==" "){let k=e[h+1];k&&k!==" "&&k!==`
11
- `&&k!==" "&&(f=h)}if(h>=u)if(f)l.push(f),u=f+c,f=void 0;else if(i===Di){for(;p===" "||p===" ";)p=b,b=e[h+=1],v=!0;let k=h>w+1?h-2:m-1;if(d[k])return e;l.push(k),d[k]=!0,u=k+c,f=void 0}else v=!0}p=b}if(v&&s&&s(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let k=l[b],S=l[b+1]||e.length;k===0?y=`
12
- ${t}${e.slice(0,S)}`:(i===Di&&d[k]&&(y+=`${e[k]}\\`),y+=`
13
- ${t}${e.slice(k+1,S)}`)}return y}function Yo(e,t,i){let r=t,n=t+1,a=e[n];for(;a===" "||a===" ";)if(t<n+i)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
- `);r=t,n=t+1,a=e[n]}return r}xt.FOLD_BLOCK=vn;xt.FOLD_FLOW=_d;xt.FOLD_QUOTED=Di;xt.foldFlowLines=Td});var At=g(Qo=>{"use strict";var te=j(),ke=Xo(),Li=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Mi=e=>/^(%|---|\.\.\.)/m.test(e);function Id(e,t,i){if(!t||t<0)return!1;let r=t-i,n=e.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(e[a]===`
15
- `){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function Ct(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=t,n=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Mi(e)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let d=i.substr(c+2,4);switch(d){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:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(r||i[c+2]==='"'||i.length<n)c+=1;else{for(o+=i.slice(s,c)+`
11
+ `&&k!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(i===Di){for(;p===" "||p===" ";)p=b,b=e[h+=1],v=!0;let k=h>w+1?h-2:m-1;if(u[k])return e;l.push(k),u[k]=!0,d=k+c,f=void 0}else v=!0}p=b}if(v&&s&&s(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let k=l[b],S=l[b+1]||e.length;k===0?y=`
12
+ ${t}${e.slice(0,S)}`:(i===Di&&u[k]&&(y+=`${e[k]}\\`),y+=`
13
+ ${t}${e.slice(k+1,S)}`)}return y}function Xo(e,t,i){let r=t,n=t+1,a=e[n];for(;a===" "||a===" ";)if(t<n+i)a=e[++t];else{do a=e[++t];while(a&&a!==`
14
+ `);r=t,n=t+1,a=e[n]}return r}Tt.FOLD_BLOCK=wn;Tt.FOLD_FLOW=$d;Tt.FOLD_QUOTED=Di;Tt.foldFlowLines=Od});var jt=g(Zo=>{"use strict";var ie=j(),Se=Qo(),Li=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Mi=e=>/^(%|---|\.\.\.)/m.test(e);function Hd(e,t,i){if(!t||t<0)return!1;let r=t-i,n=e.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(e[a]===`
15
+ `){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function It(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=t,n=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Mi(e)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let u=i.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(r||i[c+2]==='"'||i.length<n)c+=1;else{for(o+=i.slice(s,c)+`
16
16
 
17
17
  `;i[c+2]==="\\"&&i[c+3]==="n"&&i[c+4]!=='"';)o+=`
18
- `,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,r?o:ke.foldFlowLines(o,a,ke.FOLD_QUOTED,Li(t,!1))}function gn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(e))return Ct(e,t);let i=t.indent||(Mi(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${i}`)+"'";return t.implicitKey?r:ke.foldFlowLines(r,i,ke.FOLD_FLOW,Li(t,!1))}function it(e,t){let{singleQuote:i}=t.options,r;if(i===!1)r=Ct;else{let n=e.includes('"'),a=e.includes("'");n&&!a?r=gn:a&&!n?r=Ct:r=i?gn:Ct}return r(e,t)}var wn;try{wn=new RegExp(`(^|(?<!
18
+ `,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,r?o:Se.foldFlowLines(o,a,Se.FOLD_QUOTED,Li(t,!1))}function yn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(e))return It(e,t);let i=t.indent||(Mi(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${i}`)+"'";return t.implicitKey?r:Se.foldFlowLines(r,i,Se.FOLD_FLOW,Li(t,!1))}function it(e,t){let{singleQuote:i}=t.options,r;if(i===!1)r=It;else{let n=e.includes('"'),a=e.includes("'");n&&!a?r=yn:a&&!n?r=It:r=i?yn:It}return r(e,t)}var Nn;try{Nn=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{wn=/\n+(?!\n|$)/g}function Bi({comment:e,type:t,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return it(i,r);let l=r.indent||(r.forceBlockIndent||Mi(i)?" ":""),d=o==="literal"?!0:o==="folded"||t===te.Scalar.BLOCK_FOLDED?!1:t===te.Scalar.BLOCK_LITERAL?!0:!Id(i,c,l.length);if(!i)return d?`|
23
+ |$)`,"g")}catch{Nn=/\n+(?!\n|$)/g}function Bi({comment:e,type:t,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return it(i,r);let l=r.indent||(r.forceBlockIndent||Mi(i)?" ":""),u=o==="literal"?!0:o==="folded"||t===ie.Scalar.BLOCK_FOLDED?!1:t===ie.Scalar.BLOCK_LITERAL?!0:!Hd(i,c,l.length);if(!i)return u?`|
24
24
  `:`>
25
- `;let u,f;for(f=i.length;f>0;--f){let S=i[f-1];if(S!==`
25
+ `;let d,f;for(f=i.length;f>0;--f){let S=i[f-1];if(S!==`
26
26
  `&&S!==" "&&S!==" ")break}let p=i.substring(f),v=p.indexOf(`
27
- `);v===-1?u="-":i===p||v!==p.length-1?(u="+",a&&a()):u="",p&&(i=i.slice(0,-p.length),p[p.length-1]===`
28
- `&&(p=p.slice(0,-1)),p=p.replace(wn,`$&${l}`));let h=!1,m,w=-1;for(m=0;m<i.length;++m){let S=i[m];if(S===" ")h=!0;else if(S===`
29
- `)w=m;else break}let y=i.substring(0,w<m?w+1:m);y&&(i=i.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+u;if(e&&(k+=" "+s(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!d){let S=i.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,A=Li(r,!0);o!=="folded"&&t!==te.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{E=!0});let N=ke.foldFlowLines(`${y}${S}${p}`,l,ke.FOLD_BLOCK,A);if(!E)return`>${k}
27
+ `);v===-1?d="-":i===p||v!==p.length-1?(d="+",a&&a()):d="",p&&(i=i.slice(0,-p.length),p[p.length-1]===`
28
+ `&&(p=p.slice(0,-1)),p=p.replace(Nn,`$&${l}`));let h=!1,m,w=-1;for(m=0;m<i.length;++m){let S=i[m];if(S===" ")h=!0;else if(S===`
29
+ `)w=m;else break}let y=i.substring(0,w<m?w+1:m);y&&(i=i.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+d;if(e&&(k+=" "+s(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let S=i.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,A=Li(r,!0);o!=="folded"&&t!==ie.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{E=!0});let N=Se.foldFlowLines(`${y}${S}${p}`,l,Se.FOLD_BLOCK,A);if(!E)return`>${k}
31
31
  ${l}${N}`}return i=i.replace(/\n+/g,`$&${l}`),`|${k}
32
- ${l}${y}${i}${p}`}function jd(e,t,i,r){let{type:n,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:d}=t;if(s&&a.includes(`
33
- `)||d&&/[[\]{},]/.test(a))return it(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||d||!a.includes(`
34
- `)?it(a,t):Bi(e,t,i,r);if(!s&&!d&&n!==te.Scalar.PLAIN&&a.includes(`
35
- `))return Bi(e,t,i,r);if(Mi(a)){if(c==="")return t.forceBlockIndent=!0,Bi(e,t,i,r);if(s&&c===l)return it(a,t)}let u=a.replace(/\n+/g,`$&
36
- ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:v}=t.doc.schema;if(v.some(f)||p?.some(f))return it(a,t)}return s?u:ke.foldFlowLines(u,c,ke.FOLD_FLOW,Li(t,!1))}function $d(e,t,i,r){let{implicitKey:n,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==te.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=te.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case te.Scalar.BLOCK_FOLDED:case te.Scalar.BLOCK_LITERAL:return n||a?it(o.value,t):Bi(o,t,i,r);case te.Scalar.QUOTE_DOUBLE:return Ct(o.value,t);case te.Scalar.QUOTE_SINGLE:return gn(o.value,t);case te.Scalar.PLAIN:return jd(o,t,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:d,defaultStringType:u}=t.options,f=n&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Qo.stringifyString=$d});var _t=g(yn=>{"use strict";var Od=Ti(),Se=P(),Hd=Rt(),Dd=At();function Bd(e,t){let i=Object.assign({blockQuote:!0,commentString:Hd.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function Ld(e,t){if(t.tag){let n=e.filter(a=>a.tag===t.tag);if(n.length>0)return n.find(a=>a.format===t.format)??n[0]}let i,r;if(Se.isScalar(t)){r=t.value;let n=e.filter(a=>a.identify?.(r));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}i=n.find(a=>a.format===t.format)??n.find(a=>!a.format)}else r=t,i=e.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!i){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return i}function Md(e,t,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(Se.isScalar(e)||Se.isCollection(e))&&e.anchor;a&&Od.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function Fd(e,t,i,r){if(Se.isPair(e))return e.toString(t,i,r);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 n,a=Se.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=Ld(t.doc.schema.tags,a));let o=Md(a,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,t,i,r):Se.isScalar(a)?Dd.stringifyString(a,t,i,r):a.toString(t,i,r);return o?Se.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
- ${t.indent}${s}`:s}yn.createStringifyContext=Bd;yn.stringify=Fd});var is=g(ts=>{"use strict";var ve=P(),Zo=j(),es=_t(),Tt=Rt();function Vd({key:e,value:t},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=i,f=ve.isNode(e)&&e.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ve.isCollection(e)||!ve.isNode(e)&&typeof e=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!u&&(!e||f&&t==null&&!i.inFlow||ve.isCollection(e)||(ve.isScalar(e)?e.type===Zo.Scalar.BLOCK_FOLDED||e.type===Zo.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(u||!a),indent:s+c});let v=!1,h=!1,m=es.stringify(e,i,()=>v=!0,()=>h=!0);if(!p&&!i.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(a||t==null)return v&&r&&r(),m===""?"?":p?`? ${m}`:m}else if(a&&!u||t==null&&p)return m=`? ${m}`,f&&!v?m+=Tt.lineComment(m,i.indent,l(f)):h&&n&&n(),m;v&&(f=null),p?(f&&(m+=Tt.lineComment(m,i.indent,l(f))),m=`? ${m}
38
- ${s}:`):(m=`${m}:`,f&&(m+=Tt.lineComment(m,i.indent,l(f))));let w,y,b;ve.isNode(t)?(w=!!t.spaceBefore,y=t.commentBefore,b=t.comment):(w=!1,y=null,b=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!p&&!f&&ve.isScalar(t)&&(i.indentAtStart=m.length+1),h=!1,!d&&c.length>=2&&!i.inFlow&&!p&&ve.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let k=!1,S=es.stringify(t,i,()=>k=!0,()=>h=!0),E=" ";if(f||w||y){if(E=w?`
32
+ ${l}${y}${i}${p}`}function Dd(e,t,i,r){let{type:n,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
33
+ `)||u&&/[[\]{},]/.test(a))return it(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
34
+ `)?it(a,t):Bi(e,t,i,r);if(!s&&!u&&n!==ie.Scalar.PLAIN&&a.includes(`
35
+ `))return Bi(e,t,i,r);if(Mi(a)){if(c==="")return t.forceBlockIndent=!0,Bi(e,t,i,r);if(s&&c===l)return it(a,t)}let d=a.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:v}=t.doc.schema;if(v.some(f)||p?.some(f))return it(a,t)}return s?d:Se.foldFlowLines(d,c,Se.FOLD_FLOW,Li(t,!1))}function Bd(e,t,i,r){let{implicitKey:n,inFlow:a}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ie.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return n||a?it(o.value,t):Bi(o,t,i,r);case ie.Scalar.QUOTE_DOUBLE:return It(o.value,t);case ie.Scalar.QUOTE_SINGLE:return yn(o.value,t);case ie.Scalar.PLAIN:return Dd(o,t,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,f=n&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Zo.stringifyString=Bd});var $t=g(bn=>{"use strict";var Ld=Ti(),Ee=P(),Md=_t(),Fd=jt();function Vd(e,t){let i=Object.assign({blockQuote:!0,commentString:Md.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function qd(e,t){if(t.tag){let n=e.filter(a=>a.tag===t.tag);if(n.length>0)return n.find(a=>a.format===t.format)??n[0]}let i,r;if(Ee.isScalar(t)){r=t.value;let n=e.filter(a=>a.identify?.(r));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}i=n.find(a=>a.format===t.format)??n.find(a=>!a.format)}else r=t,i=e.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!i){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return i}function Wd(e,t,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(Ee.isScalar(e)||Ee.isCollection(e))&&e.anchor;a&&Ld.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function zd(e,t,i,r){if(Ee.isPair(e))return e.toString(t,i,r);if(Ee.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,a=Ee.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=qd(t.doc.schema.tags,a));let o=Wd(a,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,t,i,r):Ee.isScalar(a)?Fd.stringifyString(a,t,i,r):a.toString(t,i,r);return o?Ee.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
37
+ ${t.indent}${s}`:s}bn.createStringifyContext=Vd;bn.stringify=zd});var rs=g(is=>{"use strict";var we=P(),es=j(),ts=$t(),Ot=_t();function Jd({key:e,value:t},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=i,f=we.isNode(e)&&e.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(e)||!we.isNode(e)&&typeof e=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!e||f&&t==null&&!i.inFlow||we.isCollection(e)||(we.isScalar(e)?e.type===es.Scalar.BLOCK_FOLDED||e.type===es.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let v=!1,h=!1,m=ts.stringify(e,i,()=>v=!0,()=>h=!0);if(!p&&!i.inFlow&&m.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(a||t==null)return v&&r&&r(),m===""?"?":p?`? ${m}`:m}else if(a&&!d||t==null&&p)return m=`? ${m}`,f&&!v?m+=Ot.lineComment(m,i.indent,l(f)):h&&n&&n(),m;v&&(f=null),p?(f&&(m+=Ot.lineComment(m,i.indent,l(f))),m=`? ${m}
38
+ ${s}:`):(m=`${m}:`,f&&(m+=Ot.lineComment(m,i.indent,l(f))));let w,y,b;we.isNode(t)?(w=!!t.spaceBefore,y=t.commentBefore,b=t.comment):(w=!1,y=null,b=null,t&&typeof t=="object"&&(t=o.createNode(t))),i.implicitKey=!1,!p&&!f&&we.isScalar(t)&&(i.indentAtStart=m.length+1),h=!1,!u&&c.length>=2&&!i.inFlow&&!p&&we.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let k=!1,S=ts.stringify(t,i,()=>k=!0,()=>h=!0),E=" ";if(f||w||y){if(E=w?`
39
39
  `:"",y){let A=l(y);E+=`
40
- ${Tt.indentComment(A,i.indent)}`}S===""&&!i.inFlow?E===`
40
+ ${Ot.indentComment(A,i.indent)}`}S===""&&!i.inFlow?E===`
41
41
  `&&b&&(E=`
42
42
 
43
43
  `):E+=`
44
- ${i.indent}`}else if(!p&&ve.isCollection(t)){let A=S[0],N=S.indexOf(`
45
- `),O=N!==-1,ye=i.inFlow??t.flow??t.items.length===0;if(O||!ye){let Qe=!1;if(O&&(A==="&"||A==="!")){let H=S.indexOf(" ");A==="&"&&H!==-1&&H<N&&S[H+1]==="!"&&(H=S.indexOf(" ",H+1)),(H===-1||N<H)&&(Qe=!0)}Qe||(E=`
44
+ ${i.indent}`}else if(!p&&we.isCollection(t)){let A=S[0],N=S.indexOf(`
45
+ `),O=N!==-1,Ne=i.inFlow??t.flow??t.items.length===0;if(O||!Ne){let Qe=!1;if(O&&(A==="&"||A==="!")){let H=S.indexOf(" ");A==="&"&&H!==-1&&H<N&&S[H+1]==="!"&&(H=S.indexOf(" ",H+1)),(H===-1||N<H)&&(Qe=!0)}Qe||(E=`
46
46
  ${i.indent}`)}}else(S===""||S[0]===`
47
- `)&&(E="");return m+=E+S,i.inFlow?k&&r&&r():b&&!k?m+=Tt.lineComment(m,i.indent,l(b)):h&&n&&n(),m}ts.stringifyPair=Vd});var bn=g(Nn=>{"use strict";var rs=Pi("process");function qd(e,...t){e==="debug"&&console.log(...t)}function Wd(e,t){(e==="debug"||e==="warn")&&(typeof rs.emitWarning=="function"?rs.emitWarning(t):console.warn(t))}Nn.debug=qd;Nn.warn=Wd});var zi=g(Wi=>{"use strict";var qi=P(),ns=j(),Fi="<<",Vi={identify:e=>e===Fi||typeof e=="symbol"&&e.description===Fi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ns.Scalar(Symbol(Fi)),{addToJSMap:as}),stringify:()=>Fi},zd=(e,t)=>(Vi.identify(t)||qi.isScalar(t)&&(!t.type||t.type===ns.Scalar.PLAIN)&&Vi.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Vi.tag&&i.default);function as(e,t,i){let r=os(e,i);if(qi.isSeq(r))for(let n of r.items)kn(e,t,n);else if(Array.isArray(r))for(let n of r)kn(e,t,n);else kn(e,t,r)}function kn(e,t,i){let r=os(e,i);if(!qi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,e,Map);for(let[a,o]of n)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function os(e,t){return e&&qi.isAlias(t)?t.resolve(e.doc,e):t}Wi.addMergeToJSMap=as;Wi.isMergeKey=zd;Wi.merge=Vi});var En=g(ls=>{"use strict";var Jd=bn(),ss=zi(),Gd=_t(),cs=P(),Sn=Ne();function Ud(e,t,{key:i,value:r}){if(cs.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,r);else if(ss.isMergeKey(e,i))ss.addMergeToJSMap(e,t,r);else{let n=Sn.toJS(i,"",e);if(t instanceof Map)t.set(n,Sn.toJS(r,n,e));else if(t instanceof Set)t.add(n);else{let a=Kd(i,n,e),o=Sn.toJS(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Kd(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(cs.isNode(e)&&i?.doc){let r=Gd.createStringifyContext(i.doc,{});r.anchors=new Set;for(let a of i.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=e.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Jd.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(t)}ls.addPairToJSMap=Ud});var Ee=g(Pn=>{"use strict";var us=Pt(),Yd=is(),Xd=En(),Ji=P();function Qd(e,t,i){let r=us.createNode(e,void 0,i),n=us.createNode(t,void 0,i);return new Gi(r,n)}var Gi=class e{constructor(t,i=null){Object.defineProperty(this,Ji.NODE_TYPE,{value:Ji.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:r}=this;return Ji.isNode(i)&&(i=i.clone(t)),Ji.isNode(r)&&(r=r.clone(t)),new e(i,r)}toJSON(t,i){let r=i?.mapAsMap?new Map:{};return Xd.addPairToJSMap(i,r,this)}toString(t,i,r){return t?.doc?Yd.stringifyPair(this,t,i,r):JSON.stringify(this)}};Pn.Pair=Gi;Pn.createPair=Qd});var Rn=g(fs=>{"use strict";var Fe=P(),ds=_t(),Ui=Rt();function Zd(e,t,i){return(t.inFlow??e.flow?tf:ef)(e,t,i)}function ef({comment:e,items:t},i,{blockItemPrefix:r,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,d=Object.assign({},i,{indent:a,type:null}),u=!1,f=[];for(let v=0;v<t.length;++v){let h=t[v],m=null;if(Fe.isNode(h))!u&&h.spaceBefore&&f.push(""),Ki(i,f,h.commentBefore,u),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(!u&&y.spaceBefore&&f.push(""),Ki(i,f,y.commentBefore,u))}u=!1;let w=ds.stringify(h,d,()=>m=null,()=>u=!0);m&&(w+=Ui.lineComment(w,a,l(m))),u&&m&&(u=!1),f.push(r+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let v=1;v<f.length;++v){let h=f[v];p+=h?`
47
+ `)&&(E="");return m+=E+S,i.inFlow?k&&r&&r():b&&!k?m+=Ot.lineComment(m,i.indent,l(b)):h&&n&&n(),m}is.stringifyPair=Jd});var Sn=g(kn=>{"use strict";var ns=Ri("process");function Gd(e,...t){e==="debug"&&console.log(...t)}function Ud(e,t){(e==="debug"||e==="warn")&&(typeof ns.emitWarning=="function"?ns.emitWarning(t):console.warn(t))}kn.debug=Gd;kn.warn=Ud});var zi=g(Wi=>{"use strict";var qi=P(),as=j(),Fi="<<",Vi={identify:e=>e===Fi||typeof e=="symbol"&&e.description===Fi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new as.Scalar(Symbol(Fi)),{addToJSMap:os}),stringify:()=>Fi},Kd=(e,t)=>(Vi.identify(t)||qi.isScalar(t)&&(!t.type||t.type===as.Scalar.PLAIN)&&Vi.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Vi.tag&&i.default);function os(e,t,i){let r=ss(e,i);if(qi.isSeq(r))for(let n of r.items)En(e,t,n);else if(Array.isArray(r))for(let n of r)En(e,t,n);else En(e,t,r)}function En(e,t,i){let r=ss(e,i);if(!qi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,e,Map);for(let[a,o]of n)t instanceof Map?t.has(a)||t.set(a,o):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function ss(e,t){return e&&qi.isAlias(t)?t.resolve(e.doc,e):t}Wi.addMergeToJSMap=os;Wi.isMergeKey=Kd;Wi.merge=Vi});var Rn=g(us=>{"use strict";var Yd=Sn(),cs=zi(),Xd=$t(),ls=P(),Pn=be();function Qd(e,t,{key:i,value:r}){if(ls.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,r);else if(cs.isMergeKey(e,i))cs.addMergeToJSMap(e,t,r);else{let n=Pn.toJS(i,"",e);if(t instanceof Map)t.set(n,Pn.toJS(r,n,e));else if(t instanceof Set)t.add(n);else{let a=Zd(i,n,e),o=Pn.toJS(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Zd(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(ls.isNode(e)&&i?.doc){let r=Xd.createStringifyContext(i.doc,{});r.anchors=new Set;for(let a of i.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=e.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Yd.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(t)}us.addPairToJSMap=Qd});var Pe=g(xn=>{"use strict";var ds=At(),ef=rs(),tf=Rn(),Ji=P();function rf(e,t,i){let r=ds.createNode(e,void 0,i),n=ds.createNode(t,void 0,i);return new Gi(r,n)}var Gi=class e{constructor(t,i=null){Object.defineProperty(this,Ji.NODE_TYPE,{value:Ji.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:r}=this;return Ji.isNode(i)&&(i=i.clone(t)),Ji.isNode(r)&&(r=r.clone(t)),new e(i,r)}toJSON(t,i){let r=i?.mapAsMap?new Map:{};return tf.addPairToJSMap(i,r,this)}toString(t,i,r){return t?.doc?ef.stringifyPair(this,t,i,r):JSON.stringify(this)}};xn.Pair=Gi;xn.createPair=rf});var Cn=g(hs=>{"use strict";var Fe=P(),fs=$t(),Ui=_t();function nf(e,t,i){return(t.inFlow??e.flow?of:af)(e,t,i)}function af({comment:e,items:t},i,{blockItemPrefix:r,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,u=Object.assign({},i,{indent:a,type:null}),d=!1,f=[];for(let v=0;v<t.length;++v){let h=t[v],m=null;if(Fe.isNode(h))!d&&h.spaceBefore&&f.push(""),Ki(i,f,h.commentBefore,d),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(!d&&y.spaceBefore&&f.push(""),Ki(i,f,y.commentBefore,d))}d=!1;let w=fs.stringify(h,u,()=>m=null,()=>d=!0);m&&(w+=Ui.lineComment(w,a,l(m))),d&&m&&(d=!1),f.push(r+w)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let v=1;v<f.length;++v){let h=f[v];p+=h?`
48
48
  ${c}${h}`:`
49
49
  `}}return e?(p+=`
50
- `+Ui.indentComment(l(e),c),s&&s()):u&&o&&o(),p}function tf({items:e},t,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let v=0;v<e.length;++v){let h=e[v],m=null;if(Fe.isNode(h))h.spaceBefore&&u.push(""),Ki(t,u,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(y.spaceBefore&&u.push(""),Ki(t,u,y.commentBefore,!1),y.comment&&(l=!0));let b=Fe.isNode(h.value)?h.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):h.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=ds.stringify(h,c,()=>m=null);l||(l=u.length>d||w.includes(`
51
- `)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=u.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),m&&(w+=Ui.lineComment(w,r,s(m))),u.push(w),d=u.length}let{start:f,end:p}=i;if(u.length===0)return f+p;if(!l){let v=u.reduce((h,m)=>h+m.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=f;for(let h of u)v+=h?`
50
+ `+Ui.indentComment(l(e),c),s&&s()):d&&o&&o(),p}function of({items:e},t,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let v=0;v<e.length;++v){let h=e[v],m=null;if(Fe.isNode(h))h.spaceBefore&&d.push(""),Ki(t,d,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Fe.isPair(h)){let y=Fe.isNode(h.key)?h.key:null;y&&(y.spaceBefore&&d.push(""),Ki(t,d,y.commentBefore,!1),y.comment&&(l=!0));let b=Fe.isNode(h.value)?h.value:null;b?(b.comment&&(m=b.comment),b.commentBefore&&(l=!0)):h.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let w=fs.stringify(h,c,()=>m=null);l||(l=d.length>u||w.includes(`
51
+ `)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((y,b)=>y+b.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),m&&(w+=Ui.lineComment(w,r,s(m))),d.push(w),u=d.length}let{start:f,end:p}=i;if(d.length===0)return f+p;if(!l){let v=d.reduce((h,m)=>h+m.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=f;for(let h of d)v+=h?`
52
52
  ${a}${n}${h}`:`
53
53
  `;return`${v}
54
- ${n}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function Ki({indent:e,options:{commentString:t}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=Ui.indentComment(t(r),e);i.push(a.trimStart())}}fs.stringifyCollection=Zd});var Re=g(Cn=>{"use strict";var rf=Rn(),nf=En(),af=Oi(),Pe=P(),Yi=Ee(),of=j();function It(e,t){let i=Pe.isScalar(t)?t.value:t;for(let r of e)if(Pe.isPair(r)&&(r.key===t||r.key===i||Pe.isScalar(r.key)&&r.key.value===i))return r}var xn=class extends af.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Pe.MAP,t),this.items=[]}static from(t,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(t),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(Yi.createPair(c,l,r))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let r;Pe.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Yi.Pair(t,t?.value):r=new Yi.Pair(t.key,t.value);let n=It(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Pe.isScalar(n.value)&&of.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(a){let o=this.items.findIndex(s=>a(r,s)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){let i=It(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let n=It(this.items,t)?.value;return(!i&&Pe.isScalar(n)?n.value:n)??void 0}has(t){return!!It(this.items,t)}set(t,i){this.add(new Yi.Pair(t,i),!0)}toJSON(t,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)nf.addPairToJSMap(i,n,a);return n}toString(t,i,r){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Pe.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),rf.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:i})}};Cn.YAMLMap=xn;Cn.findPair=It});var rt=g(ps=>{"use strict";var sf=P(),hs=Re(),cf={collection:"map",default:!0,nodeClass:hs.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return sf.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>hs.YAMLMap.from(e,t,i)};ps.map=cf});var xe=g(ms=>{"use strict";var lf=Pt(),uf=Rn(),df=Oi(),Qi=P(),ff=j(),hf=Ne(),An=class extends df.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Qi.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=Xi(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let r=Xi(t);if(typeof r!="number")return;let n=this.items[r];return!i&&Qi.isScalar(n)?n.value:n}has(t){let i=Xi(t);return typeof i=="number"&&i<this.items.length}set(t,i){let r=Xi(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[r];Qi.isScalar(n)&&ff.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(t,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(hf.toJS(a,String(n++),i));return r}toString(t,i,r){return t?uf.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(t,i,r){let{replacer:n}=r,a=new this(t);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(o++);s=n.call(i,c,s)}a.items.push(lf.createNode(s,void 0,r))}}return a}};function Xi(e){let t=Qi.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}ms.YAMLSeq=An});var nt=g(gs=>{"use strict";var pf=P(),vs=xe(),mf={collection:"seq",default:!0,nodeClass:vs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return pf.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>vs.YAMLSeq.from(e,t,i)};gs.seq=mf});var jt=g(ws=>{"use strict";var vf=At(),gf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,r){return t=Object.assign({actualString:!0},t),vf.stringifyString(e,t,i,r)}};ws.string=gf});var Zi=g(bs=>{"use strict";var ys=j(),Ns={identify:e=>e==null,createNode:()=>new ys.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ys.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Ns.test.test(e)?e:t.options.nullStr};bs.nullTag=Ns});var _n=g(Ss=>{"use strict";var wf=j(),ks={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new wf.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&ks.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?i.options.trueStr:i.options.falseStr}};Ss.boolTag=ks});var at=g(Es=>{"use strict";function yf({format:e,minFractionDigits:t,tag:i,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Es.stringifyNumber=yf});var In=g(er=>{"use strict";var Nf=j(),Tn=at(),bf={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:Tn.stringifyNumber},kf={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():Tn.stringifyNumber(e)}},Sf={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 Nf.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:Tn.stringifyNumber};er.float=Sf;er.floatExp=kf;er.floatNaN=bf});var $n=g(ir=>{"use strict";var Ps=at(),tr=e=>typeof e=="bigint"||Number.isInteger(e),jn=(e,t,i,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),i);function Rs(e,t,i){let{value:r}=e;return tr(r)&&r>=0?i+r.toString(t):Ps.stringifyNumber(e)}var Ef={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>jn(e,2,8,i),stringify:e=>Rs(e,8,"0o")},Pf={identify:tr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>jn(e,0,10,i),stringify:Ps.stringifyNumber},Rf={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>jn(e,2,16,i),stringify:e=>Rs(e,16,"0x")};ir.int=Pf;ir.intHex=Rf;ir.intOct=Ef});var Cs=g(xs=>{"use strict";var xf=rt(),Cf=Zi(),Af=nt(),_f=jt(),Tf=_n(),On=In(),Hn=$n(),If=[xf.map,Af.seq,_f.string,Cf.nullTag,Tf.boolTag,Hn.intOct,Hn.int,Hn.intHex,On.floatNaN,On.floatExp,On.float];xs.schema=If});var Ts=g(_s=>{"use strict";var jf=j(),$f=rt(),Of=nt();function As(e){return typeof e=="bigint"||Number.isInteger(e)}var rr=({value:e})=>JSON.stringify(e),Hf=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:rr},{identify:e=>e==null,createNode:()=>new jf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:rr},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:rr},{identify:As,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})=>As(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:rr}],Df={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Bf=[$f.map,Of.seq].concat(Hf,Df);_s.schema=Bf});var Bn=g(Is=>{"use strict";var $t=Pi("buffer"),Dn=j(),Lf=At(),Mf={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof $t.Buffer=="function")return $t.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let n=0;n<i.length;++n)r[n]=i.charCodeAt(n);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof $t.Buffer=="function")s=o instanceof $t.Buffer?o.toString("base64"):$t.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=Dn.Scalar.BLOCK_LITERAL),t!==Dn.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(s.length/c),d=new Array(l);for(let u=0,f=0;u<l;++u,f+=c)d[u]=s.substr(f,c);s=d.join(t===Dn.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return Lf.stringifyString({comment:e,type:t,value:s},r,n,a)}};Is.binary=Mf});var or=g(ar=>{"use strict";var nr=P(),Ln=Ee(),Ff=j(),Vf=xe();function js(e,t){if(nr.isSeq(e))for(let i=0;i<e.items.length;++i){let r=e.items[i];if(!nr.isPair(r)){if(nr.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let n=r.items[0]||new Ln.Pair(new Ff.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
54
+ ${n}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function Ki({indent:e,options:{commentString:t}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=Ui.indentComment(t(r),e);i.push(a.trimStart())}}hs.stringifyCollection=nf});var xe=g(_n=>{"use strict";var sf=Cn(),cf=Rn(),lf=Oi(),Re=P(),Yi=Pe(),uf=j();function Ht(e,t){let i=Re.isScalar(t)?t.value:t;for(let r of e)if(Re.isPair(r)&&(r.key===t||r.key===i||Re.isScalar(r.key)&&r.key.value===i))return r}var An=class extends lf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Re.MAP,t),this.items=[]}static from(t,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(t),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(Yi.createPair(c,l,r))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,i){let r;Re.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Yi.Pair(t,t?.value):r=new Yi.Pair(t.key,t.value);let n=Ht(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Re.isScalar(n.value)&&uf.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(a){let o=this.items.findIndex(s=>a(r,s)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){let i=Ht(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let n=Ht(this.items,t)?.value;return(!i&&Re.isScalar(n)?n.value:n)??void 0}has(t){return!!Ht(this.items,t)}set(t,i){this.add(new Yi.Pair(t,i),!0)}toJSON(t,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)cf.addPairToJSMap(i,n,a);return n}toString(t,i,r){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Re.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),sf.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:i})}};_n.YAMLMap=An;_n.findPair=Ht});var rt=g(ms=>{"use strict";var df=P(),ps=xe(),ff={collection:"map",default:!0,nodeClass:ps.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return df.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>ps.YAMLMap.from(e,t,i)};ms.map=ff});var Ce=g(vs=>{"use strict";var hf=At(),pf=Cn(),mf=Oi(),Qi=P(),vf=j(),gf=be(),Tn=class extends mf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Qi.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=Xi(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let r=Xi(t);if(typeof r!="number")return;let n=this.items[r];return!i&&Qi.isScalar(n)?n.value:n}has(t){let i=Xi(t);return typeof i=="number"&&i<this.items.length}set(t,i){let r=Xi(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[r];Qi.isScalar(n)&&vf.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(t,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(gf.toJS(a,String(n++),i));return r}toString(t,i,r){return t?pf.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(t,i,r){let{replacer:n}=r,a=new this(t);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(o++);s=n.call(i,c,s)}a.items.push(hf.createNode(s,void 0,r))}}return a}};function Xi(e){let t=Qi.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}vs.YAMLSeq=Tn});var nt=g(ws=>{"use strict";var wf=P(),gs=Ce(),yf={collection:"seq",default:!0,nodeClass:gs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return wf.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>gs.YAMLSeq.from(e,t,i)};ws.seq=yf});var Dt=g(ys=>{"use strict";var Nf=jt(),bf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,r){return t=Object.assign({actualString:!0},t),Nf.stringifyString(e,t,i,r)}};ys.string=bf});var Zi=g(ks=>{"use strict";var Ns=j(),bs={identify:e=>e==null,createNode:()=>new Ns.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ns.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&bs.test.test(e)?e:t.options.nullStr};ks.nullTag=bs});var In=g(Es=>{"use strict";var kf=j(),Ss={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new kf.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&Ss.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?i.options.trueStr:i.options.falseStr}};Es.boolTag=Ss});var at=g(Ps=>{"use strict";function Sf({format:e,minFractionDigits:t,tag:i,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=t-(a.length-o-1);for(;s-- >0;)a+="0"}return a}Ps.stringifyNumber=Sf});var $n=g(er=>{"use strict";var Ef=j(),jn=at(),Pf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jn.stringifyNumber},Rf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():jn.stringifyNumber(e)}},xf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Ef.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:jn.stringifyNumber};er.float=xf;er.floatExp=Rf;er.floatNaN=Pf});var Hn=g(ir=>{"use strict";var Rs=at(),tr=e=>typeof e=="bigint"||Number.isInteger(e),On=(e,t,i,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),i);function xs(e,t,i){let{value:r}=e;return tr(r)&&r>=0?i+r.toString(t):Rs.stringifyNumber(e)}var Cf={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>On(e,2,8,i),stringify:e=>xs(e,8,"0o")},Af={identify:tr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>On(e,0,10,i),stringify:Rs.stringifyNumber},_f={identify:e=>tr(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>On(e,2,16,i),stringify:e=>xs(e,16,"0x")};ir.int=Af;ir.intHex=_f;ir.intOct=Cf});var As=g(Cs=>{"use strict";var Tf=rt(),If=Zi(),jf=nt(),$f=Dt(),Of=In(),Dn=$n(),Bn=Hn(),Hf=[Tf.map,jf.seq,$f.string,If.nullTag,Of.boolTag,Bn.intOct,Bn.int,Bn.intHex,Dn.floatNaN,Dn.floatExp,Dn.float];Cs.schema=Hf});var Is=g(Ts=>{"use strict";var Df=j(),Bf=rt(),Lf=nt();function _s(e){return typeof e=="bigint"||Number.isInteger(e)}var rr=({value:e})=>JSON.stringify(e),Mf=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:rr},{identify:e=>e==null,createNode:()=>new Df.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:rr},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:rr},{identify:_s,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>_s(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:rr}],Ff={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Vf=[Bf.map,Lf.seq].concat(Mf,Ff);Ts.schema=Vf});var Mn=g(js=>{"use strict";var Bt=Ri("buffer"),Ln=j(),qf=jt(),Wf={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Bt.Buffer=="function")return Bt.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let n=0;n<i.length;++n)r[n]=i.charCodeAt(n);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof Bt.Buffer=="function")s=o instanceof Bt.Buffer?o.toString("base64"):Bt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Ln.Scalar.BLOCK_LITERAL),t!==Ln.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=s.substr(f,c);s=u.join(t===Ln.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return qf.stringifyString({comment:e,type:t,value:s},r,n,a)}};js.binary=Wf});var or=g(ar=>{"use strict";var nr=P(),Fn=Pe(),zf=j(),Jf=Ce();function $s(e,t){if(nr.isSeq(e))for(let i=0;i<e.items.length;++i){let r=e.items[i];if(!nr.isPair(r)){if(nr.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let n=r.items[0]||new Fn.Pair(new zf.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
56
56
  ${n.key.commentBefore}`:r.commentBefore),r.comment){let a=n.value??n.key;a.comment=a.comment?`${r.comment}
57
- ${a.comment}`:r.comment}r=n}e.items[i]=nr.isPair(r)?r:new Ln.Pair(r)}}else t("Expected a sequence for this tag");return e}function $s(e,t,i){let{replacer:r}=i,n=new Vf.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof r=="function"&&(o=r.call(t,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(Ln.createPair(s,c,i))}return n}var qf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:js,createNode:$s};ar.createPairs=$s;ar.pairs=qf;ar.resolvePairs=js});var Vn=g(Fn=>{"use strict";var Os=P(),Mn=Ne(),Ot=Re(),Wf=xe(),Hs=or(),Ve=class e extends Wf.YAMLSeq{constructor(){super(),this.add=Ot.YAMLMap.prototype.add.bind(this),this.delete=Ot.YAMLMap.prototype.delete.bind(this),this.get=Ot.YAMLMap.prototype.get.bind(this),this.has=Ot.YAMLMap.prototype.has.bind(this),this.set=Ot.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(Os.isPair(n)?(a=Mn.toJS(n.key,"",i),o=Mn.toJS(n.value,a,i)):a=Mn.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(t,i,r){let n=Hs.createPairs(t,i,r),a=new this;return a.items=n.items,a}};Ve.tag="tag:yaml.org,2002:omap";var zf={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=Hs.resolvePairs(e,t),r=[];for(let{key:n}of i.items)Os.isScalar(n)&&(r.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new Ve,i)},createNode:(e,t,i)=>Ve.from(e,t,i)};Fn.YAMLOMap=Ve;Fn.omap=zf});var Fs=g(qn=>{"use strict";var Ds=j();function Bs({value:e,source:t},i){return t&&(e?Ls:Ms).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var Ls={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 Ds.Scalar(!0),stringify:Bs},Ms={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 Ds.Scalar(!1),stringify:Bs};qn.falseTag=Ms;qn.trueTag=Ls});var Vs=g(sr=>{"use strict";var Jf=j(),Wn=at(),Gf={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:Wn.stringifyNumber},Uf={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():Wn.stringifyNumber(e)}},Kf={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 Jf.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let r=e.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Wn.stringifyNumber};sr.float=Kf;sr.floatExp=Uf;sr.floatNaN=Gf});var Ws=g(Dt=>{"use strict";var qs=at(),Ht=e=>typeof e=="bigint"||Number.isInteger(e);function cr(e,t,i,{intAsBigInt:r}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let a=parseInt(e,i);return n==="-"?-1*a:a}function zn(e,t,i){let{value:r}=e;if(Ht(r)){let n=r.toString(t);return r<0?"-"+i+n.substr(1):i+n}return qs.stringifyNumber(e)}var Yf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>cr(e,2,2,i),stringify:e=>zn(e,2,"0b")},Xf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>cr(e,1,8,i),stringify:e=>zn(e,8,"0")},Qf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>cr(e,0,10,i),stringify:qs.stringifyNumber},Zf={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>cr(e,2,16,i),stringify:e=>zn(e,16,"0x")};Dt.int=Qf;Dt.intBin=Yf;Dt.intHex=Zf;Dt.intOct=Xf});var Gn=g(Jn=>{"use strict";var dr=P(),lr=Ee(),ur=Re(),qe=class e extends ur.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;dr.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new lr.Pair(t.key,null):i=new lr.Pair(t,null),ur.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let r=ur.findPair(this.items,t);return!i&&dr.isPair(r)?dr.isScalar(r.key)?r.key.value:r.key:r}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=ur.findPair(this.items,t);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new lr.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(t,i,r){let{replacer:n}=r,a=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(lr.createPair(o,null,r));return a}};qe.tag="tag:yaml.org,2002:set";var eh={collection:"map",identify:e=>e instanceof Set,nodeClass:qe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>qe.from(e,t,i),resolve(e,t){if(dr.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new qe,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Jn.YAMLSet=qe;Jn.set=eh});var Kn=g(fr=>{"use strict";var th=at();function Un(e,t){let i=e[0],r=i==="-"||i==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),a=r.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return i==="-"?n(-1)*a:a}function zs(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return th.stringifyNumber(e);let r="";t<0&&(r="-",t*=i(-1));let n=i(60),a=[t%n];return t<60?a.unshift(0):(t=(t-a[0])/n,a.unshift(t%n),t>=60&&(t=(t-a[0])/n,a.unshift(t))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ih={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})=>Un(e,i),stringify:zs},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=>Un(e,!1),stringify:zs},Js={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(Js.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),d=t[8];if(d&&d!=="Z"){let u=Un(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};fr.floatTime=rh;fr.intTime=ih;fr.timestamp=Js});var Ks=g(Us=>{"use strict";var nh=rt(),ah=Zi(),oh=nt(),sh=jt(),ch=Bn(),Gs=Fs(),Yn=Vs(),hr=Ws(),lh=zi(),uh=Vn(),dh=or(),fh=Gn(),Xn=Kn(),hh=[nh.map,oh.seq,sh.string,ah.nullTag,Gs.trueTag,Gs.falseTag,hr.intBin,hr.intOct,hr.int,hr.intHex,Yn.floatNaN,Yn.floatExp,Yn.float,ch.binary,lh.merge,uh.omap,dh.pairs,fh.set,Xn.intTime,Xn.floatTime,Xn.timestamp];Us.schema=hh});var ac=g(ea=>{"use strict";var Zs=rt(),ph=Zi(),ec=nt(),mh=jt(),vh=_n(),Qn=In(),Zn=$n(),gh=Cs(),wh=Ts(),tc=Bn(),Bt=zi(),ic=Vn(),rc=or(),Ys=Ks(),nc=Gn(),pr=Kn(),Xs=new Map([["core",gh.schema],["failsafe",[Zs.map,ec.seq,mh.string]],["json",wh.schema],["yaml11",Ys.schema],["yaml-1.1",Ys.schema]]),Qs={binary:tc.binary,bool:vh.boolTag,float:Qn.float,floatExp:Qn.floatExp,floatNaN:Qn.floatNaN,floatTime:pr.floatTime,int:Zn.int,intHex:Zn.intHex,intOct:Zn.intOct,intTime:pr.intTime,map:Zs.map,merge:Bt.merge,null:ph.nullTag,omap:ic.omap,pairs:rc.pairs,seq:ec.seq,set:nc.set,timestamp:pr.timestamp},yh={"tag:yaml.org,2002:binary":tc.binary,"tag:yaml.org,2002:merge":Bt.merge,"tag:yaml.org,2002:omap":ic.omap,"tag:yaml.org,2002:pairs":rc.pairs,"tag:yaml.org,2002:set":nc.set,"tag:yaml.org,2002:timestamp":pr.timestamp};function Nh(e,t,i){let r=Xs.get(t);if(r&&!e)return i&&!r.includes(Bt.merge)?r.concat(Bt.merge):r.slice();let n=r;if(!n)if(Array.isArray(e))n=[];else{let a=Array.from(Xs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)n=n.concat(a);else typeof e=="function"&&(n=e(n.slice()));return i&&(n=n.concat(Bt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?Qs[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Qs).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}ea.coreKnownTags=yh;ea.getTags=Nh});var ra=g(oc=>{"use strict";var ta=P(),bh=rt(),kh=nt(),Sh=jt(),mr=ac(),Eh=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,ia=class e{constructor({compat:t,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?mr.getTags(t,"compat"):t?mr.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?mr.coreKnownTags:{},this.tags=mr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,ta.MAP,{value:bh.map}),Object.defineProperty(this,ta.SCALAR,{value:Sh.string}),Object.defineProperty(this,ta.SEQ,{value:kh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Eh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};oc.Schema=ia});var cc=g(sc=>{"use strict";var Ph=P(),na=_t(),Lt=Rt();function Rh(e,t){let i=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(i.push(c),r=!0):e.directives.docStart&&(r=!0)}r&&i.push("---");let n=na.createStringifyContext(e,t),{commentString:a}=n.options;if(e.commentBefore){i.length!==1&&i.unshift("");let c=a(e.commentBefore);i.unshift(Lt.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(Ph.isNode(e.contents)){if(e.contents.spaceBefore&&r&&i.push(""),e.contents.commentBefore){let d=a(e.contents.commentBefore);i.push(Lt.indentComment(d,""))}n.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=na.stringify(e.contents,n,()=>s=null,c);s&&(l+=Lt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(na.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
- `)?(i.push("..."),i.push(Lt.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(Lt.indentComment(a(c),"")))}return i.join(`
57
+ ${a.comment}`:r.comment}r=n}e.items[i]=nr.isPair(r)?r:new Fn.Pair(r)}}else t("Expected a sequence for this tag");return e}function Os(e,t,i){let{replacer:r}=i,n=new Jf.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof r=="function"&&(o=r.call(t,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(Fn.createPair(s,c,i))}return n}var Gf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:$s,createNode:Os};ar.createPairs=Os;ar.pairs=Gf;ar.resolvePairs=$s});var Wn=g(qn=>{"use strict";var Hs=P(),Vn=be(),Lt=xe(),Uf=Ce(),Ds=or(),Ve=class e extends Uf.YAMLSeq{constructor(){super(),this.add=Lt.YAMLMap.prototype.add.bind(this),this.delete=Lt.YAMLMap.prototype.delete.bind(this),this.get=Lt.YAMLMap.prototype.get.bind(this),this.has=Lt.YAMLMap.prototype.has.bind(this),this.set=Lt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(Hs.isPair(n)?(a=Vn.toJS(n.key,"",i),o=Vn.toJS(n.value,a,i)):a=Vn.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(t,i,r){let n=Ds.createPairs(t,i,r),a=new this;return a.items=n.items,a}};Ve.tag="tag:yaml.org,2002:omap";var Kf={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=Ds.resolvePairs(e,t),r=[];for(let{key:n}of i.items)Hs.isScalar(n)&&(r.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new Ve,i)},createNode:(e,t,i)=>Ve.from(e,t,i)};qn.YAMLOMap=Ve;qn.omap=Kf});var Vs=g(zn=>{"use strict";var Bs=j();function Ls({value:e,source:t},i){return t&&(e?Ms:Fs).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var Ms={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Bs.Scalar(!0),stringify:Ls},Fs={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Bs.Scalar(!1),stringify:Ls};zn.falseTag=Fs;zn.trueTag=Ms});var qs=g(sr=>{"use strict";var Yf=j(),Jn=at(),Xf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Jn.stringifyNumber},Qf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Jn.stringifyNumber(e)}},Zf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Yf.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let r=e.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Jn.stringifyNumber};sr.float=Zf;sr.floatExp=Qf;sr.floatNaN=Xf});var zs=g(Ft=>{"use strict";var Ws=at(),Mt=e=>typeof e=="bigint"||Number.isInteger(e);function cr(e,t,i,{intAsBigInt:r}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let a=parseInt(e,i);return n==="-"?-1*a:a}function Gn(e,t,i){let{value:r}=e;if(Mt(r)){let n=r.toString(t);return r<0?"-"+i+n.substr(1):i+n}return Ws.stringifyNumber(e)}var eh={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>cr(e,2,2,i),stringify:e=>Gn(e,2,"0b")},th={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>cr(e,1,8,i),stringify:e=>Gn(e,8,"0")},ih={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>cr(e,0,10,i),stringify:Ws.stringifyNumber},rh={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>cr(e,2,16,i),stringify:e=>Gn(e,16,"0x")};Ft.int=ih;Ft.intBin=eh;Ft.intHex=rh;Ft.intOct=th});var Kn=g(Un=>{"use strict";var dr=P(),lr=Pe(),ur=xe(),qe=class e extends ur.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;dr.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new lr.Pair(t.key,null):i=new lr.Pair(t,null),ur.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let r=ur.findPair(this.items,t);return!i&&dr.isPair(r)?dr.isScalar(r.key)?r.key.value:r.key:r}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=ur.findPair(this.items,t);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new lr.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(t,i,r){let{replacer:n}=r,a=new this(t);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(lr.createPair(o,null,r));return a}};qe.tag="tag:yaml.org,2002:set";var nh={collection:"map",identify:e=>e instanceof Set,nodeClass:qe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>qe.from(e,t,i),resolve(e,t){if(dr.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new qe,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Un.YAMLSet=qe;Un.set=nh});var Xn=g(fr=>{"use strict";var ah=at();function Yn(e,t){let i=e[0],r=i==="-"||i==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),a=r.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return i==="-"?n(-1)*a:a}function Js(e){let{value:t}=e,i=o=>o;if(typeof t=="bigint")i=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return ah.stringifyNumber(e);let r="";t<0&&(r="-",t*=i(-1));let n=i(60),a=[t%n];return t<60?a.unshift(0):(t=(t-a[0])/n,a.unshift(t%n),t>=60&&(t=(t-a[0])/n,a.unshift(t))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var oh={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:i})=>Yn(e,i),stringify:Js},sh={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Yn(e,!1),stringify:Js},Gs={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Gs.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),u=t[8];if(u&&u!=="Z"){let d=Yn(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};fr.floatTime=sh;fr.intTime=oh;fr.timestamp=Gs});var Ys=g(Ks=>{"use strict";var ch=rt(),lh=Zi(),uh=nt(),dh=Dt(),fh=Mn(),Us=Vs(),Qn=qs(),hr=zs(),hh=zi(),ph=Wn(),mh=or(),vh=Kn(),Zn=Xn(),gh=[ch.map,uh.seq,dh.string,lh.nullTag,Us.trueTag,Us.falseTag,hr.intBin,hr.intOct,hr.int,hr.intHex,Qn.floatNaN,Qn.floatExp,Qn.float,fh.binary,hh.merge,ph.omap,mh.pairs,vh.set,Zn.intTime,Zn.floatTime,Zn.timestamp];Ks.schema=gh});var oc=g(ia=>{"use strict";var ec=rt(),wh=Zi(),tc=nt(),yh=Dt(),Nh=In(),ea=$n(),ta=Hn(),bh=As(),kh=Is(),ic=Mn(),Vt=zi(),rc=Wn(),nc=or(),Xs=Ys(),ac=Kn(),pr=Xn(),Qs=new Map([["core",bh.schema],["failsafe",[ec.map,tc.seq,yh.string]],["json",kh.schema],["yaml11",Xs.schema],["yaml-1.1",Xs.schema]]),Zs={binary:ic.binary,bool:Nh.boolTag,float:ea.float,floatExp:ea.floatExp,floatNaN:ea.floatNaN,floatTime:pr.floatTime,int:ta.int,intHex:ta.intHex,intOct:ta.intOct,intTime:pr.intTime,map:ec.map,merge:Vt.merge,null:wh.nullTag,omap:rc.omap,pairs:nc.pairs,seq:tc.seq,set:ac.set,timestamp:pr.timestamp},Sh={"tag:yaml.org,2002:binary":ic.binary,"tag:yaml.org,2002:merge":Vt.merge,"tag:yaml.org,2002:omap":rc.omap,"tag:yaml.org,2002:pairs":nc.pairs,"tag:yaml.org,2002:set":ac.set,"tag:yaml.org,2002:timestamp":pr.timestamp};function Eh(e,t,i){let r=Qs.get(t);if(r&&!e)return i&&!r.includes(Vt.merge)?r.concat(Vt.merge):r.slice();let n=r;if(!n)if(Array.isArray(e))n=[];else{let a=Array.from(Qs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(let a of e)n=n.concat(a);else typeof e=="function"&&(n=e(n.slice()));return i&&(n=n.concat(Vt.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?Zs[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Zs).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}ia.coreKnownTags=Sh;ia.getTags=Eh});var aa=g(sc=>{"use strict";var ra=P(),Ph=rt(),Rh=nt(),xh=Dt(),mr=oc(),Ch=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,na=class e{constructor({compat:t,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?mr.getTags(t,"compat"):t?mr.getTags(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?mr.coreKnownTags:{},this.tags=mr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,ra.MAP,{value:Ph.map}),Object.defineProperty(this,ra.SCALAR,{value:xh.string}),Object.defineProperty(this,ra.SEQ,{value:Rh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ch:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};sc.Schema=na});var lc=g(cc=>{"use strict";var Ah=P(),oa=$t(),qt=_t();function _h(e,t){let i=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(i.push(c),r=!0):e.directives.docStart&&(r=!0)}r&&i.push("---");let n=oa.createStringifyContext(e,t),{commentString:a}=n.options;if(e.commentBefore){i.length!==1&&i.unshift("");let c=a(e.commentBefore);i.unshift(qt.indentComment(c,""))}let o=!1,s=null;if(e.contents){if(Ah.isNode(e.contents)){if(e.contents.spaceBefore&&r&&i.push(""),e.contents.commentBefore){let u=a(e.contents.commentBefore);i.push(qt.indentComment(u,""))}n.forceBlockIndent=!!e.comment,s=e.contents.comment}let c=s?void 0:()=>o=!0,l=oa.stringify(e.contents,n,()=>s=null,c);s&&(l+=qt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(oa.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=a(e.comment);c.includes(`
58
+ `)?(i.push("..."),i.push(qt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(qt.indentComment(a(c),"")))}return i.join(`
59
59
  `)+`
60
- `}sc.stringifyDocument=Rh});var Mt=g(lc=>{"use strict";var xh=Et(),ot=Oi(),Y=P(),Ch=Ee(),Ah=Ne(),_h=ra(),Th=cc(),aa=Ti(),Ih=ln(),jh=Pt(),oa=cn(),sa=class e{constructor(t,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:r===void 0&&i&&(r=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=a;let{version:o}=a;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new oa.Directives({version:o}),this.setSchema(o,r),this.contents=t===void 0?null:this.createNode(t,n,r)}clone(){let t=Object.create(e.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Y.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){st(this.contents)&&this.contents.add(t)}addIn(t,i){st(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let r=aa.anchorNames(this);t.anchor=!i||r.has(i)?aa.findNewAnchor(i||"a",r):i}return new xh.Alias(t.anchor)}createNode(t,i,r){let n;if(typeof i=="function")t=i.call({"":t},"",t),n=i;else if(Array.isArray(i)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=i.filter(m).map(String);w.length>0&&(i=i.concat(w)),n=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:d}=r??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=aa.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=jh.createNode(t,d,v);return s&&Y.isCollection(h)&&(h.flow=!0),f(),h}createPair(t,i,r={}){let n=this.createNode(t,null,r),a=this.createNode(i,null,r);return new Ch.Pair(n,a)}delete(t){return st(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ot.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):st(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return Y.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return ot.isEmptyPath(t)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return Y.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return ot.isEmptyPath(t)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=ot.collectionFromPath(this.schema,[t],i):st(this.contents)&&this.contents.set(t,i)}setIn(t,i){ot.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=ot.collectionFromPath(this.schema,Array.from(t),i):st(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new oa.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new oa.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new _h.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=Ah.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:d}of s.anchors.values())a(d,l);return typeof o=="function"?Ih.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 Th.stringifyDocument(this,t)}};function st(e){if(Y.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}lc.Document=sa});var qt=g(Vt=>{"use strict";var Ft=class extends Error{constructor(t,i,r,n){super(),this.name=t,this.code=r,this.message=n,this.pos=i}},ca=class extends Ft{constructor(t,i,r){super("YAMLParseError",t,i,r)}},la=class extends Ft{constructor(t,i,r){super("YAMLWarning",t,i,r)}},$h=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>t.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,a))){let s=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
60
+ `}cc.stringifyDocument=_h});var Wt=g(uc=>{"use strict";var Th=Ct(),ot=Oi(),Y=P(),Ih=Pe(),jh=be(),$h=aa(),Oh=lc(),sa=Ti(),Hh=dn(),Dh=At(),ca=un(),la=class e{constructor(t,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:r===void 0&&i&&(r=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=a;let{version:o}=a;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ca.Directives({version:o}),this.setSchema(o,r),this.contents=t===void 0?null:this.createNode(t,n,r)}clone(){let t=Object.create(e.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Y.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){st(this.contents)&&this.contents.add(t)}addIn(t,i){st(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let r=sa.anchorNames(this);t.anchor=!i||r.has(i)?sa.findNewAnchor(i||"a",r):i}return new Th.Alias(t.anchor)}createNode(t,i,r){let n;if(typeof i=="function")t=i.call({"":t},"",t),n=i;else if(Array.isArray(i)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=i.filter(m).map(String);w.length>0&&(i=i.concat(w)),n=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=sa.createNodeAnchors(this,o||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=Dh.createNode(t,u,v);return s&&Y.isCollection(h)&&(h.flow=!0),f(),h}createPair(t,i,r={}){let n=this.createNode(t,null,r),a=this.createNode(i,null,r);return new Ih.Pair(n,a)}delete(t){return st(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ot.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):st(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return Y.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return ot.isEmptyPath(t)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return Y.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return ot.isEmptyPath(t)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=ot.collectionFromPath(this.schema,[t],i):st(this.contents)&&this.contents.set(t,i)}setIn(t,i){ot.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=ot.collectionFromPath(this.schema,Array.from(t),i):st(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ca.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ca.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new $h.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=jh.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?Hh.applyReviver(o,{"":c},"",c):c}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Oh.stringifyDocument(this,t)}};function st(e){if(Y.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}uc.Document=la});var Gt=g(Jt=>{"use strict";var zt=class extends Error{constructor(t,i,r,n){super(),this.name=t,this.code=r,this.message=n,this.pos=i}},ua=class extends zt{constructor(t,i,r){super("YAMLParseError",t,i,r)}},da=class extends zt{constructor(t,i,r){super("YAMLWarning",t,i,r)}},Bh=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>t.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,a))){let s=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
61
61
  `),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===r&&c.col>n&&(s=Math.max(1,Math.min(c.col-n,80-a)));let l=" ".repeat(a)+"^".repeat(s);i.message+=`:
62
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};Vt.YAMLError=Ft;Vt.YAMLParseError=ca;Vt.YAMLWarning=la;Vt.prettifyError=$h});var Wt=g(uc=>{"use strict";function Oh(e,{flow:t,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,d=s,u="",f="",p=!1,v=!1,h=null,m=null,w=null,y=null,b=null,k=null,S=null;for(let N of e)switch(v&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&a(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!t&&(i!=="doc-start"||r?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),d=!0;break;case"comment":{d||a(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=N.source.substring(1)||" ";u?u+=f+O:u=O,f="",l=!1;break}case"newline":l?u?u+=N.source:(!k||i!=="seq-item-ind")&&(c=!0):f+=N.source,l=!0,p=!0,(m||w)&&(y=N),d=!0;break;case"anchor":m&&a(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&a(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,S??(S=N.offset),l=!1,d=!1,v=!0;break;case"tag":{w&&a(N,"MULTIPLE_TAGS","A node can have at most one tag"),w=N,S??(S=N.offset),l=!1,d=!1,v=!0;break}case i:(m||w)&&a(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),k=N,l=i==="seq-item-ind"||i==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&a(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=N,l=!1,d=!1;break}default:a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,d=!1}let E=e[e.length-1],A=E?E.offset+E.source.length:n;return v&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&a(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:k,spaceBefore:c,comment:u,hasNewline:p,anchor:m,tag:w,newlineAfterProp:y,end:A,start:S??A}}uc.resolveProps=Oh});var vr=g(dc=>{"use strict";function ua(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(ua(t.key)||ua(t.value))return!0}return!1;default:return!0}}dc.containsNewline=ua});var da=g(fc=>{"use strict";var Hh=vr();function Dh(e,t,i){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Hh.containsNewline(t)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}fc.flowIndentCheck=Dh});var fa=g(pc=>{"use strict";var hc=P();function Bh(e,t,i){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||hc.isScalar(a)&&hc.isScalar(o)&&a.value===o.value;return t.some(a=>n(a.key,i))}pc.mapIncludes=Bh});var Nc=g(yc=>{"use strict";var mc=Ee(),Lh=Re(),vc=Wt(),Mh=vr(),gc=da(),Fh=fa(),wc="All mapping items must start at the same column";function Vh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??Lh.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=r.offset,l=null;for(let d of r.items){let{start:u,key:f,sep:p,value:v}=d,h=vc.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&n(c,"BAD_INDENT",wc)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
- `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Mh.containsNewline(f))&&n(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",wc);i.atKey=!0;let w=h.end,y=f?e(i,f,h,n):t(i,w,u,null,h,n);i.schema.compat&&gc.flowIndentCheck(r.indent,f,n),i.atKey=!1,Fh.mapIncludes(i,s.items,y)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let b=vc.resolveProps(p??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){m&&(v?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<b.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=v?e(i,v,b,n):t(i,c,p,null,b,n);i.schema.compat&&gc.flowIndentCheck(r.indent,v,n),c=k.range[2];let S=new mc.Pair(y,k);i.options.keepSourceTokens&&(S.srcToken=d),s.items.push(S)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
68
- `+b.comment:y.comment=b.comment);let k=new mc.Pair(y);i.options.keepSourceTokens&&(k.srcToken=d),s.items.push(k)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}yc.resolveBlockMap=Vh});var kc=g(bc=>{"use strict";var qh=xe(),Wh=Wt(),zh=da();function Jh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??qh.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=r.offset,l=null;for(let{start:d,value:u}of r.items){let f=Wh.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let p=u?e(i,u,f,n):t(i,f.end,d,null,f,n);i.schema.compat&&zh.flowIndentCheck(r.indent,u,n),c=p.range[2],s.items.push(p)}return s.range=[r.offset,c,l??c],s}bc.resolveBlockSeq=Jh});var ct=g(Sc=>{"use strict";function Gh(e,t,i,r){let n="";if(e){let a=!1,o="";for(let s of e){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";n?n+=o+d:n=d,o="";break}case"newline":n&&(o+=c),a=!0;break;default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}Sc.resolveEnd=Gh});var xc=g(Rc=>{"use strict";var Uh=P(),Kh=Ee(),Ec=Re(),Yh=xe(),Xh=ct(),Pc=Wt(),Qh=vr(),Zh=fa(),ha="Block collections are not allowed within flow collections",pa=e=>e&&(e.type==="block-map"||e.type==="block-seq");function ep({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Ec.YAMLMap:Yh.YAMLSeq),l=new c(i.schema);l.flow=!0;let d=i.atRoot;d&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let w=r.items[m],{start:y,key:b,sep:k,value:S}=w,E=Pc.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??k?.[0],offset:u,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!S){m===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<r.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),E.comment&&(l.comment?l.comment+=`
69
- `+E.comment:l.comment=E.comment),u=E.end;continue}!o&&i.options.strict&&Qh.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${s} items`),E.comment){let A="";e:for(let N of y)switch(N.type){case"comma":case"space":break;case"comment":A=N.source.substring(1);break e;default:break e}if(A){let N=l.items[l.items.length-1];Uh.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
- `+A:N.comment=A,E.comment=E.comment.substring(A.length+1)}}if(!o&&!k&&!E.found){let A=S?e(i,S,E,n):t(i,E.end,k,null,E,n);l.items.push(A),u=A.range[2],pa(S)&&n(A.range,"BLOCK_IN_FLOW",ha)}else{i.atKey=!0;let A=E.end,N=b?e(i,b,E,n):t(i,A,y,null,E,n);pa(b)&&n(N.range,"BLOCK_IN_FLOW",ha),i.atKey=!1;let O=Pc.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:S,offset:N.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(O.found){if(!o&&!E.found&&i.options.strict){if(k)for(let H of k){if(H===O.found)break;if(H.type==="newline"){n(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<O.found.offset-1024&&n(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?n(S,"MISSING_CHAR",`Missing space after : in ${s}`):n(O.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let ye=S?e(i,S,O,n):O.found?t(i,O.end,k,null,O,n):null;ye?pa(S)&&n(ye.range,"BLOCK_IN_FLOW",ha):O.comment&&(N.comment?N.comment+=`
71
- `+O.comment:N.comment=O.comment);let Qe=new Kh.Pair(N,ye);if(i.options.keepSourceTokens&&(Qe.srcToken=w),o){let H=l;Zh.mapIncludes(i,H.items,N)&&n(A,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(Qe)}else{let H=new Ec.YAMLMap(i.schema);H.flow=!0,H.items.push(Qe);let Ro=(ye??N).range;H.range=[N.range[0],Ro[1],Ro[2]],l.items.push(H)}u=ye?ye.range[2]:O.end}}let f=o?"}":"]",[p,...v]=r.end,h=u;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),w=d?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(u,d?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&v.unshift(p)}if(v.length>0){let m=Xh.resolveEnd(v,h,i.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[r.offset,h,m.offset]}else l.range=[r.offset,h,h];return l}Rc.resolveFlowCollection=ep});var Ac=g(Cc=>{"use strict";var tp=P(),ip=j(),rp=Re(),np=xe(),ap=Nc(),op=kc(),sp=xc();function ma(e,t,i,r,n,a){let o=i.type==="block-map"?ap.resolveBlockMap(e,t,i,r,a):i.type==="block-seq"?op.resolveBlockSeq(e,t,i,r,a):sp.resolveFlowCollection(e,t,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function cp(e,t,i,r,n){let a=r.tag,o=a?t.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!p||p.offset<v.offset)&&n(v,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===rp.YAMLMap.tagName&&s==="map"||o===np.YAMLSeq.tagName&&s==="seq")return ma(e,t,i,n,o);let c=t.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=t.schema.knownTags[o];if(f?.collection===s)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ma(e,t,i,n,o)}let l=ma(e,t,i,n,o,c),d=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),t.options)??l,u=tp.isNode(d)?d:new ip.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Cc.composeCollection=cp});var ga=g(_c=>{"use strict";var va=j();function lp(e,t,i){let r=t.offset,n=up(t,e.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?va.Scalar.BLOCK_FOLDED:va.Scalar.BLOCK_LITERAL,o=t.source?dp(t.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",m=r+n.length;return t.source&&(m+=t.source.length),{value:h,type:a,comment:n.comment,range:[r,m,m]}}let c=t.indent+n.indent,l=t.offset+n.length,d=0;for(let h=0;h<s;++h){let[m,w]=o[h];if(w===""||w==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&i(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),d=h,c===0&&!e.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let u="",f="",p=!1;for(let h=0;h<d;++h)u+=o[h][0].slice(c)+`
74
- `;for(let h=d;h<s;++h){let[m,w]=o[h];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}a===va.Scalar.BLOCK_LITERAL?(u+=f+m.slice(c)+w,f=`
65
+ `}};Jt.YAMLError=zt;Jt.YAMLParseError=ua;Jt.YAMLWarning=da;Jt.prettifyError=Bh});var Ut=g(dc=>{"use strict";function Lh(e,{flow:t,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d="",f="",p=!1,v=!1,h=null,m=null,w=null,y=null,b=null,k=null,S=null;for(let N of e)switch(v&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&a(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),h&&(l&&N.type!=="comment"&&N.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),N.type){case"space":!t&&(i!=="doc-start"||r?.type!=="flow-collection")&&N.source.includes(" ")&&(h=N),u=!0;break;case"comment":{u||a(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=N.source.substring(1)||" ";d?d+=f+O:d=O,f="",l=!1;break}case"newline":l?d?d+=N.source:(!k||i!=="seq-item-ind")&&(c=!0):f+=N.source,l=!0,p=!0,(m||w)&&(y=N),u=!0;break;case"anchor":m&&a(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&a(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=N,S??(S=N.offset),l=!1,u=!1,v=!0;break;case"tag":{w&&a(N,"MULTIPLE_TAGS","A node can have at most one tag"),w=N,S??(S=N.offset),l=!1,u=!1,v=!0;break}case i:(m||w)&&a(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),k=N,l=i==="seq-item-ind"||i==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&a(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=N,l=!1,u=!1;break}default:a(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,u=!1}let E=e[e.length-1],A=E?E.offset+E.source.length:n;return v&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&a(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:k,spaceBefore:c,comment:d,hasNewline:p,anchor:m,tag:w,newlineAfterProp:y,end:A,start:S??A}}dc.resolveProps=Lh});var vr=g(fc=>{"use strict";function fa(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
66
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(fa(t.key)||fa(t.value))return!0}return!1;default:return!0}}fc.containsNewline=fa});var ha=g(hc=>{"use strict";var Mh=vr();function Fh(e,t,i){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Mh.containsNewline(t)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}hc.flowIndentCheck=Fh});var pa=g(mc=>{"use strict";var pc=P();function Vh(e,t,i){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||pc.isScalar(a)&&pc.isScalar(o)&&a.value===o.value;return t.some(a=>n(a.key,i))}mc.mapIncludes=Vh});var bc=g(Nc=>{"use strict";var vc=Pe(),qh=xe(),gc=Ut(),Wh=vr(),wc=ha(),zh=pa(),yc="All mapping items must start at the same column";function Jh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??qh.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:d,key:f,sep:p,value:v}=u,h=gc.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&n(c,"BAD_INDENT",yc)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
67
+ `+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Wh.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",yc);i.atKey=!0;let w=h.end,y=f?e(i,f,h,n):t(i,w,d,null,h,n);i.schema.compat&&wc.flowIndentCheck(r.indent,f,n),i.atKey=!1,zh.mapIncludes(i,s.items,y)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let b=gc.resolveProps(p??[],{indicator:"map-value-ind",next:v,offset:y.range[2],onError:n,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){m&&(v?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<b.found.offset-1024&&n(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=v?e(i,v,b,n):t(i,c,p,null,b,n);i.schema.compat&&wc.flowIndentCheck(r.indent,v,n),c=k.range[2];let S=new vc.Pair(y,k);i.options.keepSourceTokens&&(S.srcToken=u),s.items.push(S)}else{m&&n(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(y.comment?y.comment+=`
68
+ `+b.comment:y.comment=b.comment);let k=new vc.Pair(y);i.options.keepSourceTokens&&(k.srcToken=u),s.items.push(k)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}Nc.resolveBlockMap=Jh});var Sc=g(kc=>{"use strict";var Gh=Ce(),Uh=Ut(),Kh=ha();function Yh({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=a?.nodeClass??Gh.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:d}of r.items){let f=Uh.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let p=d?e(i,d,f,n):t(i,f.end,u,null,f,n);i.schema.compat&&Kh.flowIndentCheck(r.indent,d,n),c=p.range[2],s.items.push(p)}return s.range=[r.offset,c,l??c],s}kc.resolveBlockSeq=Yh});var ct=g(Ec=>{"use strict";function Xh(e,t,i,r){let n="";if(e){let a=!1,o="";for(let s of e){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),a=!0;break;default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}Ec.resolveEnd=Xh});var Cc=g(xc=>{"use strict";var Qh=P(),Zh=Pe(),Pc=xe(),ep=Ce(),tp=ct(),Rc=Ut(),ip=vr(),rp=pa(),ma="Block collections are not allowed within flow collections",va=e=>e&&(e.type==="block-map"||e.type==="block-seq");function np({composeNode:e,composeEmptyNode:t},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?Pc.YAMLMap:ep.YAMLSeq),l=new c(i.schema);l.flow=!0;let u=i.atRoot;u&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let d=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let w=r.items[m],{start:y,key:b,sep:k,value:S}=w,E=Rc.resolveProps(y,{flow:s,indicator:"explicit-key-ind",next:b??k?.[0],offset:d,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!S){m===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<r.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),d=E.end;continue}!o&&i.options.strict&&ip.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${s} items`),E.comment){let A="";e:for(let N of y)switch(N.type){case"comma":case"space":break;case"comment":A=N.source.substring(1);break e;default:break e}if(A){let N=l.items[l.items.length-1];Qh.isPair(N)&&(N=N.value??N.key),N.comment?N.comment+=`
70
+ `+A:N.comment=A,E.comment=E.comment.substring(A.length+1)}}if(!o&&!k&&!E.found){let A=S?e(i,S,E,n):t(i,E.end,k,null,E,n);l.items.push(A),d=A.range[2],va(S)&&n(A.range,"BLOCK_IN_FLOW",ma)}else{i.atKey=!0;let A=E.end,N=b?e(i,b,E,n):t(i,A,y,null,E,n);va(b)&&n(N.range,"BLOCK_IN_FLOW",ma),i.atKey=!1;let O=Rc.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:S,offset:N.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(O.found){if(!o&&!E.found&&i.options.strict){if(k)for(let H of k){if(H===O.found)break;if(H.type==="newline"){n(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<O.found.offset-1024&&n(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?n(S,"MISSING_CHAR",`Missing space after : in ${s}`):n(O.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let Ne=S?e(i,S,O,n):O.found?t(i,O.end,k,null,O,n):null;Ne?va(S)&&n(Ne.range,"BLOCK_IN_FLOW",ma):O.comment&&(N.comment?N.comment+=`
71
+ `+O.comment:N.comment=O.comment);let Qe=new Zh.Pair(N,Ne);if(i.options.keepSourceTokens&&(Qe.srcToken=w),o){let H=l;rp.mapIncludes(i,H.items,N)&&n(A,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(Qe)}else{let H=new Pc.YAMLMap(i.schema);H.flow=!0,H.items.push(Qe);let xo=(Ne??N).range;H.range=[N.range[0],xo[1],xo[2]],l.items.push(H)}d=Ne?Ne.range[2]:O.end}}let f=o?"}":"]",[p,...v]=r.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),w=u?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&v.unshift(p)}if(v.length>0){let m=tp.resolveEnd(v,h,i.options.strict,n);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[r.offset,h,m.offset]}else l.range=[r.offset,h,h];return l}xc.resolveFlowCollection=np});var _c=g(Ac=>{"use strict";var ap=P(),op=j(),sp=xe(),cp=Ce(),lp=bc(),up=Sc(),dp=Cc();function ga(e,t,i,r,n,a){let o=i.type==="block-map"?lp.resolveBlockMap(e,t,i,r,a):i.type==="block-seq"?up.resolveBlockSeq(e,t,i,r,a):dp.resolveFlowCollection(e,t,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function fp(e,t,i,r,n){let a=r.tag,o=a?t.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,v=f&&a?f.offset>a.offset?f:a:f??a;v&&(!p||p.offset<v.offset)&&n(v,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===sp.YAMLMap.tagName&&s==="map"||o===cp.YAMLSeq.tagName&&s==="seq")return ga(e,t,i,n,o);let c=t.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=t.schema.knownTags[o];if(f?.collection===s)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ga(e,t,i,n,o)}let l=ga(e,t,i,n,o,c),u=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),t.options)??l,d=ap.isNode(u)?u:new op.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}Ac.composeCollection=fp});var ya=g(Tc=>{"use strict";var wa=j();function hp(e,t,i){let r=t.offset,n=pp(t,e.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?wa.Scalar.BLOCK_FOLDED:wa.Scalar.BLOCK_LITERAL,o=t.source?mp(t.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&o.length>0?`
73
+ `.repeat(Math.max(1,o.length-1)):"",m=r+n.length;return t.source&&(m+=t.source.length),{value:h,type:a,comment:n.comment,range:[r,m,m]}}let c=t.indent+n.indent,l=t.offset+n.length,u=0;for(let h=0;h<s;++h){let[m,w]=o[h];if(w===""||w==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&i(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),u=h,c===0&&!e.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+w.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let d="",f="",p=!1;for(let h=0;h<u;++h)d+=o[h][0].slice(c)+`
74
+ `;for(let h=u;h<s;++h){let[m,w]=o[h];l+=m.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&m.length<c){let k=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-w.length-(y?2:1),"BAD_INDENT",k),m=""}a===wa.Scalar.BLOCK_LITERAL?(d+=f+m.slice(c)+w,f=`
75
75
  `):m.length>c||w[0]===" "?(f===" "?f=`
76
76
  `:!p&&f===`
77
77
  `&&(f=`
78
78
 
79
- `),u+=f+m.slice(c)+w,f=`
79
+ `),d+=f+m.slice(c)+w,f=`
80
80
  `,p=!0):w===""?f===`
81
- `?u+=`
81
+ `?d+=`
82
82
  `:f=`
83
- `:(u+=f+w,f=" ",p=!1)}switch(n.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)u+=`
84
- `+o[h][0].slice(c);u[u.length-1]!==`
85
- `&&(u+=`
86
- `);break;default:u+=`
87
- `}let v=r+n.length+t.source.length;return{value:u,type:a,comment:n.comment,range:[r,v,v]}}function up({offset:e,props:t},i,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!s&&(p==="-"||p==="+"))s=p;else{let v=Number(p);!o&&v?o=v:c===-1&&(c=e+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,d="",u=n.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":l=!0;case"newline":u+=p.source.length;break;case"comment":i&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let v=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",v);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:d,length:u}}function dp(e){let t=e.split(/\n( *)/),i=t[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}_c.resolveBlockScalar=lp});var ya=g(Ic=>{"use strict";var wa=j(),fp=ct();function hp(e,t,i){let{offset:r,type:n,source:a,end:o}=e,s,c,l=(f,p,v)=>i(r+f,p,v);switch(n){case"scalar":s=wa.Scalar.PLAIN,c=pp(a,l);break;case"single-quoted-scalar":s=wa.Scalar.QUOTE_SINGLE,c=mp(a,l);break;case"double-quoted-scalar":s=wa.Scalar.QUOTE_DOUBLE,c=vp(a,l);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let d=r+a.length,u=fp.resolveEnd(o,d,t,i);return{value:c,type:s,comment:u.comment,range:[r,d,u.offset]}}function pp(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}`),Tc(e)}function mp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Tc(e.slice(1,-1)).replace(/''/g,"'")}function Tc(e){let t,i;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
83
+ `:(d+=f+w,f=" ",p=!1)}switch(n.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)d+=`
84
+ `+o[h][0].slice(c);d[d.length-1]!==`
85
+ `&&(d+=`
86
+ `);break;default:d+=`
87
+ `}let v=r+n.length+t.source.length;return{value:d,type:a,comment:n.comment,range:[r,v,v]}}function pp({offset:e,props:t},i,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!s&&(p==="-"||p==="+"))s=p;else{let v=Number(p);!o&&v?o=v:c===-1&&(c=e+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":i&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let v=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",v);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function mp(e){let t=e.split(/\n( *)/),i=t[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<t.length;o+=2)a.push([t[o],t[o+1]]);return a}Tc.resolveBlockScalar=hp});var ba=g(jc=>{"use strict";var Na=j(),vp=ct();function gp(e,t,i){let{offset:r,type:n,source:a,end:o}=e,s,c,l=(f,p,v)=>i(r+f,p,v);switch(n){case"scalar":s=Na.Scalar.PLAIN,c=wp(a,l);break;case"single-quoted-scalar":s=Na.Scalar.QUOTE_SINGLE,c=yp(a,l);break;case"double-quoted-scalar":s=Na.Scalar.QUOTE_DOUBLE,c=Np(a,l);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=vp.resolveEnd(o,u,t,i);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function wp(e,t){let i="";switch(e[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Ic(e)}function yp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Ic(e.slice(1,-1)).replace(/''/g,"'")}function Ic(e){let t,i;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
89
  `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let n=r[1],a=" ",o=t.lastIndex;for(i.lastIndex=o;r=i.exec(e);)r[1]===""?a===`
90
90
  `?n+=a:a=`
91
- `:(n+=a+r[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),n+a+(r?.[1]??"")}function vp(e,t){let i="";for(let r=1;r<e.length-1;++r){let n=e[r];if(!(n==="\r"&&e[r+1]===`
91
+ `:(n+=a+r[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),n+a+(r?.[1]??"")}function Np(e,t){let i="";for(let r=1;r<e.length-1;++r){let n=e[r];if(!(n==="\r"&&e[r+1]===`
92
92
  `))if(n===`
93
- `){let{fold:a,offset:o}=gp(e,r);i+=a,r=o}else if(n==="\\"){let a=e[++r],o=wp[a];if(o)i+=o;else if(a===`
93
+ `){let{fold:a,offset:o}=bp(e,r);i+=a,r=o}else if(n==="\\"){let a=e[++r],o=kp[a];if(o)i+=o;else if(a===`
94
94
  `)for(a=e[r+1];a===" "||a===" ";)a=e[++r+1];else if(a==="\r"&&e[r+1]===`
95
- `)for(a=e[++r+1];a===" "||a===" ";)a=e[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=yp(e,r+1,s,t),r+=s}else{let s=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=e[r+1];for(;o===" "||o===" ";)o=e[++r+1];o!==`
95
+ `)for(a=e[++r+1];a===" "||a===" ";)a=e[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Sp(e,r+1,s,t),r+=s}else{let s=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=e[r+1];for(;o===" "||o===" ";)o=e[++r+1];o!==`
96
96
  `&&!(o==="\r"&&e[r+2]===`
97
- `)&&(i+=r>a?e.slice(a,r+1):n)}else i+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function gp(e,t){let i="",r=e[t+1];for(;(r===" "||r===" "||r===`
97
+ `)&&(i+=r>a?e.slice(a,r+1):n)}else i+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function bp(e,t){let i="",r=e[t+1];for(;(r===" "||r===" "||r===`
98
98
  `||r==="\r")&&!(r==="\r"&&e[t+2]!==`
99
99
  `);)r===`
100
100
  `&&(i+=`
101
- `),t+=1,r=e[t+1];return i||(i=" "),{fold:i,offset:t}}var wp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function yp(e,t,i,r){let n=e.substr(t,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,i+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Ic.resolveFlowScalar=hp});var Oc=g($c=>{"use strict";var We=P(),jc=j(),Np=ga(),bp=ya();function kp(e,t,i,r){let{value:n,type:a,comment:o,range:s}=t.type==="block-scalar"?Np.resolveBlockScalar(e,t,r):bp.resolveFlowScalar(t,e.options.strict,r),c=i?e.directives.tagName(i.source,u=>r(i,"TAG_RESOLVE_FAILED",u)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[We.SCALAR]:c?l=Sp(e.schema,n,c,i,r):t.type==="scalar"?l=Ep(e,n,t,r):l=e.schema[We.SCALAR];let d;try{let u=l.resolve(n,f=>r(i??t,"TAG_RESOLVE_FAILED",f),e.options);d=We.isScalar(u)?u:new jc.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);r(i??t,"TAG_RESOLVE_FAILED",f),d=new jc.Scalar(n)}return d.range=s,d.source=n,a&&(d.type=a),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function Sp(e,t,i,r,n){if(i==="!")return e[We.SCALAR];let a=[];for(let s of e.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(t))return s;let o=e.knownTags[i];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),e[We.SCALAR])}function Ep({atKey:e,directives:t,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(r))||i[We.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[We.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),d=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",d,!0)}}return o}$c.composeScalar=kp});var Dc=g(Hc=>{"use strict";function Pp(e,t,i){if(t){i??(i=t.length);for(let r=i-1;r>=0;--r){let n=t[r];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++r];n?.type==="space";)e+=n.source.length,n=t[++r];break}}return e}Hc.emptyScalarPosition=Pp});var Mc=g(ba=>{"use strict";var Rp=Et(),xp=P(),Cp=Ac(),Bc=Oc(),Ap=ct(),_p=Dc(),Tp={composeNode:Lc,composeEmptyNode:Na};function Lc(e,t,i,r){let n=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,d=!0;switch(t.type){case"alias":l=Ip(e,t,r),(s||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Bc.composeScalar(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Cp.composeCollection(Tp,e,t,i,r),s&&(l.anchor=s.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);r(t,"RESOURCE_EXHAUSTION",f)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",u),d=!1}}return l??(l=Na(e,t.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!xp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&d&&(l.srcToken=t),l}function Na(e,t,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let d={type:"scalar",offset:_p.emptyScalarPosition(t,i,r),indent:-1,source:""},u=Bc.composeScalar(e,d,s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Ip({options:e},{offset:t,source:i,end:r},n){let a=new Rp.Alias(i.substring(1));a.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,s=Ap.resolveEnd(r,o,e.strict,n);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}ba.composeEmptyNode=Na;ba.composeNode=Lc});var qc=g(Vc=>{"use strict";var jp=Mt(),Fc=Mc(),$p=ct(),Op=Wt();function Hp(e,t,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:t},e),c=new jp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Op.resolveProps(r,{indicator:"doc-start",next:n??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Fc.composeNode(l,n,d,o):Fc.composeEmptyNode(l,d.end,r,null,d,o);let u=c.contents.range[2],f=$p.resolveEnd(a,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,u,f.offset],c}Vc.composeDoc=Hp});var Sa=g(Jc=>{"use strict";var Dp=Pi("process"),Bp=cn(),Lp=Mt(),zt=qt(),Wc=P(),Mp=qc(),Fp=ct();function Jt(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 zc(e){let t="",i=!1,r=!1;for(let n=0;n<e.length;++n){let a=e[n];switch(a[0]){case"#":t+=(t===""?"":r?`
101
+ `),t+=1,r=e[t+1];return i||(i=" "),{fold:i,offset:t}}var kp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Sp(e,t,i,r){let n=e.substr(t,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=e.substr(t-2,i+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}jc.resolveFlowScalar=gp});var Hc=g(Oc=>{"use strict";var We=P(),$c=j(),Ep=ya(),Pp=ba();function Rp(e,t,i,r){let{value:n,type:a,comment:o,range:s}=t.type==="block-scalar"?Ep.resolveBlockScalar(e,t,r):Pp.resolveFlowScalar(t,e.options.strict,r),c=i?e.directives.tagName(i.source,d=>r(i,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[We.SCALAR]:c?l=xp(e.schema,n,c,i,r):t.type==="scalar"?l=Cp(e,n,t,r):l=e.schema[We.SCALAR];let u;try{let d=l.resolve(n,f=>r(i??t,"TAG_RESOLVE_FAILED",f),e.options);u=We.isScalar(d)?d:new $c.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);r(i??t,"TAG_RESOLVE_FAILED",f),u=new $c.Scalar(n)}return u.range=s,u.source=n,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function xp(e,t,i,r,n){if(i==="!")return e[We.SCALAR];let a=[];for(let s of e.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(t))return s;let o=e.knownTags[i];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),e[We.SCALAR])}function Cp({atKey:e,directives:t,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||e&&s.default==="key")&&s.test?.test(r))||i[We.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[We.SCALAR];if(o.tag!==s.tag){let c=t.tagString(o.tag),l=t.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",u,!0)}}return o}Oc.composeScalar=Rp});var Bc=g(Dc=>{"use strict";function Ap(e,t,i){if(t){i??(i=t.length);for(let r=i-1;r>=0;--r){let n=t[r];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++r];n?.type==="space";)e+=n.source.length,n=t[++r];break}}return e}Dc.emptyScalarPosition=Ap});var Fc=g(Sa=>{"use strict";var _p=Ct(),Tp=P(),Ip=_c(),Lc=Hc(),jp=ct(),$p=Bc(),Op={composeNode:Mc,composeEmptyNode:ka};function Mc(e,t,i,r){let n=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,u=!0;switch(t.type){case"alias":l=Hp(e,t,r),(s||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Lc.composeScalar(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ip.composeCollection(Op,e,t,i,r),s&&(l.anchor=s.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);r(t,"RESOURCE_EXHAUSTION",f)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=ka(e,t.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!Tp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function ka(e,t,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:$p.emptyScalarPosition(t,i,r),indent:-1,source:""},d=Lc.composeScalar(e,u,s,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),a&&(d.comment=a,d.range[2]=c),d}function Hp({options:e},{offset:t,source:i,end:r},n){let a=new _p.Alias(i.substring(1));a.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+i.length,s=jp.resolveEnd(r,o,e.strict,n);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}Sa.composeEmptyNode=ka;Sa.composeNode=Mc});var Wc=g(qc=>{"use strict";var Dp=Wt(),Vc=Fc(),Bp=ct(),Lp=Ut();function Mp(e,t,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:t},e),c=new Dp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Lp.resolveProps(r,{indicator:"doc-start",next:n??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Vc.composeNode(l,n,u,o):Vc.composeEmptyNode(l,u.end,r,null,u,o);let d=c.contents.range[2],f=Bp.resolveEnd(a,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,d,f.offset],c}qc.composeDoc=Mp});var Pa=g(Gc=>{"use strict";var Fp=Ri("process"),Vp=un(),qp=Wt(),Kt=Gt(),zc=P(),Wp=Wc(),zp=ct();function Yt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function Jc(e){let t="",i=!1,r=!1;for(let n=0;n<e.length;++n){let a=e[n];switch(a[0]){case"#":t+=(t===""?"":r?`
103
103
 
104
104
  `:`
105
- `)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:t,afterEmptyLine:r}}var ka=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=Jt(i);a?this.warnings.push(new zt.YAMLWarning(o,r,n)):this.errors.push(new zt.YAMLParseError(o,r,n))},this.directives=new Bp.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:r,afterEmptyLine:n}=zc(this.prelude);if(r){let a=t.contents;if(i)t.comment=t.comment?`${t.comment}
106
- ${r}`:r;else if(n||t.directives.docStart||!a)t.commentBefore=r;else if(Wc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Wc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${r}
105
+ `)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:t,afterEmptyLine:r}}var Ea=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=Yt(i);a?this.warnings.push(new Kt.YAMLWarning(o,r,n)):this.errors.push(new Kt.YAMLParseError(o,r,n))},this.directives=new Vp.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:r,afterEmptyLine:n}=Jc(this.prelude);if(r){let a=t.contents;if(i)t.comment=t.comment?`${t.comment}
106
+ ${r}`:r;else if(n||t.directives.docStart||!a)t.commentBefore=r;else if(zc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];zc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${r}
107
107
  ${s}`:r}else{let o=a.commentBefore;a.commentBefore=o?`${r}
108
- ${o}`:r}}if(i){for(let a=0;a<this.errors.length;++a)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:zc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,r=-1){for(let n of t)yield*this.next(n);yield*this.end(i,r)}*next(t){switch(Dp.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,r,n)=>{let a=Jt(t);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=Mp.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new zt.YAMLParseError(Jt(t),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new zt.YAMLParseError(Jt(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=Fp.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
- ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new zt.YAMLParseError(Jt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),n=new Lp.Document(void 0,r);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,i,i],this.decorate(n,!1),yield n}}};Jc.Composer=ka});var Kc=g(gr=>{"use strict";var Vp=ga(),qp=ya(),Wp=qt(),Gc=At();function zp(e,t=!0,i){if(e){let r=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,a,o);else throw new Wp.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return qp.resolveFlowScalar(e,t,r);case"block-scalar":return Vp.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function Jp(e,t){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=t,s=Gc.stringifyString({type:o,value:e},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:r,source:`
108
+ ${o}`:r}}if(i){for(let a=0;a<this.errors.length;++a)t.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)t.warnings.push(this.warnings[a])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Jc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,r=-1){for(let n of t)yield*this.next(n);yield*this.end(i,r)}*next(t){switch(Fp.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,r,n)=>{let a=Yt(t);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=Wp.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Kt.YAMLParseError(Yt(t),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Kt.YAMLParseError(Yt(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=zp.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
+ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Kt.YAMLParseError(Yt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),n=new qp.Document(void 0,r);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,i,i],this.decorate(n,!1),yield n}}};Gc.Composer=Ea});var Yc=g(gr=>{"use strict";var Jp=ya(),Gp=ba(),Up=Gt(),Uc=jt();function Kp(e,t=!0,i){if(e){let r=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,a,o);else throw new Up.YAMLParseError([s,s+1],a,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Gp.resolveFlowScalar(e,t,r);case"block-scalar":return Jp.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function Yp(e,t){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=t,s=Uc.stringifyString({type:o,value:e},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
111
- `),d=s.substring(0,l),u=s.substring(l+1)+`
112
- `,f=[{type:"block-scalar-header",offset:a,indent:r,source:d}];return Uc(f,c)||f.push({type:"newline",offset:-1,indent:r,source:`
113
- `}),{type:"block-scalar",offset:a,indent:r,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:a,indent:r,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:r,source:s,end:c};default:return{type:"scalar",offset:a,indent:r,source:s,end:c}}}function Gp(e,t,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in e?e.indent:null;if(r&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Gc.stringifyString({type:o,value:t},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Up(e,c);break;case'"':Ea(e,c,"double-quoted-scalar");break;case"'":Ea(e,c,"single-quoted-scalar");break;default:Ea(e,c,"scalar")}}function Up(e,t){let i=t.indexOf(`
111
+ `),u=s.substring(0,l),d=s.substring(l+1)+`
112
+ `,f=[{type:"block-scalar-header",offset:a,indent:r,source:u}];return Kc(f,c)||f.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:a,indent:r,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:a,indent:r,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:r,source:s,end:c};default:return{type:"scalar",offset:a,indent:r,source:s,end:c}}}function Xp(e,t,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in e?e.indent:null;if(r&&typeof s=="number"&&(s+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=Uc.stringifyString({type:o,value:t},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Qp(e,c);break;case'"':Ra(e,c,"double-quoted-scalar");break;case"'":Ra(e,c,"single-quoted-scalar");break;default:Ra(e,c,"scalar")}}function Qp(e,t){let i=t.indexOf(`
114
114
  `),r=t.substring(0,i),n=t.substring(i+1)+`
115
- `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,e.source=n}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];Uc(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:n})}}function Uc(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 Ea(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let a of r)a.offset+=n;delete e.props,Object.assign(e,{type:i,source:t,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
- `};delete e.items,Object.assign(e,{type:i,source:t,end:[n]});break}default:{let r="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:i,indent:r,source:t,end:n})}}}gr.createScalarToken=Jp;gr.resolveAsScalar=zp;gr.setScalarValue=Gp});var Xc=g(Yc=>{"use strict";var Kp=e=>"type"in e?yr(e):wr(e);function yr(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=yr(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=wr(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=wr(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=wr(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function wr({start:e,key:t,sep:i,value:r}){let n="";for(let a of e)n+=a.source;if(t&&(n+=yr(t)),i)for(let a of i)n+=a.source;return r&&(n+=yr(r)),n}Yc.stringify=Kp});var tl=g(el=>{"use strict";var Pa=Symbol("break visit"),Yp=Symbol("skip children"),Qc=Symbol("remove item");function ze(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Zc(Object.freeze([]),e,t)}ze.BREAK=Pa;ze.SKIP=Yp;ze.REMOVE=Qc;ze.itemAtPath=(e,t)=>{let i=e;for(let[r,n]of t){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};ze.parentCollection=(e,t)=>{let i=ze.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Zc(e,t,i){let r=i(t,e);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=t[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Zc(Object.freeze(e.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===Pa)return Pa;s===Qc&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}el.visit=ze});var Nr=g(W=>{"use strict";var Ra=Kc(),Xp=Xc(),Qp=tl(),xa="\uFEFF",Ca="",Aa="",_a="",Zp=e=>!!e&&"items"in e,em=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function tm(e){switch(e){case xa:return"<BOM>";case Ca:return"<DOC>";case Aa:return"<FLOW_END>";case _a:return"<SCALAR>";default:return JSON.stringify(e)}}function im(e){switch(e){case xa:return"byte-order-mark";case Ca:return"doc-mode";case Aa:return"flow-error-end";case _a:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
+ `;if(e.type==="block-scalar"){let a=e.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,e.source=n}else{let{offset:a}=e,o="indent"in e?e.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];Kc(s,"end"in e?e.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
116
+ `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:s,source:n})}}function Kc(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function Ra(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let a of r)a.offset+=n;delete e.props,Object.assign(e,{type:i,source:t,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
117
+ `};delete e.items,Object.assign(e,{type:i,source:t,end:[n]});break}default:{let r="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(e))a!=="type"&&a!=="offset"&&delete e[a];Object.assign(e,{type:i,indent:r,source:t,end:n})}}}gr.createScalarToken=Yp;gr.resolveAsScalar=Kp;gr.setScalarValue=Xp});var Qc=g(Xc=>{"use strict";var Zp=e=>"type"in e?yr(e):wr(e);function yr(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=yr(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=wr(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=wr(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=wr(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function wr({start:e,key:t,sep:i,value:r}){let n="";for(let a of e)n+=a.source;if(t&&(n+=yr(t)),i)for(let a of i)n+=a.source;return r&&(n+=yr(r)),n}Xc.stringify=Zp});var il=g(tl=>{"use strict";var xa=Symbol("break visit"),em=Symbol("skip children"),Zc=Symbol("remove item");function ze(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),el(Object.freeze([]),e,t)}ze.BREAK=xa;ze.SKIP=em;ze.REMOVE=Zc;ze.itemAtPath=(e,t)=>{let i=e;for(let[r,n]of t){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};ze.parentCollection=(e,t)=>{let i=ze.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function el(e,t,i){let r=i(t,e);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=t[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=el(Object.freeze(e.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===xa)return xa;s===Zc&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}tl.visit=ze});var Nr=g(W=>{"use strict";var Ca=Yc(),tm=Qc(),im=il(),Aa="\uFEFF",_a="",Ta="",Ia="",rm=e=>!!e&&"items"in e,nm=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function am(e){switch(e){case Aa:return"<BOM>";case _a:return"<DOC>";case Ta:return"<FLOW_END>";case Ia:return"<SCALAR>";default:return JSON.stringify(e)}}function om(e){switch(e){case Aa:return"byte-order-mark";case _a:return"doc-mode";case Ta:return"flow-error-end";case Ia:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}W.createScalarToken=Ra.createScalarToken;W.resolveAsScalar=Ra.resolveAsScalar;W.setScalarValue=Ra.setScalarValue;W.stringify=Xp.stringify;W.visit=Qp.visit;W.BOM=xa;W.DOCUMENT=Ca;W.FLOW_END=Aa;W.SCALAR=_a;W.isCollection=Zp;W.isScalar=em;W.prettyToken=tm;W.tokenType=im});var ja=g(rl=>{"use strict";var Gt=Nr();function ie(e){switch(e){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var il=new Set("0123456789ABCDEFabcdef"),rm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),br=new Set(",[]{}"),nm=new Set(` ,[]{}
121
- \r `),Ta=e=>!e||nm.has(e),Ia=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];return!i||i==="#"||i===`
119
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}W.createScalarToken=Ca.createScalarToken;W.resolveAsScalar=Ca.resolveAsScalar;W.setScalarValue=Ca.setScalarValue;W.stringify=tm.stringify;W.visit=im.visit;W.BOM=Aa;W.DOCUMENT=_a;W.FLOW_END=Ta;W.SCALAR=Ia;W.isCollection=rm;W.isScalar=nm;W.prettyToken=am;W.tokenType=om});var Oa=g(nl=>{"use strict";var Xt=Nr();function re(e){switch(e){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var rl=new Set("0123456789ABCDEFabcdef"),sm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),br=new Set(",[]{}"),cm=new Set(` ,[]{}
121
+ \r `),ja=e=>!e||cm.has(e),$a=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];return!i||i==="#"||i===`
122
122
  `?!0:i==="\r"?this.buffer[t+1]===`
123
123
  `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let i=this.buffer[t];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+t];if(i==="\r"){let n=this.buffer[r+t+1];if(n===`
124
124
  `||!n&&!this.atEnd)return t+r+1}return i===`
125
- `||r>=this.indentNext||!i&&!this.atEnd?t+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&ie(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]===Gt.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let i=t.length,r=t.indexOf("#");for(;r!==-1;){let a=t[r-1];if(a===" "||a===" "){i=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let a=t[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-i),yield*this.pushNewline(),"stream"}return yield Gt.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==="...")&&ie(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&&!ie(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===":")&&ie(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ta),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,r=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(t+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&ie(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Gt.FLOW_END,yield*this.parseLineStart();let a=0;for(;n[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),n[a]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ta),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ie(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),i=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),n=r.indexOf(`
125
+ `||r>=this.indentNext||!i&&!this.atEnd?t+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&re(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Xt.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let i=t.length,r=t.indexOf("#");for(;r!==-1;){let a=t[r-1];if(a===" "||a===" "){i=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let a=t[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-i),yield*this.pushNewline(),"stream"}return yield Xt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&re(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!re(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&re(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ja),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,r=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(t+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&re(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Xt.FLOW_END,yield*this.parseLineStart();let a=0;for(;n[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),n[a]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(ja),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||re(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),i=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),n=r.indexOf(`
127
127
  `,this.pos);if(n!==-1){for(;n!==-1;){let a=this.continueScalar(n+1);if(a===-1)break;n=r.indexOf(`
128
- `,a)}n!==-1&&(i=n-(r[n-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let i=this.buffer[++t];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>ie(i)||i==="#")}*parseBlockScalar(){let t=this.pos-1,i=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":i+=1;break;case`
128
+ `,a)}n!==-1&&(i=n-(r[n-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let i=this.buffer[++t];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>re(i)||i==="#")}*parseBlockScalar(){let t=this.pos-1,i=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":i+=1;break;case`
129
129
  `:t=a,i=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
130
  `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(t+1);if(a===-1)break;t=this.buffer.indexOf(`
131
131
  `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
132
  `;)r=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let a=t-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
133
- `&&a>=this.pos&&a+1+i>s)t=a;else break}while(!0);return yield Gt.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let a=this.buffer[r+1];if(ie(a)||t&&br.has(a))break;i=r}else if(ie(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
133
+ `&&a>=this.pos&&a+1+i>s)t=a;else break}while(!0);return yield Xt.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let a=this.buffer[r+1];if(re(a)||t&&br.has(a))break;i=r}else if(re(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
134
134
  `?(r+=1,n=`
135
135
  `,a=this.buffer[r+1]):i=r),a==="#"||t&&br.has(a))break;if(n===`
136
- `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(t&&br.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Gt.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(i&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Ta),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(ie(r)||i&&br.has(r)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!ie(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==="%"&&il.has(this.buffer[t+1])&&il.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===`
136
+ `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(t&&br.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Xt.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(i&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(ja),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(re(r)||i&&br.has(r)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!re(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(sm.has(i))i=this.buffer[++t];else if(i==="%"&&rl.has(this.buffer[t+1])&&rl.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
137
137
  `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||t&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(t){let i=this.pos,r=this.buffer[i];for(;!t(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};rl.Lexer=Ia});var Oa=g(nl=>{"use strict";var $a=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<t?i=a+1:r=a}if(this.lineStarts[i]===t)return{line:i+1,col:1};if(i===0)return{line:0,col:t};let n=this.lineStarts[i-1];return{line:i,col:t-n+1}}}};nl.LineCounter=$a});var Da=g(ll=>{"use strict";var am=Pi("process"),al=Nr(),om=ja();function Ce(e,t){for(let i=0;i<e.length;++i)if(e[i].type===t)return!0;return!1}function ol(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 kr(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function lt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Sr(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let i=0;i<t.length;++i)e.push(t[i])}function sl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ce(t.start,"explicit-key-ind")&&!Ce(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,cl(t.value)?t.value.end?Sr(t.value.end,t.sep):t.value.end=t.sep:Sr(t.start,t.sep),delete t.sep)}var Ha=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 om.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,i))yield*this.next(r);i||(yield*this.end())}*next(t){if(this.source=t,am.env.LOG_TOKENS&&console.log("|",al.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=al.tokenType(t);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&sl(i),r.type){case"document":r.value=i;break;case"block-scalar":r.props.push(i);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=i;else{Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];n.value?r.items.push({start:[],value:i}):n.value=i;break}case"flow-collection":{let n=r.items[r.items.length-1];!n||n.value?r.items.push({start:[],key:i,sep:[]}):n.sep?n.value=i:Object.assign(n,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let n=i.items[i.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&ol(n.start)===-1&&(i.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{ol(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let i=kr(this.peek(2)),r=lt(i),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||t&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(t){let i=this.pos,r=this.buffer[i];for(;!t(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};nl.Lexer=$a});var Da=g(al=>{"use strict";var Ha=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<t?i=a+1:r=a}if(this.lineStarts[i]===t)return{line:i+1,col:1};if(i===0)return{line:0,col:t};let n=this.lineStarts[i-1];return{line:i,col:t-n+1}}}};al.LineCounter=Ha});var La=g(ul=>{"use strict";var lm=Ri("process"),ol=Nr(),um=Oa();function Ae(e,t){for(let i=0;i<e.length;++i)if(e[i].type===t)return!0;return!1}function sl(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function ll(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function kr(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function lt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Sr(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let i=0;i<t.length;++i)e.push(t[i])}function cl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ae(t.start,"explicit-key-ind")&&!Ae(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,ll(t.value)?t.value.end?Sr(t.value.end,t.sep):t.value.end=t.sep:Sr(t.start,t.sep),delete t.sep)}var Ba=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new um.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,i))yield*this.next(r);i||(yield*this.end())}*next(t){if(this.source=t,lm.env.LOG_TOKENS&&console.log("|",ol.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=ol.tokenType(t);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&cl(i),r.type){case"document":r.value=i;break;case"block-scalar":r.props.push(i);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=i;else{Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];n.value?r.items.push({start:[],value:i}):n.value=i;break}case"flow-collection":{let n=r.items[r.items.length-1];!n||n.value?r.items.push({start:[],key:i,sep:[]}):n.sep?n.value=i:Object.assign(n,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let n=i.items[i.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&sl(n.start)===-1&&(i.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{sl(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let i=kr(this.peek(2)),r=lt(i),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
139
139
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
140
- `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ce(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)&&!Ce(i.sep,"newline")){let o=lt(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(Ce(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=lt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ce(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||i.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ce(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||Ce(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?t.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?t.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=kr(r),a=lt(n);sl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let i=this.source.indexOf(`
140
+ `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ae(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(ll(i.key)&&!Ae(i.sep,"newline")){let o=lt(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(Ae(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=lt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ae(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||i.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ae(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Sr(n,i.start),n.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||Ae(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?t.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?t.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=kr(r),a=lt(n);cl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let i=this.source.indexOf(`
141
141
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
142
- `,i)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=kr(t),r=lt(i);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=kr(t),r=lt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};ll.Parser=Ha});var pl=g(Kt=>{"use strict";var ul=Sa(),sm=Mt(),Ut=qt(),cm=bn(),lm=P(),um=Oa(),dl=Da();function fl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new um.LineCounter||null,prettyErrors:t}}function dm(e,t={}){let{lineCounter:i,prettyErrors:r}=fl(t),n=new dl.Parser(i?.addNewLine),a=new ul.Composer(t),o=Array.from(a.compose(n.parse(e)));if(r&&i)for(let s of o)s.errors.forEach(Ut.prettifyError(e,i)),s.warnings.forEach(Ut.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function hl(e,t={}){let{lineCounter:i,prettyErrors:r}=fl(t),n=new dl.Parser(i?.addNewLine),a=new ul.Composer(t),o=null;for(let s of a.compose(n.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Ut.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(Ut.prettifyError(e,i)),o.warnings.forEach(Ut.prettifyError(e,i))),o}function fm(e,t,i){let r;typeof t=="function"?r=t:i===void 0&&t&&typeof t=="object"&&(i=t);let n=hl(e,i);if(!n)return null;if(n.warnings.forEach(a=>cm.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:r},i))}function hm(e,t,i){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:i===void 0&&t&&(i=t),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=i??t??{};if(!n)return}return lm.isDocument(e)&&!r?e.toString(i):new sm.Document(e,r,i).toString(i)}Kt.parse=fm;Kt.parseAllDocuments=dm;Kt.parseDocument=hl;Kt.stringify=hm});var Yt=g(x=>{"use strict";var pm=Sa(),mm=Mt(),vm=ra(),Ba=qt(),gm=Et(),Ae=P(),wm=Ee(),ym=j(),Nm=Re(),bm=xe(),km=Nr(),Sm=ja(),Em=Oa(),Pm=Da(),Er=pl(),ml=Nt();x.Composer=pm.Composer;x.Document=mm.Document;x.Schema=vm.Schema;x.YAMLError=Ba.YAMLError;x.YAMLParseError=Ba.YAMLParseError;x.YAMLWarning=Ba.YAMLWarning;x.Alias=gm.Alias;x.isAlias=Ae.isAlias;x.isCollection=Ae.isCollection;x.isDocument=Ae.isDocument;x.isMap=Ae.isMap;x.isNode=Ae.isNode;x.isPair=Ae.isPair;x.isScalar=Ae.isScalar;x.isSeq=Ae.isSeq;x.Pair=wm.Pair;x.Scalar=ym.Scalar;x.YAMLMap=Nm.YAMLMap;x.YAMLSeq=bm.YAMLSeq;x.CST=km;x.Lexer=Sm.Lexer;x.LineCounter=Em.LineCounter;x.Parser=Pm.Parser;x.parse=Er.parse;x.parseAllDocuments=Er.parseAllDocuments;x.parseDocument=Er.parseDocument;x.stringify=Er.stringify;x.visit=ml.visit;x.visitAsync=ml.visitAsync});import Qm from"path";var Zt=Ri(Yt(),1);import Rr from"path";var ei=64*1024,xr=1024,Cr=64,Ma=5,Rm=[".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/**"],xm=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Cm=[...Rm,...xm].sort((e,t)=>e.localeCompare(t,"en"));var G={include:["**/*"],exclude:[...Cm],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},Pr={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
143
- # ambient_resume: true | false`,native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs and changes. Runtime data stays under .comet.","native.language":`# Artifact language used by Native workflow documents.
142
+ `,i)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=kr(t),r=lt(i);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=kr(t),r=lt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};ul.Parser=Ba});var ml=g(Zt=>{"use strict";var dl=Pa(),dm=Wt(),Qt=Gt(),fm=Sn(),hm=P(),pm=Da(),fl=La();function hl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new pm.LineCounter||null,prettyErrors:t}}function mm(e,t={}){let{lineCounter:i,prettyErrors:r}=hl(t),n=new fl.Parser(i?.addNewLine),a=new dl.Composer(t),o=Array.from(a.compose(n.parse(e)));if(r&&i)for(let s of o)s.errors.forEach(Qt.prettifyError(e,i)),s.warnings.forEach(Qt.prettifyError(e,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function pl(e,t={}){let{lineCounter:i,prettyErrors:r}=hl(t),n=new fl.Parser(i?.addNewLine),a=new dl.Composer(t),o=null;for(let s of a.compose(n.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Qt.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(Qt.prettifyError(e,i)),o.warnings.forEach(Qt.prettifyError(e,i))),o}function vm(e,t,i){let r;typeof t=="function"?r=t:i===void 0&&t&&typeof t=="object"&&(i=t);let n=pl(e,i);if(!n)return null;if(n.warnings.forEach(a=>fm.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:r},i))}function gm(e,t,i){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:i===void 0&&t&&(i=t),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=i??t??{};if(!n)return}return hm.isDocument(e)&&!r?e.toString(i):new dm.Document(e,r,i).toString(i)}Zt.parse=vm;Zt.parseAllDocuments=mm;Zt.parseDocument=pl;Zt.stringify=gm});var ut=g(x=>{"use strict";var wm=Pa(),ym=Wt(),Nm=aa(),Ma=Gt(),bm=Ct(),_e=P(),km=Pe(),Sm=j(),Em=xe(),Pm=Ce(),Rm=Nr(),xm=Oa(),Cm=Da(),Am=La(),Er=ml(),vl=Et();x.Composer=wm.Composer;x.Document=ym.Document;x.Schema=Nm.Schema;x.YAMLError=Ma.YAMLError;x.YAMLParseError=Ma.YAMLParseError;x.YAMLWarning=Ma.YAMLWarning;x.Alias=bm.Alias;x.isAlias=_e.isAlias;x.isCollection=_e.isCollection;x.isDocument=_e.isDocument;x.isMap=_e.isMap;x.isNode=_e.isNode;x.isPair=_e.isPair;x.isScalar=_e.isScalar;x.isSeq=_e.isSeq;x.Pair=km.Pair;x.Scalar=Sm.Scalar;x.YAMLMap=Em.YAMLMap;x.YAMLSeq=Pm.YAMLSeq;x.CST=Rm;x.Lexer=xm.Lexer;x.LineCounter=Cm.LineCounter;x.Parser=Am.Parser;x.parse=Er.parse;x.parseAllDocuments=Er.parseAllDocuments;x.parseDocument=Er.parseDocument;x.stringify=Er.stringify;x.visit=vl.visit;x.visitAsync=vl.visitAsync});import rv from"path";var ei=St(ut(),1);import Rr from"path";var ti=64*1024,xr=1024,Cr=64,Va=5,_m=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Tm=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Im=[..._m,...Tm].sort((e,t)=>e.localeCompare(t,"en"));var G={include:["**/*"],exclude:[...Im],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},Pr={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
143
+ # ambient_resume: true | false`,hook:"# Hook write policy shared by Native and Classic. Paths are project-relative.","hook.allow_paths":"# Project-relative directories allowed during guarded phases. Use one path per list item; empty by default.",native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs and changes. Runtime data stays under .comet.","native.language":`# Artifact language used by Native workflow documents.
144
144
  # language: en | zh-CN`,"native.clarification_mode":`# Controls how Native asks clarifying questions: batch asks every currently answerable question per round (default), sequential asks one at a time.
145
145
  # clarification_mode: batch | sequential`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
146
146
  # archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed acceptance target before Native stops the completion loop.","native.snapshot":"# Controls the auditable project scope and bounded work used by Native content snapshots.","native.snapshot.include":"# Selects the project-relative paths included in Native snapshots. Patterns use / and support *, **, and ?.","native.snapshot.exclude":"# Removes paths from the included scope. Exclusions are bound into each new change baseline.","native.snapshot.max_files":"# Bounds the number of files captured by one snapshot. Increase it for large monorepos.","native.snapshot.max_total_bytes":"# Bounds the total file content hashed by one snapshot. Content is streamed and does not depend on Git hashes.","native.snapshot.max_duration_ms":"# Bounds snapshot capture time in milliseconds. Increase it together with the byte budget on slower or larger repositories.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
@@ -149,7 +149,7 @@ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.pus
149
149
  # context_compression: off | beta`,"classic.review_mode":`# Sets the default review depth for new Classic changes.
150
150
  # review_mode: off | standard | thorough`,"classic.auto_transition":`# Automatically enters the next Classic phase after a phase passes.
151
151
  # auto_transition: true | false`},"zh-CN":{schema:"# Comet 使用的配置格式版本,请勿修改此值。",default_workflow:"# `/comet` 默认进入的工作流;该值也必须出现在 workflows 中。",workflows:"# 此项目启用的工作流,可填写 native、classic 或同时启用两者。",ambient_resume:`# 是否启用只读的环境感知恢复探针,同时作用于 Native 和 Classic;设为 false 可关闭自动工作流恢复。
152
- # ambient_resume: true | false`,native:"# Native 工作流配置,不会改变 Classic 的状态或行为。","native.artifact_root":"# Native 规格和 change 的存放根目录;运行时数据始终位于 .comet。","native.language":`# Native 工作流文档使用的产物语言。
152
+ # ambient_resume: true | false`,hook:"# Native 和 Classic 共享的 Hook 写入策略;路径必须是项目相对路径。","hook.allow_paths":"# 在受保护阶段允许写入的项目相对目录;每项填写一个目录,默认为空。",native:"# Native 工作流配置,不会改变 Classic 的状态或行为。","native.artifact_root":"# Native 规格和 change 的存放根目录;运行时数据始终位于 .comet。","native.language":`# Native 工作流文档使用的产物语言。
153
153
  # 可选值:en | zh-CN`,"native.clarification_mode":`# Native 提问澄清问题的方式:batch 每轮一次提出当前所有可回答的问题(默认),sequential 每轮只问一个。
154
154
  # 可选值:batch | sequential`,"native.archive_confirmation":`# Native 归档检查成功后自动归档,或等待用户明确确认。
155
155
  # 可选值:automatic | required`,"native.max_verify_failures":"# 同一个已确认验收目标最多允许的 Verify 失败次数;达到上限后停止完成循环。","native.snapshot":"# Native 内容快照使用的可审计项目范围与有界工作预算。","native.snapshot.include":"# Native 快照纳入的项目相对路径;模式使用 /,支持 *、** 和 ?。","native.snapshot.exclude":"# 从纳入范围中排除路径;新 change 会把排除策略绑定到 baseline。","native.snapshot.max_files":"# 单次快照最多捕获的文件数;大型 monorepo 可按需提高。","native.snapshot.max_total_bytes":"# 单次快照最多哈希的文件内容总字节数;内容采用流式读取,不依赖 Git hash。","native.snapshot.max_duration_ms":"# 单次快照的最长执行时间(毫秒);较慢或更大的仓库应与字节预算一并提高。",classic:"# Classic 工作流配置,不会改变 Native 的状态或行为。","classic.artifact_layout":`# Classic 产物布局;默认使用 docs,update 检测到根目录 legacy 产物时予以保留。
@@ -157,34 +157,34 @@ ${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 gl(e,t){return Pr[t][e]}function Am(e,t,i){let r=/^(\s*)([a-z_]+):/u.exec(e);if(!r)return null;let n=r[1].length,a=r[2];if(n===0&&a in Pr.en)return a;if(n===2&&t){let o=`${t}.${a}`;if(o in Pr.en)return o}if(n===4&&t==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in Pr.en)return o}return null}function ti(e,t){let i=[],r=null,n=null;for(let a of(0,Zt.stringify)(e).trimEnd().split(`
161
- `)){let o=Am(a,r,n);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of gl(o,t).split(`
162
- `))i.push(`${s}${c}`)}i.push(a),/^[a-z_]+:/u.test(a)?(a.startsWith("native:")?r="native":a.startsWith("classic:")?r="classic":r=null,n=null):/^ {2}[a-z_]+:/u.test(a)&&r==="native"&&(n=a.startsWith(" snapshot:")?"snapshot":null)}return i.push(""),i.join(`
163
- `)}function _m(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim();if(i.length===0||Rr.posix.isAbsolute(i)||Rr.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${t} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${t} must not contain empty or dot path segments`);return r}function Je(e){let t=_m(e,"native.artifact_root");return t.length===0?".":t.join("/")}function wl(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 Fa(e,t,i=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim().replaceAll("\\","/");if(r.length===0||Rr.posix.isAbsolute(r)||Rr.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${t} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${t} cannot contain wildcards`);return n.join("/")}function Qt(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function yl(e,t,i){let r=e??t;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function Va(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>xr)throw new Error(`${t} exceeds ${xr} characters`);let i=0;for(let r=0;r<e.length;r+=1)e[r]==="?"?i+=1:e[r]==="*"&&(i+=1,e[r+1]==="*"&&(r+=1));if(i>Cr)throw new Error(`${t} contains more than ${Cr} wildcard tokens`);return e}function vl(e,t,i){if(e===void 0)return[...i];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(r=>Va(r,t)))].sort((r,n)=>r.localeCompare(n,"en"))}function La(e,t,i){let r=e??t;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function Tm(e){if(e===void 0)return{...G,include:[...G.include],exclude:[...G.exclude]};let t=Qt(e,"native.snapshot");return{include:vl(t.include,"native.snapshot.include",G.include),exclude:vl(t.exclude,"native.snapshot.exclude",G.exclude),max_files:La(t.max_files,G.max_files,"native.snapshot.max_files"),max_total_bytes:La(t.max_total_bytes,G.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:La(t.max_duration_ms,G.max_duration_ms,"native.snapshot.max_duration_ms")}}function Im(e){if(e===void 0)return;let t=Qt(e,"native.pending_root_move"),i=t.id,r=t.from_artifact_root,n=t.to_artifact_root,a=t.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(t.cleanup!==void 0){let s=Qt(t.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,d=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 d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:i,fromArtifactRoot:Je(r),toArtifactRoot:Je(n),stage:a,...o?{cleanup:o}:{}}}function jm(e,t={}){let i=Qt(e,"native"),r=i.artifact_root??(t.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??Ma;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Im(i.pending_root_move);return{artifact_root:Je(r),language:yl(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:Tm(i.snapshot),...s?{pending_root_move:s}:{}}}function $m(e){let t=Qt(e,"classic"),i=t.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=t.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=t.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:wl(t.artifact_layout),language:yl(t.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function Om(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function Hm(e,t,i,r,n){let a=e.schema!==void 0;if(!(a||e.default_workflow!==void 0||e.workflows!==void 0||!n.allowPartialProject&&e.native!==void 0)||n.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:r,...t?{native:t}:{},...i?{classic:i}:{}}}function ut(e,t={}){let i=(0,Zt.parseDocument)(e,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let r=i.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=r,a=Om(n.ambient_resume),o=n.native===void 0?void 0:jm(n.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),s=n.classic===void 0?void 0:$m(n.classic),c=Hm(n,o,s,a,{allowPartialProject:t.allowPartialProject??!1});return{value:n,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function Nl(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 bl(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,...e.native.pending_root_move?{pending_root_move:Nl(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 Xt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ii(e,t){let i=bl(t),r=ut((0,Zt.stringify)(i)).config;if(!r)throw new Error("Unsupported Comet project schema");let n={...e,schema:r.schema,default_workflow:r.default_workflow,workflows:r.workflows,ambient_resume:r.ambient_resume};if(r.native){let a=Xt(e.native),o={...a,artifact_root:r.native.artifact_root,language:r.native.language,clarification_mode:r.native.clarification_mode,archive_confirmation:r.native.archive_confirmation,max_verify_failures:r.native.max_verify_failures};if(delete o.snapshot,r.native.pending_root_move){let s=Xt(a.pending_root_move),c=Nl(r.native.pending_root_move),l=Xt(s.cleanup),d=Xt(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...d}}:{}}}else delete o.pending_root_move;n.native=o}return r.classic&&(n.classic={...Xt(e.classic),artifact_layout:r.classic.artifact_layout,language:r.classic.language,context_compression:r.classic.context_compression,review_mode:r.classic.review_mode,auto_transition:r.classic.auto_transition}),n}function Ar(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Je(e),language:t,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ma,snapshot:{...G,include:[...G.include],exclude:[...G.exclude]}}}}import{createHash as Bm}from"crypto";import{promises as Ir}from"fs";import Te from"path";import{constants as _r,promises as Ge}from"fs";function _e(e){return e!==0&&e!==0n&&e!=="0"}function U(e,t){return _e(e.dev)&&_e(t.dev)&&_e(e.ino)&&_e(t.ino)}function T(e,t){let i=_e(e.dev)&&_e(t.dev);if(i&&e.dev!==t.dev)return!1;let r=_e(e.ino)&&_e(t.ino);return r&&e.ino!==t.ino?!1:i&&r?!0:e.birthtime===t.birthtime}var re=class extends Error{reason;constructor(t,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=t}};function qa(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function kl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function ri(e){return{dev:e.dev,ino:e.ino,birthtime:qa(e)}}function Tr(e,t){let i=ri(e),r=ri(t);return U(i,r)?T(i,r):T(i,r)&&qa(e)===qa(t)&&kl(e)===kl(t)&&e.size===t.size}async function dt(e,t,i={}){if(!Number.isSafeInteger(t)||t<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,a=await Ge.lstat(e,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new re("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new re("too-large",`${r} exceeds ${t} bytes`);let o=await Ge.realpath(e);await i.verify?.("pre-open",{realPath:o,identity:ri(a)});let s=process.platform==="win32"?_r.O_RDONLY:_r.O_RDONLY|_r.O_NOFOLLOW|_r.O_NONBLOCK,c;try{c=await Ge.open(e,s)}catch(l){throw l.code==="ELOOP"?new re("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!Tr(a,l)||!Tr(a,d))throw new re("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:ri(l)}),await i.hooks?.afterOpen?.();let f=[],p=0,v=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let y=t+1-p,{bytesRead:b}=await c.read(v,0,Math.min(v.length,y),null);if(b===0)break;if(p+=b,p>t)throw new re("too-large",`${r} exceeds ${t} bytes`);f.push(Buffer.from(v.subarray(0,b)))}await i.hooks?.beforeFinalCheck?.();let[h,m,w]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!Tr(a,h)||!Tr(a,m))throw new re("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:w,identity:ri(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:w}}finally{await c.close()}}function Dm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function Wa(e,t){let i=Te.relative(e,t);return i===""||!Te.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Te.sep}`)}async function Sl(e,t){let i=Te.resolve(e),r=await Ir.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return Ir.realpath(i)}async function El(e,t,i,r){let n=e;for(let a=0;a<i.length;a++){n=Te.join(n,i[a]);let o;try{o=await Ir.lstat(n)}catch(d){if(Dm(d))return{exists:!1,kind:"missing"};throw d}let s=Te.relative(e,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!o.isFile()||r.expected==="directory"&&!o.isDirectory()||r.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Ir.realpath(n);if(!Wa(t,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function ft(e,t,i){let r=Fa(t,i.label),n=Te.resolve(e),a=await Sl(n,i.label),o=r.split("/"),s=Te.resolve(n,...o);if(!Wa(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await El(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function Ie(e,t,i,r){let n=await ft(e,t,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let a=await Sl(n.projectRoot,r.label);return dt(n.target,i,{...r,verify:async(o,s)=>{if(!Wa(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await El(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var ni=".comet/config.yaml";function za(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function Lm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function Ja(e,t={}){return(await ai(e,t)).document}async function Pl(e){try{return(await Ie(e,ni,ei,{label:ni})).bytes}catch(t){if(Lm(t))return null;throw t}}function Rl(e){return e?{exists:!0,sha256:Bm("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function jr(e){return Rl(await Pl(e))}async function ai(e,t={}){let i=await Pl(e);return{document:i?ut(i.toString("utf8"),t):null,identity:Rl(i)}}var gN=16*1024;async function Ga(e,t){if(!t)return;let i=await jr(e);if(!za(i,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as qm}from"crypto";import{promises as M}from"fs";import ne from"path";function Ka(e,t){let i=ne.relative(e,t);return i===""||!ne.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ne.sep}`)}function Wm(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Ua(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function xl(e){let t=await M.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await M.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function si(e){for(let t of e){let i=await M.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Wm(t,i)||await M.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function zm(e,t){let i=ne.resolve(e),r=ne.resolve(t);if(!Ka(i,r))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let n=[await xl(i)],a=ne.relative(i,r).split(ne.sep).filter(Boolean),o=i;for(let s of a){await si(n),o=ne.join(o,s);try{await M.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await xl(o);if(!Ka(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await si(n),n}async function Jm(e){let t;try{t=await M.open(e,"r"),await t.sync()}catch(i){let r=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw i}finally{await t?.close()}}async function Cl(e,t,i={}){let r=ne.dirname(e),n=i.containedRoot?await zm(i.containedRoot,r):null;n||await M.mkdir(r,{recursive:!0});let a=ne.join(r,`.${ne.basename(e)}.${qm()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await M.open(a,"wx"),s=await o.stat(),n){let[c,l]=await Promise.all([M.lstat(a),M.realpath(a)]);if(await si(n),!c.isFile()||c.isSymbolicLink()||!Ua(s,c)||!Ka(n[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),!Ua(s,await o.stat()))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await i.beforeCommit?.(),n){await si(n);let c=await M.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!Ua(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await M.link(a,e),await M.unlink(a)):await M.rename(a,e),await Jm(r)}catch(c){if(await o?.close(),!n)await M.rm(a,{force:!0});else try{await si(n),await M.rm(a,{force:!0})}catch{}throw c}}async function z(e,t,i={}){await Cl(e,t,i)}async function Al(e,t,i={}){await Cl(e,t,i)}async function X(e,t,i={}){await z(e,JSON.stringify(t,null,2)+`
164
- `,i)}import{existsSync as _l,promises as Ue}from"fs";import C from"path";import Gm from"os";var $r=".comet/config.yaml",Um=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function Ya(e){try{return await Ue.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Km(e){try{let t=await Ue.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function pt(e,t){let i=C.relative(e,t);return i===""||!C.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${C.sep}`)}async function ht(e){let t=[],i=e;for(;!await Ya(i);){let n=C.dirname(i);if(n===i)break;t.push(C.basename(i)),i=n}let r=await Ue.realpath(i);return C.resolve(r,...t.reverse())}async function Xa(e){try{return(await Ue.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Qa(e){let t=C.resolve(e);try{(await Ue.stat(t)).isDirectory()||(t=C.dirname(t))}catch(n){if(n.code!=="ENOENT")throw n}let i=t,r=C.resolve(Gm.homedir());for(;;){if(!(t===r&&i!==r)){let o=C.join(t,...$r.split("/")),s=t===i||await Km(o);if(await Ya(o)&&s)return t}if(await Ya(C.join(t,".git")))return t;let a=C.dirname(t);if(a===t)return i;t=a}}function ci(e){return Je(e)}async function Ym(e,t){let i=ci(t),r=C.resolve(e,...i.split("/")),n=await Ue.realpath(e),a=await ht(r);if(!pt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function je(e,t){let i=ci(t),r=await Ym(e,i),n=C.join(r,"comet");if(await Xa(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([ht(r),ht(n)]);if(!pt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=C.resolve(e),c=C.join(s,".comet","runtime","native");if(await Xa(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,d]=await Promise.all([Ue.realpath(s),ht(c)]);if(!pt(l,d))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:C.join(e,...$r.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:C.join(n,"specs"),changesDir:C.join(n,"changes"),archiveDir:C.join(n,"archive"),runtimeDir:c,changesRuntimeDir:C.join(c,"changes"),locksDir:C.join(c,"locks"),transactionsDir:C.join(c,"transactions")}}function Tl(e){if(!Um.test(e))throw new Error(`Invalid Native change name: ${e}`)}function Or(e,t){Tl(t);let i=C.join(e.changesRuntimeDir,t);if(!F(e.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function Xm(e,t){Tl(t);let i=C.join(e.changesDir,t,"runtime");if(!F(e.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function de(e,t){let i=Or(e,t);if(_l(i))return i;let r=Xm(e,t);return _l(r)?r:i}function ae(e,t){let i=C.resolve(t);if(F(e.runtimeDir,i))return e.runtimeDir;if(F(e.nativeRoot,i))return e.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${t}`)}function F(e,t){return pt(C.resolve(e),C.resolve(t))}async function $(e,t){let i=C.resolve(e),r=C.resolve(t);if(!pt(i,r))throw new Error(`Path is outside the Native root: ${t}`);if(await Xa(i))throw new Error(`Native root must not be a symbolic link: ${e}`);let[n,a]=await Promise.all([ht(i),ht(r)]);if(!pt(n,a))throw new Error(`Path resolves outside the Native root: ${t}`);return r}function Il(e="docs",t="en"){return Ar(e,t)}async function fe(e){let t=(await Ja(e))?.config??null;return t?.native?t:null}async function $e(e,t,i={}){let r=await ai(e,{allowPartialProject:!0}),n=ii(r.document?.value??{},t),a=Qm.join(e,...$r.split("/"));await z(a,ti(n,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await i.beforeCommit?.(),await Ga(e,r.identity)}})}import{createHash as kg,randomUUID as Sg}from"crypto";import{promises as Le}from"fs";import I from"path";import{AsyncLocalStorage as Zm}from"async_hooks";import{randomUUID as Ol}from"crypto";import{promises as Q}from"fs";import Hl from"os";import V from"path";var jl=16*1024,Dl=".coordinator",ev=5e3,$l=new Zm,Hr=new Map;function tv(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function iv(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 Bl(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 Za(e,t){let i={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},r={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return U(i,r)?T(i,r):T(i,r)&&e.size===t.size}function eo(e,t){return Za(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Oe(e){let t,i;try{let r=await dt(e,jl,{bigint:!0,label:"Native lock"});t=r.bytes,i=r.stat}catch(r){if(r.code==="ENOENT")return null;throw r instanceof re?r.reason==="too-large"?new Error(`Native lock metadata exceeds ${jl} bytes: ${e}`,{cause:r}):r.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:r}):new Error(`Native lock changed while reading: ${e}`,{cause:r}):r}return{file:e,owner:iv(JSON.parse(t.toString("utf8")),e),identity:Bl(i)}}async function rv(e){return(await Oe(e))?.owner??null}function nv(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==Hl.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=uv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function av(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 to(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(!eo(i.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await Q.mkdir(t,{recursive:!0});let r=V.join(t,`${V.basename(e.file)}.${e.owner.id}.${Ol()}.removed`);try{await Q.rename(e.file,r)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await Oe(r);if(!n||n.owner.id!==e.owner.id||!Za(n.identity,e.identity))throw await av(r,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await Q.rm(r,{force:!0}),"removed"}function Ll(e){return{id:Ol(),pid:process.pid,hostname:Hl.hostname(),createdAt:new Date().toISOString(),operation:e}}async function Ml(e,t){let i;try{i=await Q.open(e,"wx")}catch(r){if(r.code==="EEXIST"){let n=await rv(e);throw new Error(`Native lock is already held: ${e}${n?` by pid ${n.pid} for ${n.operation}`:""}`,{cause:r})}throw r}try{return await i.writeFile(JSON.stringify(t,null,2)+`
165
- `,"utf8"),await i.sync(),Bl(await i.stat({bigint:!0}))}finally{await i.close()}}async function ov(e,t){let i=await $(e.runtimeDir,e.locksDir);await Q.mkdir(i,{recursive:!0});let r=await $(e.runtimeDir,V.join(i,Dl));await Q.mkdir(r,{recursive:!0});let n=Ll(t),a=V.join(r,`.${n.id}.tmp`),o=V.join(r,`${n.id}.claim`);try{let s=await Ml(a,n);await Q.rename(a,o);let c=await Oe(o);if(!c||!Za(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.runtimeDir,locksDir:i,owner:n,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function sv(e){let t=V.dirname(e.file),i=!1,r=V.basename(e.file);for(let n of await Q.readdir(t,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=V.join(t,n.name);if(V.resolve(a)!==V.resolve(e.file))try{let o=await Oe(a),s=nv(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await to(o,t);continue}n.name<r&&(i=!0)}catch{n.name<r&&(i=!0)}}return i}async function Fl(e){let t=await Oe(e.file);if(t){if(t.owner.id!==e.owner.id||!eo(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await to(t,V.dirname(e.file))}}async function cv(e,t){let i=Date.now()+ev;for(;;){let r=await ov(e,t);if(!await sv(r))return r;if(await Fl(r),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function lv(e){let t=Hr.get(e)??Promise.resolve(),i,r=new Promise(a=>{i=a}),n=t.then(()=>r);return Hr.set(e,n),await t,()=>{i(),Hr.get(e)===n&&Hr.delete(e)}}async function Vl(e,t,i){let r=V.resolve(e.locksDir),n=$l.getStore();if(n?.has(r))return i();let a=await lv(r);try{let o=await cv(e,t),s=new Map(n??[]);return s.set(r,o),await $l.run(s,async()=>{try{return await i()}finally{await Fl(o)}})}finally{a()}}async function li(e,t,i){return Vl(e,`acquire ${t}`,async()=>{let r=await $(e.runtimeDir,e.locksDir);await Q.mkdir(r,{recursive:!0});let n=await $(e.runtimeDir,V.join(r,tv(t))),a=Ll(i),o=await Ml(n,a);return{file:n,nativeRoot:e.runtimeDir,locksDir:r,owner:a,identity:o}})}async function ui(e){await Oe(e.file)&&await Vl({runtimeDir:e.nativeRoot,locksDir:e.locksDir},`release ${V.basename(e.file)}`,async()=>{let t=await Oe(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!eo(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let i=V.join(e.locksDir,Dl);await to(t,i)})}function uv(e){try{return process.kill(e,0),!0}catch(t){let i=t.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{createHash as dv}from"node:crypto";import{constants as Dr,promises as R}from"node:fs";import _ from"node:path";function he(e,t){let i=_.relative(e,t);return i===""||!_.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_.sep}`)}function ql(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Br(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Wl(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function mt(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Ke(e,t){let i=await R.lstat(e);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await R.realpath(e),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function di(e,t,i){let r=_.resolve(e),n=_.resolve(t);if(!he(r,n))throw new Error(`${i} is outside its managed root`);let a=[await Ke(r,i)],o=r;for(let s of _.relative(r,n).split(_.sep).filter(Boolean)){await L(a,i),o=_.join(o,s);let c=await Ke(o,i);if(!he(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,i),a}async function L(e,t){for(let i of e){let r=await R.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Br(i,r)||await R.realpath(i.path)!==i.realPath)throw new Error(`${t} parent changed during I/O: ${i.path}`)}}async function fv(e,t,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-n,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>t)throw new Error(`${i} exceeds ${t} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function J(e){let t=ql(e.maxBytes),i=_.resolve(e.file),r=await di(e.root,_.dirname(i),e.label),n=await Promise.all((e.forbiddenRoots??[]).map(d=>Ke(_.resolve(d),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(r,e.label);let a=await R.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=Wl(a),s=await R.realpath(i);if(!he(r[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(n.some(d=>he(d.realPath,s)))throw new Error(`${e.label} resolves inside an excluded root`);let c=process.platform==="win32"?Dr.O_RDONLY:Dr.O_RDONLY|Dr.O_NOFOLLOW|Dr.O_NONBLOCK,l=await R.open(i,c);try{let d=await l.stat();await e.hooks?.afterOpen?.();let[u,f]=await Promise.all([R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!d.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!mt(o,d)||!mt(o,u))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let p=await fv(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([l.stat(),R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!h.isFile()||h.isSymbolicLink()||m!==s||!mt(o,v)||!mt(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:p,hash:dv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function Ye(e){let t=await di(e.root,e.directory,e.label),i;if(e.maxEntries===void 0)i=await R.readdir(e.directory,{withFileTypes:!0});else{let r=ql(e.maxEntries);i=[];let n=await R.opendir(e.directory);try{for await(let a of n)if(i.push(a),i.length>r)throw new Error(`${e.label} exceeds ${r} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:i,verify:()=>L(t,e.label)}}async function hv(e){let t=_.resolve(e.directory),i=_.resolve(e.quarantine);if(_.dirname(i)!==_.dirname(t)||!he(_.resolve(e.root),i)||i===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let r=await di(e.root,_.dirname(t),e.label),n=await Ke(t,e.label);if(!he(r[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(r,e.label);let a=await R.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Br(n,a)||await R.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await R.lstat(i),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await R.rename(t,i),await L(r,e.label);let o=await R.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Br(n,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(i);try{throw await R.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:r,identity:n}}async function zl(e){await hv(e)}async function io(e){let t=_.resolve(e.file),i=await di(e.root,_.dirname(t),e.label),r=await R.lstat(t);if(!r.isFile()||r.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let n=Wl(r),a=await R.realpath(t);if(!he(i[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await J({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!mt(n,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(i,e.label);let[l,d]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!mt(n,l)||d!==a)throw new Error(`${e.label} changed before removal`);await R.rm(t),await L(i,e.label)}async function ro(e){let t=_.resolve(e.directory),i=await di(e.root,_.dirname(t),e.label),r=await Ke(t,e.label);if(!he(i[0].realPath,r.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(i,e.label);let n=await R.lstat(t);if(!n.isDirectory()||n.isSymbolicLink()||!Br(r,n)||await R.realpath(t)!==r.realPath)throw new Error(`${e.label} changed before removal`);await R.rmdir(t),await L(i,e.label)}async function fi(e){let t=_.resolve(e.root),i=_.resolve(e.directory);if(!he(t,i))throw new Error(`${e.label} is outside its managed root`);let r=[await Ke(t,e.label)],n=t;for(let a of _.relative(t,i).split(_.sep).filter(Boolean)){await L(r,e.label),n=_.join(n,a);try{await R.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Ke(n,e.label);if(!he(r[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${n}`);r.push(o)}await L(r,e.label)}async function hi(e){let t=await J({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await Al(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await R.lstat(e.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${e.label} target changed before commit`)}if((await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let i=await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(i.hash!==t.hash||i.size!==t.size)throw new Error(`${e.label} target could not be verified`);return i}import{promises as Mr}from"fs";import ge from"path";import{TextDecoder as pv}from"util";var mv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),vv=new Set(["id","type","source","target","staged","backup"]),gv=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),wv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),yv=new Set(["sequence","timestamp","type","operationId"]),Ul=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),Kl=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Nv=256*1024,bv=1024*1024,Yl=16*1024,Fr=1024,pb=64*1024*1024;var Xl=new pv("utf-8",{fatal:!0});function pi(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function mi(e,t,i){let r=Object.keys(e).filter(n=>!t.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function gt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function no(e,t){if(typeof e!="string"||e.length===0||ge.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Lr(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function Jl(e,t){if(no(e,t),e.includes("\\")||e!==ge.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 kv(e,t){let i=pi(e,`transaction operations[${t}]`);if(mi(i,vv,`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`);no(i.target,`transaction operation ${i.id} target`);for(let r of["source","staged","backup"])i[r]!==void 0&&no(i[r],`transaction operation ${i.id} ${r}`);if(i.type==="write"){if(i.staged===void 0||i.source!==void 0)throw new Error(`write operation ${i.id} requires staged and forbids source`)}else if(i.type==="remove"){if(i.source!==void 0||i.staged!==void 0)throw new Error(`remove operation ${i.id} forbids source and staged`)}else if(i.source===void 0||i.staged!==void 0||i.backup!==void 0)throw new Error(`move operation ${i.id} requires source and forbids staged and backup`);return i}function Ql(e){let t=pi(e,"Native Archive transaction journal");if(mi(t,gv,"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"||!Ul.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(!gt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Lr(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=pi(s,`Archive transaction operations[${c}]`);if(mi(l,wv,`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`);Jl(l.target,`Archive transaction operation ${l.id} target`);for(let d of["source","staged","backup"])l[d]!==void 0&&Jl(l[d],`Archive transaction operation ${l.id} ${d}`);if(l.expectedTargetHash!==null&&Lr(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(Lr(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`);Lr(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),r=i.map(s=>s.id);if(new Set(r).size!==r.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${t.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.change}$`,"u").test(a[0].target)||i.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of i.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:i}}function ao(e){let t=pi(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return Ql(t);if(mi(t,mv,"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"||!Ul.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!ge.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!ge.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(!gt(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(kv),r=i.map(n=>n.id);if(new Set(r).size!==r.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:i}}function Zl(e,t){let i=pi(e,`Native transaction event at line ${t}`);if(mi(i,yv,`Native transaction event at line ${t}`),i.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!gt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof i.type!="string"||!Kl.has(i.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let r=i.type==="operation-started"||i.type==="operation-completed";if(r&&(typeof i.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.operationId)||Buffer.byteLength(i.operationId,"utf8")>256)||!r&&i.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Sv(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let r=0;r<e.length;r+=1){let n=t[r],a=e[r];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let i=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[r,n,a,o]of i){if(e.length<=r)continue;let s=e.slice(r,Math.min(r+n,e.length));if(!Array.from({length:o-a+1},(l,d)=>String(a+d).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!gt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||gt(e)}function vt(e,t){return e.length<t.length&&t.startsWith(e)}function Ev(e){let t='","operationId":"';if(vt(e,t))return!0;if(!e.startsWith(t))return!1;let i=e.slice(t.length),r=i.indexOf('"');if(r===-1)return i.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(i);let n=i.slice(0,r);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?vt(i.slice(r),'"}'):!1}function Pv(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>Yl)return!1;let i=`{"sequence":${t},"timestamp":"`;if(vt(e,i))return!0;if(!e.startsWith(i))return!1;let r=e.slice(i.length),n=r.slice(0,Math.min(24,r.length));if(!Sv(n))return!1;if(r.length<24)return!0;if(!gt(n))return!1;let a='","type":"',o=r.slice(24);if(vt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of Kl){if(vt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Ev(l))return!0}else if(vt(l,'"}'))return!0}return!1}function Rv(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>Yl)throw new Error(`Native transaction event at line ${t} is too large`);return Zl(JSON.parse(e),t)}function xv(e){let t=e.split(`
166
- `),i=t.at(-1)==="";if(i&&t.pop(),t.length>Fr)throw new Error(`Native transaction event log exceeds ${Fr} events`);let r=[];for(let n=0;n<t.length;n+=1){let a=n+1,o=t[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&n===t.length-1;try{r.push(Rv(s,a))}catch(l){if(c){let d=!1;try{JSON.parse(s),d=!0}catch{}if(!d&&Pv(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return r}function eu(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
160
+ # 可选值:true | false`}};function wl(e,t){return Pr[t][e]}function jm(e,t,i){let r=/^(\s*)([a-z_]+):/u.exec(e);if(!r)return null;let n=r[1].length,a=r[2];if(n===0&&a in Pr.en)return a;if(n===2&&t){let o=`${t}.${a}`;if(o in Pr.en)return o}if(n===2&&t===null&&a==="hook")return"hook";if(n===2&&t==="hook"&&a==="allow_paths")return"hook.allow_paths";if(n===4&&t==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in Pr.en)return o}return null}function ii(e,t){let i=[],r=null,n=null;for(let a of(0,ei.stringify)(e).trimEnd().split(`
161
+ `)){let o=jm(a,r,n);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of wl(o,t).split(`
162
+ `))i.push(`${s}${c}`)}i.push(a),/^[a-z_]+:/u.test(a)?(a.startsWith("native:")?r="native":a.startsWith("classic:")?r="classic":a.startsWith("hook:")?r="hook":r=null,n=null):/^ {2}[a-z_]+:/u.test(a)&&r==="native"&&(n=a.startsWith(" snapshot:")?"snapshot":null)}return i.push(""),i.join(`
163
+ `)}function $m(e,t){if(typeof e!="string")throw new Error(`${t} must be a string`);let i=e.trim();if(i.length===0||Rr.posix.isAbsolute(i)||Rr.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${t} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${t} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${t} must not contain empty or dot path segments`);return r}function Je(e){let t=$m(e,"native.artifact_root");return t.length===0?".":t.join("/")}function yl(e,t="docs"){let i=e??t;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function Ar(e,t,i=!1){if(typeof e!="string")throw new Error(`${t} must be a string`);let r=e.trim().replaceAll("\\","/");if(r.length===0||Rr.posix.isAbsolute(r)||Rr.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${t} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${t} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${t} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${t} cannot contain wildcards`);return n.join("/")}function ft(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a mapping`);return e}function Nl(e,t,i){let r=e??t;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function qa(e,t){if(typeof e!="string"||e.length===0||e.includes("\\")||e.includes("\0")||e.startsWith("/")||e.split("/").includes(".."))throw new Error(`${t} contains an unsafe pattern`);if(e.length>xr)throw new Error(`${t} exceeds ${xr} characters`);let i=0;for(let r=0;r<e.length;r+=1)e[r]==="?"?i+=1:e[r]==="*"&&(i+=1,e[r+1]==="*"&&(r+=1));if(i>Cr)throw new Error(`${t} contains more than ${Cr} wildcard tokens`);return e}function gl(e,t,i){if(e===void 0)return[...i];if(!Array.isArray(e))throw new Error(`${t} contains an unsafe pattern`);return[...new Set(e.map(r=>qa(r,t)))].sort((r,n)=>r.localeCompare(n,"en"))}function Fa(e,t,i){let r=e??t;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function Om(e){if(e===void 0)return{...G,include:[...G.include],exclude:[...G.exclude]};let t=ft(e,"native.snapshot");return{include:gl(t.include,"native.snapshot.include",G.include),exclude:gl(t.exclude,"native.snapshot.exclude",G.exclude),max_files:Fa(t.max_files,G.max_files,"native.snapshot.max_files"),max_total_bytes:Fa(t.max_total_bytes,G.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Fa(t.max_duration_ms,G.max_duration_ms,"native.snapshot.max_duration_ms")}}function Hm(e){if(e===void 0)return;let t=ft(e,"native.pending_root_move"),i=t.id,r=t.from_artifact_root,n=t.to_artifact_root,a=t.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(t.cleanup!==void 0){let s=ft(t.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:i,fromArtifactRoot:Je(r),toArtifactRoot:Je(n),stage:a,...o?{cleanup:o}:{}}}function Dm(e,t={}){let i=ft(e,"native"),r=i.artifact_root??(t.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??Va;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Hm(i.pending_root_move);return{artifact_root:Je(r),language:Nl(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:Om(i.snapshot),...s?{pending_root_move:s}:{}}}function Bm(e){let t=ft(e,"classic"),i=t.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=t.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=t.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:yl(t.artifact_layout),language:Nl(t.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function Lm(e){let i=ft(e,"hook").allow_paths??[];if(!Array.isArray(i))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(i.map((r,n)=>Ar(r,`hook.allow_paths[${n}]`)))]}}function Mm(e){let t=e??!0;if(typeof t!="boolean")throw new Error("ambient_resume must be true or false");return t}function Fm(e,t,i,r,n,a){let o=e.schema!==void 0;if(!(o||e.default_workflow!==void 0||e.workflows!==void 0||!a.allowPartialProject&&e.native!==void 0)||a.allowPartialProject&&!o)return null;if(e.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(e.default_workflow!=="native"&&e.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let c=e.workflows??[e.default_workflow];if(!Array.isArray(c)||c.length===0||c.some(u=>u!=="native"&&u!=="classic"))throw new Error("workflows must contain native and/or classic");let l=[...new Set(c)];if(!l.includes(e.default_workflow))throw new Error("workflows must include default_workflow");if(l.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:e.default_workflow,workflows:l,ambient_resume:n,...t?{hook:t}:{},...i?{native:i}:{},...r?{classic:r}:{}}}function ht(e,t={}){let i=(0,ei.parseDocument)(e,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let r=i.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=r,a=Mm(n.ambient_resume),o=n.hook===void 0?void 0:Lm(n.hook),s=n.native===void 0?void 0:Dm(n.native,{allowMissingArtifactRoot:t.allowMissingNativeFields}),c=n.classic===void 0?void 0:Bm(n.classic),l=Fm(n,o,s,c,a,{allowPartialProject:t.allowPartialProject??!1});return{value:n,config:l,ambient_resume:a,...o?{hook:o}:{},...s?{native:s}:{},...c?{classic:c}:{}}}function bl(e){return{id:e.id,from_artifact_root:e.fromArtifactRoot,to_artifact_root:e.toArtifactRoot,stage:e.stage,...e.cleanup?{cleanup:{kind:e.cleanup.kind,state:e.cleanup.state,manifest_hash:e.cleanup.manifestHash}}:{}}}function kl(e){return{schema:e.schema,default_workflow:e.default_workflow,workflows:e.workflows??[e.default_workflow],ambient_resume:e.ambient_resume,...e.hook?{hook:{allow_paths:[...e.hook.allow_paths]}}:{},...e.native?{native:{artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,...e.native.pending_root_move?{pending_root_move:bl(e.native.pending_root_move)}:{}}}:{},...e.classic?{classic:{artifact_layout:e.classic.artifact_layout,language:e.classic.language,context_compression:e.classic.context_compression,review_mode:e.classic.review_mode,auto_transition:e.classic.auto_transition}}:{}}}function dt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ri(e,t){let i=kl(t),r=ht((0,ei.stringify)(i)).config;if(!r)throw new Error("Unsupported Comet project schema");let n={...e,schema:r.schema,default_workflow:r.default_workflow,workflows:r.workflows,ambient_resume:r.ambient_resume};if(r.hook&&(n.hook={...dt(e.hook),allow_paths:[...r.hook.allow_paths]}),r.native){let a=dt(e.native),o={...a,artifact_root:r.native.artifact_root,language:r.native.language,clarification_mode:r.native.clarification_mode,archive_confirmation:r.native.archive_confirmation,max_verify_failures:r.native.max_verify_failures};if(delete o.snapshot,r.native.pending_root_move){let s=dt(a.pending_root_move),c=bl(r.native.pending_root_move),l=dt(s.cleanup),u=dt(c.cleanup);o.pending_root_move={...s,...c,...c.cleanup?{cleanup:{...l,...u}}:{}}}else delete o.pending_root_move;n.native=o}return r.classic&&(n.classic={...dt(e.classic),artifact_layout:r.classic.artifact_layout,language:r.classic.language,context_compression:r.classic.context_compression,review_mode:r.classic.review_mode,auto_transition:r.classic.auto_transition}),n}function _r(e="docs",t="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Je(e),language:t,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Va,snapshot:{...G,include:[...G.include],exclude:[...G.exclude]}}}}import{createHash as qm}from"crypto";import{promises as jr}from"fs";import Ie from"path";import{constants as Tr,promises as Ge}from"fs";function Te(e){return e!==0&&e!==0n&&e!=="0"}function U(e,t){return Te(e.dev)&&Te(t.dev)&&Te(e.ino)&&Te(t.ino)}function T(e,t){let i=Te(e.dev)&&Te(t.dev);if(i&&e.dev!==t.dev)return!1;let r=Te(e.ino)&&Te(t.ino);return r&&e.ino!==t.ino?!1:i&&r?!0:e.birthtime===t.birthtime}var ne=class extends Error{reason;constructor(t,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=t}};function Wa(e){return"birthtimeNs"in e&&typeof e.birthtimeNs=="bigint"?e.birthtimeNs:e.birthtimeMs}function Sl(e){return"ctimeNs"in e&&typeof e.ctimeNs=="bigint"?e.ctimeNs:e.ctimeMs}function ni(e){return{dev:e.dev,ino:e.ino,birthtime:Wa(e)}}function Ir(e,t){let i=ni(e),r=ni(t);return U(i,r)?T(i,r):T(i,r)&&Wa(e)===Wa(t)&&Sl(e)===Sl(t)&&e.size===t.size}async function pt(e,t,i={}){if(!Number.isSafeInteger(t)||t<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,a=await Ge.lstat(e,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new ne("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(t))throw new ne("too-large",`${r} exceeds ${t} bytes`);let o=await Ge.realpath(e);await i.verify?.("pre-open",{realPath:o,identity:ni(a)});let s=process.platform==="win32"?Tr.O_RDONLY:Tr.O_RDONLY|Tr.O_NOFOLLOW|Tr.O_NONBLOCK,c;try{c=await Ge.open(e,s)}catch(l){throw l.code==="ELOOP"?new ne("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==o||!Ir(a,l)||!Ir(a,u))throw new ne("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:d,identity:ni(l)}),await i.hooks?.afterOpen?.();let f=[],p=0,v=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let y=t+1-p,{bytesRead:b}=await c.read(v,0,Math.min(v.length,y),null);if(b===0)break;if(p+=b,p>t)throw new ne("too-large",`${r} exceeds ${t} bytes`);f.push(Buffer.from(v.subarray(0,b)))}await i.hooks?.beforeFinalCheck?.();let[h,m,w]=await Promise.all([c.stat({bigint:n}),Ge.lstat(e,{bigint:n}),Ge.realpath(e)]);if(!m.isFile()||m.isSymbolicLink()||w!==o||!Ir(a,h)||!Ir(a,m))throw new ne("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:w,identity:ni(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:w}}finally{await c.close()}}function Vm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function za(e,t){let i=Ie.relative(e,t);return i===""||!Ie.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Ie.sep}`)}async function El(e,t){let i=Ie.resolve(e),r=await jr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} project root must be a real directory`);return jr.realpath(i)}async function Pl(e,t,i,r){let n=e;for(let a=0;a<i.length;a++){n=Ie.join(n,i[a]);let o;try{o=await jr.lstat(n)}catch(u){if(Vm(u))return{exists:!1,kind:"missing"};throw u}let s=Ie.relative(e,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!o.isFile()||r.expected==="directory"&&!o.isDirectory()||r.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await jr.realpath(n);if(!za(t,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function mt(e,t,i){let r=Ar(t,i.label),n=Ie.resolve(e),a=await El(n,i.label),o=r.split("/"),s=Ie.resolve(n,...o);if(!za(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await Pl(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function je(e,t,i,r){let n=await mt(e,t,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let a=await El(n.projectRoot,r.label);return pt(n.target,i,{...r,verify:async(o,s)=>{if(!za(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await Pl(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var ai=".comet/config.yaml";function Ja(e,t){return e.exists===t.exists&&e.sha256===t.sha256}function Wm(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}async function $r(e,t={}){return(await oi(e,t)).document}async function Rl(e){try{return(await je(e,ai,ti,{label:ai})).bytes}catch(t){if(Wm(t))return null;throw t}}function xl(e){return e?{exists:!0,sha256:qm("sha256").update(e).digest("hex")}:{exists:!1,sha256:null}}async function Or(e){return xl(await Rl(e))}async function oi(e,t={}){let i=await Rl(e);return{document:i?ht(i.toString("utf8"),t):null,identity:xl(i)}}async function Ga(e){return(await $r(e))?.config??null}var PN=16*1024;async function Ua(e,t){if(!t)return;let i=await Or(e);if(!Ja(i,t))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as Um}from"crypto";import{promises as M}from"fs";import ae from"path";function Ya(e,t){let i=ae.relative(e,t);return i===""||!ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ae.sep}`)}function Km(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Ka(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function Cl(e){let t=await M.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${e}`);return{path:e,realPath:await M.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function ci(e){for(let t of e){let i=await M.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Km(t,i)||await M.realpath(t.path)!==t.realPath)throw new Error(`Native atomic write parent changed before commit: ${t.path}`)}}async function Ym(e,t){let i=ae.resolve(e),r=ae.resolve(t);if(!Ya(i,r))throw new Error(`Native atomic write parent is outside its managed root: ${t}`);let n=[await Cl(i)],a=ae.relative(i,r).split(ae.sep).filter(Boolean),o=i;for(let s of a){await ci(n),o=ae.join(o,s);try{await M.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Cl(o);if(!Ya(n[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);n.push(c)}return await ci(n),n}async function Xm(e){let t;try{t=await M.open(e,"r"),await t.sync()}catch(i){let r=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw i}finally{await t?.close()}}async function Al(e,t,i={}){let r=ae.dirname(e),n=i.containedRoot?await Ym(i.containedRoot,r):null;n||await M.mkdir(r,{recursive:!0});let a=ae.join(r,`.${ae.basename(e)}.${Um()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await M.open(a,"wx"),s=await o.stat(),n){let[c,l]=await Promise.all([M.lstat(a),M.realpath(a)]);if(await ci(n),!c.isFile()||c.isSymbolicLink()||!Ka(s,c)||!Ya(n[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof t=="string"?await o.writeFile(t,"utf8"):await o.writeFile(t),await o.sync(),!Ka(s,await o.stat()))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await i.beforeCommit?.(),n){await ci(n);let c=await M.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!Ka(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await M.link(a,e),await M.unlink(a)):await M.rename(a,e),await Xm(r)}catch(c){if(await o?.close(),!n)await M.rm(a,{force:!0});else try{await ci(n),await M.rm(a,{force:!0})}catch{}throw c}}async function z(e,t,i={}){await Al(e,t,i)}async function _l(e,t,i={}){await Al(e,t,i)}async function X(e,t,i={}){await z(e,JSON.stringify(t,null,2)+`
164
+ `,i)}import{existsSync as Tl,promises as Ue}from"fs";import C from"path";import Qm from"os";var Hr=".comet/config.yaml",Zm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function Xa(e){try{return await Ue.lstat(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function ev(e){try{let t=await Ue.readFile(e,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}function gt(e,t){let i=C.relative(e,t);return i===""||!C.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${C.sep}`)}async function vt(e){let t=[],i=e;for(;!await Xa(i);){let n=C.dirname(i);if(n===i)break;t.push(C.basename(i)),i=n}let r=await Ue.realpath(i);return C.resolve(r,...t.reverse())}async function Qa(e){try{return(await Ue.lstat(e)).isSymbolicLink()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Za(e){let t=C.resolve(e);try{(await Ue.stat(t)).isDirectory()||(t=C.dirname(t))}catch(n){if(n.code!=="ENOENT")throw n}let i=t,r=C.resolve(Qm.homedir());for(;;){if(!(t===r&&i!==r)){let o=C.join(t,...Hr.split("/")),s=t===i||await ev(o);if(await Xa(o)&&s)return t}if(await Xa(C.join(t,".git")))return t;let a=C.dirname(t);if(a===t)return i;t=a}}function li(e){return Je(e)}async function tv(e,t){let i=li(t),r=C.resolve(e,...i.split("/")),n=await Ue.realpath(e),a=await vt(r);if(!gt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function fe(e,t){let i=li(t),r=await tv(e,i),n=C.join(r,"comet");if(await Qa(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([vt(r),vt(n)]);if(!gt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=C.resolve(e),c=C.join(s,".comet","runtime","native");if(await Qa(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,u]=await Promise.all([Ue.realpath(s),vt(c)]);if(!gt(l,u))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:C.join(e,...Hr.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:C.join(n,"specs"),changesDir:C.join(n,"changes"),archiveDir:C.join(n,"archive"),runtimeDir:c,changesRuntimeDir:C.join(c,"changes"),locksDir:C.join(c,"locks"),transactionsDir:C.join(c,"transactions")}}function Il(e){if(!Zm.test(e))throw new Error(`Invalid Native change name: ${e}`)}function Dr(e,t){Il(t);let i=C.join(e.changesRuntimeDir,t);if(!F(e.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function iv(e,t){Il(t);let i=C.join(e.changesDir,t,"runtime");if(!F(e.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function he(e,t){let i=Dr(e,t);if(Tl(i))return i;let r=iv(e,t);return Tl(r)?r:i}function oe(e,t){let i=C.resolve(t);if(F(e.runtimeDir,i))return e.runtimeDir;if(F(e.nativeRoot,i))return e.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${t}`)}function F(e,t){return gt(C.resolve(e),C.resolve(t))}async function $(e,t){let i=C.resolve(e),r=C.resolve(t);if(!gt(i,r))throw new Error(`Path is outside the Native root: ${t}`);if(await Qa(i))throw new Error(`Native root must not be a symbolic link: ${e}`);let[n,a]=await Promise.all([vt(i),vt(r)]);if(!gt(n,a))throw new Error(`Path resolves outside the Native root: ${t}`);return r}function jl(e="docs",t="en"){return _r(e,t)}async function se(e){let t=(await $r(e))?.config??null;return t?.native?t:null}async function $e(e,t,i={}){let r=await oi(e,{allowPartialProject:!0}),n=ri(r.document?.value??{},t),a=rv.join(e,...Hr.split("/"));await z(a,ii(n,t.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:e,beforeCommit:async()=>{await i.beforeCommit?.(),await Ua(e,r.identity)}})}import{createHash as xg,randomUUID as Cg}from"crypto";import{promises as Le}from"fs";import I from"path";import{AsyncLocalStorage as nv}from"async_hooks";import{randomUUID as Hl}from"crypto";import{promises as Q}from"fs";import Dl from"os";import V from"path";var $l=16*1024,Bl=".coordinator",av=5e3,Ol=new nv,Br=new Map;function ov(e){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw new Error(`Invalid Native lock name: ${e}`);return`${e}.lock`}function sv(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid Native lock metadata: ${t}`);let i=e;if(typeof i.id!="string"||i.id.length===0||typeof i.pid!="number"||!Number.isSafeInteger(i.pid)||i.pid<1||typeof i.hostname!="string"||i.hostname.length===0||typeof i.createdAt!="string"||i.createdAt.length===0||typeof i.operation!="string"||i.operation.length===0)throw new Error(`Invalid Native lock metadata: ${t}`);return i}function Ll(e){return{device:e.dev.toString(),inode:e.ino.toString(),size:e.size.toString(),birthtimeNs:e.birthtimeNs.toString(),ctimeNs:e.ctimeNs.toString(),mtimeNs:e.mtimeNs.toString()}}function eo(e,t){let i={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs},r={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs};return U(i,r)?T(i,r):T(i,r)&&e.size===t.size}function to(e,t){return eo(e,t)&&e.size===t.size&&e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.mtimeNs===t.mtimeNs}async function Oe(e){let t,i;try{let r=await pt(e,$l,{bigint:!0,label:"Native lock"});t=r.bytes,i=r.stat}catch(r){if(r.code==="ENOENT")return null;throw r instanceof ne?r.reason==="too-large"?new Error(`Native lock metadata exceeds ${$l} bytes: ${e}`,{cause:r}):r.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${e}`,{cause:r}):new Error(`Native lock changed while reading: ${e}`,{cause:r}):r}return{file:e,owner:sv(JSON.parse(t.toString("utf8")),e),identity:Ll(i)}}async function cv(e){return(await Oe(e))?.owner??null}function lv(e){if(!e)return{status:"missing",owner:null,identity:null};if(e.owner.hostname!==Dl.hostname())return{status:"unknown",owner:e.owner,identity:e.identity};let t=mv(e.owner.pid);return{status:t===!0?"active":t===!1?"stale":"unknown",owner:e.owner,identity:e.identity}}async function uv(e,t){try{await Q.lstat(t);return}catch(i){if(i.code!=="ENOENT")throw i}try{await Q.rename(e,t)}catch(i){if(i.code!=="ENOENT")throw i}}async function io(e,t){let i=await Oe(e.file);if(!i)return"missing";if(i.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!to(i.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);await Q.mkdir(t,{recursive:!0});let r=V.join(t,`${V.basename(e.file)}.${e.owner.id}.${Hl()}.removed`);try{await Q.rename(e.file,r)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let n=await Oe(r);if(!n||n.owner.id!==e.owner.id||!eo(n.identity,e.identity))throw await uv(r,e.file),new Error(`Native lock changed before quarantine: ${e.file}`);return await Q.rm(r,{force:!0}),"removed"}function Ml(e){return{id:Hl(),pid:process.pid,hostname:Dl.hostname(),createdAt:new Date().toISOString(),operation:e}}async function Fl(e,t){let i;try{i=await Q.open(e,"wx")}catch(r){if(r.code==="EEXIST"){let n=await cv(e);throw new Error(`Native lock is already held: ${e}${n?` by pid ${n.pid} for ${n.operation}`:""}`,{cause:r})}throw r}try{return await i.writeFile(JSON.stringify(t,null,2)+`
165
+ `,"utf8"),await i.sync(),Ll(await i.stat({bigint:!0}))}finally{await i.close()}}async function dv(e,t){let i=await $(e.runtimeDir,e.locksDir);await Q.mkdir(i,{recursive:!0});let r=await $(e.runtimeDir,V.join(i,Bl));await Q.mkdir(r,{recursive:!0});let n=Ml(t),a=V.join(r,`.${n.id}.tmp`),o=V.join(r,`${n.id}.claim`);try{let s=await Fl(a,n);await Q.rename(a,o);let c=await Oe(o);if(!c||!eo(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:e.runtimeDir,locksDir:i,owner:n,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function fv(e){let t=V.dirname(e.file),i=!1,r=V.basename(e.file);for(let n of await Q.readdir(t,{withFileTypes:!0})){if(!n.isFile()||n.isSymbolicLink()||!n.name.endsWith(".claim"))continue;let a=V.join(t,n.name);if(V.resolve(a)!==V.resolve(e.file))try{let o=await Oe(a),s=lv(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await io(o,t);continue}n.name<r&&(i=!0)}catch{n.name<r&&(i=!0)}}return i}async function Vl(e){let t=await Oe(e.file);if(t){if(t.owner.id!==e.owner.id||!to(t.identity,e.identity))throw new Error(`Native lock coordinator ownership changed: ${e.file}`);await io(t,V.dirname(e.file))}}async function hv(e,t){let i=Date.now()+av;for(;;){let r=await dv(e,t);if(!await fv(r))return r;if(await Vl(r),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${e.locksDir}`);await new Promise(n=>setTimeout(n,2+Math.floor(Math.random()*7)))}}async function pv(e){let t=Br.get(e)??Promise.resolve(),i,r=new Promise(a=>{i=a}),n=t.then(()=>r);return Br.set(e,n),await t,()=>{i(),Br.get(e)===n&&Br.delete(e)}}async function ql(e,t,i){let r=V.resolve(e.locksDir),n=Ol.getStore();if(n?.has(r))return i();let a=await pv(r);try{let o=await hv(e,t),s=new Map(n??[]);return s.set(r,o),await Ol.run(s,async()=>{try{return await i()}finally{await Vl(o)}})}finally{a()}}async function ui(e,t,i){return ql(e,`acquire ${t}`,async()=>{let r=await $(e.runtimeDir,e.locksDir);await Q.mkdir(r,{recursive:!0});let n=await $(e.runtimeDir,V.join(r,ov(t))),a=Ml(i),o=await Fl(n,a);return{file:n,nativeRoot:e.runtimeDir,locksDir:r,owner:a,identity:o}})}async function di(e){await Oe(e.file)&&await ql({runtimeDir:e.nativeRoot,locksDir:e.locksDir},`release ${V.basename(e.file)}`,async()=>{let t=await Oe(e.file);if(!t)return;if(t.owner.id!==e.owner.id)throw new Error(`Native lock ownership changed: ${e.file}`);if(!to(t.identity,e.identity))throw new Error(`Native lock identity changed: ${e.file}`);let i=V.join(e.locksDir,Bl);await io(t,i)})}function mv(e){try{return process.kill(e,0),!0}catch(t){let i=t.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{createHash as vv}from"node:crypto";import{constants as Lr,promises as R}from"node:fs";import _ from"node:path";function pe(e,t){let i=_.relative(e,t);return i===""||!_.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_.sep}`)}function Wl(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native protected file byte limit must be a positive integer");return e}function Mr(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function zl(e){return{dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs,ctimeMs:e.ctimeMs,mtimeMs:e.mtimeMs,size:e.size}}function wt(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Ke(e,t){let i=await R.lstat(e);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${t} parent must be a real directory: ${e}`);return{path:e,realPath:await R.realpath(e),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function fi(e,t,i){let r=_.resolve(e),n=_.resolve(t);if(!pe(r,n))throw new Error(`${i} is outside its managed root`);let a=[await Ke(r,i)],o=r;for(let s of _.relative(r,n).split(_.sep).filter(Boolean)){await L(a,i),o=_.join(o,s);let c=await Ke(o,i);if(!pe(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await L(a,i),a}async function L(e,t){for(let i of e){let r=await R.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!Mr(i,r)||await R.realpath(i.path)!==i.realPath)throw new Error(`${t} parent changed during I/O: ${i.path}`)}}async function gv(e,t,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,t+1));for(;;){let o=t+1-n,{bytesRead:s}=await e.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>t)throw new Error(`${i} exceeds ${t} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function J(e){let t=Wl(e.maxBytes),i=_.resolve(e.file),r=await fi(e.root,_.dirname(i),e.label),n=await Promise.all((e.forbiddenRoots??[]).map(u=>Ke(_.resolve(u),e.label)));await e.hooks?.afterParentChainCaptured?.(),await L(r,e.label);let a=await R.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);if(a.size>t)throw new Error(`${e.label} exceeds ${t} bytes`);let o=zl(a),s=await R.realpath(i);if(!pe(r[0].realPath,s))throw new Error(`${e.label} resolves outside its managed root`);if(n.some(u=>pe(u.realPath,s)))throw new Error(`${e.label} resolves inside an excluded root`);let c=process.platform==="win32"?Lr.O_RDONLY:Lr.O_RDONLY|Lr.O_NOFOLLOW|Lr.O_NONBLOCK,l=await R.open(i,c);try{let u=await l.stat();await e.hooks?.afterOpen?.();let[d,f]=await Promise.all([R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!u.isFile()||!d.isFile()||d.isSymbolicLink()||f!==s||!wt(o,u)||!wt(o,d))throw new Error(`${e.label} changed while opening`);await e.hooks?.beforeRead?.();let p=await gv(l,t,e.label);await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([l.stat(),R.lstat(i),R.realpath(i)]);if(await L(r,e.label),await L(n,e.label),!h.isFile()||h.isSymbolicLink()||m!==s||!wt(o,v)||!wt(o,h))throw new Error(`${e.label} changed while reading`);return{bytes:p,hash:vv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function Ye(e){let t=await fi(e.root,e.directory,e.label),i;if(e.maxEntries===void 0)i=await R.readdir(e.directory,{withFileTypes:!0});else{let r=Wl(e.maxEntries);i=[];let n=await R.opendir(e.directory);try{for await(let a of n)if(i.push(a),i.length>r)throw new Error(`${e.label} exceeds ${r} entries`)}finally{await n.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await L(t,e.label),{entries:i,verify:()=>L(t,e.label)}}async function wv(e){let t=_.resolve(e.directory),i=_.resolve(e.quarantine);if(_.dirname(i)!==_.dirname(t)||!pe(_.resolve(e.root),i)||i===t)throw new Error(`${e.label} quarantine must be a distinct sibling inside its root`);let r=await fi(e.root,_.dirname(t),e.label),n=await Ke(t,e.label);if(!pe(r[0].realPath,n.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeQuarantine?.(),await L(r,e.label);let a=await R.lstat(t);if(!a.isDirectory()||a.isSymbolicLink()||!Mr(n,a)||await R.realpath(t)!==n.realPath)throw new Error(`${e.label} changed before quarantine`);try{throw await R.lstat(i),new Error(`${e.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await R.rename(t,i),await L(r,e.label);let o=await R.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Mr(n,o))throw new Error(`${e.label} changed while quarantining`);await e.afterQuarantine?.(i);try{throw await R.lstat(t),new Error(`${e.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:r,identity:n}}async function Jl(e){await wv(e)}async function ro(e){let t=_.resolve(e.file),i=await fi(e.root,_.dirname(t),e.label),r=await R.lstat(t);if(!r.isFile()||r.isSymbolicLink())throw new Error(`${e.label} must be a regular file`);let n=zl(r),a=await R.realpath(t);if(!pe(i[0].realPath,a))throw new Error(`${e.label} resolves outside its managed root`);let o=await J({root:e.root,file:t,maxBytes:e.maxBytes,label:e.label});if(o.hash!==e.expectedHash||o.size!==e.expectedSize)throw new Error(`${e.label} changed before removal`);let[s,c]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!wt(n,s)||c!==a)throw new Error(`${e.label} changed while verifying removal`);await e.beforeRemove?.(),await L(i,e.label);let[l,u]=await Promise.all([R.lstat(t),R.realpath(t)]);if(!l.isFile()||l.isSymbolicLink()||!wt(n,l)||u!==a)throw new Error(`${e.label} changed before removal`);await R.rm(t),await L(i,e.label)}async function no(e){let t=_.resolve(e.directory),i=await fi(e.root,_.dirname(t),e.label),r=await Ke(t,e.label);if(!pe(i[0].realPath,r.realPath))throw new Error(`${e.label} resolves outside its managed root`);await e.beforeRemove?.(),await L(i,e.label);let n=await R.lstat(t);if(!n.isDirectory()||n.isSymbolicLink()||!Mr(r,n)||await R.realpath(t)!==r.realPath)throw new Error(`${e.label} changed before removal`);await R.rmdir(t),await L(i,e.label)}async function hi(e){let t=_.resolve(e.root),i=_.resolve(e.directory);if(!pe(t,i))throw new Error(`${e.label} is outside its managed root`);let r=[await Ke(t,e.label)],n=t;for(let a of _.relative(t,i).split(_.sep).filter(Boolean)){await L(r,e.label),n=_.join(n,a);try{await R.mkdir(n)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Ke(n,e.label);if(!pe(r[0].realPath,o.realPath))throw new Error(`${e.label} resolves outside its managed root: ${n}`);r.push(o)}await L(r,e.label)}async function pi(e){let t=await J({root:e.sourceRoot,file:e.source,maxBytes:e.maxBytes,label:e.label,hooks:e.hooks,forbiddenRoots:e.forbiddenRoots});if(e.expectedHash!==void 0&&t.hash!==e.expectedHash)throw new Error(`${e.label} content changed before copy`);await _l(e.target,t.bytes,{containedRoot:e.targetRoot,exclusive:e.exclusive,beforeCommit:async()=>{if(await e.hooks?.beforeTargetCommit?.(),e.expectedTargetHash===void 0)return;if(e.expectedTargetHash===null){try{await R.lstat(e.target)}catch(n){if(n.code==="ENOENT")return;throw n}throw new Error(`${e.label} target changed before commit`)}if((await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} existing target`})).hash!==e.expectedTargetHash)throw new Error(`${e.label} target changed before commit`)}});let i=await J({root:e.targetRoot,file:e.target,maxBytes:e.maxBytes,label:`${e.label} target`});if(i.hash!==t.hash||i.size!==t.size)throw new Error(`${e.label} target could not be verified`);return i}import{promises as Vr}from"fs";import ye from"path";import{TextDecoder as yv}from"util";var Nv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),bv=new Set(["id","type","source","target","staged","backup"]),kv=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),Sv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),Ev=new Set(["sequence","timestamp","type","operationId"]),Kl=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),Yl=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),Pv=256*1024,Rv=1024*1024,Xl=16*1024,qr=1024,kb=64*1024*1024;var Ql=new yv("utf-8",{fatal:!0});function mi(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function vi(e,t,i){let r=Object.keys(e).filter(n=>!t.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function Nt(e){if(typeof e!="string")return!1;let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e}function ao(e,t){if(typeof e!="string"||e.length===0||ye.isAbsolute(e)||/^(?:[A-Za-z]:|~|[\\/])/u.test(e)||e.split(/[\\/]/u).includes(".."))throw new Error(`${t} must stay inside the Native root`)}function Fr(e,t){if(typeof e!="string"||!/^[a-f0-9]{64}$/u.test(e))throw new Error(`${t} must be a SHA-256 hash`)}function Gl(e,t){if(ao(e,t),e.includes("\\")||e!==ye.posix.normalize(e)||e.split("/").includes(".")||e.endsWith("/")||Buffer.byteLength(e,"utf8")>1024)throw new Error(`${t} must be a normalized Native-relative ref`)}function xv(e,t){let i=mi(e,`transaction operations[${t}]`);if(vi(i,bv,`transaction operations[${t}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${t}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);ao(i.target,`transaction operation ${i.id} target`);for(let r of["source","staged","backup"])i[r]!==void 0&&ao(i[r],`transaction operation ${i.id} ${r}`);if(i.type==="write"){if(i.staged===void 0||i.source!==void 0)throw new Error(`write operation ${i.id} requires staged and forbids source`)}else if(i.type==="remove"){if(i.source!==void 0||i.staged!==void 0)throw new Error(`remove operation ${i.id} forbids source and staged`)}else if(i.source===void 0||i.staged!==void 0||i.backup!==void 0)throw new Error(`move operation ${i.id} requires source and forbids staged and backup`);return i}function Zl(e){let t=mi(e,"Native Archive transaction journal");if(vi(t,kv,"Native Archive transaction journal"),t.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native Archive transaction id is invalid");if(t.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof t.status!="string"||!Kl.has(t.status))throw new Error("Native Archive transaction status is invalid");if(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change))throw new Error("Native Archive transaction change name is invalid");if(!Nt(t.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Fr(t.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(t.operations)||t.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=t.operations.map((s,c)=>{let l=mi(s,`Archive transaction operations[${c}]`);if(vi(l,Sv,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);Gl(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&Gl(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Fr(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Fr(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Fr(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),r=i.map(s=>s.id);if(new Set(r).size!==r.length)throw new Error("Native Archive transaction operation ids must be unique");let n=`runtime/transactions/${t.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${t.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${t.change}$`,"u").test(a[0].target)||i.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of i.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${n}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${n}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:t.id,kind:"archive",status:t.status,change:t.change,createdAt:t.createdAt,preflightHash:t.preflightHash,operations:i}}function oo(e){let t=mi(e,"Native transaction journal");if(t.schema==="comet.native.transaction.v2")return Zl(t);if(vi(t,Nv,"Native transaction journal"),t.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof t.id!="string"||!/^[a-f0-9-]{8,}$/u.test(t.id))throw new Error("Native transaction id is invalid");if(t.kind!=="archive"&&t.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof t.status!="string"||!Kl.has(t.status))throw new Error("Native transaction status is invalid");if(typeof t.projectRoot!="string"||!ye.isAbsolute(t.projectRoot)||typeof t.nativeRoot!="string"||!ye.isAbsolute(t.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(t.change!==void 0&&(typeof t.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t.change)))throw new Error("Native transaction change name is invalid");if(!Nt(t.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(t.operations))throw new Error("Native transaction operations must be an array");let i=t.operations.map(xv),r=i.map(n=>n.id);if(new Set(r).size!==r.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:t.id,kind:t.kind,status:t.status,projectRoot:t.projectRoot,nativeRoot:t.nativeRoot,...typeof t.change=="string"?{change:t.change}:{},createdAt:t.createdAt,operations:i}}function eu(e,t){let i=mi(e,`Native transaction event at line ${t}`);if(vi(i,Ev,`Native transaction event at line ${t}`),i.sequence!==t)throw new Error(`Native transaction event sequence at line ${t} must be ${t}`);if(!Nt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${t} is invalid`);if(typeof i.type!="string"||!Yl.has(i.type))throw new Error(`Native transaction event type at line ${t} is invalid`);let r=i.type==="operation-started"||i.type==="operation-completed";if(r&&(typeof i.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.operationId)||Buffer.byteLength(i.operationId,"utf8")>256)||!r&&i.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${t} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Cv(e){if(e.length>24)return!1;let t="0000-00-00T00:00:00.000Z";for(let r=0;r<e.length;r+=1){let n=t[r],a=e[r];if(n==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==n)return!1}let i=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[r,n,a,o]of i){if(e.length<=r)continue;let s=e.slice(r,Math.min(r+n,e.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(n,"0")).some(l=>l.startsWith(s)))return!1}return e.length>=10&&!Nt(`${e.slice(0,10)}T00:00:00.000Z`)?!1:e.length<24||Nt(e)}function yt(e,t){return e.length<t.length&&t.startsWith(e)}function Av(e){let t='","operationId":"';if(yt(e,t))return!0;if(!e.startsWith(t))return!1;let i=e.slice(t.length),r=i.indexOf('"');if(r===-1)return i.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(i);let n=i.slice(0,r);return/^[a-z0-9][a-z0-9-]*$/u.test(n)?yt(i.slice(r),'"}'):!1}function _v(e,t){if(e.length===0||Buffer.byteLength(e,"utf8")>Xl)return!1;let i=`{"sequence":${t},"timestamp":"`;if(yt(e,i))return!0;if(!e.startsWith(i))return!1;let r=e.slice(i.length),n=r.slice(0,Math.min(24,r.length));if(!Cv(n))return!1;if(r.length<24)return!0;if(!Nt(n))return!1;let a='","type":"',o=r.slice(24);if(yt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of Yl){if(yt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if(Av(l))return!0}else if(yt(l,'"}'))return!0}return!1}function Tv(e,t){if(e.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(e,"utf8")>Xl)throw new Error(`Native transaction event at line ${t} is too large`);return eu(JSON.parse(e),t)}function Iv(e){let t=e.split(`
166
+ `),i=t.at(-1)==="";if(i&&t.pop(),t.length>qr)throw new Error(`Native transaction event log exceeds ${qr} events`);let r=[];for(let n=0;n<t.length;n+=1){let a=n+1,o=t[n],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&n===t.length-1;try{r.push(Tv(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&_v(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return r}function tu(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
167
167
  `)}
168
- `}function Cv(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return ge.join(e.transactionsDir,t)}function Vr(e,t){let i=Cv(e,t);return{directory:i,journal:ge.join(i,"transaction.json"),events:ge.join(i,"events.jsonl"),staged:ge.join(i,"staged"),backups:ge.join(i,"backups")}}async function Xe(e,t){let i=Vr(e,t);return await Promise.all(Object.values(i).map(r=>$(e.runtimeDir,r))),i}async function tu(e,t,i={}){let r=await Xe(e,t);try{await Mr.lstat(r.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await J({root:e.runtimeDir,file:r.events,maxBytes:bv,label:`Native transaction event log ${t}`,hooks:i.hooks}),a;try{a=Xl.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=xv(a),s=eu(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:n}):n}}async function Gl(e,t,i){let r=await tu(e,t);if(r.exists!==i.exists||r.hash!==i.hash||r.size!==i.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function oo(e,t,i,r){let n=await Xe(e,t),a=await tu(e,t),o=a.events.find(c=>c.type===i&&c.operationId===r);if(o)return a.needsRepair&&await z(n.events,a.canonicalSource,{containedRoot:e.runtimeDir,beforeCommit:()=>Gl(e,t,a)}),o;if(a.events.length>=Fr)throw new Error(`Native transaction event log ${t} exceeds ${Fr} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...r?{operationId:r}:{}};return Zl(s,s.sequence),await Mr.mkdir(n.directory,{recursive:!0}),await z(n.events,eu([...a.events,s]),{containedRoot:e.runtimeDir,beforeCommit:()=>Gl(e,t,a)}),s}async function iu(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=ao(t);let i=await Xe(e,t.id);await Mr.mkdir(i.staged,{recursive:!0}),await Mr.mkdir(i.backups,{recursive:!0}),await X(i.journal,t,{containedRoot:e.runtimeDir}),await oo(e,t.id,"prepared")}async function vi(e,t,i={}){let r=await Xe(e,t),n=await J({root:e.runtimeDir,file:r.journal,maxBytes:Nv,label:`Native transaction journal ${t}`,hooks:i.hooks}),a=JSON.parse(Xl.decode(n.bytes)),o=ao(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function Av(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let r=ao({...t,status:i});return await X((await Xe(e,t.id)).journal,r,{containedRoot:e.runtimeDir}),r}async function so(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 oo(e,t.id,i),i==="commit"?Av(e,t,"committed"):t}import{createHash as mg}from"node:crypto";import{promises as Yr}from"node:fs";import Be from"node:path";import{execFileSync as _v}from"child_process";import Wr from"path";function qr(e,t){return _v("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Tv(e,t){let i=Wr.normalize(e),r=Wr.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function He(e){try{let t=Wr.resolve(qr(e,["rev-parse","--show-toplevel"])),r=qr(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?Wr.resolve(r.slice(9)):t,a=null;try{a=qr(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Tv(t,n),currentWorktreeRoot:t,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function co(e,t){try{let i=qr(e,["rev-parse","--verify",`${t}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(i)?i:null}catch{return null}}import{createHash as Ov}from"node:crypto";import{promises as oe}from"node:fs";import Z from"node:path";import{TextDecoder as Hv}from"node:util";var Iv=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),jv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function $v(e){return e.toLowerCase().startsWith(".env")}function gi(e){let i=e.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>$v(r))?"environment-file":i.some(r=>jv.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>Iv.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var Jr=1024*1024;function lo(e,t){let i=Z.relative(e,t);return i===""||!Z.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Z.sep}`)}function Dv(e){let t=Z.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||Z.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let i=e.toLowerCase(),r=gi(e);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${e}`);return e}function Bv(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function Lv(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function zr(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function ru(e){let t=await oe.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await oe.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function Mv(e,t){let i=Z.resolve(e),r=Z.resolve(t);if(!lo(i,r))throw new Error("Native artifact path is outside its root");let n=[await ru(i)],a=i;for(let o of Z.relative(i,r).split(Z.sep).filter(Boolean)){a=Z.join(a,o);let s=await ru(a);if(!lo(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function nu(e){for(let t of e){let i=await oe.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Lv(t,i)||await oe.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function we(e){let t=Dv(e.ref),i=e.maxBytes===null?null:Bv(e.maxBytes??Jr),r=Z.resolve(e.root,...t.split("/")),n=await Mv(e.root,Z.dirname(r));await e.hooks?.afterParentChainCaptured?.();let a=await oe.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);let o=await oe.realpath(r);if(!lo(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await oe.open(r,"r");try{let[c,l,d]=await Promise.all([s.stat(),oe.lstat(r),oe.realpath(r)]);if(await nu(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!zr(a,c)||!zr(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let u=[],f=0,p=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let b=i===null?p.length:i+1-f,k=await s.read(p,0,Math.min(p.length,b),null);if(k.bytesRead===0)break;if(f+=k.bytesRead,i!==null&&f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);u.push(Buffer.from(p.subarray(0,k.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([s.stat(),oe.lstat(r),oe.realpath(r)]);if(await nu(n),!h.isFile()||h.isSymbolicLink()||m!==o||!zr(c,v)||!zr(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let w=Buffer.concat(u,f),y;try{y=new Hv("utf-8",{fatal:!0}).decode(w)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:b})}return{ref:t,size:f,hash:e.includeHash===!1?null:Ov("sha256").update(w).digest("hex"),text:y}}finally{await s.close()}}var su=Ri(Yt(),1);import{createHash as Fv}from"crypto";function ee(e){return Fv("sha256").update(e).digest("hex")}var Lb={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024};var Mb=8*1024*1024;var Fb=64*1024,Vb=64*1024;var qb={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Wb={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};var zb=(1n<<256n)-1n;var Uv=Ri(Yt(),1);var sk=4*1024*1024;var Zk=256*1024;var fS={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};var cu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],LS=new Set(cu),ig=new Set([...cu,"minimum_runtime_version","revision"]),MS=new Set([...ig,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]);var Gr=class extends Error{constructor(i,r,n){super(`Native change ${i} revision conflict: expected ${r}, actual ${n}`);this.change=i;this.expectedRevision=r;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},wi=class extends Error{constructor(i,r){super(`Native working directory already contains active change${r.length===1?"":"s"} ${r.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=r;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},Ur=class extends Error{constructor(i,r,n,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${r} omitted entr${r===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=r;this.omittedByReason=n;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},FS=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
169
- `);var VS=256*1024;import{createHash as rg}from"crypto";function se(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function ng(e,t){t.has(e)&&se("cyclic structures are not supported"),t.add(e);try{let i=Object.keys(e);for(let r=0;r<e.length;r+=1)Object.prototype.hasOwnProperty.call(e,r)||se("sparse arrays are not supported");return(i.length!==e.length||i.some((r,n)=>r!==String(n)))&&se("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&se("symbol properties are not supported"),`[${e.map(r=>ho(r,t)).join(",")}]`}finally{t.delete(e)}}function ag(e,t){let i=Object.getPrototypeOf(e);i!==Object.prototype&&i!==null&&se("only plain objects are supported"),t.has(e)&&se("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&se("symbol properties are not supported"),t.add(e);try{let r=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&se("accessor properties are not supported"),`${JSON.stringify(o)}:${ho(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function ho(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)||se("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?ng(e,t):ag(e,t);case"bigint":case"function":case"symbol":case"undefined":return se(`${typeof e} values are not supported`)}return se("unsupported value type")}function po(e){return ho(e,new Set)}function ce(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 rg("sha256").update(`${e}
170
- ${po(t)}`).digest("hex")}var KS=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),lu=Object.freeze({maxCriteria:1024});var uu=Ri(Yt(),1);var hu="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",gE=new RegExp(`^portable-archive-(${hu})\\.json$`,"u"),wE=new RegExp(`^portable-migration-(${hu})\\.json$`,"u");var yi=/^[a-f0-9]{64}$/u,pu=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,vg=16*1024,vo=process.platform;function gu(e,t){let i=Be.relative(e,t);return Be.isAbsolute(i)||i===".."||i.startsWith(`..${Be.sep}`)?null:i.replaceAll("\\","/")||"."}function wu(e){return Array.from(e).some(t=>{let i=t.codePointAt(0)??0;return i<=31||i===127})}function yu(e,t){if(e.length===0||wu(e)||e.includes("\\")||Be.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let i=Be.posix.normalize(e);if(i!==e||i===".."||i.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return i}function go(e,t){return mg("sha256").update(`${e}
171
- ${t}`).digest("hex")}async function mu(e,t){let i=await Yr.realpath(t),r=await Yr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=vo==="win32"?Be.normalize(i).toLowerCase():i;return go(e,`${n}
168
+ `}function jv(e,t){if(!/^[a-f0-9-]{8,}$/u.test(t))throw new Error(`Invalid Native transaction id: ${t}`);return ye.join(e.transactionsDir,t)}function Wr(e,t){let i=jv(e,t);return{directory:i,journal:ye.join(i,"transaction.json"),events:ye.join(i,"events.jsonl"),staged:ye.join(i,"staged"),backups:ye.join(i,"backups")}}async function Xe(e,t){let i=Wr(e,t);return await Promise.all(Object.values(i).map(r=>$(e.runtimeDir,r))),i}async function iu(e,t,i={}){let r=await Xe(e,t);try{await Vr.lstat(r.events)}catch(n){if(n.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw n}try{let n=await J({root:e.runtimeDir,file:r.events,maxBytes:Rv,label:`Native transaction event log ${t}`,hooks:i.hooks}),a;try{a=Ql.decode(n.bytes)}catch(c){throw new Error(`Native transaction event log ${t} is not valid UTF-8`,{cause:c})}let o=Iv(a),s=tu(o);return{exists:!0,hash:n.hash,size:n.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction event log ${t} changed while reading`,{cause:n}):n}}async function Ul(e,t,i){let r=await iu(e,t);if(r.exists!==i.exists||r.hash!==i.hash||r.size!==i.size)throw new Error(`Native transaction event log ${t} changed before append`)}async function so(e,t,i,r){let n=await Xe(e,t),a=await iu(e,t),o=a.events.find(c=>c.type===i&&c.operationId===r);if(o)return a.needsRepair&&await z(n.events,a.canonicalSource,{containedRoot:e.runtimeDir,beforeCommit:()=>Ul(e,t,a)}),o;if(a.events.length>=qr)throw new Error(`Native transaction event log ${t} exceeds ${qr} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...r?{operationId:r}:{}};return eu(s,s.sequence),await Vr.mkdir(n.directory,{recursive:!0}),await z(n.events,tu([...a.events,s]),{containedRoot:e.runtimeDir,beforeCommit:()=>Ul(e,t,a)}),s}async function ru(e,t){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");t=oo(t);let i=await Xe(e,t.id);await Vr.mkdir(i.staged,{recursive:!0}),await Vr.mkdir(i.backups,{recursive:!0}),await X(i.journal,t,{containedRoot:e.runtimeDir}),await so(e,t.id,"prepared")}async function gi(e,t,i={}){let r=await Xe(e,t),n=await J({root:e.runtimeDir,file:r.journal,maxBytes:Pv,label:`Native transaction journal ${t}`,hooks:i.hooks}),a=JSON.parse(Ql.decode(n.bytes)),o=oo(a);if(o.id!==t)throw new Error(`Invalid Native transaction journal: ${t}`);return o}async function $v(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let r=oo({...t,status:i});return await X((await Xe(e,t.id)).journal,r,{containedRoot:e.runtimeDir}),r}async function co(e,t,i){if(t.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await so(e,t.id,i),i==="commit"?$v(e,t,"committed"):t}import{createHash as Ng}from"node:crypto";import{promises as Qr}from"node:fs";import Be from"node:path";import{execFileSync as Ov}from"child_process";import Jr from"path";function zr(e,t){return Ov("git",["-C",e,...t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function Hv(e,t){let i=Jr.normalize(e),r=Jr.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function He(e){try{let t=Jr.resolve(zr(e,["rev-parse","--show-toplevel"])),r=zr(e,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?Jr.resolve(r.slice(9)):t,a=null;try{a=zr(e,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!Hv(t,n),currentWorktreeRoot:t,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function lo(e,t){try{let i=zr(e,["rev-parse","--verify",`${t}^{commit}`]).toLowerCase();return/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(i)?i:null}catch{return null}}import{createHash as Mv}from"node:crypto";import{promises as ce}from"node:fs";import Z from"node:path";import{TextDecoder as Fv}from"node:util";var Dv=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),Bv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function Lv(e){return e.toLowerCase().startsWith(".env")}function wi(e){let i=e.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>Lv(r))?"environment-file":i.some(r=>Bv.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>Dv.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var Ur=1024*1024;function uo(e,t){let i=Z.relative(e,t);return i===""||!Z.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Z.sep}`)}function Vv(e){let t=Z.posix.normalize(e);if(e.length===0||e!==e.trim()||e.includes("\\")||Array.from(e).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||Z.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes("..")||t!==e||t==="."||e.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${e}`);let i=e.toLowerCase(),r=wi(e);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${e}`);return e}function qv(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("Native artifact byte limit must be a positive integer");return e}function Wv(e,t){return T({...e,birthtime:e.birthtimeMs},{...t,birthtime:t.birthtimeMs})}function Gr(e,t){let i={...e,birthtime:e.birthtimeMs},r={...t,birthtime:t.birthtimeMs};return U(i,r)?T(i,r):T(i,r)&&e.birthtimeMs===t.birthtimeMs&&e.ctimeMs===t.ctimeMs&&e.size===t.size}async function nu(e){let t=await ce.lstat(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${e}`);return{path:e,realPath:await ce.realpath(e),dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs}}async function zv(e,t){let i=Z.resolve(e),r=Z.resolve(t);if(!uo(i,r))throw new Error("Native artifact path is outside its root");let n=[await nu(i)],a=i;for(let o of Z.relative(i,r).split(Z.sep).filter(Boolean)){a=Z.join(a,o);let s=await nu(a);if(!uo(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function au(e){for(let t of e){let i=await ce.lstat(t.path);if(!i.isDirectory()||i.isSymbolicLink()||!Wv(t,i)||await ce.realpath(t.path)!==t.realPath)throw new Error(`Native artifact parent changed while reading: ${t.path}`)}}async function me(e){let t=Vv(e.ref),i=e.maxBytes===null?null:qv(e.maxBytes??Ur),r=Z.resolve(e.root,...t.split("/")),n=await zv(e.root,Z.dirname(r));await e.hooks?.afterParentChainCaptured?.();let a=await ce.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${t}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);let o=await ce.realpath(r);if(!uo(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${t}`);let s=await ce.open(r,"r");try{let[c,l,u]=await Promise.all([s.stat(),ce.lstat(r),ce.realpath(r)]);if(await au(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Gr(a,c)||!Gr(c,l))throw new Error(`Native artifact changed while opening: ${t}`);await e.hooks?.afterOpen?.();let d=[],f=0,p=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let b=i===null?p.length:i+1-f,k=await s.read(p,0,Math.min(p.length,b),null);if(k.bytesRead===0)break;if(f+=k.bytesRead,i!==null&&f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${t}`);d.push(Buffer.from(p.subarray(0,k.bytesRead)))}await e.hooks?.beforeFinalCheck?.();let[v,h,m]=await Promise.all([s.stat(),ce.lstat(r),ce.realpath(r)]);if(await au(n),!h.isFile()||h.isSymbolicLink()||m!==o||!Gr(c,v)||!Gr(c,h))throw new Error(`Native artifact changed while reading: ${t}`);let w=Buffer.concat(d,f),y;try{y=new Fv("utf-8",{fatal:!0}).decode(w)}catch(b){throw new Error(`Native artifact is not valid UTF-8: ${t}`,{cause:b})}return{ref:t,size:f,hash:e.includeHash===!1?null:Mv("sha256").update(w).digest("hex"),text:y}}finally{await s.close()}}var uu=St(ut(),1);import{createHash as Jv}from"crypto";function ee(e){return Jv("sha256").update(e).digest("hex")}var Gb={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024};var Ub=8*1024*1024;var Kb=64*1024,Yb=64*1024;var Xb={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Qb={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};var Zb=(1n<<256n)-1n;var Zv=St(ut(),1);var mk=4*1024*1024;var eg=null;function tg(e,t){let i=e;for(let r of t)i+="\0"+(typeof r=="string"?r:JSON.stringify(r));return i}function ou(e,t){return(...i)=>{let r=eg;if(r===null)return t(...i);let n=tg(`async:${e}`,i),a=r.entries.get(n);if(a)return a.value;let o=t(...i).catch(s=>{throw r.entries.delete(n),s});return r.entries.set(n,{value:o}),o}}var Nk=ou("hookWritePolicy",async e=>(await Ga(e))?.hook??{allow_paths:[]});var hS=256*1024;var RS={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};var du=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],ZS=new Set(du),cg=new Set([...du,"minimum_runtime_version","revision"]),eE=new Set([...cg,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]);var Kr=class extends Error{constructor(i,r,n){super(`Native change ${i} revision conflict: expected ${r}, actual ${n}`);this.change=i;this.expectedRevision=r;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},yi=class extends Error{constructor(i,r){super(`Native working directory already contains active change${r.length===1?"":"s"} ${r.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=r;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},Yr=class extends Error{constructor(i,r,n,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${r} omitted entr${r===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=r;this.omittedByReason=n;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},tE=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
169
+ `);var iE=256*1024;import{createHash as lg}from"crypto";function le(e){throw new TypeError(`Value is not valid canonical JSON: ${e}`)}function ug(e,t){t.has(e)&&le("cyclic structures are not supported"),t.add(e);try{let i=Object.keys(e);for(let r=0;r<e.length;r+=1)Object.prototype.hasOwnProperty.call(e,r)||le("sparse arrays are not supported");return(i.length!==e.length||i.some((r,n)=>r!==String(n)))&&le("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),`[${e.map(r=>po(r,t)).join(",")}]`}finally{t.delete(e)}}function dg(e,t){let i=Object.getPrototypeOf(e);i!==Object.prototype&&i!==null&&le("only plain objects are supported"),t.has(e)&&le("cyclic structures are not supported"),Object.getOwnPropertySymbols(e).length>0&&le("symbol properties are not supported"),t.add(e);try{let r=Object.getOwnPropertyDescriptors(e);return`{${Object.keys(e).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&le("accessor properties are not supported"),`${JSON.stringify(o)}:${po(s.value,t)}`}).join(",")}}`}finally{t.delete(e)}}function po(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"string":return JSON.stringify(e);case"number":return Number.isFinite(e)||le("numbers must be finite"),JSON.stringify(Object.is(e,-0)?0:e);case"object":return Array.isArray(e)?ug(e,t):dg(e,t);case"bigint":case"function":case"symbol":case"undefined":return le(`${typeof e} values are not supported`)}return le("unsupported value type")}function mo(e){return po(e,new Set)}function te(e,t){if(e.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(e))throw new TypeError("Canonical hash tag must not contain a line break");return lg("sha256").update(`${e}
170
+ ${mo(t)}`).digest("hex")}var lE=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),fu=Object.freeze({maxCriteria:1024});var hu=St(ut(),1);var gu="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",TE=new RegExp(`^portable-archive-(${gu})\\.json$`,"u"),IE=new RegExp(`^portable-migration-(${gu})\\.json$`,"u");var Ni=/^[a-f0-9]{64}$/u,wu=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,bg=16*1024,go=process.platform;function bu(e,t){let i=Be.relative(e,t);return Be.isAbsolute(i)||i===".."||i.startsWith(`..${Be.sep}`)?null:i.replaceAll("\\","/")||"."}function ku(e){return Array.from(e).some(t=>{let i=t.codePointAt(0)??0;return i<=31||i===127})}function Su(e,t){if(e.length===0||ku(e)||e.includes("\\")||Be.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(e)||e.split("/").includes(".."))throw new Error(`${t} must be a portable project-relative path`);let i=Be.posix.normalize(e);if(i!==e||i===".."||i.startsWith("../"))throw new Error(`${t} must be a normalized project-relative path`);return i}function wo(e,t){return Ng("sha256").update(`${e}
171
+ ${t}`).digest("hex")}async function yu(e,t){let i=await Qr.realpath(t),r=await Qr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=go==="win32"?Be.normalize(i).toLowerCase():i;return wo(e,`${n}
172
172
  ${r.dev}
173
173
  ${r.ino}
174
- ${r.birthtimeMs}`)}async function vu(e,t){let i=await Yr.realpath(t),r=await Yr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=vo==="win32"?Be.normalize(i).toLowerCase():i;return go(e,n)}function gg(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 mo(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||wu(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Nu(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(mo(e.changeBranch,"Native workspace change branch"),mo(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 wg(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace Git provenance must be an object");let t=e,i=new Set(["provider","baseCommit","targetBranch","targetCommit"]),r=Object.keys(t).filter(n=>!i.has(n));if(r.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${r.join(", ")}`);if(t.provider!=="git"||typeof t.baseCommit!="string"||!pu.test(t.baseCommit)||typeof t.targetCommit!="string"||!pu.test(t.targetCommit))throw new Error("Native workspace Git provenance is invalid");mo(t.targetBranch,"Native workspace Git target branch")}function Xr(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),r=Object.keys(t).filter(o=>!i.has(o));if(r.length>0)throw new Error(`Native workspace identity has unknown field(s): ${r.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!yi.test(String(t.projectRootId))||!yi.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");gg(t.capturedAt),yu(t.nativeRootRef,"Native workspace root ref");let n=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!yi.test(String(t.projectRootPathId))||a&&!yi.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!yi.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.git!==void 0&&wg(t.git),t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Nu(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 bu(e,t){return Be.join(de(e,t),"workspace.json")}function yg(e,t){let i=bu(e,t),r=ae(e,i),n=gu(r,i);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:r,ref:yu(n,"Native workspace file ref")}}async function Ng(e,t){try{let i=yg(e,t),r=await we({root:i.root,ref:i.ref,maxBytes:vg});return JSON.parse(r.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function ku(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=gu(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let i=He(e.paths.projectRoot),r=i.isGitWorktree?co(e.paths.projectRoot,"HEAD"):null,n=e.binding?.targetBranch??i.currentBranch,a=n==null?null:co(e.paths.projectRoot,n),o=r!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:r,targetBranch:n,targetCommit:a}:void 0,[s,c,l,d]=await Promise.all([mu("comet.native.workspace-project-root.v2",e.paths.projectRoot),mu("comet.native.workspace-native-root.v2",e.paths.nativeRoot),vu("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),vu("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),u=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Nu(e.binding);let f={capturedAt:u,capturedRevision:e.revision,nativeRootRef:t,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:d,...o?{git:o}:{},...e.sessionId?{sessionHash:go("comet.native.workspace-session.v2",`${s}
174
+ ${r.birthtimeMs}`)}async function Nu(e,t){let i=await Qr.realpath(t),r=await Qr.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let n=go==="win32"?Be.normalize(i).toLowerCase():i;return wo(e,n)}function kg(e){if(typeof e!="string")throw new Error("Native workspace capturedAt is invalid");let t=new Date(e);if(!Number.isFinite(t.getTime())||t.toISOString()!==e)throw new Error("Native workspace capturedAt is invalid");return e}function vo(e,t){if(e===null)return null;if(typeof e!="string"||e.length===0||e.trim()!==e||ku(e))throw new Error(`${t} must be a non-empty branch name or null`);return e}function Eu(e){if(!new Set(["current","branch","worktree"]).has(e.isolation))throw new Error("Native workspace isolation must be current, branch, or worktree");if(vo(e.changeBranch,"Native workspace change branch"),vo(e.targetBranch,"Native workspace target branch"),(e.isolation==="branch"||e.isolation==="worktree")&&(e.changeBranch===null||e.targetBranch===null))throw new Error("Native isolated workspace requires change and target branches")}function Sg(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace Git provenance must be an object");let t=e,i=new Set(["provider","baseCommit","targetBranch","targetCommit"]),r=Object.keys(t).filter(n=>!i.has(n));if(r.length>0)throw new Error(`Native workspace Git provenance has unknown field(s): ${r.join(", ")}`);if(t.provider!=="git"||typeof t.baseCommit!="string"||!wu.test(t.baseCommit)||typeof t.targetCommit!="string"||!wu.test(t.targetCommit))throw new Error("Native workspace Git provenance is invalid");vo(t.targetBranch,"Native workspace Git target branch")}function Zr(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native workspace identity must be an object");let t=e,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash","git","isolation","changeBranch","targetBranch","finish"]),r=Object.keys(t).filter(o=>!i.has(o));if(r.length>0)throw new Error(`Native workspace identity has unknown field(s): ${r.join(", ")}`);if(t.schema!=="comet.native.workspace.v2"&&t.schema!=="comet.native.workspace.v3")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(t.capturedRevision)||t.capturedRevision<1||typeof t.nativeRootRef!="string"||!Ni.test(String(t.projectRootId))||!Ni.test(String(t.nativeRootId)))throw new Error("Native workspace identity is invalid");kg(t.capturedAt),Su(t.nativeRootRef,"Native workspace root ref");let n=t.projectRootPathId!==void 0,a=t.nativeRootPathId!==void 0;if(n!==a)throw new Error("Native workspace path identities must be provided together");if(n&&!Ni.test(String(t.projectRootPathId))||a&&!Ni.test(String(t.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(t.sessionHash!==void 0&&!Ni.test(String(t.sessionHash)))throw new Error("Native workspace session hash is invalid");if(t.git!==void 0&&Sg(t.git),t.schema==="comet.native.workspace.v2"){if(t.isolation!==void 0||t.changeBranch!==void 0||t.targetBranch!==void 0||t.finish!==void 0)throw new Error("Native workspace v2 identity cannot contain a workspace binding");return}if(typeof t.isolation!="string"||t.changeBranch===void 0||t.targetBranch===void 0||t.finish===void 0)throw new Error("Native workspace v3 identity requires a workspace binding");if(Eu(t),t.finish!==null&&!new Set(["merge","push","pull-request","keep"]).has(t.finish))throw new Error("Native workspace finish must be merge, push, pull-request, keep, or null")}function Pu(e,t){return Be.join(he(e,t),"workspace.json")}function Eg(e,t){let i=Pu(e,t),r=oe(e,i),n=bu(r,i);if(!n||n===".")throw new Error("Native workspace file escaped its root");return{root:r,ref:Su(n,"Native workspace file ref")}}async function Pg(e,t){try{let i=Eg(e,t),r=await me({root:i.root,ref:i.ref,maxBytes:bg});return JSON.parse(r.text)}catch(i){if(i.code==="ENOENT")return null;throw i}}async function Ru(e){if(!Number.isSafeInteger(e.revision)||e.revision<1)throw new Error("Native workspace revision must be a positive integer");let t=bu(e.paths.projectRoot,e.paths.nativeRoot);if(!t)throw new Error("Native root is outside the project root");let i=He(e.paths.projectRoot),r=i.isGitWorktree?lo(e.paths.projectRoot,"HEAD"):null,n=e.binding?.targetBranch??i.currentBranch,a=n==null?null:lo(e.paths.projectRoot,n),o=r!==null&&n!==null&&n!==void 0&&a!==null?{provider:"git",baseCommit:r,targetBranch:n,targetCommit:a}:void 0,[s,c,l,u]=await Promise.all([yu("comet.native.workspace-project-root.v2",e.paths.projectRoot),yu("comet.native.workspace-native-root.v2",e.paths.nativeRoot),Nu("comet.native.workspace-project-root-path.v2",e.paths.projectRoot),Nu("comet.native.workspace-native-root-path.v2",e.paths.nativeRoot)]),d=(e.now??new Date).toISOString();if(e.finish&&!e.binding)throw new Error("Native workspace finish requires a workspace binding");e.binding&&Eu(e.binding);let f={capturedAt:d,capturedRevision:e.revision,nativeRootRef:t,projectRootId:s,nativeRootId:c,projectRootPathId:l,nativeRootPathId:u,...o?{git:o}:{},...e.sessionId?{sessionHash:wo("comet.native.workspace-session.v2",`${s}
175
175
  ${c}
176
- ${e.sessionId}`)}:{}},p=e.binding?{schema:"comet.native.workspace.v3",...f,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...f};return Xr(p),p}async function uo(e){let t=await ku(e),i=bu(e.paths,e.name),r=ae(e.paths,i);return await $(r,i),await X(i,t,{containedRoot:r}),t}async function wt(e,t){let i=await Ng(e,t);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(Xr(i),i)}async function Kr(e){Xr(e.identity);let t=await ku({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),i=[],r=[];return t.nativeRootRef!==e.identity.nativeRootRef&&i.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&i.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&i.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&i.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&i.push("native-root-legacy-identity")),vo==="win32"&&i.length>0&&i.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?r.push("workspace-inspection-unavailable"):i.length>0&&r.push("workspace-root-changed"),{state:r.length===0?"aligned":r.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:r,driftComponents:i}}async function fo(e){if(Xr(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 Kr(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=He(e.paths.projectRoot);return e.identity.changeBranch===null?i.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:i.isGitWorktree?i.currentBranch!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:e.identity.isolation==="worktree"&&!i.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}var yo=64*1024*1024,UE=256*1024,Ru=16*1024*1024;async function K(e){try{return await Le.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Eg(e){let t;try{t=await Le.readdir(e.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t){if(!i.isDirectory()||i.isSymbolicLink())continue;let r;try{r=await vi(e,i.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${i.name} has no journal; run doctor before moving`,{cause:n}):n}if(r.status!=="committed"&&r.status!=="rolled-back")throw new Error(`Native transaction ${r.id} is unfinished; recover it before moving`)}}async function Pg(e,t){for(let i of await Le.readdir(e.locksDir,{withFileTypes:!0})){let r=I.join(e.locksDir,i.name);if(I.resolve(r)!==I.resolve(t)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${r}`)}}async function Rg(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let r=await wt(e,i.name);if(r){await uo({paths:e,name:i.name,revision:r.capturedRevision,...r.schema==="comet.native.workspace.v3"?{binding:{isolation:r.isolation,changeBranch:r.changeBranch,targetBranch:r.targetBranch},...r.finish?{finish:r.finish}:{}}:{}});continue}}}async function xg(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name)))if(!(!i.isDirectory()||i.isSymbolicLink()))try{let r=await wt(e,i.name);if(r?.schema==="comet.native.workspace.v3"){let n=await fo({paths:e,identity:r});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(r){let n=await Kr({paths:e,identity:r});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(r){throw new Error(`Native workspace identity for ${i.name} must be aligned and repaired before moving the root`,{cause:r})}}async function bi(e,t){let i=[];async function r(n){let a=await Ye({root:e,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=I.join(n,s.name);if(t.excludedFiles?.has(I.resolve(c))){await a.verify();continue}let l=await Le.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"directory"}),await r(c);else if(s.isFile()&&l.isFile()){let d=await J({root:e,file:c,maxBytes:yo,label:`Native root file ${I.relative(e,c)}`});i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"file",size:d.size,hash:d.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await r(e),i.sort((n,a)=>n.ref.localeCompare(a.ref))}async function Cg(e,t,i,r){await fi({root:r,directory:t,label:"Native root move staging directory"});async function n(a,o){let s=await Ye({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let d=I.join(a,l.name);if(I.resolve(d)===I.resolve(i)){await s.verify();continue}let u=await Le.lstat(d);if(l.isSymbolicLink()||u.isSymbolicLink())throw new Error(`Native root contains a symlink: ${d}`);let f=I.join(o,l.name);if(l.isDirectory()&&u.isDirectory())await fi({root:r,directory:f,label:"Native root move staging directory"}),await n(d,f);else if(l.isFile()&&u.isFile())await hi({sourceRoot:e,source:d,targetRoot:r,target:f,maxBytes:yo,label:`Native root move file ${I.relative(e,d)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${d}`);await s.verify()}}await n(e,t)}async function Qr(e,t,i,r){let n=await bi(e,{rejectSymlinks:!0,excludedFiles:i?new Set([I.resolve(i)]):void 0}),a=await bi(t,{rejectSymlinks:!0,excludedFiles:r?new Set([I.resolve(r)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function Ag(e,t){return I.join(e.artifactRoot,`.comet-native-move-${t}`)}function _g(e,t){return I.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function Tg(e){return`${e}.removing`}function xu(e,t,i){return I.join(Vr(e,t).directory,`root-move-cleanup-${i}.json`)}function Ig(e){return JSON.stringify(e,null,2)+`
177
- `}function jg(e){return kg("sha256").update(e).digest("hex")}function $g(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let i=e,r=Object.keys(i).sort(),n=i.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(r)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof i.ref!="string"||i.ref.length===0||i.ref.includes("\\")||I.posix.normalize(i.ref)!==i.ref||i.ref.startsWith("/")||i.ref.split("/").includes("..")||Buffer.byteLength(i.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(i.type==="directory")return{ref:i.ref,type:"directory"};if(i.type!=="file"||typeof i.size!="number"||!Number.isSafeInteger(i.size)||i.size<0||typeof i.hash!="string"||!/^[a-f0-9]{64}$/u.test(i.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function Og(e,t,i){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let r=e;if(JSON.stringify(Object.keys(r).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||r.schema!=="comet.native.root-move-cleanup.v1"||r.transactionId!==t||r.kind!==i||!Array.isArray(r.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=r.entries.map($g);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=I.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:i,entries:n}}async function Hg(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},i=Ig(t);if(Buffer.byteLength(i,"utf8")>Ru)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await z(xu(e.paths,e.id,e.kind),i,{containedRoot:e.paths.runtimeDir}),jg(i)}async function Dg(e){let t=await J({root:e.paths.runtimeDir,file:xu(e.paths,e.id,e.cleanup.kind),maxBytes:Ru,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 Og(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function wo(e){let t=await bi(e.quarantine,{rejectSymlinks:!0}),i=new Map(e.manifest.entries.map(r=>[r.ref,r]));for(let r of t){let n=i.get(r.ref);if(!n||JSON.stringify(n)!==JSON.stringify(r))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${r.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function Su(e){return e.ref.split("/").length}async function Bg(e){let i=[...await wo({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((n,a)=>Su(a)-Su(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),r=0;for(let n of i){let a=I.join(e.quarantine,...n.ref.split("/"));n.type==="file"?await io({root:e.projectRoot,file:a,maxBytes:yo,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await ro({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),r+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,n.ref,r)}await wo({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await ro({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function Zr(e,t,i=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:i,pending_root_move:t}}}function Lg(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 Eu(e){let t=Zr(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await $e(e.projectRoot,t),t}async function Ni(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=Zr(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await $e(e.projectRoot,i),i}async function Pu(e){let t=e.config,i=t.native.pending_root_move;if(!i||i.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let r=i.cleanup;if(r&&r.kind!==e.kind)throw new Error(`Native root move has unfinished ${r.kind} cleanup; cannot start ${e.kind}`);let n=await K(e.target),a=await K(e.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!r){if(!n&&!a)return t;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await Hg({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await bi(e.target,{rejectSymlinks:!0})});r={kind:e.kind,state:"prepared",manifestHash:s},t=await Ni({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})}let o=await Dg({paths:e.stablePaths,id:e.id,cleanup:r});if(n=await K(e.target),a=await K(e.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(n){if(r.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await zl({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(r.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return Ni({projectRoot:e.projectRoot,config:t,id:e.id})}return await wo({quarantine:e.quarantine,manifest:o,exact:r.state!=="deleting"}),r.state==="prepared"&&(r={...r,state:"quarantined"},t=await Ni({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),r.state==="quarantined"&&(r={...r,state:"deleting"},t=await Ni({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),await Bg({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),Ni({projectRoot:e.projectRoot,config:t,id:e.id})}async function Mg(e){let t=e.config,i=t.native.pending_root_move.stage;if(i==="copying"){if(!await K(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=Tg(e.staging);t=await Pu({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 bi(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([I.resolve(e.lockFile)])}),await Cg(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await Qr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await Eu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),i="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(i==="ready"){if(await K(e.destinationPaths.nativeRoot)){if(await K(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await Qr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await K(e.staging))throw new Error("Native move staging tree is missing");await Qr(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await Le.rename(e.staging,e.destinationPaths.nativeRoot)}t=await Eu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),i="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await K(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let r=_g(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await K(e.sourcePaths.nativeRoot)&&await Qr(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Pu({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:r,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await Rg(e.destinationPaths);let n=await vi(e.destinationPaths,e.pending.id);await so(e.destinationPaths,n,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await $e(e.projectRoot,o),o}async function Cu(e){let t=await fe(e.projectRoot)??Il("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let i=ci(e.toArtifactRoot);if(i===t.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let r=await je(e.projectRoot,t.native.artifact_root),n=await je(e.projectRoot,i);if(F(r.nativeRoot,n.nativeRoot)||F(n.nativeRoot,r.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await K(r.nativeRoot))throw new Error(`Native source root does not exist: ${r.nativeRoot}`);if(await Eg(r),await K(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await li(r,"root-move",`move root to ${i}`),o=Sg(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=Lg({id:o,paths:r,now:e.now??new Date}),l=Ag(n,o);try{if(await Pg(r,a.file),await xg(r),await K(l))throw new Error(`Native move staging path is occupied: ${l}`);return await $e(e.projectRoot,Zr(t,s)),await iu(r,c),await e.hooks?.afterRootMoveStage?.("copying",c),await Mg({projectRoot:e.projectRoot,config:Zr(t,s),pending:s,sourcePaths:r,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:r.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await ui(a)}}import ko from"path";var Vg=["Outcome","Scope","Non-goals","Acceptance examples"],lP=[...Vg,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var qg=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 Au=1024*1024;var Tu="scoped-text-safety",Wg=1,zg=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Jg="comet.native.checker-policy.v1";var RP=ce(Jg,{policy:Tu,version:Wg,limits:zg,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Gg=["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"],xP=new Set(Gg);var Yg=Au,WP=3*Yg;var Iu={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:[]},Qg=ee("comet-native-runtime:v3:scope-reopen"),gR=[{skillVersion:"3",skillHash:ee("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:ee("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:ee("comet-native-runtime:v1")}];var $u=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],XR=new Set($u),aw=new Set([...$u,"minimum_runtime_version","revision"]),QR=new Set([...aw,"operation"]),ZR=512*1024,ow=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),ex=new Set([...ow,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var nx={maxAcceptanceCriteria:lu.maxCriteria};var lx={maxSpecs:64,maxFileBytes:Jr,maxTotalBytes:4*1024*1024};import{execFile as gw}from"node:child_process";import{promisify as ww}from"node:util";var dx=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");var kx={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var qx=512*1024;var Ei=class extends Error{recovery;constructor(t,i){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var fC=64*1024;var hC=3600*1e3;var pC=ww(gw);var en=class extends Error{details;constructor(t){let i=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=t}};var ZC={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var cA=16*1024*1024,lA=256*1024,uA=16*1024;var mA=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var wA=16*1024;var K_=16*1024;var BT=16*1024*1024,tn=class extends Error{constructor(i,r,n,a){super(`Canonical spec conflict for ${i}: expected ${r??"(missing)"}, actual ${n??"(missing)"}`);this.capability=i;this.expectedHash=r;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},rn=class extends Error{constructor(i,r=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(r);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var MT=8*1024*1024;var nn=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var Du=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--help Show help without requiring an initialized project."],bo=Object.freeze({"":{usage:"comet native <command> [options]",purpose:"Create, inspect, recover, and archive portable Native changes through Runtime-enforced, skill-coordinated steps.",subcommands:["init Initialize Native project configuration.","root show Inspect the configured artifact root.","root move <artifact-root> Move the configured artifact root.","new <change-name> Create a change and prepare its workspace.","spec remove Record a complete capability removal intent.","show <change-name> Read formal artifacts and portable state.","status [<change-name>] Discover stable boundaries and Runner actions.","select <change-name> Select a change in its bound workspace.","next <change-name> Confirm or recover a stable workflow boundary.","archive <change-name> Preview and execute Archive plus workspace finish.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:Du,output:"Human-readable text by default; use --json for a structured command envelope.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN","comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:"comet native spec remove <change-name> <capability>",purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["remove <change-name> <capability> Record a capability removal."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"The portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries or inspect the exact next Runner action.",options:["--cursor <token> Continue a status-list page.","--details Include acceptance, Spec, workspace, and report details."],output:"A v2 status page or one portable Loop projection with local execution availability and continuation.runnerAction.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--confirmed|--return-to-build|--retry-verifier|--resolve-verifier-blocker]
178
- comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm Shape, a completed skill-coordinated pass, or an explicitly degraded verifier-unavailable fallback before Archive.","--return-to-build Return Verify or Archive to Build after invalidation or user choice.","--retry-verifier Retry a blocked Verifier execution when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, verifier-response, verifier-execution-error, or verifier-unavailable. Identity/provider/execution/candidate fields are rejected."," builder-handoff fields: kind, summary, addressed_acceptance_ids, checks, known_limits."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," verifier-response fields: kind, response (request-checks or final-result)."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."],output:"The portable state, explicit skill-coordinated label, Runtime-owned check results, complete verifierDispatch, bounded request-check response, continuation.runnerAction, and machine-readable continuation.inputOptions. This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.",examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed','comet native next session-timeout --summary "Implementation changed" --return-to-build','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep]
179
- comet native archive <change-name> [--confirmed] [--serial-first <current-change>]`,purpose:"Preview or execute deterministic Archive after the portable state reaches archive-ready.",options:["--dry-run Inspect readiness without rerunning verification.","--finish <action> Persist merge, push, pull-request, or keep for an isolated workspace.","--serial-first <current-change> During execution only, confirm that this change archives before detected capability peers; the value must equal <change-name>.","--confirmed Confirm Archive when project policy requires it."],output:"Readiness plus continuation, or the completed Archive transaction and workspace finish result; Archive does not repeat verification."},doctor:{usage:"comet native doctor [<change-name>] [--repair]",purpose:"Inspect portable state, migrate a legacy active change, or rebuild its local execution overlay.",options:["--repair Apply deterministic migration or rebuild from the portable stable boundary."],output:"Health, migration or recovery details, and the continuation with the next Runner action."}});function No(e,t){return`${e}:
176
+ ${e.sessionId}`)}:{}},p=e.binding?{schema:"comet.native.workspace.v3",...f,...e.binding,finish:e.finish??null}:{schema:"comet.native.workspace.v2",...f};return Zr(p),p}async function fo(e){let t=await Ru(e),i=Pu(e.paths,e.name),r=oe(e.paths,i);return await $(r,i),await X(i,t,{containedRoot:r}),t}async function bt(e,t){let i=await Pg(e,t);return i===null||i&&typeof i=="object"&&!Array.isArray(i)&&i.schema==="comet.native.workspace.v1"?null:(Zr(i),i)}async function Xr(e){Zr(e.identity);let t=await Ru({paths:e.paths,name:"workspace-advisory",revision:e.identity.capturedRevision}),i=[],r=[];return t.nativeRootRef!==e.identity.nativeRootRef&&i.push("native-root-ref"),e.identity.projectRootPathId&&e.identity.nativeRootPathId?(t.projectRootPathId!==e.identity.projectRootPathId&&i.push("project-root-path"),t.nativeRootPathId!==e.identity.nativeRootPathId&&i.push("native-root-path")):(t.projectRootId!==e.identity.projectRootId&&i.push("project-root-legacy-identity"),t.nativeRootId!==e.identity.nativeRootId&&i.push("native-root-legacy-identity")),go==="win32"&&i.length>0&&i.every(a=>a==="project-root-legacy-identity"||a==="native-root-legacy-identity")?r.push("workspace-inspection-unavailable"):i.length>0&&r.push("workspace-root-changed"),{state:r.length===0?"aligned":r.includes("workspace-root-changed")?"drifted":"unknown",findingCodes:r,driftComponents:i}}async function ho(e){if(Zr(e.identity),e.identity.schema==="comet.native.workspace.v2")return{state:"legacy",code:"workspace-binding-legacy",message:"Legacy Native workspace metadata has no isolation binding"};if((await Xr(e)).state==="drifted")return{state:"drifted",code:"workspace-binding-root-changed",message:"Native change is being accessed from a different working directory"};let i=He(e.paths.projectRoot);return e.identity.changeBranch===null?i.isGitWorktree?{state:"drifted",code:"workspace-branch-changed",message:"Native change was created outside Git but is now being accessed inside Git"}:{state:"aligned",code:null,message:null}:i.isGitWorktree?i.currentBranch!==e.identity.changeBranch?{state:"drifted",code:"workspace-branch-changed",message:`Native change is bound to branch ${e.identity.changeBranch}, but the current branch is ${i.currentBranch??"detached HEAD"}`}:e.identity.isolation==="worktree"&&!i.isSecondaryWorktree?{state:"drifted",code:"workspace-kind-changed",message:"Native change is bound to a linked Git worktree"}:{state:"aligned",code:null,message:null}:{state:"drifted",code:"workspace-vcs-unavailable",message:"Native change requires its bound Git working directory"}}var No=64*1024*1024,cP=256*1024,_u=16*1024*1024;async function K(e){try{return await Le.access(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Ag(e){let t;try{t=await Le.readdir(e.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t){if(!i.isDirectory()||i.isSymbolicLink())continue;let r;try{r=await gi(e,i.name)}catch(n){throw n.code==="ENOENT"?new Error(`Native transaction ${i.name} has no journal; run doctor before moving`,{cause:n}):n}if(r.status!=="committed"&&r.status!=="rolled-back")throw new Error(`Native transaction ${r.id} is unfinished; recover it before moving`)}}async function _g(e,t){for(let i of await Le.readdir(e.locksDir,{withFileTypes:!0})){let r=I.join(e.locksDir,i.name);if(I.resolve(r)!==I.resolve(t)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${r}`)}}async function Tg(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let r=await bt(e,i.name);if(r){await fo({paths:e,name:i.name,revision:r.capturedRevision,...r.schema==="comet.native.workspace.v3"?{binding:{isolation:r.isolation,changeBranch:r.changeBranch,targetBranch:r.targetBranch},...r.finish?{finish:r.finish}:{}}:{}});continue}}}async function Ig(e){let t;try{t=await Le.readdir(e.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of t.sort((r,n)=>r.name.localeCompare(n.name)))if(!(!i.isDirectory()||i.isSymbolicLink()))try{let r=await bt(e,i.name);if(r?.schema==="comet.native.workspace.v3"){let n=await ho({paths:e,identity:r});if(n.state!=="aligned")throw new Error(n.message??"workspace binding is not aligned")}else if(r){let n=await Xr({paths:e,identity:r});if(n.state!=="aligned")throw new Error(`legacy workspace ownership is ${n.state}`)}}catch(r){throw new Error(`Native workspace identity for ${i.name} must be aligned and repaired before moving the root`,{cause:r})}}async function ki(e,t){let i=[];async function r(n){let a=await Ye({root:e,directory:n,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=I.join(n,s.name);if(t.excludedFiles?.has(I.resolve(c))){await a.verify();continue}let l=await Le.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(t.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"directory"}),await r(c);else if(s.isFile()&&l.isFile()){let u=await J({root:e,file:c,maxBytes:No,label:`Native root file ${I.relative(e,c)}`});i.push({ref:I.relative(e,c).split(I.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await r(e),i.sort((n,a)=>n.ref.localeCompare(a.ref))}async function jg(e,t,i,r){await hi({root:r,directory:t,label:"Native root move staging directory"});async function n(a,o){let s=await Ye({root:e,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=I.join(a,l.name);if(I.resolve(u)===I.resolve(i)){await s.verify();continue}let d=await Le.lstat(u);if(l.isSymbolicLink()||d.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let f=I.join(o,l.name);if(l.isDirectory()&&d.isDirectory())await hi({root:r,directory:f,label:"Native root move staging directory"}),await n(u,f);else if(l.isFile()&&d.isFile())await pi({sourceRoot:e,source:u,targetRoot:r,target:f,maxBytes:No,label:`Native root move file ${I.relative(e,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await n(e,t)}async function en(e,t,i,r){let n=await ki(e,{rejectSymlinks:!0,excludedFiles:i?new Set([I.resolve(i)]):void 0}),a=await ki(t,{rejectSymlinks:!0,excludedFiles:r?new Set([I.resolve(r)]):void 0});if(JSON.stringify(n)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${e} and ${t}`)}function $g(e,t){return I.join(e.artifactRoot,`.comet-native-move-${t}`)}function Og(e,t){return I.join(e.artifactRoot,`.comet-native-source-${t}.removing`)}function Hg(e){return`${e}.removing`}function Tu(e,t,i){return I.join(Wr(e,t).directory,`root-move-cleanup-${i}.json`)}function Dg(e){return JSON.stringify(e,null,2)+`
177
+ `}function Bg(e){return xg("sha256").update(e).digest("hex")}function Lg(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`Native root-move cleanup manifest entry ${t} must be an object`);let i=e,r=Object.keys(i).sort(),n=i.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(r)!==JSON.stringify(n))throw new Error(`Native root-move cleanup manifest entry ${t} has invalid fields`);if(typeof i.ref!="string"||i.ref.length===0||i.ref.includes("\\")||I.posix.normalize(i.ref)!==i.ref||i.ref.startsWith("/")||i.ref.split("/").includes("..")||Buffer.byteLength(i.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${t} has an invalid ref`);if(i.type==="directory")return{ref:i.ref,type:"directory"};if(i.type!=="file"||typeof i.size!="number"||!Number.isSafeInteger(i.size)||i.size<0||typeof i.hash!="string"||!/^[a-f0-9]{64}$/u.test(i.hash))throw new Error(`Native root-move cleanup manifest entry ${t} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function Mg(e,t,i){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Native root-move cleanup manifest must be an object");let r=e;if(JSON.stringify(Object.keys(r).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||r.schema!=="comet.native.root-move-cleanup.v1"||r.transactionId!==t||r.kind!==i||!Array.isArray(r.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let n=r.entries.map(Lg);for(let a=0;a<n.length;a+=1){if(a>0&&n[a-1].ref.localeCompare(n[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=I.posix.dirname(n[a].ref);if(o!=="."&&!n.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:t,kind:i,entries:n}}async function Fg(e){let t={schema:"comet.native.root-move-cleanup.v1",transactionId:e.id,kind:e.kind,entries:e.entries},i=Dg(t);if(Buffer.byteLength(i,"utf8")>_u)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await z(Tu(e.paths,e.id,e.kind),i,{containedRoot:e.paths.runtimeDir}),Bg(i)}async function Vg(e){let t=await J({root:e.paths.runtimeDir,file:Tu(e.paths,e.id,e.cleanup.kind),maxBytes:_u,label:`Native root-move cleanup manifest ${e.cleanup.kind}`});if(t.hash!==e.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return Mg(JSON.parse(t.bytes.toString("utf8")),e.id,e.cleanup.kind)}async function yo(e){let t=await ki(e.quarantine,{rejectSymlinks:!0}),i=new Map(e.manifest.entries.map(r=>[r.ref,r]));for(let r of t){let n=i.get(r.ref);if(!n||JSON.stringify(n)!==JSON.stringify(r))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${r.ref}`)}if(e.exact&&t.length!==e.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return t}function xu(e){return e.ref.split("/").length}async function qg(e){let i=[...await yo({quarantine:e.quarantine,manifest:e.manifest,exact:!1})].sort((n,a)=>xu(a)-xu(n)||(n.type===a.type?a.ref.localeCompare(n.ref):n.type==="file"?-1:1)),r=0;for(let n of i){let a=I.join(e.quarantine,...n.ref.split("/"));n.type==="file"?await ro({root:e.projectRoot,file:a,maxBytes:No,expectedHash:n.hash,expectedSize:n.size,label:`Native root-move cleanup file ${n.ref}`}):await no({root:e.projectRoot,directory:a,label:`Native root-move cleanup directory ${n.ref}`}),r+=1,await e.hooks?.afterRootMoveCleanupEntryRemoved?.(e.manifest.kind,n.ref,r)}await yo({quarantine:e.quarantine,manifest:e.manifest,exact:!1}),await no({root:e.projectRoot,directory:e.quarantine,label:`Native root-move cleanup quarantine ${e.manifest.kind}`})}function tn(e,t,i=e.native.artifact_root){return{...e,native:{...e.native,artifact_root:i,pending_root_move:t}}}function Wg(e){return{schema:"comet.native.transaction.v1",id:e.id,kind:"root-move",status:"prepared",projectRoot:e.paths.projectRoot,nativeRoot:e.paths.nativeRoot,createdAt:e.now.toISOString(),operations:[]}}async function Cu(e){let t=tn(e.config,{...e.pending,stage:e.stage},e.activeArtifactRoot);return await $e(e.projectRoot,t),t}async function bi(e){let t=e.config.native.pending_root_move;if(!t||t.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let i=tn(e.config,{id:t.id,fromArtifactRoot:t.fromArtifactRoot,toArtifactRoot:t.toArtifactRoot,stage:t.stage,...e.cleanup?{cleanup:e.cleanup}:{}},e.config.native.artifact_root);return await $e(e.projectRoot,i),i}async function Au(e){let t=e.config,i=t.native.pending_root_move;if(!i||i.id!==e.id)throw new Error(`Native root-move cleanup ${e.id} lost its pending configuration`);let r=i.cleanup;if(r&&r.kind!==e.kind)throw new Error(`Native root move has unfinished ${r.kind} cleanup; cannot start ${e.kind}`);let n=await K(e.target),a=await K(e.quarantine);if(n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(!r){if(!n&&!a)return t;if(!n&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${e.kind}`);let s=await Fg({paths:e.stablePaths,id:e.id,kind:e.kind,entries:await ki(e.target,{rejectSymlinks:!0})});r={kind:e.kind,state:"prepared",manifestHash:s},t=await bi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})}let o=await Vg({paths:e.stablePaths,id:e.id,cleanup:r});if(n=await K(e.target),a=await K(e.quarantine),n&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${e.kind}`);if(n){if(r.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${e.kind}`);await Jl({root:e.projectRoot,directory:e.target,quarantine:e.quarantine,label:e.label,beforeQuarantine:e.beforeQuarantine,afterQuarantine:e.afterQuarantine}),a=!0}if(!a){if(r.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${e.kind}`);return bi({projectRoot:e.projectRoot,config:t,id:e.id})}return await yo({quarantine:e.quarantine,manifest:o,exact:r.state!=="deleting"}),r.state==="prepared"&&(r={...r,state:"quarantined"},t=await bi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),r.state==="quarantined"&&(r={...r,state:"deleting"},t=await bi({projectRoot:e.projectRoot,config:t,id:e.id,cleanup:r})),await qg({projectRoot:e.projectRoot,quarantine:e.quarantine,manifest:o,hooks:e.hooks}),bi({projectRoot:e.projectRoot,config:t,id:e.id})}async function zg(e){let t=e.config,i=t.native.pending_root_move.stage;if(i==="copying"){if(!await K(e.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${e.sourcePaths.nativeRoot}`);let s=Hg(e.staging);t=await Au({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"restart-staging",stablePaths:e.sourcePaths,target:e.staging,quarantine:s,label:"Native root move stale staging removal",hooks:e.hooks}),await ki(e.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([I.resolve(e.lockFile)])}),await jg(e.sourcePaths.nativeRoot,e.staging,e.lockFile,e.destinationPaths.projectRoot),await en(e.sourcePaths.nativeRoot,e.staging,e.lockFile),t=await Cu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"ready"}),i="ready",await e.hooks?.afterRootMoveStage?.("ready",e.journal)}if(i==="ready"){if(await K(e.destinationPaths.nativeRoot)){if(await K(e.staging))throw new Error(`Native destination is occupied: ${e.destinationPaths.nativeRoot}`);await en(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile)}else{if(!await K(e.staging))throw new Error("Native move staging tree is missing");await en(e.sourcePaths.nativeRoot,e.staging,e.lockFile),await Le.rename(e.staging,e.destinationPaths.nativeRoot)}t=await Cu({projectRoot:e.projectRoot,config:t,pending:e.pending,stage:"switched",activeArtifactRoot:e.pending.toArtifactRoot}),i="switched",await e.hooks?.afterRootMoveStage?.("switched",e.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await K(e.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${e.destinationPaths.nativeRoot}`);let r=Og(e.sourcePaths,e.pending.id);!t.native.pending_root_move?.cleanup&&await K(e.sourcePaths.nativeRoot)&&await en(e.sourcePaths.nativeRoot,e.destinationPaths.nativeRoot,e.lockFile),t=await Au({projectRoot:e.projectRoot,config:t,id:e.pending.id,kind:"forward-source",stablePaths:e.destinationPaths,target:e.sourcePaths.nativeRoot,quarantine:r,label:"Native root move source removal",beforeQuarantine:()=>e.hooks?.beforeRootMoveSourceRemove?.(e.sourcePaths.nativeRoot),afterQuarantine:s=>e.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:e.hooks}),await Tg(e.destinationPaths);let n=await gi(e.destinationPaths,e.pending.id);await co(e.destinationPaths,n,"commit");let a={artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot},o={...t,native:{...a,artifact_root:e.pending.toArtifactRoot}};return await $e(e.projectRoot,o),o}async function Iu(e){let t=await se(e.projectRoot)??jl("docs");if(t.native.pending_root_move)throw new Error(`Native root move ${t.native.pending_root_move.id} is already incomplete`);let i=li(e.toArtifactRoot);if(i===t.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let r=await fe(e.projectRoot,t.native.artifact_root),n=await fe(e.projectRoot,i);if(F(r.nativeRoot,n.nativeRoot)||F(n.nativeRoot,r.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await K(r.nativeRoot))throw new Error(`Native source root does not exist: ${r.nativeRoot}`);if(await Ag(r),await K(n.nativeRoot))throw new Error(`Native destination is occupied: ${n.nativeRoot}`);let a=await ui(r,"root-move",`move root to ${i}`),o=Cg(),s={id:o,fromArtifactRoot:t.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=Wg({id:o,paths:r,now:e.now??new Date}),l=$g(n,o);try{if(await _g(r,a.file),await Ig(r),await K(l))throw new Error(`Native move staging path is occupied: ${l}`);return await $e(e.projectRoot,tn(t,s)),await ru(r,c),await e.hooks?.afterRootMoveStage?.("copying",c),await zg({projectRoot:e.projectRoot,config:tn(t,s),pending:s,sourcePaths:r,destinationPaths:n,staging:l,journal:c,lockFile:a.file,hooks:e.hooks}),{fromNativeRoot:r.nativeRoot,toNativeRoot:n.nativeRoot,transactionId:o}}finally{await di(a)}}import So from"path";var Gg=["Outcome","Scope","Non-goals","Acceptance examples"],SP=[...Gg,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var Ug=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var ju=1024*1024;var Ou="scoped-text-safety",Kg=1,Yg=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Xg="comet.native.checker-policy.v1";var MP=te(Xg,{policy:Ou,version:Kg,limits:Yg,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Qg=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],FP=new Set(Qg);var tw=ju,nR=3*tw;var Hu={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},rw=ee("comet-native-runtime:v3:scope-reopen"),TR=[{skillVersion:"3",skillHash:ee("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:ee("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:ee("comet-native-runtime:v1")}];var Bu=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],dx=new Set(Bu),uw=new Set([...Bu,"minimum_runtime_version","revision"]),fx=new Set([...uw,"operation"]),hx=512*1024,dw=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),px=new Set([...dw,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var wx={maxAcceptanceCriteria:fu.maxCriteria};var Sx={maxSpecs:64,maxFileBytes:Ur,maxTotalBytes:4*1024*1024};import{execFile as kw}from"node:child_process";import{promisify as Sw}from"node:util";var Px=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");var Hx={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var rC=512*1024;var Pi=class extends Error{recovery;constructor(t,i){super(t),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var RC=64*1024;var xC=3600*1e3;var CC=Sw(kw);var rn=class extends Error{details;constructor(t){let i=t.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${t.length} receipt(s)): ${t.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=t}};var hA={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var kA=16*1024*1024,SA=256*1024,EA=16*1024;var AA=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var IA=16*1024;var Tw=St(ut(),1);var $A=8*1024*1024;var ST=16*1024;var fI=16*1024*1024,nn=class extends Error{constructor(i,r,n,a){super(`Canonical spec conflict for ${i}: expected ${r??"(missing)"}, actual ${n??"(missing)"}`);this.capability=i;this.expectedHash=r;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},an=class extends Error{constructor(i,r=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(r);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var on=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var Fu=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--help Show help without requiring an initialized project."],ko=Object.freeze({"":{usage:"comet native <command> [options]",purpose:"Create, inspect, recover, and archive portable Native changes through Runtime-enforced, skill-coordinated steps.",subcommands:["init Initialize Native project configuration.","root show Inspect the configured artifact root.","root move <artifact-root> Move the configured artifact root.","new <change-name> Create a change and prepare its workspace.","spec remove Record a complete capability removal intent.","show <change-name> Read formal artifacts and portable state.","status [<change-name>] Discover stable boundaries and Runner actions.","select <change-name> Select a change in its bound workspace.","next <change-name> Confirm or recover a stable workflow boundary.","archive <change-name> Preview and execute Archive plus workspace finish.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:Fu,output:"Human-readable text by default; use --json for a structured command envelope.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN","comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:"comet native spec remove <change-name> <capability>",purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["remove <change-name> <capability> Record a capability removal."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"The portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries, parent child readiness, or the exact next Runner action.",options:["--cursor <token> Continue a status-list page.","--details Include acceptance, Spec, workspace, and report details."],output:"A v2 status page or one portable Loop projection with local execution availability and continuation.runnerAction; parent changes also expose children and readyChildren.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--confirmed|--return-to-build|--retry-verifier|--resolve-verifier-blocker]
178
+ comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, advance parent child changes, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm Shape, a completed skill-coordinated pass, or an explicitly degraded verifier-unavailable fallback before Archive.","--return-to-build Return Verify or Archive to Build after invalidation or user choice.","--retry-verifier Retry a blocked Verifier execution when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, verifier-response, verifier-execution-error, or verifier-unavailable. Identity/provider/execution/candidate fields are rejected."," builder-handoff fields: kind, summary, addressed_acceptance_ids, checks, known_limits."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," verifier-response fields: kind, response (request-checks or final-result)."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."],output:"The portable state, explicit skill-coordinated label, Runtime-owned check results, complete verifierDispatch, bounded request-check response, continuation.runnerAction, and machine-readable continuation.inputOptions. This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.",examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed','comet native next session-timeout --summary "Implementation changed" --return-to-build','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep]
179
+ comet native archive <change-name> [--confirmed] [--serial-first <current-change>]`,purpose:"Preview or execute deterministic Archive after the portable state reaches archive-ready.",options:["--dry-run Inspect readiness without rerunning verification.","--finish <action> Persist merge, push, pull-request, or keep for an isolated workspace.","--serial-first <current-change> During execution only, confirm that this change archives before detected capability peers; the value must equal <change-name>.","--confirmed Confirm Archive when project policy requires it."],output:"Readiness plus continuation, or the completed Archive transaction and workspace finish result; Archive does not repeat verification."},doctor:{usage:"comet native doctor [<change-name>] [--repair]",purpose:"Inspect portable state, migrate a legacy active change, or rebuild its local execution overlay.",options:["--repair Apply deterministic migration or rebuild from the portable stable boundary."],output:"Health, migration or recovery details, and the continuation with the next Runner action."}});function bo(e,t){return`${e}:
180
180
  ${t.map(i=>` ${i}`).join(`
181
- `)}`}function xw(e){let t=e.filter(r=>r!=="--help");if(t.length===0)return"";let i=t.slice(0,2).join(" ");return bo[i]||t.length>1&&bo[t[0]]?.subcommands?i:t[0]}function Cw(e=[]){let t=xw(e),i=bo[t];if(!i)throw new Error(`Unknown Native help topic: ${t}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",No("Commands",i.subcommands));let n=t===""?i.options:[...i.options??[],...Du];return n&&n.length>0&&r.push("",No("Options",n)),r.push("",`Output:
182
- ${i.output}`),i.examples&&r.push("",No("Examples",i.examples)),t===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:t,usage:`${r.join(`
181
+ `)}`}function Ow(e){let t=e.filter(r=>r!=="--help");if(t.length===0)return"";let i=t.slice(0,2).join(" ");return ko[i]||t.length>1&&ko[t[0]]?.subcommands?i:t[0]}function Hw(e=[]){let t=Ow(e),i=ko[t];if(!i)throw new Error(`Unknown Native help topic: ${t}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",bo("Commands",i.subcommands));let n=t===""?i.options:[...i.options??[],...Fu];return n&&n.length>0&&r.push("",bo("Options",n)),r.push("",`Output:
182
+ ${i.output}`),i.examples&&r.push("",bo("Examples",i.examples)),t===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:t,usage:`${r.join(`
183
183
  `)}
184
- `}}var Aw=Cw().usage;var sI=10*1024*1024,pe=class extends Error{};function Lu(e,t){let i=e.flatMap((r,n)=>r===t?[n]:[]);if(i.length>1)throw new pe(`${t} may only be provided once`);return i.length===0?!1:(e.splice(i[0],1),!0)}function Mu(e,t){let i=e.flatMap((a,o)=>a===t?[o]:[]);if(i.length>1)throw new pe(`${t} may only be provided once`);if(i.length===0)return;let r=i[0],n=e[r+1];if(n===void 0||n.startsWith("--"))throw new pe(`${t} requires a value`);return e.splice(r,2),n}function So(e){if(e.length>0)throw new pe(`Unexpected argument: ${e[0]}`)}function Eo(e,t){let i=e.shift();if(!i||i.startsWith("--"))throw new pe(`${t} is required`);return i}function Bu(e,t){let i=ko.normalize(e),r=ko.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function _w(e){let t=ko.resolve(e),i=He(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return t;let r=He(t);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!Bu(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||Bu(i.currentWorktreeRoot,r.currentWorktreeRoot)?t:i.currentWorktreeRoot}async function Fu(e){return e?_w(e):Qa(process.cwd())}function Po(e,t,i){return{command:e,exitCode:0,data:t,text:i??JSON.stringify(t,null,2)+`
185
- `}}function Vu(e,t){if(t instanceof pe)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof tn)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 rn)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof Gr)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 wi)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 nn)return{command:e,exitCode:73,data:{preparation:t.preparation},error:{code:"workspace-preparation-incomplete",message:t.message}};if(t instanceof Ur)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 en)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof Ei)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let i=t.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function qu(e,t){return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
186
- `}:e.error?{exitCode:e.exitCode,stderr:e.error.message}:{exitCode:e.exitCode,stdout:e.text}}async function Wu(e,t){let i=Eo(e,"root subcommand");if(i==="show"){So(e);let r=await fe(t);if(!r)throw new Error(".comet/config.yaml was not found");let n=await je(t,r.native.artifact_root);return Po("root show",{projectRoot:t,artifactRoot:r.native.artifact_root,language:r.native.language,nativeRoot:n.nativeRoot,pendingRootMove:r.native.pending_root_move??null})}if(i==="move"){let r=Eo(e,"artifact root");So(e);let n=await Cu({projectRoot:t,toArtifactRoot:r});return Po("root move",n,`Moved Comet Native to ${n.toNativeRoot}
187
- `)}throw new pe(`Unknown root command: ${i}`)}function Tw(e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
188
- `}}async function zu(e,t,i=process.argv.slice(2)){let r=i.indexOf("--"),n=r<0?[...i]:i.slice(0,r),a=r<0?[]:i.slice(r),o=n.includes("--json"),s,c;try{Lu(n,"--json"),s=Mu(n,"--project-root");let d=[...n,...a],u=await Fu(s);c=await t(d,u)}catch(d){c=Vu(e,d)}let l=o?Tw(c):qu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
184
+ `}}var Dw=Hw().usage;var HI=10*1024*1024,ve=class extends Error{};function qu(e,t){let i=e.flatMap((r,n)=>r===t?[n]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);return i.length===0?!1:(e.splice(i[0],1),!0)}function Wu(e,t){let i=e.flatMap((a,o)=>a===t?[o]:[]);if(i.length>1)throw new ve(`${t} may only be provided once`);if(i.length===0)return;let r=i[0],n=e[r+1];if(n===void 0||n.startsWith("--"))throw new ve(`${t} requires a value`);return e.splice(r,2),n}function Eo(e){if(e.length>0)throw new ve(`Unexpected argument: ${e[0]}`)}function Po(e,t){let i=e.shift();if(!i||i.startsWith("--"))throw new ve(`${t} is required`);return i}function Vu(e,t){let i=So.normalize(e),r=So.normalize(t);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function Bw(e){let t=So.resolve(e),i=He(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return t;let r=He(t);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!Vu(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||Vu(i.currentWorktreeRoot,r.currentWorktreeRoot)?t:i.currentWorktreeRoot}async function zu(e){return e?Bw(e):Za(process.cwd())}function Ro(e,t,i){return{command:e,exitCode:0,data:t,text:i??JSON.stringify(t,null,2)+`
185
+ `}}function Ju(e,t){if(t instanceof ve)return{command:e,exitCode:64,error:{code:"usage",message:t.message}};if(t instanceof nn)return{command:e,exitCode:73,data:{capability:t.capability,expectedHash:t.expectedHash,actualHash:t.actualHash,canonicalPath:t.canonicalPath},error:{code:"conflict",message:t.message}};if(t instanceof an)return{command:e,exitCode:73,data:t.preflight,error:{code:"conflict",message:t.message}};if(t instanceof Kr)return{command:e,exitCode:73,data:{change:t.change,expectedRevision:t.expectedRevision,actualRevision:t.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:t.message}};if(t instanceof yi)return{command:e,exitCode:73,data:{requestedIsolation:t.requestedIsolation,activeChanges:t.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:t.message}};if(t instanceof on)return{command:e,exitCode:73,data:{preparation:t.preparation},error:{code:"workspace-preparation-incomplete",message:t.message}};if(t instanceof Yr)return{command:e,exitCode:65,data:{change:t.change,complete:!1,omittedCount:t.omittedCount,omittedByReason:t.omittedByReason,samplePaths:t.samplePaths,sampleTruncated:t.sampleTruncated,effectiveLimits:t.effectiveLimits,policyHash:t.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:t.message}};if(t instanceof rn)return{command:e,exitCode:65,data:{receiptBindingFailures:t.details},error:{code:"invalid-data",message:t.message}};if(t instanceof Pi)return{command:e,exitCode:65,data:t.recovery,error:{code:"implementation-scope-stale",message:t.message}};if(t instanceof Error){let i=t.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:e,exitCode:70,error:{code:"internal",message:t.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(t.message);return{command:e,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:t.message}}}return{command:e,exitCode:70,error:{code:"internal",message:String(t)}}}function Gu(e,t){return t?{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
186
+ `}:e.error?{exitCode:e.exitCode,stderr:e.error.message}:{exitCode:e.exitCode,stdout:e.text}}async function Uu(e,t){let i=Po(e,"root subcommand");if(i==="show"){Eo(e);let r=await se(t);if(!r)throw new Error(".comet/config.yaml was not found");let n=await fe(t,r.native.artifact_root);return Ro("root show",{projectRoot:t,artifactRoot:r.native.artifact_root,language:r.native.language,nativeRoot:n.nativeRoot,pendingRootMove:r.native.pending_root_move??null})}if(i==="move"){let r=Po(e,"artifact root");Eo(e);let n=await Iu({projectRoot:t,toArtifactRoot:r});return Ro("root move",n,`Moved Comet Native to ${n.toNativeRoot}
187
+ `)}throw new ve(`Unknown root command: ${i}`)}function Lw(e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:e.command,exitCode:e.exitCode,...e.data===void 0?{}:{data:e.data},...e.error===void 0?{}:{error:e.error}})+`
188
+ `}}async function Ku(e,t,i=process.argv.slice(2)){let r=i.indexOf("--"),n=r<0?[...i]:i.slice(0,r),a=r<0?[]:i.slice(r),o=n.includes("--json"),s,c;try{qu(n,"--json"),s=Wu(n,"--project-root");let u=[...n,...a],d=await zu(s);c=await t(u,d)}catch(u){c=Ju(e,u)}let l=o?Lw(c):Gu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
189
189
  `)?"":`
190
- `)),l.exitCode}process.exitCode=await zu("root",Wu);
190
+ `)),l.exitCode}process.exitCode=await Ku("root",Uu);