@rpamis/comet 0.4.0-beta.13 → 0.4.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +13 -1
- package/assets/manifest.json +1 -1
- package/assets/skills/comet/SKILL.md +6 -5
- package/assets/skills/comet/reference/subagent-dispatch.md +2 -4
- package/assets/skills/comet/rules/comet-phase-guard.en.md +4 -3
- package/assets/skills/comet/rules/comet-phase-guard.md +4 -3
- package/assets/skills/comet/rules/comet-workflow-guard.en.md +1 -1
- package/assets/skills/comet/rules/comet-workflow-guard.md +1 -1
- package/assets/skills/comet/scripts/comet-archive.mjs +85 -85
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +1 -1
- package/assets/skills/comet/scripts/comet-guard.mjs +111 -111
- package/assets/skills/comet/scripts/comet-handoff.mjs +85 -85
- package/assets/skills/comet/scripts/comet-hook-guard.mjs +91 -89
- package/assets/skills/comet/scripts/comet-hook-router.mjs +124 -116
- package/assets/skills/comet/scripts/comet-resume-probe.mjs +77 -77
- package/assets/skills/comet/scripts/comet-runtime.mjs +188 -185
- package/assets/skills/comet/scripts/comet-state.mjs +108 -107
- package/assets/skills/comet/scripts/comet-yaml-validate.mjs +95 -95
- package/assets/skills/comet-any/SKILL.md +1 -1
- package/assets/skills/comet-any/reference/authoring-subagents.md +3 -11
- package/assets/skills/comet-any/reference/subagents/pause-points-author.md +1 -4
- package/assets/skills/comet-any/reference/subagents/reference-author.md +1 -4
- package/assets/skills/comet-any/reference/subagents/script-author.md +1 -4
- package/assets/skills/comet-any/reference/subagents/skill-core-author.md +1 -4
- package/assets/skills/comet-any/reference/subagents/skill-reviewer.md +1 -4
- package/assets/skills/comet-any/reference/subagents/workflow-entry-author.md +1 -4
- package/assets/skills/comet-build/SKILL.md +2 -2
- package/assets/skills/comet-native/SKILL.md +85 -11
- package/assets/skills/comet-native/reference/artifacts.md +3 -1
- package/assets/skills/comet-native/reference/commands.md +15 -6
- package/assets/skills/comet-native/reference/recovery.md +12 -1
- package/assets/skills/comet-native/scripts/comet-native-archive.mjs +124 -118
- package/assets/skills/comet-native/scripts/comet-native-check.mjs +116 -110
- package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +110 -110
- package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +121 -121
- package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +83 -83
- package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +88 -82
- package/assets/skills/comet-native/scripts/comet-native-init.mjs +85 -85
- package/assets/skills/comet-native/scripts/comet-native-new.mjs +114 -114
- package/assets/skills/comet-native/scripts/comet-native-next.mjs +122 -122
- package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +124 -116
- package/assets/skills/comet-native/scripts/comet-native-root.mjs +110 -110
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +154 -152
- package/assets/skills/comet-native/scripts/comet-native-select.mjs +110 -110
- package/assets/skills/comet-native/scripts/comet-native-show.mjs +80 -80
- package/assets/skills/comet-native/scripts/comet-native-spec.mjs +112 -112
- package/assets/skills/comet-native/scripts/comet-native-status.mjs +107 -107
- package/assets/skills-zh/comet/SKILL.md +3 -3
- package/assets/skills-zh/comet/reference/subagent-dispatch.md +2 -4
- package/assets/skills-zh/comet-any/SKILL.md +1 -1
- package/assets/skills-zh/comet-any/reference/authoring-subagents.md +3 -14
- package/assets/skills-zh/comet-any/reference/subagents/pause-points-author.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/reference-author.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/script-author.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/skill-core-author.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/skill-reviewer.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/workflow-entry-author.md +1 -4
- package/assets/skills-zh/comet-build/SKILL.md +2 -2
- package/assets/skills-zh/comet-native/SKILL.md +86 -12
- package/assets/skills-zh/comet-native/reference/artifacts.md +3 -1
- package/assets/skills-zh/comet-native/reference/commands.md +17 -8
- package/assets/skills-zh/comet-native/reference/recovery.md +14 -3
- package/bin/fast-runtime-router.js +1 -0
- package/dist/app/cli/index.js +1 -0
- package/dist/app/cli/index.js.map +1 -1
- package/dist/app/commands/doctor.d.ts.map +1 -1
- package/dist/app/commands/doctor.js +138 -37
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/i18n.d.ts +1 -1
- package/dist/app/commands/i18n.d.ts.map +1 -1
- package/dist/app/commands/i18n.js +90 -0
- package/dist/app/commands/i18n.js.map +1 -1
- package/dist/app/commands/init.d.ts.map +1 -1
- package/dist/app/commands/init.js +45 -12
- package/dist/app/commands/init.js.map +1 -1
- package/dist/app/commands/project-scope-selection.d.ts +2 -1
- package/dist/app/commands/project-scope-selection.d.ts.map +1 -1
- package/dist/app/commands/project-scope-selection.js +5 -7
- package/dist/app/commands/project-scope-selection.js.map +1 -1
- package/dist/app/commands/uninstall.d.ts +6 -0
- package/dist/app/commands/uninstall.d.ts.map +1 -1
- package/dist/app/commands/uninstall.js +197 -110
- package/dist/app/commands/uninstall.js.map +1 -1
- package/dist/app/commands/update.d.ts.map +1 -1
- package/dist/app/commands/update.js +81 -10
- package/dist/app/commands/update.js.map +1 -1
- package/dist/app/commands/workflow.d.ts +1 -0
- package/dist/app/commands/workflow.d.ts.map +1 -1
- package/dist/app/commands/workflow.js +9 -2
- package/dist/app/commands/workflow.js.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard.d.ts +5 -1
- package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard.js +104 -20
- package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
- package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-layout-initialization.js +8 -4
- package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
- package/dist/domains/comet-classic/classic-layout.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-layout.js +1 -0
- package/dist/domains/comet-classic/classic-layout.js.map +1 -1
- package/dist/domains/comet-classic/classic-plan-readiness.d.ts +12 -0
- package/dist/domains/comet-classic/classic-plan-readiness.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-plan-readiness.js +26 -0
- package/dist/domains/comet-classic/classic-plan-readiness.js.map +1 -0
- package/dist/domains/comet-classic/classic-project-config.d.ts +1 -0
- package/dist/domains/comet-classic/classic-project-config.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-project-config.js +13 -7
- package/dist/domains/comet-classic/classic-project-config.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.js +58 -7
- package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
- package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-adapter.js +15 -2
- package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
- package/dist/domains/comet-entry/hook-project-root.d.ts +3 -0
- package/dist/domains/comet-entry/hook-project-root.d.ts.map +1 -0
- package/dist/domains/comet-entry/hook-project-root.js +62 -0
- package/dist/domains/comet-entry/hook-project-root.js.map +1 -0
- package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -1
- package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router-entry.js +6 -4
- package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
- package/dist/domains/comet-entry/hook-router.d.ts +2 -0
- package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router.js +45 -9
- package/dist/domains/comet-entry/hook-router.js.map +1 -1
- package/dist/domains/comet-entry/hook-types.d.ts +1 -0
- package/dist/domains/comet-entry/hook-types.d.ts.map +1 -1
- package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
- package/dist/domains/comet-entry/init-workflow.js +2 -3
- package/dist/domains/comet-entry/init-workflow.js.map +1 -1
- package/dist/domains/comet-entry/project-activation.d.ts +12 -0
- package/dist/domains/comet-entry/project-activation.d.ts.map +1 -0
- package/dist/domains/comet-entry/project-activation.js +109 -0
- package/dist/domains/comet-entry/project-activation.js.map +1 -0
- package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-entry/resume-probe.js +47 -26
- package/dist/domains/comet-entry/resume-probe.js.map +1 -1
- package/dist/domains/comet-entry/types.d.ts +1 -1
- package/dist/domains/comet-entry/types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-command.js +43 -1
- package/dist/domains/comet-native/native-archive-command.js.map +1 -1
- package/dist/domains/comet-native/native-archive-inspection.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-inspection.js +11 -0
- package/dist/domains/comet-native/native-archive-inspection.js.map +1 -1
- package/dist/domains/comet-native/native-archive-preflight.d.ts +10 -0
- package/dist/domains/comet-native/native-archive-preflight.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-preflight.js +44 -0
- package/dist/domains/comet-native/native-archive-preflight.js.map +1 -1
- package/dist/domains/comet-native/native-change.d.ts +18 -1
- package/dist/domains/comet-native/native-change.d.ts.map +1 -1
- package/dist/domains/comet-native/native-change.js +72 -3
- package/dist/domains/comet-native/native-change.js.map +1 -1
- package/dist/domains/comet-native/native-check.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check.js +13 -1
- package/dist/domains/comet-native/native-check.js.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
- package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.js +24 -3
- package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
- package/dist/domains/comet-native/native-conflict-inspection.d.ts +3 -1
- package/dist/domains/comet-native/native-conflict-inspection.d.ts.map +1 -1
- package/dist/domains/comet-native/native-conflict-inspection.js +20 -10
- package/dist/domains/comet-native/native-conflict-inspection.js.map +1 -1
- package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-continuation.js +16 -0
- package/dist/domains/comet-native/native-continuation.js.map +1 -1
- package/dist/domains/comet-native/native-diagnostics.d.ts +2 -0
- package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
- package/dist/domains/comet-native/native-diagnostics.js +43 -32
- package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.d.ts +6 -0
- package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.js +24 -0
- package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
- package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
- package/dist/domains/comet-native/native-findings.js +36 -0
- package/dist/domains/comet-native/native-findings.js.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.js +2 -2
- package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
- package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-new-command.js +22 -7
- package/dist/domains/comet-native/native-new-command.js.map +1 -1
- package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-receipt-command.js +14 -1
- package/dist/domains/comet-native/native-receipt-command.js.map +1 -1
- package/dist/domains/comet-native/native-receipt-errors.d.ts +23 -0
- package/dist/domains/comet-native/native-receipt-errors.d.ts.map +1 -0
- package/dist/domains/comet-native/native-receipt-errors.js +9 -0
- package/dist/domains/comet-native/native-receipt-errors.js.map +1 -0
- package/dist/domains/comet-native/native-receipt-refresh.d.ts +3 -0
- package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -1
- package/dist/domains/comet-native/native-receipt-refresh.js +13 -2
- package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -1
- package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
- package/dist/domains/comet-native/native-root-move.js +54 -1
- package/dist/domains/comet-native/native-root-move.js.map +1 -1
- package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-native/native-snapshot.js +71 -14
- package/dist/domains/comet-native/native-snapshot.js.map +1 -1
- package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transitions.js +74 -42
- package/dist/domains/comet-native/native-transitions.js.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +37 -4
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.js +192 -4
- package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.d.ts +27 -1
- package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.js +29 -6
- package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-workspace.d.ts +39 -3
- package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
- package/dist/domains/comet-native/native-workspace.js +200 -8
- package/dist/domains/comet-native/native-workspace.js.map +1 -1
- package/dist/domains/dashboard/collector.d.ts +26 -1
- package/dist/domains/dashboard/collector.d.ts.map +1 -1
- package/dist/domains/dashboard/collector.js +381 -1
- package/dist/domains/dashboard/collector.js.map +1 -1
- package/dist/domains/dashboard/native-adapter.d.ts +15 -0
- package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
- package/dist/domains/dashboard/native-adapter.js +1 -1
- package/dist/domains/dashboard/native-adapter.js.map +1 -1
- package/dist/domains/dashboard/native-collector.d.ts +26 -1
- package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
- package/dist/domains/dashboard/native-collector.js +284 -5
- package/dist/domains/dashboard/native-collector.js.map +1 -1
- package/dist/domains/dashboard/server.d.ts.map +1 -1
- package/dist/domains/dashboard/server.js +92 -3
- package/dist/domains/dashboard/server.js.map +1 -1
- package/dist/domains/dashboard/types.d.ts +41 -1
- package/dist/domains/dashboard/types.d.ts.map +1 -1
- package/dist/domains/dashboard/verify-parser.d.ts +1 -0
- package/dist/domains/dashboard/verify-parser.d.ts.map +1 -1
- package/dist/domains/dashboard/verify-parser.js +8 -4
- package/dist/domains/dashboard/verify-parser.js.map +1 -1
- package/dist/domains/dashboard/web/assets/{arc-mNt_SS1l.js → arc-ClrSujVb.js} +1 -1
- package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-Bc5akVD6.js → architectureDiagram-3BPJPVTR-B4A_t84A.js} +1 -1
- package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-C43zhVBe.js → blockDiagram-GPEHLZMM-D72u2953.js} +1 -1
- package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-dToETarK.js → c4Diagram-AAUBKEIU-Ca5zba3N.js} +1 -1
- package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-C0oO137R.js → chunk-2J33WTMH-CCVPBm0J.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-CGms1fgI.js → chunk-4BX2VUAB-JYluRsP-.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-Bugl8v6f.js → chunk-55IACEB6-DfYm7pN7.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-8ATNMlBG.js → chunk-727SXJPM-CwghIMO9.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-BNYjSSqU.js → chunk-AQP2D5EJ-BA_zgMXZ.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-_nJAqSbe.js → chunk-FMBD7UC4-BAJLB5V6.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-lyxYm5NX.js → chunk-ND2GUHAM-Bj6HWRwi.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-PUMVeWpd.js → chunk-QZHKN3VN-B1kXfg5N.js} +1 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +1 -0
- package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-DzMqjexn.js → cose-bilkent-S5V4N54A-BBrkuiAU.js} +1 -1
- package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-B67ET0eq.js → cynefin-VYW2F7L2-DlFhgQHt.js} +1 -1
- package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-CQPMvRLK.js → dagre-BM42HDAG-B0Bk5oiP.js} +1 -1
- package/dist/domains/dashboard/web/assets/{demo-BuVau32v.js → demo-DZYPLZpF.js} +2 -2
- package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-BRpLrFHM.js → diagram-2AECGRRQ-tvTUiBA2.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-CPGWuGrE.js → diagram-5GNKFQAL-BZfcK29q.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-D2wpX2iO.js → diagram-KO2AKTUF-BQahyP-C.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-D54mAbDu.js → diagram-LMA3HP47-D5bJnW2C.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-ZGQDpSs_.js → diagram-OG6HWLK6-DTwWdzWJ.js} +1 -1
- package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-C3qDo7sd.js → erDiagram-TEJ5UH35-BbvrdCp9.js} +1 -1
- package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-B7hStPd9.js → flowDiagram-I6XJVG4X-DgbR7Tcc.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-IqcLFbTK.js → ganttDiagram-6RSMTGT7-wWMOA7F4.js} +1 -1
- package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-YrMZpzUu.js → gitGraphDiagram-PVQCEYII-DCxvMAUJ.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +1 -0
- package/dist/domains/dashboard/web/assets/{index-icxk8_BP.js → index-Blit0P5Z.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +257 -0
- package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-CcIgGK_7.js → infoDiagram-5YYISTIA-9qXEkzDe.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-1x3rNjGP.js → ishikawaDiagram-YF4QCWOH-Dkf5othW.js} +1 -1
- package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-B2XiqMNP.js → journeyDiagram-JHISSGLW-C2_IkO4s.js} +1 -1
- package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-x46cGuo3.js → kanban-definition-UN3LZRKU-BxWgu4DL.js} +1 -1
- package/dist/domains/dashboard/web/assets/{linear-DFLqGZWl.js → linear-Dkr6p-Ro.js} +1 -1
- package/dist/domains/dashboard/web/assets/{mermaid.core-g3J6BACc.js → mermaid.core-DZUcsoG4.js} +4 -4
- package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CTdeKmcX.js → mindmap-definition-RKZ34NQL-C9xyxGfa.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-C_obwjIf.js → pieDiagram-4H26LBE5-Dn67tdOF.js} +1 -1
- package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-B6Gnfz9M.js → quadrantDiagram-W4KKPZXB-Cy6iOcxc.js} +1 -1
- package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-nX4PObnB.js → requirementDiagram-4Y6WPE33-B_gZONhx.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-QjDwwHgl.js → sankeyDiagram-5OEKKPKP-C3u-4dOk.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-BEEe0j6B.js → sequenceDiagram-3UESZ5HK-Xd3ByTVF.js} +1 -1
- package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CXfAaBgM.js → stateDiagram-AJRCARHV-CJGHL7Up.js} +1 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +1 -0
- package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-BOzX2EnD.js → timeline-definition-PNZ67QCA-DvONX2YQ.js} +1 -1
- package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-C40vhXRq.js → vennDiagram-CIIHVFJN-B-L4qWy4.js} +1 -1
- package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-B1rm89JH.js → wardleyDiagram-YWT4CUSO-cf39WX2o.js} +1 -1
- package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-BlMr59qK.js → xychartDiagram-2RQKCTM6-Dk1vcm3u.js} +1 -1
- package/dist/domains/dashboard/web/index.html +16 -16
- package/dist/domains/integrations/openspec.d.ts.map +1 -1
- package/dist/domains/integrations/openspec.js +5 -2
- package/dist/domains/integrations/openspec.js.map +1 -1
- package/dist/domains/skill/hook-lifecycle.d.ts +9 -0
- package/dist/domains/skill/hook-lifecycle.d.ts.map +1 -0
- package/dist/domains/skill/hook-lifecycle.js +48 -0
- package/dist/domains/skill/hook-lifecycle.js.map +1 -0
- package/dist/domains/skill/platform-inspect.d.ts +2 -0
- package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
- package/dist/domains/skill/platform-inspect.js +170 -32
- package/dist/domains/skill/platform-inspect.js.map +1 -1
- package/dist/domains/skill/platform-install.d.ts +21 -1
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +174 -31
- package/dist/domains/skill/platform-install.js.map +1 -1
- package/dist/domains/skill/project-hook-projection.d.ts +14 -0
- package/dist/domains/skill/project-hook-projection.d.ts.map +1 -0
- package/dist/domains/skill/project-hook-projection.js +41 -0
- package/dist/domains/skill/project-hook-projection.js.map +1 -0
- package/dist/domains/skill/project-instructions.d.ts +3 -0
- package/dist/domains/skill/project-instructions.d.ts.map +1 -1
- package/dist/domains/skill/project-instructions.js +8 -0
- package/dist/domains/skill/project-instructions.js.map +1 -1
- package/dist/domains/skill/uninstall.d.ts +6 -2
- package/dist/domains/skill/uninstall.d.ts.map +1 -1
- package/dist/domains/skill/uninstall.js +192 -29
- package/dist/domains/skill/uninstall.js.map +1 -1
- package/dist/domains/workflow-contract/contained-atomic-write.d.ts +3 -0
- package/dist/domains/workflow-contract/contained-atomic-write.d.ts.map +1 -1
- package/dist/domains/workflow-contract/contained-atomic-write.js +15 -2
- package/dist/domains/workflow-contract/contained-atomic-write.js.map +1 -1
- package/dist/domains/workflow-contract/global-config.d.ts +10 -0
- package/dist/domains/workflow-contract/global-config.d.ts.map +1 -0
- package/dist/domains/workflow-contract/global-config.js +117 -0
- package/dist/domains/workflow-contract/global-config.js.map +1 -0
- package/dist/domains/workflow-contract/hook-target-scope.d.ts +6 -0
- package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -0
- package/dist/domains/workflow-contract/hook-target-scope.js +51 -0
- package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -0
- package/dist/domains/workflow-contract/index.d.ts +2 -1
- package/dist/domains/workflow-contract/index.d.ts.map +1 -1
- package/dist/domains/workflow-contract/index.js +2 -1
- package/dist/domains/workflow-contract/index.js.map +1 -1
- package/dist/domains/workflow-contract/project-config-reader.d.ts +2 -0
- package/dist/domains/workflow-contract/project-config-reader.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config-reader.js.map +1 -1
- package/dist/domains/workflow-contract/project-config-writer.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config-writer.js +3 -2
- package/dist/domains/workflow-contract/project-config-writer.js.map +1 -1
- package/dist/domains/workflow-contract/project-config.d.ts +1 -0
- package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config.js +9 -4
- package/dist/domains/workflow-contract/project-config.js.map +1 -1
- package/dist/domains/workflow-contract/types.d.ts +3 -0
- package/dist/domains/workflow-contract/types.d.ts.map +1 -1
- package/dist/platform/install/platforms.d.ts +2 -0
- package/dist/platform/install/platforms.d.ts.map +1 -1
- package/dist/platform/install/platforms.js +1 -0
- package/dist/platform/install/platforms.js.map +1 -1
- package/dist/platform/paths/git-worktree.d.ts +4 -1
- package/dist/platform/paths/git-worktree.d.ts.map +1 -1
- package/dist/platform/paths/git-worktree.js +34 -1
- package/dist/platform/paths/git-worktree.js.map +1 -1
- package/eval/local/tests/scaffold/test_utils.py +74 -0
- package/eval/pyproject.toml +4 -4
- package/eval/scaffold/shell/docker.sh +5 -0
- package/package.json +1 -1
- package/dist/domains/dashboard/web/assets/channel-b2wWDG4F.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-B9SWZywo.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-B9SWZywo.js +0 -1
- package/dist/domains/dashboard/web/assets/index-DhtBssCt.js +0 -257
- package/dist/domains/dashboard/web/assets/index-pr3axVDI.css +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-CD3nS4cC.js +0 -1
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cometCreateRequire } from 'module';
|
|
3
3
|
const require = __cometCreateRequire(import.meta.url);
|
|
4
|
-
var
|
|
5
|
-
`)}};at.defaultYaml={explicit:!1,version:"1.2"};at.defaultTags={"!!":"tag:yaml.org,2002:"};
|
|
6
|
-
`)?
|
|
4
|
+
var _l=Object.create;var La=Object.defineProperty;var Ol=Object.getOwnPropertyDescriptor;var jl=Object.getOwnPropertyNames;var $l=Object.getPrototypeOf,Hl=Object.prototype.hasOwnProperty;var Yt=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var Ll=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of jl(e))!Hl.call(t,r)&&r!==i&&La(t,r,{get:()=>e[r],enumerable:!(n=Ol(e,r))||n.enumerable});return t};var Cn=(t,e,i)=>(i=t!=null?_l($l(t)):{},Ll(e||!t||!t.__esModule?La(i,"default",{value:t,enumerable:!0}):i,t));var C=w($=>{"use strict";var Rn=Symbol.for("yaml.alias"),Fa=Symbol.for("yaml.document"),Xt=Symbol.for("yaml.map"),Ma=Symbol.for("yaml.pair"),Pn=Symbol.for("yaml.scalar"),Qt=Symbol.for("yaml.seq"),oe=Symbol.for("yaml.node.type"),Fl=t=>!!t&&typeof t=="object"&&t[oe]===Rn,Ml=t=>!!t&&typeof t=="object"&&t[oe]===Fa,Bl=t=>!!t&&typeof t=="object"&&t[oe]===Xt,Dl=t=>!!t&&typeof t=="object"&&t[oe]===Ma,Ba=t=>!!t&&typeof t=="object"&&t[oe]===Pn,ql=t=>!!t&&typeof t=="object"&&t[oe]===Qt;function Da(t){if(t&&typeof t=="object")switch(t[oe]){case Xt:case Qt:return!0}return!1}function Vl(t){if(t&&typeof t=="object")switch(t[oe]){case Rn:case Xt:case Pn:case Qt:return!0}return!1}var Wl=t=>(Ba(t)||Da(t))&&!!t.anchor;$.ALIAS=Rn;$.DOC=Fa;$.MAP=Xt;$.NODE_TYPE=oe;$.PAIR=Ma;$.SCALAR=Pn;$.SEQ=Qt;$.hasAnchor=Wl;$.isAlias=Fl;$.isCollection=Da;$.isDocument=Ml;$.isMap=Bl;$.isNode=Vl;$.isPair=Dl;$.isScalar=Ba;$.isSeq=ql});var rt=w(An=>{"use strict";var O=C(),L=Symbol("break visit"),qa=Symbol("skip children"),te=Symbol("remove node");function Zt(t,e){let i=Va(e);O.isDocument(t)?qe(null,t.contents,i,Object.freeze([t]))===te&&(t.contents=null):qe(null,t,i,Object.freeze([]))}Zt.BREAK=L;Zt.SKIP=qa;Zt.REMOVE=te;function qe(t,e,i,n){let r=Wa(t,e,i,n);if(O.isNode(r)||O.isPair(r))return za(t,n,r),qe(t,r,i,n);if(typeof r!="symbol"){if(O.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=qe(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===L)return L;o===te&&(e.items.splice(a,1),a-=1)}}}else if(O.isPair(e)){n=Object.freeze(n.concat(e));let a=qe("key",e.key,i,n);if(a===L)return L;a===te&&(e.key=null);let o=qe("value",e.value,i,n);if(o===L)return L;o===te&&(e.value=null)}}return r}async function ei(t,e){let i=Va(e);O.isDocument(t)?await Ve(null,t.contents,i,Object.freeze([t]))===te&&(t.contents=null):await Ve(null,t,i,Object.freeze([]))}ei.BREAK=L;ei.SKIP=qa;ei.REMOVE=te;async function Ve(t,e,i,n){let r=await Wa(t,e,i,n);if(O.isNode(r)||O.isPair(r))return za(t,n,r),Ve(t,r,i,n);if(typeof r!="symbol"){if(O.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=await Ve(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===L)return L;o===te&&(e.items.splice(a,1),a-=1)}}}else if(O.isPair(e)){n=Object.freeze(n.concat(e));let a=await Ve("key",e.key,i,n);if(a===L)return L;a===te&&(e.key=null);let o=await Ve("value",e.value,i,n);if(o===L)return L;o===te&&(e.value=null)}}return r}function Va(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Wa(t,e,i,n){if(typeof i=="function")return i(t,e,n);if(O.isMap(e))return i.Map?.(t,e,n);if(O.isSeq(e))return i.Seq?.(t,e,n);if(O.isPair(e))return i.Pair?.(t,e,n);if(O.isScalar(e))return i.Scalar?.(t,e,n);if(O.isAlias(e))return i.Alias?.(t,e,n)}function za(t,e,i){let n=e[e.length-1];if(O.isCollection(n))n.items[t]=i;else if(O.isPair(n))t==="key"?n.key=i:n.value=i;else if(O.isDocument(n))n.contents=i;else{let r=O.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}An.visit=Zt;An.visitAsync=ei});var xn=w(Ga=>{"use strict";var Ja=C(),zl=rt(),Jl={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Gl=t=>t.replace(/[!,[\]{}]/g,e=>Jl[e]),at=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[a,o]=n;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=n;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${r}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||i(`The ${e} tag has no suffix`);let a=this.tags[n];if(a)try{return a+decodeURIComponent(r)}catch(o){return i(String(o)),null}return n==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,n]of Object.entries(this.tags))if(e.startsWith(n))return i+Gl(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Ja.isNode(e.contents)){let a={};zl.visit(e.contents,(o,s)=>{Ja.isNode(s)&&s.tag&&(a[s.tag]=!0)}),r=Object.keys(a)}else r=[];for(let[a,o]of n)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
|
|
5
|
+
`)}};at.defaultYaml={explicit:!1,version:"1.2"};at.defaultTags={"!!":"tag:yaml.org,2002:"};Ga.Directives=at});var ti=w(ot=>{"use strict";var Ka=C(),Kl=rt();function Ul(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function Ua(t){let e=new Set;return Kl.visit(t,{Value(i,n){n.anchor&&e.add(n.anchor)}}),e}function Ya(t,e){for(let i=1;;++i){let n=`${t}${i}`;if(!e.has(n))return n}}function Yl(t,e){let i=[],n=new Map,r=null;return{onAnchor:a=>{i.push(a),r??(r=Ua(t));let o=Ya(e,r);return r.add(o),o},setAnchors:()=>{for(let a of i){let o=n.get(a);if(typeof o=="object"&&o.anchor&&(Ka.isScalar(o.node)||Ka.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:n}}ot.anchorIsValid=Ul;ot.anchorNames=Ua;ot.createNodeAnchors=Yl;ot.findNewAnchor=Ya});var Tn=w(Xa=>{"use strict";function st(t,e,i,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,a=n.length;r<a;++r){let o=n[r],s=st(t,n,String(r),o);s===void 0?delete n[r]:s!==o&&(n[r]=s)}else if(n instanceof Map)for(let r of Array.from(n.keys())){let a=n.get(r),o=st(t,n,r,a);o===void 0?n.delete(r):o!==a&&n.set(r,o)}else if(n instanceof Set)for(let r of Array.from(n)){let a=st(t,n,r,r);a===void 0?n.delete(r):a!==r&&(n.delete(r),n.add(a))}else for(let[r,a]of Object.entries(n)){let o=st(t,n,r,a);o===void 0?delete n[r]:o!==a&&(n[r]=o)}return t.call(e,i,n)}Xa.applyReviver=st});var ce=w(Za=>{"use strict";var Xl=C();function Qa(t,e,i){if(Array.isArray(t))return t.map((n,r)=>Qa(n,String(r),i));if(t&&typeof t.toJSON=="function"){if(!i||!Xl.hasAnchor(t))return t.toJSON(e,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(t,n),i.onCreate=a=>{n.res=a,delete i.onCreate};let r=t.toJSON(e,i);return i.onCreate&&i.onCreate(r),r}return typeof t=="bigint"&&!i?.keep?Number(t):t}Za.toJS=Qa});var ii=w(to=>{"use strict";var Ql=Tn(),eo=C(),Zl=ce(),In=class{constructor(e){Object.defineProperty(this,eo.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:a}={}){if(!eo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=Zl.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof a=="function"?Ql.applyReviver(a,{"":s},"",s):s}};to.NodeBase=In});var ct=w(io=>{"use strict";var eu=ti(),tu=rt(),We=C(),iu=ii(),nu=ce(),_n=class extends iu.NodeBase{constructor(e){super(We.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;i?.aliasResolveCache?n=i.aliasResolveCache:(n=[],tu.visit(e,{Node:(a,o)=>{(We.isAlias(o)||We.hasAnchor(o))&&n.push(o)}}),i&&(i.aliasResolveCache=n));let r;for(let a of n){if(a===this)break;a.anchor===this.source&&(r=a)}return r}toJSON(e,i){if(!i)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:a}=i,o=this.resolve(r,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=n.get(o);if(s||(nu.toJS(o,null,i),s=n.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ni(r,o,n)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,n){let r=`*${this.source}`;if(e){if(eu.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${r} `}return r}};function ni(t,e,i){if(We.isAlias(e)){let n=e.resolve(t),r=i&&n&&i.get(n);return r?r.count*r.aliasCount:0}else if(We.isCollection(e)){let n=0;for(let r of e.items){let a=ni(t,r,i);a>n&&(n=a)}return n}else if(We.isPair(e)){let n=ni(t,e.key,i),r=ni(t,e.value,i);return Math.max(n,r)}return 1}io.Alias=_n});var T=w(On=>{"use strict";var ru=C(),au=ii(),ou=ce(),su=t=>!t||typeof t!="function"&&typeof t!="object",le=class extends au.NodeBase{constructor(e){super(ru.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:ou.toJS(this.value,e,i)}toString(){return String(this.value)}};le.BLOCK_FOLDED="BLOCK_FOLDED";le.BLOCK_LITERAL="BLOCK_LITERAL";le.PLAIN="PLAIN";le.QUOTE_DOUBLE="QUOTE_DOUBLE";le.QUOTE_SINGLE="QUOTE_SINGLE";On.Scalar=le;On.isScalarValue=su});var lt=w(ro=>{"use strict";var cu=ct(),Ce=C(),no=T(),lu="tag:yaml.org,2002:";function uu(t,e,i){if(e){let n=i.filter(a=>a.tag===e),r=n.find(a=>!a.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return i.find(n=>n.identify?.(t)&&!n.format)}function fu(t,e,i){if(Ce.isDocument(t)&&(t=t.contents),Ce.isNode(t))return t;if(Ce.isPair(t)){let u=i.schema[Ce.MAP].createNode?.(i.schema,null,i);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:r,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(n&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=r(t)),new cu.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=lu+e.slice(2));let l=uu(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new no.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Ce.MAP]:Symbol.iterator in Object(t)?o[Ce.SEQ]:o[Ce.MAP]}a&&(a(l),delete i.onTagObj);let d=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new no.Scalar(t);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}ro.createNode=fu});var ai=w(ri=>{"use strict";var du=lt(),ie=C(),hu=ii();function jn(t,e,i){let n=i;for(let r=e.length-1;r>=0;--r){let a=e[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=n,n=o}else n=new Map([[a,n]])}return du.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var ao=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,$n=class extends hu.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(n=>ie.isNode(n)||ie.isPair(n)?n.clone(e):n),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(ao(e))this.add(i);else{let[n,...r]=e,a=this.get(n,!0);if(ie.isCollection(a))a.addIn(r,i);else if(a===void 0&&this.schema)this.set(n,jn(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[i,...n]=e;if(n.length===0)return this.delete(i);let r=this.get(i,!0);if(ie.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}getIn(e,i){let[n,...r]=e,a=this.get(n,!0);return r.length===0?!i&&ie.isScalar(a)?a.value:a:ie.isCollection(a)?a.getIn(r,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!ie.isPair(i))return!1;let n=i.value;return n==null||e&&ie.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[i,...n]=e;if(n.length===0)return this.has(i);let r=this.get(i,!0);return ie.isCollection(r)?r.hasIn(n):!1}setIn(e,i){let[n,...r]=e;if(r.length===0)this.set(n,i);else{let a=this.get(n,!0);if(ie.isCollection(a))a.setIn(r,i);else if(a===void 0&&this.schema)this.set(n,jn(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};ri.Collection=$n;ri.collectionFromPath=jn;ri.isEmptyPath=ao});var ut=w(oi=>{"use strict";var pu=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Hn(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var mu=(t,e,i)=>t.endsWith(`
|
|
6
|
+
`)?Hn(i,e):i.includes(`
|
|
7
7
|
`)?`
|
|
8
|
-
`+
|
|
9
|
-
`)i===
|
|
10
|
-
`&&m!==" "){let
|
|
11
|
-
`&&
|
|
12
|
-
${e}${t.slice(0,E)}`:(i===
|
|
13
|
-
${e}${t.slice(
|
|
14
|
-
`);n=e,r=e+1,a=t[r]}return n}ft.FOLD_BLOCK=
|
|
15
|
-
`){if(a-o>n)return!0;if(o=a+1,r-o<=n)return!1}return!0}function dt(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(
|
|
8
|
+
`+Hn(i,e):(t.endsWith(" ")?"":" ")+i;oi.indentComment=Hn;oi.lineComment=mu;oi.stringifyComment=pu});var so=w(ft=>{"use strict";var vu="flow",Ln="block",si="quoted";function gu(t,e,i="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!r||r<0)return t;r<a&&(a=0);let c=Math.max(1+a,1+r-e.length);if(t.length<=c)return t;let l=[],d={},u=r-e.length;typeof n=="number"&&(n>r-Math.max(2,a)?l.push(0):u=r-n);let f,m,g=!1,h=-1,p=-1,y=-1;i===Ln&&(h=oo(t,h,e.length),h!==-1&&(u=h+c));for(let k;k=t[h+=1];){if(i===si&&k==="\\"){switch(p=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(k===`
|
|
9
|
+
`)i===Ln&&(h=oo(t,h,e.length)),u=h+e.length+c,f=void 0;else{if(k===" "&&m&&m!==" "&&m!==`
|
|
10
|
+
`&&m!==" "){let S=t[h+1];S&&S!==" "&&S!==`
|
|
11
|
+
`&&S!==" "&&(f=h)}if(h>=u)if(f)l.push(f),u=f+c,f=void 0;else if(i===si){for(;m===" "||m===" ";)m=k,k=t[h+=1],g=!0;let S=h>y+1?h-2:p-1;if(d[S])return t;l.push(S),d[S]=!0,u=S+c,f=void 0}else g=!0}m=k}if(g&&s&&s(),l.length===0)return t;o&&o();let N=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let S=l[k],E=l[k+1]||t.length;S===0?N=`
|
|
12
|
+
${e}${t.slice(0,E)}`:(i===si&&d[S]&&(N+=`${t[S]}\\`),N+=`
|
|
13
|
+
${e}${t.slice(S+1,E)}`)}return N}function oo(t,e,i){let n=e,r=e+1,a=t[r];for(;a===" "||a===" ";)if(e<r+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
|
|
14
|
+
`);n=e,r=e+1,a=t[r]}return n}ft.FOLD_BLOCK=Ln;ft.FOLD_FLOW=vu;ft.FOLD_QUOTED=si;ft.foldFlowLines=gu});var ht=w(co=>{"use strict";var J=T(),ue=so(),li=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ui=t=>/^(%|---|\.\.\.)/m.test(t);function wu(t,e,i){if(!e||e<0)return!1;let n=e-i,r=t.length;if(r<=n)return!1;for(let a=0,o=0;a<r;++a)if(t[a]===`
|
|
15
|
+
`){if(a-o>n)return!0;if(o=a+1,r-o<=n)return!1}return!0}function dt(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(ui(t)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let 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(n||i[c+2]==='"'||i.length<r)c+=1;else{for(o+=i.slice(s,c)+`
|
|
16
16
|
|
|
17
17
|
`;i[c+2]==="\\"&&i[c+3]==="n"&&i[c+4]!=='"';)o+=`
|
|
18
|
-
`,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,n?o:ue.foldFlowLines(o,a,ue.FOLD_QUOTED,
|
|
19
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return dt(t,e);let i=e.indent||(
|
|
20
|
-
${i}`)+"'";return e.implicitKey?n:ue.foldFlowLines(n,i,ue.FOLD_FLOW,
|
|
18
|
+
`,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,n?o:ue.foldFlowLines(o,a,ue.FOLD_QUOTED,li(e,!1))}function Fn(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
19
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return dt(t,e);let i=e.indent||(ui(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
20
|
+
${i}`)+"'";return e.implicitKey?n:ue.foldFlowLines(n,i,ue.FOLD_FLOW,li(e,!1))}function ze(t,e){let{singleQuote:i}=e.options,n;if(i===!1)n=dt;else{let r=t.includes('"'),a=t.includes("'");r&&!a?n=Fn:a&&!r?n=dt:n=i?Fn:dt}return n(t,e)}var Mn;try{Mn=new RegExp(`(^|(?<!
|
|
21
21
|
))
|
|
22
22
|
+(?!
|
|
23
|
-
|$)`,"g")}catch{
|
|
23
|
+
|$)`,"g")}catch{Mn=/\n+(?!\n|$)/g}function ci({comment:t,type:e,value:i},n,r,a){let{blockQuote:o,commentString:s,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(i))return ze(i,n);let l=n.indent||(n.forceBlockIndent||ui(i)?" ":""),d=o==="literal"?!0:o==="folded"||e===J.Scalar.BLOCK_FOLDED?!1:e===J.Scalar.BLOCK_LITERAL?!0:!wu(i,c,l.length);if(!i)return d?`|
|
|
24
24
|
`:`>
|
|
25
25
|
`;let u,f;for(f=i.length;f>0;--f){let E=i[f-1];if(E!==`
|
|
26
26
|
`&&E!==" "&&E!==" ")break}let m=i.substring(f),g=m.indexOf(`
|
|
27
27
|
`);g===-1?u="-":i===m||g!==m.length-1?(u="+",a&&a()):u="",m&&(i=i.slice(0,-m.length),m[m.length-1]===`
|
|
28
|
-
`&&(m=m.slice(0,-1)),m=m.replace(
|
|
29
|
-
`)y=p;else break}let N=i.substring(0,y<p?y+1:p);N&&(i=i.substring(N.length),N=N.replace(/\n+/g,`$&${l}`));let
|
|
30
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,R=
|
|
31
|
-
${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${
|
|
32
|
-
${l}${N}${i}${m}`}function
|
|
28
|
+
`&&(m=m.slice(0,-1)),m=m.replace(Mn,`$&${l}`));let h=!1,p,y=-1;for(p=0;p<i.length;++p){let E=i[p];if(E===" ")h=!0;else if(E===`
|
|
29
|
+
`)y=p;else break}let N=i.substring(0,y<p?y+1:p);N&&(i=i.substring(N.length),N=N.replace(/\n+/g,`$&${l}`));let S=(h?l?"2":"1":"")+u;if(t&&(S+=" "+s(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!d){let E=i.replace(/\n+/g,`
|
|
30
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,R=li(n,!0);o!=="folded"&&e!==J.Scalar.BLOCK_FOLDED&&(R.onOverflow=()=>{v=!0});let b=ue.foldFlowLines(`${N}${E}${m}`,l,ue.FOLD_BLOCK,R);if(!v)return`>${S}
|
|
31
|
+
${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${S}
|
|
32
|
+
${l}${N}${i}${m}`}function yu(t,e,i,n){let{type:r,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:d}=e;if(s&&a.includes(`
|
|
33
33
|
`)||d&&/[[\]{},]/.test(a))return ze(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||d||!a.includes(`
|
|
34
|
-
`)?ze(a,e):
|
|
35
|
-
`))return
|
|
36
|
-
${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:m,tags:g}=e.doc.schema;if(g.some(f)||m?.some(f))return ze(a,e)}return s?u:ue.foldFlowLines(u,c,ue.FOLD_FLOW,
|
|
37
|
-
${e.indent}${s}`:s}
|
|
38
|
-
${s}:`):(p=`${p}:`,f&&(p+=mt.lineComment(p,i.indent,l(f))));let y,N,
|
|
34
|
+
`)?ze(a,e):ci(t,e,i,n);if(!s&&!d&&r!==J.Scalar.PLAIN&&a.includes(`
|
|
35
|
+
`))return ci(t,e,i,n);if(ui(a)){if(c==="")return e.forceBlockIndent=!0,ci(t,e,i,n);if(s&&c===l)return ze(a,e)}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:m,tags:g}=e.doc.schema;if(g.some(f)||m?.some(f))return ze(a,e)}return s?u:ue.foldFlowLines(u,c,ue.FOLD_FLOW,li(e,!1))}function Nu(t,e,i,n){let{implicitKey:r,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==J.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=J.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case J.Scalar.BLOCK_FOLDED:case J.Scalar.BLOCK_LITERAL:return r||a?ze(o.value,e):ci(o,e,i,n);case J.Scalar.QUOTE_DOUBLE:return dt(o.value,e);case J.Scalar.QUOTE_SINGLE:return Fn(o.value,e);case J.Scalar.PLAIN:return yu(o,e,i,n);default:return null}},l=c(s);if(l===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=r&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}co.stringifyString=Nu});var pt=w(Bn=>{"use strict";var bu=ti(),fe=C(),ku=ut(),Su=ht();function Eu(t,e){let i=Object.assign({blockQuote:!0,commentString:ku.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(i.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:n,options:i}}function Cu(t,e){if(e.tag){let r=t.filter(a=>a.tag===e.tag);if(r.length>0)return r.find(a=>a.format===e.format)??r[0]}let i,n;if(fe.isScalar(e)){n=e.value;let r=t.filter(a=>a.identify?.(n));if(r.length>1){let a=r.filter(o=>o.test);a.length>0&&(r=a)}i=r.find(a=>a.format===e.format)??r.find(a=>!a.format)}else n=e,i=t.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!i){let r=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${r} value`)}return i}function Ru(t,e,{anchors:i,doc:n}){if(!n.directives)return"";let r=[],a=(fe.isScalar(t)||fe.isCollection(t))&&t.anchor;a&&bu.anchorIsValid(a)&&(i.add(a),r.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function Pu(t,e,i,n){if(fe.isPair(t))return t.toString(e,i,n);if(fe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,a=fe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Cu(e.doc.schema.tags,a));let o=Ru(a,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof r.stringify=="function"?r.stringify(a,e,i,n):fe.isScalar(a)?Su.stringifyString(a,e,i,n):a.toString(e,i,n);return o?fe.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
|
|
37
|
+
${e.indent}${s}`:s}Bn.createStringifyContext=Eu;Bn.stringify=Pu});var ho=w(fo=>{"use strict";var se=C(),lo=T(),uo=pt(),mt=ut();function Au({key:t,value:e},i,n,r){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=i,f=se.isNode(t)&&t.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(se.isCollection(t)||!se.isNode(t)&&typeof t=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let m=!u&&(!t||f&&e==null&&!i.inFlow||se.isCollection(t)||(se.isScalar(t)?t.type===lo.Scalar.BLOCK_FOLDED||t.type===lo.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(u||!a),indent:s+c});let g=!1,h=!1,p=uo.stringify(t,i,()=>g=!0,()=>h=!0);if(!m&&!i.inFlow&&p.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(i.inFlow){if(a||e==null)return g&&n&&n(),p===""?"?":m?`? ${p}`:p}else if(a&&!u||e==null&&m)return p=`? ${p}`,f&&!g?p+=mt.lineComment(p,i.indent,l(f)):h&&r&&r(),p;g&&(f=null),m?(f&&(p+=mt.lineComment(p,i.indent,l(f))),p=`? ${p}
|
|
38
|
+
${s}:`):(p=`${p}:`,f&&(p+=mt.lineComment(p,i.indent,l(f))));let y,N,k;se.isNode(e)?(y=!!e.spaceBefore,N=e.commentBefore,k=e.comment):(y=!1,N=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!m&&!f&&se.isScalar(e)&&(i.indentAtStart=p.length+1),h=!1,!d&&c.length>=2&&!i.inFlow&&!m&&se.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=uo.stringify(e,i,()=>S=!0,()=>h=!0),v=" ";if(f||y||N){if(v=y?`
|
|
39
39
|
`:"",N){let R=l(N);v+=`
|
|
40
40
|
${mt.indentComment(R,i.indent)}`}E===""&&!i.inFlow?v===`
|
|
41
|
-
`&&
|
|
41
|
+
`&&k&&(v=`
|
|
42
42
|
|
|
43
43
|
`):v+=`
|
|
44
44
|
${i.indent}`}else if(!m&&se.isCollection(e)){let R=E[0],b=E.indexOf(`
|
|
45
|
-
`),x=b!==-1,
|
|
45
|
+
`),x=b!==-1,M=i.inFlow??e.flow??e.items.length===0;if(x||!M){let De=!1;if(x&&(R==="&"||R==="!")){let _=E.indexOf(" ");R==="&"&&_!==-1&&_<b&&E[_+1]==="!"&&(_=E.indexOf(" ",_+1)),(_===-1||b<_)&&(De=!0)}De||(v=`
|
|
46
46
|
${i.indent}`)}}else(E===""||E[0]===`
|
|
47
|
-
`)&&(v="");return p+=v+E,i.inFlow?
|
|
47
|
+
`)&&(v="");return p+=v+E,i.inFlow?S&&n&&n():k&&!S?p+=mt.lineComment(p,i.indent,l(k)):h&&r&&r(),p}fo.stringifyPair=Au});var qn=w(Dn=>{"use strict";var po=Yt("process");function xu(t,...e){t==="debug"&&console.log(...e)}function Tu(t,e){(t==="debug"||t==="warn")&&(typeof po.emitWarning=="function"?po.emitWarning(e):console.warn(e))}Dn.debug=xu;Dn.warn=Tu});var mi=w(pi=>{"use strict";var hi=C(),mo=T(),fi="<<",di={identify:t=>t===fi||typeof t=="symbol"&&t.description===fi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new mo.Scalar(Symbol(fi)),{addToJSMap:vo}),stringify:()=>fi},Iu=(t,e)=>(di.identify(e)||hi.isScalar(e)&&(!e.type||e.type===mo.Scalar.PLAIN)&&di.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===di.tag&&i.default);function vo(t,e,i){let n=go(t,i);if(hi.isSeq(n))for(let r of n.items)Vn(t,e,r);else if(Array.isArray(n))for(let r of n)Vn(t,e,r);else Vn(t,e,n)}function Vn(t,e,i){let n=go(t,i);if(!hi.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,t,Map);for(let[a,o]of r)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function go(t,e){return t&&hi.isAlias(e)?e.resolve(t.doc,t):e}pi.addMergeToJSMap=vo;pi.isMergeKey=Iu;pi.merge=di});var zn=w(No=>{"use strict";var _u=qn(),wo=mi(),Ou=pt(),yo=C(),Wn=ce();function ju(t,e,{key:i,value:n}){if(yo.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,n);else if(wo.isMergeKey(t,i))wo.addMergeToJSMap(t,e,n);else{let r=Wn.toJS(i,"",t);if(e instanceof Map)e.set(r,Wn.toJS(n,r,t));else if(e instanceof Set)e.add(r);else{let a=$u(i,r,t),o=Wn.toJS(n,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function $u(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(yo.isNode(t)&&i?.doc){let n=Ou.createStringifyContext(i.doc,{});n.anchors=new Set;for(let a of i.anchors.keys())n.anchors.add(a.anchor);n.inFlow=!0,n.inStringifyKey=!0;let r=t.toString(n);if(!i.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),_u.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return r}return JSON.stringify(e)}No.addPairToJSMap=ju});var de=w(Jn=>{"use strict";var bo=lt(),Hu=ho(),Lu=zn(),vi=C();function Fu(t,e,i){let n=bo.createNode(t,void 0,i),r=bo.createNode(e,void 0,i);return new gi(n,r)}var gi=class t{constructor(e,i=null){Object.defineProperty(this,vi.NODE_TYPE,{value:vi.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:n}=this;return vi.isNode(i)&&(i=i.clone(e)),vi.isNode(n)&&(n=n.clone(e)),new t(i,n)}toJSON(e,i){let n=i?.mapAsMap?new Map:{};return Lu.addPairToJSMap(i,n,this)}toString(e,i,n){return e?.doc?Hu.stringifyPair(this,e,i,n):JSON.stringify(this)}};Jn.Pair=gi;Jn.createPair=Fu});var Gn=w(So=>{"use strict";var Re=C(),ko=pt(),wi=ut();function Mu(t,e,i){return(e.inFlow??t.flow?Du:Bu)(t,e,i)}function Bu({comment:t,items:e},i,{blockItemPrefix:n,flowChars:r,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 g=0;g<e.length;++g){let h=e[g],p=null;if(Re.isNode(h))!u&&h.spaceBefore&&f.push(""),yi(i,f,h.commentBefore,u),h.comment&&(p=h.comment);else if(Re.isPair(h)){let N=Re.isNode(h.key)?h.key:null;N&&(!u&&N.spaceBefore&&f.push(""),yi(i,f,N.commentBefore,u))}u=!1;let y=ko.stringify(h,d,()=>p=null,()=>u=!0);p&&(y+=wi.lineComment(y,a,l(p))),u&&p&&(u=!1),f.push(n+y)}let m;if(f.length===0)m=r.start+r.end;else{m=f[0];for(let g=1;g<f.length;++g){let h=f[g];m+=h?`
|
|
48
48
|
${c}${h}`:`
|
|
49
49
|
`}}return t?(m+=`
|
|
50
|
-
`+
|
|
51
|
-
`)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((N,
|
|
50
|
+
`+wi.indentComment(l(t),c),s&&s()):u&&o&&o(),m}function Du({items:t},e,{flowChars:i,itemIndent:n}){let{indent:r,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;n+=a;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let g=0;g<t.length;++g){let h=t[g],p=null;if(Re.isNode(h))h.spaceBefore&&u.push(""),yi(e,u,h.commentBefore,!1),h.comment&&(p=h.comment);else if(Re.isPair(h)){let N=Re.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&u.push(""),yi(e,u,N.commentBefore,!1),N.comment&&(l=!0));let k=Re.isNode(h.value)?h.value:null;k?(k.comment&&(p=k.comment),k.commentBefore&&(l=!0)):h.value==null&&N?.comment&&(p=N.comment)}p&&(l=!0);let y=ko.stringify(h,c,()=>p=null);l||(l=u.length>d||y.includes(`
|
|
51
|
+
`)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((N,k)=>N+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),p&&(y+=wi.lineComment(y,n,s(p))),u.push(y),d=u.length}let{start:f,end:m}=i;if(u.length===0)return f+m;if(!l){let g=u.reduce((h,p)=>h+p.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=f;for(let h of u)g+=h?`
|
|
52
52
|
${a}${r}${h}`:`
|
|
53
53
|
`;return`${g}
|
|
54
|
-
${r}${m}`}else return`${f}${o}${u.join(" ")}${o}${m}`}function
|
|
55
|
-
`:" ")}return
|
|
54
|
+
${r}${m}`}else return`${f}${o}${u.join(" ")}${o}${m}`}function yi({indent:t,options:{commentString:e}},i,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let a=wi.indentComment(e(n),t);i.push(a.trimStart())}}So.stringifyCollection=Mu});var pe=w(Un=>{"use strict";var qu=Gn(),Vu=zn(),Wu=ai(),he=C(),Ni=de(),zu=T();function vt(t,e){let i=he.isScalar(e)?e.value:e;for(let n of t)if(he.isPair(n)&&(n.key===e||n.key===i||he.isScalar(n.key)&&n.key.value===i))return n}var Kn=class extends Wu.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(he.MAP,e),this.items=[]}static from(e,i,n){let{keepUndefined:r,replacer:a}=n,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||r)&&o.items.push(Ni.createPair(c,l,n))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let n;he.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ni.Pair(e,e?.value):n=new Ni.Pair(e.key,e.value);let r=vt(this.items,n.key),a=this.schema?.sortMapEntries;if(r){if(!i)throw new Error(`Key ${n.key} already set`);he.isScalar(r.value)&&zu.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(a){let o=this.items.findIndex(s=>a(n,s)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let i=vt(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let r=vt(this.items,e)?.value;return(!i&&he.isScalar(r)?r.value:r)??void 0}has(e){return!!vt(this.items,e)}set(e,i){this.add(new Ni.Pair(e,i),!0)}toJSON(e,i,n){let r=n?new n:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(r);for(let a of this.items)Vu.addPairToJSMap(i,r,a);return r}toString(e,i,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!he.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),qu.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:i})}};Un.YAMLMap=Kn;Un.findPair=vt});var Je=w(Co=>{"use strict";var Ju=C(),Eo=pe(),Gu={collection:"map",default:!0,nodeClass:Eo.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ju.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>Eo.YAMLMap.from(t,e,i)};Co.map=Gu});var me=w(Ro=>{"use strict";var Ku=lt(),Uu=Gn(),Yu=ai(),ki=C(),Xu=T(),Qu=ce(),Yn=class extends Yu.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ki.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=bi(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let n=bi(e);if(typeof n!="number")return;let r=this.items[n];return!i&&ki.isScalar(r)?r.value:r}has(e){let i=bi(e);return typeof i=="number"&&i<this.items.length}set(e,i){let n=bi(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[n];ki.isScalar(r)&&Xu.isScalarValue(i)?r.value=i:this.items[n]=i}toJSON(e,i){let n=[];i?.onCreate&&i.onCreate(n);let r=0;for(let a of this.items)n.push(Qu.toJS(a,String(r++),i));return n}toString(e,i,n){return e?Uu.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:i}):JSON.stringify(this)}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof r=="function"){let c=i instanceof Set?s:String(o++);s=r.call(i,c,s)}a.items.push(Ku.createNode(s,void 0,n))}}return a}};function bi(t){let e=ki.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ro.YAMLSeq=Yn});var Ge=w(Ao=>{"use strict";var Zu=C(),Po=me(),ef={collection:"seq",default:!0,nodeClass:Po.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Zu.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>Po.YAMLSeq.from(t,e,i)};Ao.seq=ef});var gt=w(xo=>{"use strict";var tf=ht(),nf={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,n){return e=Object.assign({actualString:!0},e),tf.stringifyString(t,e,i,n)}};xo.string=nf});var Si=w(_o=>{"use strict";var To=T(),Io={identify:t=>t==null,createNode:()=>new To.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new To.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Io.test.test(t)?t:e.options.nullStr};_o.nullTag=Io});var Xn=w(jo=>{"use strict";var rf=T(),Oo={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new rf.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&Oo.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?i.options.trueStr:i.options.falseStr}};jo.boolTag=Oo});var Ke=w($o=>{"use strict";function af({format:t,minFractionDigits:e,tag:i,value:n}){if(typeof n=="bigint")return String(n);let r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let a=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}$o.stringifyNumber=af});var Zn=w(Ei=>{"use strict";var of=T(),Qn=Ke(),sf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Qn.stringifyNumber},cf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Qn.stringifyNumber(t)}},lf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new of.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:Qn.stringifyNumber};Ei.float=lf;Ei.floatExp=cf;Ei.floatNaN=sf});var tr=w(Ri=>{"use strict";var Ho=Ke(),Ci=t=>typeof t=="bigint"||Number.isInteger(t),er=(t,e,i,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),i);function Lo(t,e,i){let{value:n}=t;return Ci(n)&&n>=0?i+n.toString(e):Ho.stringifyNumber(t)}var uf={identify:t=>Ci(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>er(t,2,8,i),stringify:t=>Lo(t,8,"0o")},ff={identify:Ci,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>er(t,0,10,i),stringify:Ho.stringifyNumber},df={identify:t=>Ci(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>er(t,2,16,i),stringify:t=>Lo(t,16,"0x")};Ri.int=ff;Ri.intHex=df;Ri.intOct=uf});var Mo=w(Fo=>{"use strict";var hf=Je(),pf=Si(),mf=Ge(),vf=gt(),gf=Xn(),ir=Zn(),nr=tr(),wf=[hf.map,mf.seq,vf.string,pf.nullTag,gf.boolTag,nr.intOct,nr.int,nr.intHex,ir.floatNaN,ir.floatExp,ir.float];Fo.schema=wf});var qo=w(Do=>{"use strict";var yf=T(),Nf=Je(),bf=Ge();function Bo(t){return typeof t=="bigint"||Number.isInteger(t)}var Pi=({value:t})=>JSON.stringify(t),kf=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Pi},{identify:t=>t==null,createNode:()=>new yf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Pi},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Pi},{identify:Bo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>Bo(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Pi}],Sf={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ef=[Nf.map,bf.seq].concat(kf,Sf);Do.schema=Ef});var ar=w(Vo=>{"use strict";var wt=Yt("buffer"),rr=T(),Cf=ht(),Rf={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof wt.Buffer=="function")return wt.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(i.length);for(let r=0;r<i.length;++r)n[r]=i.charCodeAt(r);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},n,r,a){if(!i)return"";let o=i,s;if(typeof wt.Buffer=="function")s=o instanceof wt.Buffer?o.toString("base64"):wt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=rr.Scalar.BLOCK_LITERAL),e!==rr.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.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(e===rr.Scalar.BLOCK_LITERAL?`
|
|
55
|
+
`:" ")}return Cf.stringifyString({comment:t,type:e,value:s},n,r,a)}};Vo.binary=Rf});var Ti=w(xi=>{"use strict";var Ai=C(),or=de(),Pf=T(),Af=me();function Wo(t,e){if(Ai.isSeq(t))for(let i=0;i<t.items.length;++i){let n=t.items[i];if(!Ai.isPair(n)){if(Ai.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let r=n.items[0]||new or.Pair(new Pf.Scalar(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
|
|
56
56
|
${r.key.commentBefore}`:n.commentBefore),n.comment){let a=r.value??r.key;a.comment=a.comment?`${n.comment}
|
|
57
|
-
${a.comment}`:n.comment}n=r}t.items[i]=Ci.isPair(n)?n:new er.Pair(n)}}else e("Expected a sequence for this tag");return t}function Bo(t,e,i){let{replacer:n}=i,r=new Cf.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;r.items.push(er.createPair(s,c,i))}return r}var Rf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Fo,createNode:Bo};Ri.createPairs=Bo;Ri.pairs=Rf;Ri.resolvePairs=Fo});var nr=w(ir=>{"use strict";var qo=C(),tr=ce(),yt=pe(),Pf=me(),Vo=Pi(),Re=class t extends Pf.YAMLSeq{constructor(){super(),this.add=yt.YAMLMap.prototype.add.bind(this),this.delete=yt.YAMLMap.prototype.delete.bind(this),this.get=yt.YAMLMap.prototype.get.bind(this),this.has=yt.YAMLMap.prototype.has.bind(this),this.set=yt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(qo.isPair(r)?(a=tr.toJS(r.key,"",i),o=tr.toJS(r.value,a,i)):a=tr.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(e,i,n){let r=Vo.createPairs(e,i,n),a=new this;return a.items=r.items,a}};Re.tag="tag:yaml.org,2002:omap";var Af={collection:"seq",identify:t=>t instanceof Map,nodeClass:Re,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Vo.resolvePairs(t,e),n=[];for(let{key:r}of i.items)qo.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Re,i)},createNode:(t,e,i)=>Re.from(t,e,i)};ir.YAMLOMap=Re;ir.omap=Af});var Go=w(rr=>{"use strict";var zo=T();function Wo({value:t,source:e},i){return e&&(t?Jo:Ko).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Jo={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new zo.Scalar(!0),stringify:Wo},Ko={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new zo.Scalar(!1),stringify:Wo};rr.falseTag=Ko;rr.trueTag=Jo});var Uo=w(Ai=>{"use strict";var xf=T(),ar=Ke(),Tf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ar.stringifyNumber},If={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():ar.stringifyNumber(t)}},_f={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new xf.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let n=t.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:ar.stringifyNumber};Ai.float=_f;Ai.floatExp=If;Ai.floatNaN=Tf});var Xo=w(bt=>{"use strict";var Yo=Ke(),Nt=t=>typeof t=="bigint"||Number.isInteger(t);function xi(t,e,i,{intAsBigInt:n}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return r==="-"?-1*a:a}function or(t,e,i){let{value:n}=t;if(Nt(n)){let r=n.toString(e);return n<0?"-"+i+r.substr(1):i+r}return Yo.stringifyNumber(t)}var Of={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>xi(t,2,2,i),stringify:t=>or(t,2,"0b")},jf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>xi(t,1,8,i),stringify:t=>or(t,8,"0")},$f={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>xi(t,0,10,i),stringify:Yo.stringifyNumber},Hf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>xi(t,2,16,i),stringify:t=>or(t,16,"0x")};bt.int=$f;bt.intBin=Of;bt.intHex=Hf;bt.intOct=jf});var cr=w(sr=>{"use strict";var _i=C(),Ti=de(),Ii=pe(),Pe=class t extends Ii.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;_i.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new Ti.Pair(e.key,null):i=new Ti.Pair(e,null),Ii.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let n=Ii.findPair(this.items,e);return!i&&_i.isPair(n)?_i.isScalar(n.key)?n.key.value:n.key:n}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=Ii.findPair(this.items,e);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new Ti.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(Ti.createPair(o,null,n));return a}};Pe.tag="tag:yaml.org,2002:set";var Lf={collection:"map",identify:t=>t instanceof Set,nodeClass:Pe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>Pe.from(t,e,i),resolve(t,e){if(_i.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Pe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};sr.YAMLSet=Pe;sr.set=Lf});var ur=w(Oi=>{"use strict";var Mf=Ke();function lr(t,e){let i=t[0],n=i==="-"||i==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),a=n.replace(/_/g,"").split(":").reduce((o,s)=>o*r(60)+r(s),r(0));return i==="-"?r(-1)*a:a}function Qo(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Mf.stringifyNumber(t);let n="";e<0&&(n="-",e*=i(-1));let r=i(60),a=[e%r];return e<60?a.unshift(0):(e=(e-a[0])/r,a.unshift(e%r),e>=60&&(e=(e-a[0])/r,a.unshift(e))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Df={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:i})=>lr(t,i),stringify:Qo},Ff={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>lr(t,!1),stringify:Qo},Zo={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Zo.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),d=e[8];if(d&&d!=="Z"){let u=lr(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Oi.floatTime=Ff;Oi.intTime=Df;Oi.timestamp=Zo});var is=w(ts=>{"use strict";var Bf=We(),qf=Ni(),Vf=Je(),zf=gt(),Wf=Zn(),es=Go(),fr=Uo(),ji=Xo(),Jf=di(),Kf=nr(),Gf=Pi(),Uf=cr(),dr=ur(),Yf=[Bf.map,Vf.seq,zf.string,qf.nullTag,es.trueTag,es.falseTag,ji.intBin,ji.intOct,ji.int,ji.intHex,fr.floatNaN,fr.floatExp,fr.float,Wf.binary,Jf.merge,Kf.omap,Gf.pairs,Uf.set,dr.intTime,dr.floatTime,dr.timestamp];ts.schema=Yf});var ds=w(mr=>{"use strict";var os=We(),Xf=Ni(),ss=Je(),Qf=gt(),Zf=Wn(),hr=Kn(),pr=Un(),ed=$o(),td=Mo(),cs=Zn(),St=di(),ls=nr(),us=Pi(),ns=is(),fs=cr(),$i=ur(),rs=new Map([["core",ed.schema],["failsafe",[os.map,ss.seq,Qf.string]],["json",td.schema],["yaml11",ns.schema],["yaml-1.1",ns.schema]]),as={binary:cs.binary,bool:Zf.boolTag,float:hr.float,floatExp:hr.floatExp,floatNaN:hr.floatNaN,floatTime:$i.floatTime,int:pr.int,intHex:pr.intHex,intOct:pr.intOct,intTime:$i.intTime,map:os.map,merge:St.merge,null:Xf.nullTag,omap:ls.omap,pairs:us.pairs,seq:ss.seq,set:fs.set,timestamp:$i.timestamp},id={"tag:yaml.org,2002:binary":cs.binary,"tag:yaml.org,2002:merge":St.merge,"tag:yaml.org,2002:omap":ls.omap,"tag:yaml.org,2002:pairs":us.pairs,"tag:yaml.org,2002:set":fs.set,"tag:yaml.org,2002:timestamp":$i.timestamp};function nd(t,e,i){let n=rs.get(e);if(n&&!t)return i&&!n.includes(St.merge)?n.concat(St.merge):n.slice();let r=n;if(!r)if(Array.isArray(t))r=[];else{let a=Array.from(rs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)r=r.concat(a);else typeof t=="function"&&(r=t(r.slice()));return i&&(r=r.concat(St.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?as[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(as).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},[])}mr.coreKnownTags=id;mr.getTags=nd});var wr=w(hs=>{"use strict";var vr=C(),rd=We(),ad=Je(),od=gt(),Hi=ds(),sd=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,gr=class t{constructor({compat:e,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?Hi.getTags(e,"compat"):e?Hi.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?Hi.coreKnownTags:{},this.tags=Hi.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,vr.MAP,{value:rd.map}),Object.defineProperty(this,vr.SCALAR,{value:od.string}),Object.defineProperty(this,vr.SEQ,{value:ad.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?sd:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};hs.Schema=gr});var ms=w(ps=>{"use strict";var cd=C(),yr=pt(),kt=ut();function ld(t,e){let i=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&i.push("---");let r=yr.createStringifyContext(t,e),{commentString:a}=r.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(kt.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(cd.isNode(t.contents)){if(t.contents.spaceBefore&&n&&i.push(""),t.contents.commentBefore){let d=a(t.contents.commentBefore);i.push(kt.indentComment(d,""))}r.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=yr.stringify(t.contents,r,()=>s=null,c);s&&(l+=kt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(yr.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
|
|
58
|
-
`)?(i.push("..."),i.push(
|
|
57
|
+
${a.comment}`:n.comment}n=r}t.items[i]=Ai.isPair(n)?n:new or.Pair(n)}}else e("Expected a sequence for this tag");return t}function zo(t,e,i){let{replacer:n}=i,r=new Af.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;r.items.push(or.createPair(s,c,i))}return r}var xf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Wo,createNode:zo};xi.createPairs=zo;xi.pairs=xf;xi.resolvePairs=Wo});var lr=w(cr=>{"use strict";var Jo=C(),sr=ce(),yt=pe(),Tf=me(),Go=Ti(),Pe=class t extends Tf.YAMLSeq{constructor(){super(),this.add=yt.YAMLMap.prototype.add.bind(this),this.delete=yt.YAMLMap.prototype.delete.bind(this),this.get=yt.YAMLMap.prototype.get.bind(this),this.has=yt.YAMLMap.prototype.has.bind(this),this.set=yt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(Jo.isPair(r)?(a=sr.toJS(r.key,"",i),o=sr.toJS(r.value,a,i)):a=sr.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(e,i,n){let r=Go.createPairs(e,i,n),a=new this;return a.items=r.items,a}};Pe.tag="tag:yaml.org,2002:omap";var If={collection:"seq",identify:t=>t instanceof Map,nodeClass:Pe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Go.resolvePairs(t,e),n=[];for(let{key:r}of i.items)Jo.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Pe,i)},createNode:(t,e,i)=>Pe.from(t,e,i)};cr.YAMLOMap=Pe;cr.omap=If});var Qo=w(ur=>{"use strict";var Ko=T();function Uo({value:t,source:e},i){return e&&(t?Yo:Xo).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Yo={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ko.Scalar(!0),stringify:Uo},Xo={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ko.Scalar(!1),stringify:Uo};ur.falseTag=Xo;ur.trueTag=Yo});var Zo=w(Ii=>{"use strict";var _f=T(),fr=Ke(),Of={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fr.stringifyNumber},jf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():fr.stringifyNumber(t)}},$f={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new _f.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let n=t.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:fr.stringifyNumber};Ii.float=$f;Ii.floatExp=jf;Ii.floatNaN=Of});var ts=w(bt=>{"use strict";var es=Ke(),Nt=t=>typeof t=="bigint"||Number.isInteger(t);function _i(t,e,i,{intAsBigInt:n}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return r==="-"?-1*a:a}function dr(t,e,i){let{value:n}=t;if(Nt(n)){let r=n.toString(e);return n<0?"-"+i+r.substr(1):i+r}return es.stringifyNumber(t)}var Hf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>_i(t,2,2,i),stringify:t=>dr(t,2,"0b")},Lf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>_i(t,1,8,i),stringify:t=>dr(t,8,"0")},Ff={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>_i(t,0,10,i),stringify:es.stringifyNumber},Mf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>_i(t,2,16,i),stringify:t=>dr(t,16,"0x")};bt.int=Ff;bt.intBin=Hf;bt.intHex=Mf;bt.intOct=Lf});var pr=w(hr=>{"use strict";var $i=C(),Oi=de(),ji=pe(),Ae=class t extends ji.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;$i.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new Oi.Pair(e.key,null):i=new Oi.Pair(e,null),ji.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let n=ji.findPair(this.items,e);return!i&&$i.isPair(n)?$i.isScalar(n.key)?n.key.value:n.key:n}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=ji.findPair(this.items,e);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new Oi.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(Oi.createPair(o,null,n));return a}};Ae.tag="tag:yaml.org,2002:set";var Bf={collection:"map",identify:t=>t instanceof Set,nodeClass:Ae,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>Ae.from(t,e,i),resolve(t,e){if($i.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ae,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};hr.YAMLSet=Ae;hr.set=Bf});var vr=w(Hi=>{"use strict";var Df=Ke();function mr(t,e){let i=t[0],n=i==="-"||i==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),a=n.replace(/_/g,"").split(":").reduce((o,s)=>o*r(60)+r(s),r(0));return i==="-"?r(-1)*a:a}function is(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Df.stringifyNumber(t);let n="";e<0&&(n="-",e*=i(-1));let r=i(60),a=[e%r];return e<60?a.unshift(0):(e=(e-a[0])/r,a.unshift(e%r),e>=60&&(e=(e-a[0])/r,a.unshift(e))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var qf={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:i})=>mr(t,i),stringify:is},Vf={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>mr(t,!1),stringify:is},ns={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(ns.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),d=e[8];if(d&&d!=="Z"){let u=mr(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Hi.floatTime=Vf;Hi.intTime=qf;Hi.timestamp=ns});var os=w(as=>{"use strict";var Wf=Je(),zf=Si(),Jf=Ge(),Gf=gt(),Kf=ar(),rs=Qo(),gr=Zo(),Li=ts(),Uf=mi(),Yf=lr(),Xf=Ti(),Qf=pr(),wr=vr(),Zf=[Wf.map,Jf.seq,Gf.string,zf.nullTag,rs.trueTag,rs.falseTag,Li.intBin,Li.intOct,Li.int,Li.intHex,gr.floatNaN,gr.floatExp,gr.float,Kf.binary,Uf.merge,Yf.omap,Xf.pairs,Qf.set,wr.intTime,wr.floatTime,wr.timestamp];as.schema=Zf});var vs=w(br=>{"use strict";var us=Je(),ed=Si(),fs=Ge(),td=gt(),id=Xn(),yr=Zn(),Nr=tr(),nd=Mo(),rd=qo(),ds=ar(),kt=mi(),hs=lr(),ps=Ti(),ss=os(),ms=pr(),Fi=vr(),cs=new Map([["core",nd.schema],["failsafe",[us.map,fs.seq,td.string]],["json",rd.schema],["yaml11",ss.schema],["yaml-1.1",ss.schema]]),ls={binary:ds.binary,bool:id.boolTag,float:yr.float,floatExp:yr.floatExp,floatNaN:yr.floatNaN,floatTime:Fi.floatTime,int:Nr.int,intHex:Nr.intHex,intOct:Nr.intOct,intTime:Fi.intTime,map:us.map,merge:kt.merge,null:ed.nullTag,omap:hs.omap,pairs:ps.pairs,seq:fs.seq,set:ms.set,timestamp:Fi.timestamp},ad={"tag:yaml.org,2002:binary":ds.binary,"tag:yaml.org,2002:merge":kt.merge,"tag:yaml.org,2002:omap":hs.omap,"tag:yaml.org,2002:pairs":ps.pairs,"tag:yaml.org,2002:set":ms.set,"tag:yaml.org,2002:timestamp":Fi.timestamp};function od(t,e,i){let n=cs.get(e);if(n&&!t)return i&&!n.includes(kt.merge)?n.concat(kt.merge):n.slice();let r=n;if(!r)if(Array.isArray(t))r=[];else{let a=Array.from(cs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)r=r.concat(a);else typeof t=="function"&&(r=t(r.slice()));return i&&(r=r.concat(kt.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?ls[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(ls).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},[])}br.coreKnownTags=ad;br.getTags=od});var Er=w(gs=>{"use strict";var kr=C(),sd=Je(),cd=Ge(),ld=gt(),Mi=vs(),ud=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Sr=class t{constructor({compat:e,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?Mi.getTags(e,"compat"):e?Mi.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?Mi.coreKnownTags:{},this.tags=Mi.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,kr.MAP,{value:sd.map}),Object.defineProperty(this,kr.SCALAR,{value:ld.string}),Object.defineProperty(this,kr.SEQ,{value:cd.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?ud:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};gs.Schema=Sr});var ys=w(ws=>{"use strict";var fd=C(),Cr=pt(),St=ut();function dd(t,e){let i=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&i.push("---");let r=Cr.createStringifyContext(t,e),{commentString:a}=r.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(St.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(fd.isNode(t.contents)){if(t.contents.spaceBefore&&n&&i.push(""),t.contents.commentBefore){let d=a(t.contents.commentBefore);i.push(St.indentComment(d,""))}r.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=Cr.stringify(t.contents,r,()=>s=null,c);s&&(l+=St.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(Cr.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
|
|
58
|
+
`)?(i.push("..."),i.push(St.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(St.indentComment(a(c),"")))}return i.join(`
|
|
59
59
|
`)+`
|
|
60
|
-
`}
|
|
60
|
+
`}ws.stringifyDocument=dd});var Et=w(Ns=>{"use strict";var hd=ct(),Ue=ai(),q=C(),pd=de(),md=ce(),vd=Er(),gd=ys(),Rr=ti(),wd=Tn(),yd=lt(),Pr=xn(),Ar=class t{constructor(e,i,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,q.NODE_TYPE,{value:q.DOC});let r=null;typeof i=="function"||Array.isArray(i)?r=i:n===void 0&&i&&(n=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Pr.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let e=Object.create(t.prototype,{[q.NODE_TYPE]:{value:q.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=q.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Ye(this.contents)&&this.contents.add(e)}addIn(e,i){Ye(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let n=Rr.anchorNames(this);e.anchor=!i||n.has(i)?Rr.findNewAnchor(i||"a",n):i}return new hd.Alias(e.anchor)}createNode(e,i,n){let r;if(typeof i=="function")e=i.call({"":e},"",e),r=i;else if(Array.isArray(i)){let p=N=>typeof N=="number"||N instanceof String||N instanceof Number,y=i.filter(p).map(String);y.length>0&&(i=i.concat(y)),r=i}else n===void 0&&i&&(n=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:d}=n??{},{onAnchor:u,setAnchors:f,sourceObjects:m}=Rr.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},h=yd.createNode(e,d,g);return s&&q.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,i,n={}){let r=this.createNode(e,null,n),a=this.createNode(i,null,n);return new pd.Pair(r,a)}delete(e){return Ye(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ue.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Ye(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return q.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return Ue.isEmptyPath(e)?!i&&q.isScalar(this.contents)?this.contents.value:this.contents:q.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return q.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ue.isEmptyPath(e)?this.contents!==void 0:q.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=Ue.collectionFromPath(this.schema,[e],i):Ye(this.contents)&&this.contents.set(e,i)}setIn(e,i){Ue.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=Ue.collectionFromPath(this.schema,Array.from(e),i):Ye(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Pr.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Pr.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(n)this.schema=new vd.Schema(Object.assign(n,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:n,maxAliasCount:r,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=md.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"?wd.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return gd.stringifyDocument(this,e)}};function Ye(t){if(q.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Ns.Document=Ar});var Pt=w(Rt=>{"use strict";var Ct=class extends Error{constructor(e,i,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=i}},xr=class extends Ct{constructor(e,i,n){super("YAMLParseError",e,i,n)}},Tr=class extends Ct{constructor(e,i,n){super("YAMLWarning",e,i,n)}},Nd=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:n,col:r}=i.linePos[0];i.message+=` at line ${n}, column ${r}`;let a=r-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);s.length>80&&(s=s.substring(0,79)+`…
|
|
61
61
|
`),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===n&&c.col>r&&(s=Math.max(1,Math.min(c.col-r,80-a)));let l=" ".repeat(a)+"^".repeat(s);i.message+=`:
|
|
62
62
|
|
|
63
63
|
${o}
|
|
64
64
|
${l}
|
|
65
|
-
`}};Rt.YAMLError=Ct;Rt.YAMLParseError=
|
|
66
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(
|
|
67
|
-
`+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||
|
|
68
|
-
`+
|
|
69
|
-
`+v.comment:l.comment=v.comment),u=v.end;continue}!o&&i.options.strict
|
|
70
|
-
`+R:b.comment=R,v.comment=v.comment.substring(R.length+1)}}if(!o&&!
|
|
71
|
-
`+x.comment:b.comment=x.comment);let
|
|
72
|
-
`+p.comment:l.comment=p.comment),l.range=[n.offset,h,p.offset]}else l.range=[n.offset,h,h];return l}
|
|
65
|
+
`}};Rt.YAMLError=Ct;Rt.YAMLParseError=xr;Rt.YAMLWarning=Tr;Rt.prettifyError=Nd});var At=w(bs=>{"use strict";function bd(t,{flow:e,indicator:i,next:n,offset:r,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,d=s,u="",f="",m=!1,g=!1,h=null,p=null,y=null,N=null,k=null,S=null,E=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&a(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(l&&b.type!=="comment"&&b.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),b.type){case"space":!e&&(i!=="doc-start"||n?.type!=="flow-collection")&&b.source.includes(" ")&&(h=b),d=!0;break;case"comment":{d||a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let x=b.source.substring(1)||" ";u?u+=f+x:u=x,f="",l=!1;break}case"newline":l?u?u+=b.source:(!S||i!=="seq-item-ind")&&(c=!0):f+=b.source,l=!0,m=!0,(p||y)&&(N=b),d=!0;break;case"anchor":p&&a(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&a(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=b,E??(E=b.offset),l=!1,d=!1,g=!0;break;case"tag":{y&&a(b,"MULTIPLE_TAGS","A node can have at most one tag"),y=b,E??(E=b.offset),l=!1,d=!1,g=!0;break}case i:(p||y)&&a(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),S&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),S=b,l=i==="seq-item-ind"||i==="explicit-key-ind",d=!1;break;case"comma":if(e){k&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,d=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,d=!1}let v=t[t.length-1],R=v?v.offset+v.source.length:r;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&a(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:S,spaceBefore:c,comment:u,hasNewline:m,anchor:p,tag:y,newlineAfterProp:N,end:R,start:E??R}}bs.resolveProps=bd});var Bi=w(ks=>{"use strict";function Ir(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
66
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(Ir(e.key)||Ir(e.value))return!0}return!1;default:return!0}}ks.containsNewline=Ir});var _r=w(Ss=>{"use strict";var kd=Bi();function Sd(t,e,i){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&kd.containsNewline(e)&&i(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ss.flowIndentCheck=Sd});var Or=w(Cs=>{"use strict";var Es=C();function Ed(t,e,i){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let r=typeof n=="function"?n:(a,o)=>a===o||Es.isScalar(a)&&Es.isScalar(o)&&a.value===o.value;return e.some(a=>r(a.key,i))}Cs.mapIncludes=Ed});var Is=w(Ts=>{"use strict";var Rs=de(),Cd=pe(),Ps=At(),Rd=Bi(),As=_r(),Pd=Or(),xs="All mapping items must start at the same column";function Ad({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??Cd.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=n.offset,l=null;for(let d of n.items){let{start:u,key:f,sep:m,value:g}=d,h=Ps.resolveProps(u,{indicator:"explicit-key-ind",next:f??m?.[0],offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0}),p=!h.found;if(p){if(f&&(f.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&r(c,"BAD_INDENT",xs)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(s.comment?s.comment+=`
|
|
67
|
+
`+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Rd.containsNewline(f))&&r(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&r(c,"BAD_INDENT",xs);i.atKey=!0;let y=h.end,N=f?t(i,f,h,r):e(i,y,u,null,h,r);i.schema.compat&&As.flowIndentCheck(n.indent,f,r),i.atKey=!1,Pd.mapIncludes(i,s.items,N)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let k=Ps.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:N.range[2],onError:r,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=k.end,k.found){p&&(g?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<k.found.offset-1024&&r(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=g?t(i,g,k,r):e(i,c,m,null,k,r);i.schema.compat&&As.flowIndentCheck(n.indent,g,r),c=S.range[2];let E=new Rs.Pair(N,S);i.options.keepSourceTokens&&(E.srcToken=d),s.items.push(E)}else{p&&r(N.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(N.comment?N.comment+=`
|
|
68
|
+
`+k.comment:N.comment=k.comment);let S=new Rs.Pair(N);i.options.keepSourceTokens&&(S.srcToken=d),s.items.push(S)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[n.offset,c,l??c],s}Ts.resolveBlockMap=Ad});var Os=w(_s=>{"use strict";var xd=me(),Td=At(),Id=_r();function _d({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??xd.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=n.offset,l=null;for(let{start:d,value:u}of n.items){let f=Td.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?r(f.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let m=u?t(i,u,f,r):e(i,f.end,d,null,f,r);i.schema.compat&&Id.flowIndentCheck(n.indent,u,r),c=m.range[2],s.items.push(m)}return s.range=[n.offset,c,l??c],s}_s.resolveBlockSeq=_d});var Xe=w(js=>{"use strict";function Od(t,e,i,n){let r="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&n(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";r?r+=o+d:r=d,o="";break}case"newline":r&&(o+=c),a=!0;break;default:n(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}js.resolveEnd=Od});var Fs=w(Ls=>{"use strict";var jd=C(),$d=de(),$s=pe(),Hd=me(),Ld=Xe(),Hs=At(),Fd=Bi(),Md=Or(),jr="Block collections are not allowed within flow collections",$r=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Bd({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=n.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?$s.YAMLMap:Hd.YAMLSeq),l=new c(i.schema);l.flow=!0;let d=i.atRoot;d&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=n.offset+n.start.source.length;for(let p=0;p<n.items.length;++p){let y=n.items[p],{start:N,key:k,sep:S,value:E}=y,v=Hs.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:k??S?.[0],offset:u,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!S&&!E){p===0&&v.comma?r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):p<n.items.length-1&&r(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
|
|
69
|
+
`+v.comment:l.comment=v.comment),u=v.end;continue}!o&&i.options.strict&&Fd.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||r(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let R="";e:for(let b of N)switch(b.type){case"comma":case"space":break;case"comment":R=b.source.substring(1);break e;default:break e}if(R){let b=l.items[l.items.length-1];jd.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
|
|
70
|
+
`+R:b.comment=R,v.comment=v.comment.substring(R.length+1)}}if(!o&&!S&&!v.found){let R=E?t(i,E,v,r):e(i,v.end,S,null,v,r);l.items.push(R),u=R.range[2],$r(E)&&r(R.range,"BLOCK_IN_FLOW",jr)}else{i.atKey=!0;let R=v.end,b=k?t(i,k,v,r):e(i,R,N,null,v,r);$r(k)&&r(b.range,"BLOCK_IN_FLOW",jr),i.atKey=!1;let x=Hs.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(x.found){if(!o&&!v.found&&i.options.strict){if(S)for(let _ of S){if(_===x.found)break;if(_.type==="newline"){r(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<x.found.offset-1024&&r(x.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?r(E,"MISSING_CHAR",`Missing space after : in ${s}`):r(x.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let M=E?t(i,E,x,r):x.found?e(i,x.end,S,null,x,r):null;M?$r(E)&&r(M.range,"BLOCK_IN_FLOW",jr):x.comment&&(b.comment?b.comment+=`
|
|
71
|
+
`+x.comment:b.comment=x.comment);let De=new $d.Pair(b,M);if(i.options.keepSourceTokens&&(De.srcToken=y),o){let _=l;Md.mapIncludes(i,_.items,b)&&r(R,"DUPLICATE_KEY","Map keys must be unique"),_.items.push(De)}else{let _=new $s.YAMLMap(i.schema);_.flow=!0,_.items.push(De);let Ha=(M??b).range;_.range=[b.range[0],Ha[1],Ha[2]],l.items.push(_)}u=M?M.range[2]:x.end}}let f=o?"}":"]",[m,...g]=n.end,h=u;if(m?.source===f)h=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),y=d?`${p} must end with a ${f}`:`${p} in block collection must be sufficiently indented and end with a ${f}`;r(u,d?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let p=Ld.resolveEnd(g,h,i.options.strict,r);p.comment&&(l.comment?l.comment+=`
|
|
72
|
+
`+p.comment:l.comment=p.comment),l.range=[n.offset,h,p.offset]}else l.range=[n.offset,h,h];return l}Ls.resolveFlowCollection=Bd});var Bs=w(Ms=>{"use strict";var Dd=C(),qd=T(),Vd=pe(),Wd=me(),zd=Is(),Jd=Os(),Gd=Fs();function Hr(t,e,i,n,r,a){let o=i.type==="block-map"?zd.resolveBlockMap(t,e,i,n,a):i.type==="block-seq"?Jd.resolveBlockSeq(t,e,i,n,a):Gd.resolveFlowCollection(t,e,i,n,a),s=o.constructor;return r==="!"||r===s.tagName?(o.tag=s.tagName,o):(r&&(o.tag=r),o)}function Kd(t,e,i,n,r){let a=n.tag,o=a?e.directives.tagName(a.source,f=>r(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:m}=n,g=f&&a?f.offset>a.offset?f:a:f??a;g&&(!m||m.offset<g.offset)&&r(g,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===Vd.YAMLMap.tagName&&s==="map"||o===Wd.YAMLSeq.tagName&&s==="seq")return Hr(t,e,i,r,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=e.schema.knownTags[o];if(f?.collection===s)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?r(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):r(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Hr(t,e,i,r,o)}let l=Hr(t,e,i,r,o,c),d=c.resolve?.(l,f=>r(a,"TAG_RESOLVE_FAILED",f),e.options)??l,u=Dd.isNode(d)?d:new qd.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Ms.composeCollection=Kd});var Fr=w(Ds=>{"use strict";var Lr=T();function Ud(t,e,i){let n=e.offset,r=Yd(e,t.options.strict,i);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let a=r.mode===">"?Lr.Scalar.BLOCK_FOLDED:Lr.Scalar.BLOCK_LITERAL,o=e.source?Xd(e.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let p=o[h][1];if(p===""||p==="\r")s=h;else break}if(s===0){let h=r.chomp==="+"&&o.length>0?`
|
|
73
73
|
`.repeat(Math.max(1,o.length-1)):"",p=n+r.length;return e.source&&(p+=e.source.length),{value:h,type:a,comment:r.comment,range:[n,p,p]}}let c=e.indent+r.indent,l=e.offset+r.length,d=0;for(let h=0;h<s;++h){let[p,y]=o[h];if(y===""||y==="\r")r.indent===0&&p.length>c&&(c=p.length);else{p.length<c&&i(l+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=p.length),d=h,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+y.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let u="",f="",m=!1;for(let h=0;h<d;++h)u+=o[h][0].slice(c)+`
|
|
74
|
-
`;for(let h=d;h<s;++h){let[p,y]=o[h];l+=p.length+y.length+1;let N=y[y.length-1]==="\r";if(N&&(y=y.slice(0,-1)),y&&p.length<c){let
|
|
74
|
+
`;for(let h=d;h<s;++h){let[p,y]=o[h];l+=p.length+y.length+1;let N=y[y.length-1]==="\r";if(N&&(y=y.slice(0,-1)),y&&p.length<c){let S=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(N?2:1),"BAD_INDENT",S),p=""}a===Lr.Scalar.BLOCK_LITERAL?(u+=f+p.slice(c)+y,f=`
|
|
75
75
|
`):p.length>c||y[0]===" "?(f===" "?f=`
|
|
76
76
|
`:!m&&f===`
|
|
77
77
|
`&&(f=`
|
|
@@ -84,68 +84,68 @@ ${l}
|
|
|
84
84
|
`+o[h][0].slice(c);u[u.length-1]!==`
|
|
85
85
|
`&&(u+=`
|
|
86
86
|
`);break;default:u+=`
|
|
87
|
-
`}let g=n+r.length+e.source.length;return{value:u,type:a,comment:r.comment,range:[n,g,g]}}function
|
|
87
|
+
`}let g=n+r.length+e.source.length;return{value:u,type:a,comment:r.comment,range:[n,g,g]}}function Yd({offset:t,props:e},i,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],a=r[0],o=0,s="",c=-1;for(let f=1;f<r.length;++f){let m=r[f];if(!s&&(m==="-"||m==="+"))s=m;else{let g=Number(m);!o&&g?o=g:c===-1&&(c=t+f)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,d="",u=r.length;for(let f=1;f<e.length;++f){let m=e[f];switch(m.type){case"space":l=!0;case"newline":u+=m.source.length;break;case"comment":i&&!l&&n(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,d=m.source.substring(1);break;case"error":n(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;n(m,"UNEXPECTED_TOKEN",g);let h=m.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:d,length:u}}function Xd(t){let e=t.split(/\n( *)/),i=e[0],n=i.match(/^( *)/),a=[n?.[1]?[n[1],i.slice(n[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}Ds.resolveBlockScalar=Ud});var Br=w(Vs=>{"use strict";var Mr=T(),Qd=Xe();function Zd(t,e,i){let{offset:n,type:r,source:a,end:o}=t,s,c,l=(f,m,g)=>i(n+f,m,g);switch(r){case"scalar":s=Mr.Scalar.PLAIN,c=eh(a,l);break;case"single-quoted-scalar":s=Mr.Scalar.QUOTE_SINGLE,c=th(a,l);break;case"double-quoted-scalar":s=Mr.Scalar.QUOTE_DOUBLE,c=ih(a,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+a.length,n+a.length]}}let d=n+a.length,u=Qd.resolveEnd(o,d,e,i);return{value:c,type:s,comment:u.comment,range:[n,d,u.offset]}}function eh(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),qs(t)}function th(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),qs(t.slice(1,-1)).replace(/''/g,"'")}function qs(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
88
88
|
`,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
89
89
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let r=n[1],a=" ",o=e.lastIndex;for(i.lastIndex=o;n=i.exec(t);)n[1]===""?a===`
|
|
90
90
|
`?r+=a:a=`
|
|
91
|
-
`:(r+=a+n[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,n=s.exec(t),r+a+(n?.[1]??"")}function
|
|
91
|
+
`:(r+=a+n[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,n=s.exec(t),r+a+(n?.[1]??"")}function ih(t,e){let i="";for(let n=1;n<t.length-1;++n){let r=t[n];if(!(r==="\r"&&t[n+1]===`
|
|
92
92
|
`))if(r===`
|
|
93
|
-
`){let{fold:a,offset:o}=
|
|
93
|
+
`){let{fold:a,offset:o}=nh(t,n);i+=a,n=o}else if(r==="\\"){let a=t[++n],o=rh[a];if(o)i+=o;else if(a===`
|
|
94
94
|
`)for(a=t[n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="\r"&&t[n+1]===`
|
|
95
|
-
`)for(a=t[++n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=
|
|
95
|
+
`)for(a=t[++n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=ah(t,n+1,s,e),n+=s}else{let s=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(r===" "||r===" "){let a=n,o=t[n+1];for(;o===" "||o===" ";)o=t[++n+1];o!==`
|
|
96
96
|
`&&!(o==="\r"&&t[n+2]===`
|
|
97
|
-
`)&&(i+=n>a?t.slice(a,n+1):r)}else i+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function
|
|
97
|
+
`)&&(i+=n>a?t.slice(a,n+1):r)}else i+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function nh(t,e){let i="",n=t[e+1];for(;(n===" "||n===" "||n===`
|
|
98
98
|
`||n==="\r")&&!(n==="\r"&&t[e+2]!==`
|
|
99
99
|
`);)n===`
|
|
100
100
|
`&&(i+=`
|
|
101
|
-
`),e+=1,n=t[e+1];return i||(i=" "),{fold:i,offset:e}}var
|
|
102
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
101
|
+
`),e+=1,n=t[e+1];return i||(i=" "),{fold:i,offset:e}}var rh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
102
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ah(t,e,i,n){let r=t.substr(e,i),o=r.length===i&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Vs.resolveFlowScalar=Zd});var Js=w(zs=>{"use strict";var xe=C(),Ws=T(),oh=Fr(),sh=Br();function ch(t,e,i,n){let{value:r,type:a,comment:o,range:s}=e.type==="block-scalar"?oh.resolveBlockScalar(t,e,n):sh.resolveFlowScalar(e,t.options.strict,n),c=i?t.directives.tagName(i.source,u=>n(i,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[xe.SCALAR]:c?l=lh(t.schema,r,c,i,n):e.type==="scalar"?l=uh(t,r,e,n):l=t.schema[xe.SCALAR];let d;try{let u=l.resolve(r,f=>n(i??e,"TAG_RESOLVE_FAILED",f),t.options);d=xe.isScalar(u)?u:new Ws.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);n(i??e,"TAG_RESOLVE_FAILED",f),d=new Ws.Scalar(r)}return d.range=s,d.source=r,a&&(d.type=a),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function lh(t,e,i,n,r){if(i==="!")return t[xe.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[xe.SCALAR])}function uh({atKey:t,directives:e,schema:i},n,r,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(n))||i[xe.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(n))??i[xe.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),d=`Value may be parsed as either ${c} or ${l}`;a(r,"TAG_RESOLVE_FAILED",d,!0)}}return o}zs.composeScalar=ch});var Ks=w(Gs=>{"use strict";function fh(t,e,i){if(e){i??(i=e.length);for(let n=i-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++n];r?.type==="space";)t+=r.source.length,r=e[++n];break}}return t}Gs.emptyScalarPosition=fh});var Xs=w(qr=>{"use strict";var dh=ct(),hh=C(),ph=Bs(),Us=Js(),mh=Xe(),vh=Ks(),gh={composeNode:Ys,composeEmptyNode:Dr};function Ys(t,e,i,n){let r=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,d=!0;switch(e.type){case"alias":l=wh(t,e,n),(s||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Us.composeScalar(t,e,c,n),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=ph.composeCollection(gh,t,e,i,n),s&&(l.anchor=s.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),d=!1}}return l??(l=Dr(t,e.offset,void 0,null,i,n)),s&&l.anchor===""&&n(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!hh.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&d&&(l.srcToken=e),l}function Dr(t,e,i,n,{spaceBefore:r,comment:a,anchor:o,tag:s,end:c},l){let d={type:"scalar",offset:vh.emptyScalarPosition(e,i,n),indent:-1,source:""},u=Us.composeScalar(t,d,s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function wh({options:t},{offset:e,source:i,end:n},r){let a=new dh.Alias(i.substring(1));a.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=mh.resolveEnd(n,o,t.strict,r);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}qr.composeEmptyNode=Dr;qr.composeNode=Ys});var ec=w(Zs=>{"use strict";var yh=Et(),Qs=Xs(),Nh=Xe(),bh=At();function kh(t,e,{offset:i,start:n,value:r,end:a},o){let s=Object.assign({_directives:e},t),c=new yh.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=bh.resolveProps(n,{indicator:"doc-start",next:r??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Qs.composeNode(l,r,d,o):Qs.composeEmptyNode(l,d.end,n,null,d,o);let u=c.contents.range[2],f=Nh.resolveEnd(a,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,u,f.offset],c}Zs.composeDoc=kh});var Wr=w(nc=>{"use strict";var Sh=Yt("process"),Eh=xn(),Ch=Et(),xt=Pt(),tc=C(),Rh=ec(),Ph=Xe();function Tt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function ic(t){let e="",i=!1,n=!1;for(let r=0;r<t.length;++r){let a=t[r];switch(a[0]){case"#":e+=(e===""?"":n?`
|
|
103
103
|
|
|
104
104
|
`:`
|
|
105
|
-
`)+(a.substring(1)||" "),i=!0,n=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:e,afterEmptyLine:n}}var
|
|
106
|
-
${n}`:n;else if(r||e.directives.docStart||!a)e.commentBefore=n;else if(
|
|
105
|
+
`)+(a.substring(1)||" "),i=!0,n=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:e,afterEmptyLine:n}}var Vr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,n,r,a)=>{let o=Tt(i);a?this.warnings.push(new xt.YAMLWarning(o,n,r)):this.errors.push(new xt.YAMLParseError(o,n,r))},this.directives=new Eh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:n,afterEmptyLine:r}=ic(this.prelude);if(n){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
|
|
106
|
+
${n}`:n;else if(r||e.directives.docStart||!a)e.commentBefore=n;else if(tc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];tc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${n}
|
|
107
107
|
${s}`:n}else{let o=a.commentBefore;a.commentBefore=o?`${n}
|
|
108
|
-
${o}`:n}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
109
|
-
${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new xt.YAMLParseError(Tt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),r=new
|
|
108
|
+
${o}`:n}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ic(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(i,n)}*next(e){switch(Sh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,n,r)=>{let a=Tt(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=Rh.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new xt.YAMLParseError(Tt(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new xt.YAMLParseError(Tt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let i=Ph.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
109
|
+
${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new xt.YAMLParseError(Tt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),r=new Ch.Document(void 0,n);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,i,i],this.decorate(r,!1),yield r}}};nc.Composer=Vr});var oc=w(Di=>{"use strict";var Ah=Fr(),xh=Br(),Th=Pt(),rc=ht();function Ih(t,e=!0,i){if(t){let n=(r,a,o)=>{let s=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(i)i(s,a,o);else throw new Th.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return xh.resolveFlowScalar(t,e,n);case"block-scalar":return Ah.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function _h(t,e){let{implicitKey:i=!1,indent:n,inFlow:r=!1,offset:a=-1,type:o="PLAIN"}=e,s=rc.stringifyString({type:o,value:t},{implicitKey:i,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
110
110
|
`}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
|
|
111
111
|
`),d=s.substring(0,l),u=s.substring(l+1)+`
|
|
112
|
-
`,f=[{type:"block-scalar-header",offset:a,indent:n,source:d}];return
|
|
113
|
-
`}),{type:"block-scalar",offset:a,indent:n,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:a,indent:n,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:n,source:s,end:c};default:return{type:"scalar",offset:a,indent:n,source:s,end:c}}}function
|
|
112
|
+
`,f=[{type:"block-scalar-header",offset:a,indent:n,source:d}];return ac(f,c)||f.push({type:"newline",offset:-1,indent:n,source:`
|
|
113
|
+
`}),{type:"block-scalar",offset:a,indent:n,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:a,indent:n,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:n,source:s,end:c};default:return{type:"scalar",offset:a,indent:n,source:s,end:c}}}function Oh(t,e,i={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(n&&typeof s=="number"&&(s+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=rc.stringifyString({type:o,value:e},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":jh(t,c);break;case'"':zr(t,c,"double-quoted-scalar");break;case"'":zr(t,c,"single-quoted-scalar");break;default:zr(t,c,"scalar")}}function jh(t,e){let i=e.indexOf(`
|
|
114
114
|
`),n=e.substring(0,i),r=e.substring(i+1)+`
|
|
115
|
-
`;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,t.source=r}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:n}];
|
|
116
|
-
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:r})}}function
|
|
117
|
-
`};delete t.items,Object.assign(t,{type:i,source:e,end:[r]});break}default:{let n="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:n,source:e,end:r})}}}
|
|
115
|
+
`;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,t.source=r}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:n}];ac(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
|
|
116
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:r})}}function ac(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function zr(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let a of n)a.offset+=r;delete t.props,Object.assign(t,{type:i,source:e,end:n});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
117
|
+
`};delete t.items,Object.assign(t,{type:i,source:e,end:[r]});break}default:{let n="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:n,source:e,end:r})}}}Di.createScalarToken=_h;Di.resolveAsScalar=Ih;Di.setScalarValue=Oh});var cc=w(sc=>{"use strict";var $h=t=>"type"in t?Vi(t):qi(t);function Vi(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=Vi(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=qi(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=qi(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=qi(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function qi({start:t,key:e,sep:i,value:n}){let r="";for(let a of t)r+=a.source;if(e&&(r+=Vi(e)),i)for(let a of i)r+=a.source;return n&&(r+=Vi(n)),r}sc.stringify=$h});var dc=w(fc=>{"use strict";var Jr=Symbol("break visit"),Hh=Symbol("skip children"),lc=Symbol("remove item");function Te(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),uc(Object.freeze([]),t,e)}Te.BREAK=Jr;Te.SKIP=Hh;Te.REMOVE=lc;Te.itemAtPath=(t,e)=>{let i=t;for(let[n,r]of e){let a=i?.[n];if(a&&"items"in a)i=a.items[r];else return}return i};Te.parentCollection=(t,e)=>{let i=Te.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],r=i?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function uc(t,e,i){let n=i(e,t);if(typeof n=="symbol")return n;for(let r of["key","value"]){let a=e[r];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=uc(Object.freeze(t.concat([[r,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===Jr)return Jr;s===lc&&(a.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}fc.visit=Te});var Wi=w(F=>{"use strict";var Gr=oc(),Lh=cc(),Fh=dc(),Kr="\uFEFF",Ur="",Yr="",Xr="",Mh=t=>!!t&&"items"in t,Bh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Dh(t){switch(t){case Kr:return"<BOM>";case Ur:return"<DOC>";case Yr:return"<FLOW_END>";case Xr:return"<SCALAR>";default:return JSON.stringify(t)}}function qh(t){switch(t){case Kr:return"byte-order-mark";case Ur:return"doc-mode";case Yr:return"flow-error-end";case Xr:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
118
118
|
`:case`\r
|
|
119
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
120
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
121
|
-
\r `),
|
|
119
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}F.createScalarToken=Gr.createScalarToken;F.resolveAsScalar=Gr.resolveAsScalar;F.setScalarValue=Gr.setScalarValue;F.stringify=Lh.stringify;F.visit=Fh.visit;F.BOM=Kr;F.DOCUMENT=Ur;F.FLOW_END=Yr;F.SCALAR=Xr;F.isCollection=Mh;F.isScalar=Bh;F.prettyToken=Dh;F.tokenType=qh});var ea=w(pc=>{"use strict";var It=Wi();function G(t){switch(t){case void 0:case" ":case`
|
|
120
|
+
`:case"\r":case" ":return!0;default:return!1}}var hc=new Set("0123456789ABCDEFabcdef"),Vh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),zi=new Set(",[]{}"),Wh=new Set(` ,[]{}
|
|
121
|
+
\r `),Qr=t=>!t||Wh.has(t),Zr=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,i=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!i;let n=this.next??"stream";for(;n&&(i||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
|
|
122
122
|
`?!0:i==="\r"?this.buffer[e+1]===`
|
|
123
123
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let n=0;for(;i===" ";)i=this.buffer[++n+e];if(i==="\r"){let r=this.buffer[n+e+1];if(r===`
|
|
124
124
|
`||!r&&!this.atEnd)return e+n+1}return i===`
|
|
125
|
-
`||n>=this.indentNext||!i&&!this.atEnd?e+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&
|
|
126
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===It.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,n=e.indexOf("#");for(;n!==-1;){let a=e[n-1];if(a===" "||a===" "){i=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield It.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&
|
|
125
|
+
`||n>=this.indentNext||!i&&!this.atEnd?e+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&G(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
126
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===It.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,n=e.indexOf("#");for(;n!==-1;){let a=e[n-1];if(a===" "||a===" "){i=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield It.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&G(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&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&G(i)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Qr),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,n=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=n=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&G(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield It.FLOW_END,yield*this.parseLineStart();let a=0;for(;r[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),r[a]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Qr),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||G(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let n=this.buffer.substring(0,i),r=n.indexOf(`
|
|
127
127
|
`,this.pos);if(r!==-1){for(;r!==-1;){let a=this.continueScalar(r+1);if(a===-1)break;r=n.indexOf(`
|
|
128
|
-
`,a)}r!==-1&&(i=r-(n[r-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>
|
|
128
|
+
`,a)}r!==-1&&(i=r-(n[r-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>G(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,n;e:for(let a=this.pos;n=this.buffer[a];++a)switch(n){case" ":i+=1;break;case`
|
|
129
129
|
`:e=a,i=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
130
130
|
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
|
|
131
131
|
`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
132
132
|
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
|
|
133
|
-
`&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield It.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let a=this.buffer[n+1];if(
|
|
133
|
+
`&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield It.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let a=this.buffer[n+1];if(G(a)||e&&zi.has(a))break;i=n}else if(G(r)){let a=this.buffer[n+1];if(r==="\r"&&(a===`
|
|
134
134
|
`?(n+=1,r=`
|
|
135
|
-
`,a=this.buffer[n+1]):i=n),a==="#"||e&&
|
|
136
|
-
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&
|
|
135
|
+
`,a=this.buffer[n+1]):i=n),a==="#"||e&&zi.has(a))break;if(r===`
|
|
136
|
+
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&zi.has(r))break;i=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield It.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(i&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Qr),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,n=this.charAt(1);if(G(n)||i&&zi.has(n)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,i=this.buffer[e];for(;!G(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(Vh.has(i))i=this.buffer[++e];else if(i==="%"&&hc.has(this.buffer[e+1])&&hc.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
137
137
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
138
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||e&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(e){let i=this.pos,n=this.buffer[i];for(;!e(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};
|
|
138
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||e&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(e){let i=this.pos,n=this.buffer[i];for(;!e(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};pc.Lexer=Zr});var ia=w(mc=>{"use strict";var ta=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,n=this.lineStarts.length;for(;i<n;){let a=i+n>>1;this.lineStarts[a]<e?i=a+1:n=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let r=this.lineStarts[i-1];return{line:i,col:e-r+1}}}};mc.LineCounter=ta});var ra=w(Nc=>{"use strict";var zh=Yt("process"),vc=Wi(),Jh=ea();function ve(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function gc(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function yc(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ji(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Qe(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Gi(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function wc(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!ve(e.start,"explicit-key-ind")&&!ve(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,yc(e.value)?e.value.end?Gi(e.value.end,e.sep):e.value.end=e.sep:Gi(e.start,e.sep),delete e.sep)}var na=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Jh.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,i))yield*this.next(n);i||(yield*this.end())}*next(e){if(this.source=e,zh.env.LOG_TOKENS&&console.log("|",vc.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=vc.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let n=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in n?n.indent:0:i.type==="flow-collection"&&n.type==="document"&&(i.indent=0),i.type==="flow-collection"&&wc(i),n.type){case"document":n.value=i;break;case"block-scalar":n.props.push(i);break;case"block-map":{let r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=i;else{Object.assign(r,{key:i,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:i}):r.value=i;break}case"flow-collection":{let r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:i,sep:[]}):r.sep?r.value=i:Object.assign(r,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let r=i.items[i.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&gc(r.start)===-1&&(i.indent===0||r.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{gc(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let i=Ji(this.peek(2)),n=Qe(i),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
|
|
139
139
|
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
140
|
-
`,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){
|
|
140
|
+
`,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Gi(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(r&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||i.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):r||i.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ve(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(yc(i.key)&&!ve(i.sep,"newline")){let o=Qe(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(ve(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=Qe(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||r?e.items.push({start:a,key:null,sep:[this.sourceToken]}):ve(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||i.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!ve(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Gi(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||ve(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:r,sep:[]}):i.sep?this.stack.push(r):Object.assign(i,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=Ji(n),a=Qe(r);wc(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
|
|
141
141
|
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
142
|
-
`,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=Vi(e),n=Xe(i);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=Vi(e),n=Xe(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};vc.Parser=Xr});var bc=w(Ot=>{"use strict";var gc=Mr(),zh=Et(),_t=Pt(),Wh=Hn(),Jh=C(),Kh=Yr(),wc=Qr();function yc(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Kh.LineCounter||null,prettyErrors:e}}function Gh(t,e={}){let{lineCounter:i,prettyErrors:n}=yc(e),r=new wc.Parser(i?.addNewLine),a=new gc.Composer(e),o=Array.from(a.compose(r.parse(t)));if(n&&i)for(let s of o)s.errors.forEach(_t.prettifyError(t,i)),s.warnings.forEach(_t.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function Nc(t,e={}){let{lineCounter:i,prettyErrors:n}=yc(e),r=new wc.Parser(i?.addNewLine),a=new gc.Composer(e),o=null;for(let s of a.compose(r.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new _t.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(o.errors.forEach(_t.prettifyError(t,i)),o.warnings.forEach(_t.prettifyError(t,i))),o}function Uh(t,e,i){let n;typeof e=="function"?n=e:i===void 0&&e&&typeof e=="object"&&(i=e);let r=Nc(t,i);if(!r)return null;if(r.warnings.forEach(a=>Wh.warn(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},i))}function Yh(t,e,i){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let r=Math.round(i);i=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=i??e??{};if(!r)return}return Jh.isDocument(t)&&!n?t.toString(i):new zh.Document(t,n,i).toString(i)}Ot.parse=Uh;Ot.parseAllDocuments=Gh;Ot.parseDocument=Nc;Ot.stringify=Yh});var ea=w(P=>{"use strict";var Xh=Mr(),Qh=Et(),Zh=wr(),Zr=Pt(),ep=ct(),ge=C(),tp=de(),ip=T(),np=pe(),rp=me(),ap=Bi(),op=Gr(),sp=Yr(),cp=Qr(),Wi=bc(),Sc=rt();P.Composer=Xh.Composer;P.Document=Qh.Document;P.Schema=Zh.Schema;P.YAMLError=Zr.YAMLError;P.YAMLParseError=Zr.YAMLParseError;P.YAMLWarning=Zr.YAMLWarning;P.Alias=ep.Alias;P.isAlias=ge.isAlias;P.isCollection=ge.isCollection;P.isDocument=ge.isDocument;P.isMap=ge.isMap;P.isNode=ge.isNode;P.isPair=ge.isPair;P.isScalar=ge.isScalar;P.isSeq=ge.isSeq;P.Pair=tp.Pair;P.Scalar=ip.Scalar;P.YAMLMap=np.YAMLMap;P.YAMLSeq=rp.YAMLSeq;P.CST=ap;P.Lexer=op.Lexer;P.LineCounter=sp.LineCounter;P.Parser=cp.Parser;P.parse=Wi.parse;P.parseAllDocuments=Wi.parseAllDocuments;P.parseDocument=Wi.parseDocument;P.stringify=Wi.stringify;P.visit=Sc.visit;P.visitAsync=Sc.visitAsync});var ba=Oa(ea(),1);import{promises as Om}from"fs";import Le from"path";import{createHash as dp}from"node:crypto";import{promises as U}from"node:fs";import V from"node:path";import{TextDecoder as hp}from"node:util";var lp=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),up=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function fp(t){return t.toLowerCase().startsWith(".env")}function jt(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>fp(n))?"environment-file":i.some(n=>up.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>lp.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function we(t){return t!==0&&t!==0n&&t!=="0"}function G(t,e){return we(t.dev)&&we(e.dev)&&we(t.ino)&&we(e.ino)}function I(t,e){let i=we(t.dev)&&we(e.dev);if(i&&t.dev!==e.dev)return!1;let n=we(t.ino)&&we(e.ino);return n&&t.ino!==e.ino?!1:i&&n?!0:t.birthtime===e.birthtime}var Ki=1024*1024;function ta(t,e){let i=V.relative(t,e);return i===""||!V.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${V.sep}`)}function pp(t){let e=V.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||V.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),n=jt(t);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${t}`);return t}function mp(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function vp(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Ji(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return G(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function kc(t){let e=await U.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await U.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function gp(t,e){let i=V.resolve(t),n=V.resolve(e);if(!ta(i,n))throw new Error("Native artifact path is outside its root");let r=[await kc(i)],a=i;for(let o of V.relative(i,n).split(V.sep).filter(Boolean)){a=V.join(a,o);let s=await kc(a);if(!ta(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function Ec(t){for(let e of t){let i=await U.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!vp(e,i)||await U.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function Y(t){let e=pp(t.ref),i=mp(t.maxBytes??Ki),n=V.resolve(t.root,...e.split("/")),r=await gp(t.root,V.dirname(n));await t.hooks?.afterParentChainCaptured?.();let a=await U.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await U.realpath(n);if(!ta(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await U.open(n,"r");try{let[c,l,d]=await Promise.all([s.stat(),U.lstat(n),U.realpath(n)]);if(await Ec(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!Ji(a,c)||!Ji(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let u=[],f=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let S=i+1-f,k=await s.read(m,0,Math.min(m.length,S),null);if(k.bytesRead===0)break;if(f+=k.bytesRead,f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);u.push(Buffer.from(m.subarray(0,k.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),U.lstat(n),U.realpath(n)]);if(await Ec(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Ji(c,g)||!Ji(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(u,f),N;try{N=new hp("utf-8",{fatal:!0}).decode(y)}catch(S){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:S})}return{ref:e,size:f,hash:dp("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}var na=Oa(ea(),1);import Gi from"path";var Xi=64*1024,Ui=1024,Yi=64,ra=5,wp=[".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/**"],F={include:["**/*"],exclude:[...wp],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function yp(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||Gi.posix.isAbsolute(i)||Gi.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function Te(t){let e=yp(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Rc(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function aa(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||Gi.posix.isAbsolute(n)||Gi.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function $t(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Pc(t,e,i){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function Qi(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Ui)throw new Error(`${e} exceeds ${Ui} characters`);let i=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?i+=1:t[n]==="*"&&(i+=1,t[n+1]==="*"&&(n+=1));if(i>Yi)throw new Error(`${e} contains more than ${Yi} wildcard tokens`);return t}function Cc(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>Qi(n,e)))].sort((n,r)=>n.localeCompare(r,"en"))}function ia(t,e,i){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Np(t){if(t===void 0)return{...F,include:[...F.include],exclude:[...F.exclude]};let e=$t(t,"native.snapshot");return{include:Cc(e.include,"native.snapshot.include",F.include),exclude:Cc(e.exclude,"native.snapshot.exclude",F.exclude),max_files:ia(e.max_files,F.max_files,"native.snapshot.max_files"),max_total_bytes:ia(e.max_total_bytes,F.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:ia(e.max_duration_ms,F.max_duration_ms,"native.snapshot.max_duration_ms")}}function bp(t){if(t===void 0)return;let e=$t(t,"native.pending_root_move"),i=e.id,n=e.from_artifact_root,r=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=$t(e.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:Te(n),toArtifactRoot:Te(r),stage:a,...o?{cleanup:o}:{}}}function Sp(t){let e=$t(t,"native");if(typeof e.artifact_root!="string")throw new Error("native.artifact_root must be a string");let i=e.clarification_mode??"sequential";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let n=e.archive_confirmation??"automatic";if(n!=="automatic"&&n!=="required")throw new Error("native.archive_confirmation must be automatic or required");let r=e.max_verify_failures??ra;if(!Number.isSafeInteger(r)||r<1)throw new Error("native.max_verify_failures must be a positive integer");let a=bp(e.pending_root_move);return{artifact_root:Te(e.artifact_root),language:Pc(e.language,"en","native.language"),clarification_mode:i,archive_confirmation:n,max_verify_failures:r,snapshot:Np(e.snapshot),...a?{pending_root_move:a}:{}}}function kp(t){let e=$t(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Rc(e.artifact_layout),language:Pc(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function Ep(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Cp(t,e,i,n,r){let a=t.schema!==void 0;if(!(a||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!a)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:n,...e?{native:e}:{},...i?{classic:i}:{}}}function Zi(t,e={}){let i=(0,na.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let n=i.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=n,a=Ep(r.ambient_resume),o=r.native===void 0?void 0:Sp(r.native),s=r.classic===void 0?void 0:kp(r.classic),c=Cp(r,o,s,a,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function oa(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Te(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:ra,snapshot:{...F,include:[...F.include],exclude:[...F.exclude]}}}}import{createHash as Pp}from"crypto";import{promises as nn}from"fs";import ye from"path";import{constants as en,promises as Ie}from"fs";var ne=class extends Error{reason;constructor(e,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=e}};function sa(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Ac(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Ht(t){return{dev:t.dev,ino:t.ino,birthtime:sa(t)}}function tn(t,e){let i=Ht(t),n=Ht(e);return G(i,n)?I(i,n):I(i,n)&&sa(t)===sa(e)&&Ac(t)===Ac(e)&&t.size===e.size}async function Lt(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,a=await Ie.lstat(t,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new ne("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new ne("too-large",`${n} exceeds ${e} bytes`);let o=await Ie.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:Ht(a)});let s=process.platform==="win32"?en.O_RDONLY:en.O_RDONLY|en.O_NOFOLLOW|en.O_NONBLOCK,c;try{c=await Ie.open(t,s)}catch(l){throw l.code==="ELOOP"?new ne("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:r}),Ie.lstat(t,{bigint:r}),Ie.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!tn(a,l)||!tn(a,d))throw new ne("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:Ht(l)}),await i.hooks?.afterOpen?.();let f=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-m,{bytesRead:S}=await c.read(g,0,Math.min(g.length,N),null);if(S===0)break;if(m+=S,m>e)throw new ne("too-large",`${n} exceeds ${e} bytes`);f.push(Buffer.from(g.subarray(0,S)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),Ie.lstat(t,{bigint:r}),Ie.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!tn(a,h)||!tn(a,p))throw new ne("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:Ht(h)}),{bytes:Buffer.concat(f,m),stat:h,realPath:y}}finally{await c.close()}}function Rp(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function ca(t,e){let i=ye.relative(t,e);return i===""||!ye.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ye.sep}`)}async function xc(t,e){let i=ye.resolve(t),n=await nn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return nn.realpath(i)}async function Tc(t,e,i,n){let r=t;for(let a=0;a<i.length;a++){r=ye.join(r,i[a]);let o;try{o=await nn.lstat(r)}catch(d){if(Rp(d))return{exists:!1,kind:"missing"};throw d}let s=ye.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${n.label} ancestor ${s} must be a real directory`);if(c&&(n.expected==="file"&&!o.isFile()||n.expected==="directory"&&!o.isDirectory()||n.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await nn.realpath(r);if(!ca(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function Mt(t,e,i){let n=aa(e,i.label),r=ye.resolve(t),a=await xc(r,i.label),o=n.split("/"),s=ye.resolve(r,...o);if(!ca(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await Tc(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function Qe(t,e,i,n){let r=await Mt(t,e,{label:n.label,expected:"file"});if(!r.exists){let o=new Error(`${n.label} does not exist`);throw o.code="ENOENT",o}let a=await xc(r.projectRoot,n.label);return Lt(r.target,i,{...n,verify:async(o,s)=>{if(!ca(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await Tc(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var Dt=".comet/config.yaml";function Ap(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function la(t,e={}){return(await rn(t,e)).document}async function xp(t){try{return(await Qe(t,Dt,Xi,{label:Dt})).bytes}catch(e){if(Ap(e))return null;throw e}}function Tp(t){return t?{exists:!0,sha256:Pp("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function rn(t,e={}){let i=await xp(t);return{document:i?Zi(i.toString("utf8"),e):null,identity:Tp(i)}}var Cw=16*1024;import{promises as Ze}from"fs";import A from"path";import jp from"os";var an=".comet/config.yaml";async function fa(t){try{return await Ze.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function $p(t){try{let e=await Ze.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Ft(t,e){let i=A.relative(t,e);return i===""||!A.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${A.sep}`)}async function Bt(t){let e=[],i=t;for(;!await fa(i);){let r=A.dirname(i);if(r===i)break;e.push(A.basename(i)),i=r}let n=await Ze.realpath(i);return A.resolve(n,...e.reverse())}async function jc(t){try{return(await Ze.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function on(t){let e=A.resolve(t);try{(await Ze.stat(e)).isDirectory()||(e=A.dirname(e))}catch(r){if(r.code!=="ENOENT")throw r}let i=e,n=A.resolve(jp.homedir());for(;;){if(!(e===n&&i!==n)){let o=A.join(e,...an.split("/")),s=e===i||await $p(o);if(await fa(o)&&s)return e}if(await fa(A.join(e,".git")))return e;let a=A.dirname(e);if(a===e)return i;e=a}}function sn(t){return Te(t)}async function Hp(t,e){let i=sn(e),n=A.resolve(t,...i.split("/")),r=await Ze.realpath(t),a=await Bt(n);if(!Ft(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function da(t,e){let i=sn(e),n=await Hp(t,i),r=A.join(n,"comet");if(await jc(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([Bt(n),Bt(r)]);if(!Ft(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:A.resolve(t),configFile:A.join(t,...an.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:A.join(r,"specs"),changesDir:A.join(r,"changes"),archiveDir:A.join(r,"archive"),runtimeDir:A.join(r,"runtime"),locksDir:A.join(r,"runtime","locks"),transactionsDir:A.join(r,"runtime","transactions")}}function re(t,e){return Ft(A.resolve(t),A.resolve(e))}async function j(t,e){let i=A.resolve(t),n=A.resolve(e);if(!Ft(i,n))throw new Error(`Path is outside the Native root: ${e}`);if(await jc(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[r,a]=await Promise.all([Bt(i),Bt(n)]);if(!Ft(r,a))throw new Error(`Path resolves outside the Native root: ${e}`);return n}var cn=Qi;function Mp(t="docs",e="en"){return oa(t,e)}async function qt(t){let e=(await la(t))?.config??null;return e?.native?e:null}async function $c(t){let e=await on(t.startPath),i=await qt(e);if(!i&&t.allowMissingConfig===!1)throw new Error(`${an} was not found`);if(i?.native.pending_root_move)throw new Error(`Native root move ${i.native.pending_root_move.id} is incomplete; use comet native doctor --repair`);let n=t.explicitArtifactRoot?sn(t.explicitArtifactRoot):void 0;if(i&&n&&n!==i.native.artifact_root)throw new Error(`Configured Native artifact root is ${i.native.artifact_root}; refusing conflicting root ${n}`);let r=i??Mp(n??"docs"),a=await da(e,r.native.artifact_root);return{config:r,paths:a,configured:i!==null}}import{AsyncLocalStorage as Dp}from"async_hooks";var Uw=16*1024;var Yw=new Dp;import{TextDecoder as Kp}from"util";import{createHash as Fp}from"node:crypto";import{constants as ln,promises as X}from"node:fs";import Q from"node:path";import{TextDecoder as Bp}from"node:util";function fn(t,e){let i=Q.relative(t,e);return i===""||!Q.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Q.sep}`)}function qp(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Vp(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function zp(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function un(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function pa(t,e){let i=await X.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await X.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Hc(t,e,i){let n=Q.resolve(t),r=Q.resolve(e);if(!fn(n,r))throw new Error(`${i} is outside its managed root`);let a=[await pa(n,i)],o=n;for(let s of Q.relative(n,r).split(Q.sep).filter(Boolean)){await Ne(a,i),o=Q.join(o,s);let c=await pa(o,i);if(!fn(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await Ne(a,i),a}async function Ne(t,e){for(let i of t){let n=await X.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Vp(i,n)||await X.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Wp(t,e,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-r,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>e)throw new Error(`${i} exceeds ${e} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function et(t){let e=qp(t.maxBytes),i=Q.resolve(t.file),n=await Hc(t.root,Q.dirname(i),t.label),r=await Promise.all((t.forbiddenRoots??[]).map(d=>pa(Q.resolve(d),t.label)));await t.hooks?.afterParentChainCaptured?.(),await Ne(n,t.label);let a=await X.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=zp(a),s=await X.realpath(i);if(!fn(n[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(r.some(d=>fn(d.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?ln.O_RDONLY:ln.O_RDONLY|ln.O_NOFOLLOW|ln.O_NONBLOCK,l=await X.open(i,c);try{let d=await l.stat();await t.hooks?.afterOpen?.();let[u,f]=await Promise.all([X.lstat(i),X.realpath(i)]);if(await Ne(n,t.label),await Ne(r,t.label),!d.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!un(o,d)||!un(o,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await Wp(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),X.lstat(i),X.realpath(i)]);if(await Ne(n,t.label),await Ne(r,t.label),!h.isFile()||h.isSymbolicLink()||p!==s||!un(o,g)||!un(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:Fp("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function Lc(t){let e=await et(t),i;try{i=new Bp("utf-8",{fatal:!0}).decode(e.bytes)}catch(n){throw new Error(`${t.label} is not valid UTF-8`,{cause:n})}return{...e,text:i}}async function ma(t){let e=await Hc(t.root,t.directory,t.label);return{verify:()=>Ne(e,t.label)}}var dy=256*1024,hy=1024*1024,py=16*1024;var my=64*1024*1024;var vy=new Kp("utf-8",{fatal:!0});import hn from"path";import{createHash as Up}from"crypto";function B(t){return Up("sha256").update(t).digest("hex")}var jy={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},Xp=1e3,Qp=8*1024*1024,Zp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,em=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),tm=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),im=new Set(["schema","include","exclude","hash"]),nm=new Set(["provider","gitSelection","physicalSelection","projection"]),rm=new Set(["provider","selection"]),am=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),om=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),sm=new Set(["schema","status","before","after"]),cm=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),lm=new Set(["path","hash","size","type","gitObjectId"]),um=new Set(["path","size","type","reason"]),fm=new Set(["ref","hash","count"]),dm=new Set(["change-created","legacy-migration","explicit"]),hm=new Set(["file","directory","other"]),pm=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),pn=/^[a-f0-9]{64}$/u,mm=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var $y=64*1024,Hy=64*1024;var Ly={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},My={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function dn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var Dy=(1n<<256n)-1n;function vm(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function gm(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
|
|
143
|
-
`)}function
|
|
144
|
-
${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function ga(t,e,i){let n=new Set(e),r=[...e];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!n.has(a+1)&&(n.add(a+1),r.push(a+1))}return n}function ym(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function qc(t){let e=cn(t,"Native snapshot pattern"),i=[];for(let n=0;n<e.length;n+=1){let r=e[n];r==="*"&&e[n+1]==="*"?(n+=1,e[n+1]==="/"?(n+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):r==="*"?i.push({kind:"star"}):r==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:r})}return(n,r)=>{let a=r?ym(r):void 0;if(a&&!a())return!1;let o=ga(i,new Set([0]),a);if(o===null)return!1;for(let s of n){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let d=i[l];d&&(d.kind==="literal"&&d.value===s||d.kind==="question"&&s!=="/"?c.add(l+1):d.kind==="star"&&s!=="/"||d.kind==="globstar"?c.add(l):d.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=ga(i,c,a),o===null||o.size===0)return!1}return ga(i,o,a)?.has(i.length)??!1}}function Nm(t){if(t===void 0)return;let e=[...new Set(t.include.map(r=>cn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(t.exclude.map(r=>cn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let n=wm(e,i);if("hash"in t&&t.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:n},includeMatchers:e.map(qc),excludeMatchers:i.map(qc),excludedDirectoryPrefixes:i.flatMap(r=>{if(!r.endsWith("/**"))return[];let a=r.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((r,a)=>r.localeCompare(a,"en"))}}function z(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function W(t,e,i){let n=Object.keys(t).find(r=>!e.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function it(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function ae(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function Wc(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=hn.posix.normalize(t);if(i!==t||hn.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function bm(t,e){let i=z(t,`Native snapshot entry ${e}`);W(i,lm,`Native snapshot entry ${e}`);let n=Wc(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!pn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let r={path:n,hash:i.hash,size:ae(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!mm.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function Sm(t,e){let i=z(t,`Native snapshot omission ${e}`);if(W(i,um,`Native snapshot omission ${e}`),!hm.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!pm.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:Wc(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:ae(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function km(t){let e=z(t,"Native snapshot omission overflow");if(W(e,fm,"Native snapshot omission overflow"),typeof e.hash!="string"||!pn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:it(e.count,"Native snapshot omission overflow count")}}function tt(t,e){let i=z(t,e);if(W(i,om,e),typeof i.hash!="string"||!pn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let n=ae(i.recordCount,`${e} recordCount`),r=ae(i.storedRecordCount,`${e} storedRecordCount`),a=ae(i.stdoutBytes,`${e} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function Vc(t){let e=z(t,"Native Git selection evidence");if(W(e,am,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=tt(e.stageBefore,"Native Git selection stageBefore"),n=tt(e.combined,"Native Git selection combined"),r=tt(e.stageAfter,"Native Git selection stageAfter"),a=tt(e.finalStageBefore,"Native Git selection finalStageBefore"),o=tt(e.finalCombined,"Native Git selection finalCombined"),s=tt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(u=>u.overflow),l=!dn(i,r)||!dn(r,a)||!dn(n,o)||!dn(a,s),d=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==d)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:d,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function zc(t,e){let i=z(t,e);if(W(i,cm,e),typeof i.hash!="string"||!pn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let n=ae(i.visitedNodeCount,`${e} visitedNodeCount`),r=ae(i.recordCount,`${e} recordCount`),a=ae(i.storedRecordCount,`${e} storedRecordCount`),o=ae(i.encodedBytes,`${e} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function Em(t){let e=z(t,"Native physical selection evidence");if(W(e,sm,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=zc(e.before,"Native physical selection before"),n=zc(e.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!vm(i,n);if(!r&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=r&&a?"overflow-and-changed":r?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:n}}function Jc(t){let e=z(t,"Native content snapshot manifest");if(W(e,em,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!dm.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=z(e.capture,"Native content snapshot capture");if(W(v,nm,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let R=v.gitSelection===void 0?void 0:Vc(v.gitSelection),b=v.physicalSelection===void 0?void 0:Em(v.physicalSelection),x=null;if(v.projection!==void 0){let D=z(v.projection,"Native content snapshot projection");if(W(D,rm,"Native content snapshot projection"),D.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");x={provider:"git",...D.selection===void 0?{}:{selection:Vc(D.selection)}}}if(v.provider==="git"){if(b||x)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...R?{gitSelection:R}:{}}}else{if(R)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&x)throw new Error("Native physical-tree capture cannot combine selection and projection");i=x?{provider:"physical-tree",projection:x}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=z(e.limits,"Native content snapshot limits");W(n,tm,"Native content snapshot limits");let r={maxFiles:it(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:it(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:it(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:it(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:it(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=z(e.policy,"Native snapshot policy");if(W(v,im,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=Nm({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(bm),s=e.omitted.map(Sm),c=ae(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:km(e.omissionOverflow);if(o.length>r.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>r.maxFileBytes)||o.reduce((v,R)=>v+R.size,0)>r.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>Xp||c<s.length)throw new Error("Native content snapshot omission count is invalid");let d=c-s.length;if(d===0&&l||d>0&&l?.count!==d)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let u=s.filter(v=>v.reason==="git-enumeration-limit"),f=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...u,...f])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(u.length>1||f.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,g=m?.status==="overflow"||m?.status==="overflow-and-changed",h=m?.status==="changed"||m?.status==="overflow-and-changed";if(g!==(u.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(f.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let p=s.filter(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...y])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(p.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let N=i?.physicalSelection,S=N?.status==="overflow"||N?.status==="overflow-and-changed",k=N?.status==="changed"||N?.status==="overflow-and-changed";if(S!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(k!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(gm(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function Cm(t,e){if(!Zp.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=hn.join(t.changesDir,e);if(!re(t.changesDir,i))throw new Error("Native change path escaped");return hn.join(i,"runtime","baseline-manifest.json")}async function Kc(t,e){let i=Cm(t,e);await j(t.nativeRoot,i);try{let n=await Lc({root:t.nativeRoot,file:i,maxBytes:Qp,label:"Native baseline snapshot manifest"});return Jc(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var IN=256*1024;var zN={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 ib=16*1024;var je="comet.native.v3",$e="comet.native.v2",He="comet.native.v1";var Uc=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],jm=new Set(Uc),Yc=new Set([...Uc,"minimum_runtime_version","revision"]),$m=new Set([...Yc,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Hm=new Set(["capability","operation","source","base_hash"]),Lm=new Set(["shape","build","verify","archive"]),Mm=new Set(["implicit","confirmed"]),Dm=new Set(["pending","pass","fail"]),Me="comet-state.yaml",ya=/^[a-f0-9]{64}$/u,Xc=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Fm=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,Na=class extends Error{constructor(i,n){super(`Native change ${i} uses ${n}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=n;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},Se=class extends Error{constructor(i,n){super(i!==je||n===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${n}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=n;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},mn=class extends Error{constructor(i,n,r){super(`Native change ${i} revision conflict: expected ${n}, actual ${r}`);this.change=i;this.expectedRevision=n;this.actualRevision=r;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},vn=class extends Error{constructor(i,n,r,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${n} omitted entr${n===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=n;this.omittedByReason=r;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},kb=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
|
|
145
|
-
`);function
|
|
146
|
-
${
|
|
147
|
-
`}}function
|
|
148
|
-
`}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function
|
|
149
|
-
`}}async function
|
|
142
|
+
`,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=Ji(e),n=Qe(i);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=Ji(e),n=Qe(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Nc.Parser=na});var Cc=w(Ot=>{"use strict";var bc=Wr(),Gh=Et(),_t=Pt(),Kh=qn(),Uh=C(),Yh=ia(),kc=ra();function Sc(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Yh.LineCounter||null,prettyErrors:e}}function Xh(t,e={}){let{lineCounter:i,prettyErrors:n}=Sc(e),r=new kc.Parser(i?.addNewLine),a=new bc.Composer(e),o=Array.from(a.compose(r.parse(t)));if(n&&i)for(let s of o)s.errors.forEach(_t.prettifyError(t,i)),s.warnings.forEach(_t.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function Ec(t,e={}){let{lineCounter:i,prettyErrors:n}=Sc(e),r=new kc.Parser(i?.addNewLine),a=new bc.Composer(e),o=null;for(let s of a.compose(r.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new _t.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(o.errors.forEach(_t.prettifyError(t,i)),o.warnings.forEach(_t.prettifyError(t,i))),o}function Qh(t,e,i){let n;typeof e=="function"?n=e:i===void 0&&e&&typeof e=="object"&&(i=e);let r=Ec(t,i);if(!r)return null;if(r.warnings.forEach(a=>Kh.warn(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},i))}function Zh(t,e,i){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let r=Math.round(i);i=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=i??e??{};if(!r)return}return Uh.isDocument(t)&&!n?t.toString(i):new Gh.Document(t,n,i).toString(i)}Ot.parse=Qh;Ot.parseAllDocuments=Xh;Ot.parseDocument=Ec;Ot.stringify=Zh});var Ui=w(P=>{"use strict";var ep=Wr(),tp=Et(),ip=Er(),aa=Pt(),np=ct(),ge=C(),rp=de(),ap=T(),op=pe(),sp=me(),cp=Wi(),lp=ea(),up=ia(),fp=ra(),Ki=Cc(),Rc=rt();P.Composer=ep.Composer;P.Document=tp.Document;P.Schema=ip.Schema;P.YAMLError=aa.YAMLError;P.YAMLParseError=aa.YAMLParseError;P.YAMLWarning=aa.YAMLWarning;P.Alias=np.Alias;P.isAlias=ge.isAlias;P.isCollection=ge.isCollection;P.isDocument=ge.isDocument;P.isMap=ge.isMap;P.isNode=ge.isNode;P.isPair=ge.isPair;P.isScalar=ge.isScalar;P.isSeq=ge.isSeq;P.Pair=rp.Pair;P.Scalar=ap.Scalar;P.YAMLMap=op.YAMLMap;P.YAMLSeq=sp.YAMLSeq;P.CST=cp;P.Lexer=lp.Lexer;P.LineCounter=up.LineCounter;P.Parser=fp.Parser;P.parse=Ki.parse;P.parseAllDocuments=Ki.parseAllDocuments;P.parseDocument=Ki.parseDocument;P.stringify=Ki.stringify;P.visit=Rc.visit;P.visitAsync=Rc.visitAsync});var Ra=Cn(Ui(),1);import{promises as Fm}from"fs";import Fe from"path";import{createHash as mp}from"node:crypto";import{promises as U}from"node:fs";import V from"node:path";import{TextDecoder as vp}from"node:util";var dp=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),hp=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function pp(t){return t.toLowerCase().startsWith(".env")}function jt(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>pp(n))?"environment-file":i.some(n=>hp.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>dp.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function we(t){return t!==0&&t!==0n&&t!=="0"}function K(t,e){return we(t.dev)&&we(e.dev)&&we(t.ino)&&we(e.ino)}function I(t,e){let i=we(t.dev)&&we(e.dev);if(i&&t.dev!==e.dev)return!1;let n=we(t.ino)&&we(e.ino);return n&&t.ino!==e.ino?!1:i&&n?!0:t.birthtime===e.birthtime}var Xi=1024*1024;function oa(t,e){let i=V.relative(t,e);return i===""||!V.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${V.sep}`)}function gp(t){let e=V.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||V.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),n=jt(t);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${t}`);return t}function wp(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function yp(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Yi(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return K(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Pc(t){let e=await U.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await U.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function Np(t,e){let i=V.resolve(t),n=V.resolve(e);if(!oa(i,n))throw new Error("Native artifact path is outside its root");let r=[await Pc(i)],a=i;for(let o of V.relative(i,n).split(V.sep).filter(Boolean)){a=V.join(a,o);let s=await Pc(a);if(!oa(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function Ac(t){for(let e of t){let i=await U.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!yp(e,i)||await U.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function Y(t){let e=gp(t.ref),i=wp(t.maxBytes??Xi),n=V.resolve(t.root,...e.split("/")),r=await Np(t.root,V.dirname(n));await t.hooks?.afterParentChainCaptured?.();let a=await U.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await U.realpath(n);if(!oa(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await U.open(n,"r");try{let[c,l,d]=await Promise.all([s.stat(),U.lstat(n),U.realpath(n)]);if(await Ac(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!Yi(a,c)||!Yi(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let u=[],f=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let k=i+1-f,S=await s.read(m,0,Math.min(m.length,k),null);if(S.bytesRead===0)break;if(f+=S.bytesRead,f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);u.push(Buffer.from(m.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),U.lstat(n),U.realpath(n)]);if(await Ac(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Yi(c,g)||!Yi(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(u,f),N;try{N=new vp("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:k})}return{ref:e,size:f,hash:mp("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}var ca=Cn(Ui(),1);import Qi from"path";var Ht=64*1024,Zi=1024,en=64,la=5,bp=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],B={include:["**/*"],exclude:[...bp],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function kp(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||Qi.posix.isAbsolute(i)||Qi.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function Ie(t){let e=kp(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Tc(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function ua(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||Qi.posix.isAbsolute(n)||Qi.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function $t(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Ic(t,e,i){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function tn(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Zi)throw new Error(`${e} exceeds ${Zi} characters`);let i=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?i+=1:t[n]==="*"&&(i+=1,t[n+1]==="*"&&(n+=1));if(i>en)throw new Error(`${e} contains more than ${en} wildcard tokens`);return t}function xc(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>tn(n,e)))].sort((n,r)=>n.localeCompare(r,"en"))}function sa(t,e,i){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Sp(t){if(t===void 0)return{...B,include:[...B.include],exclude:[...B.exclude]};let e=$t(t,"native.snapshot");return{include:xc(e.include,"native.snapshot.include",B.include),exclude:xc(e.exclude,"native.snapshot.exclude",B.exclude),max_files:sa(e.max_files,B.max_files,"native.snapshot.max_files"),max_total_bytes:sa(e.max_total_bytes,B.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:sa(e.max_duration_ms,B.max_duration_ms,"native.snapshot.max_duration_ms")}}function Ep(t){if(t===void 0)return;let e=$t(t,"native.pending_root_move"),i=e.id,n=e.from_artifact_root,r=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=$t(e.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:Ie(n),toArtifactRoot:Ie(r),stage:a,...o?{cleanup:o}:{}}}function Cp(t,e={}){let i=$t(t,"native"),n=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let r=i.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??la;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Ep(i.pending_root_move);return{artifact_root:Ie(n),language:Ic(i.language,"en","native.language"),clarification_mode:r,archive_confirmation:a,max_verify_failures:o,snapshot:Sp(i.snapshot),...s?{pending_root_move:s}:{}}}function Rp(t){let e=$t(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Tc(e.artifact_layout),language:Ic(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function Pp(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Ap(t,e,i,n,r){let a=t.schema!==void 0;if(!(a||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!a)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:n,...e?{native:e}:{},...i?{classic:i}:{}}}function Lt(t,e={}){let i=(0,ca.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let n=i.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=n,a=Pp(r.ambient_resume),o=r.native===void 0?void 0:Cp(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),s=r.classic===void 0?void 0:Rp(r.classic),c=Ap(r,o,s,a,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function nn(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Ie(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:la,snapshot:{...B,include:[...B.include],exclude:[...B.exclude]}}}}import{createHash as Tp}from"crypto";import{promises as on}from"fs";import ye from"path";import{constants as rn,promises as _e}from"fs";var ne=class extends Error{reason;constructor(e,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=e}};function fa(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function _c(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Ft(t){return{dev:t.dev,ino:t.ino,birthtime:fa(t)}}function an(t,e){let i=Ft(t),n=Ft(e);return K(i,n)?I(i,n):I(i,n)&&fa(t)===fa(e)&&_c(t)===_c(e)&&t.size===e.size}async function Mt(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,a=await _e.lstat(t,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new ne("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new ne("too-large",`${n} exceeds ${e} bytes`);let o=await _e.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:Ft(a)});let s=process.platform==="win32"?rn.O_RDONLY:rn.O_RDONLY|rn.O_NOFOLLOW|rn.O_NONBLOCK,c;try{c=await _e.open(t,s)}catch(l){throw l.code==="ELOOP"?new ne("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:r}),_e.lstat(t,{bigint:r}),_e.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!an(a,l)||!an(a,d))throw new ne("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:Ft(l)}),await i.hooks?.afterOpen?.();let f=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-m,{bytesRead:k}=await c.read(g,0,Math.min(g.length,N),null);if(k===0)break;if(m+=k,m>e)throw new ne("too-large",`${n} exceeds ${e} bytes`);f.push(Buffer.from(g.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),_e.lstat(t,{bigint:r}),_e.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!an(a,h)||!an(a,p))throw new ne("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:Ft(h)}),{bytes:Buffer.concat(f,m),stat:h,realPath:y}}finally{await c.close()}}function xp(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function da(t,e){let i=ye.relative(t,e);return i===""||!ye.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ye.sep}`)}async function Oc(t,e){let i=ye.resolve(t),n=await on.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return on.realpath(i)}async function jc(t,e,i,n){let r=t;for(let a=0;a<i.length;a++){r=ye.join(r,i[a]);let o;try{o=await on.lstat(r)}catch(d){if(xp(d))return{exists:!1,kind:"missing"};throw d}let s=ye.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${n.label} ancestor ${s} must be a real directory`);if(c&&(n.expected==="file"&&!o.isFile()||n.expected==="directory"&&!o.isDirectory()||n.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await on.realpath(r);if(!da(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function Bt(t,e,i){let n=ua(e,i.label),r=ye.resolve(t),a=await Oc(r,i.label),o=n.split("/"),s=ye.resolve(r,...o);if(!da(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await jc(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function Oe(t,e,i,n){let r=await Bt(t,e,{label:n.label,expected:"file"});if(!r.exists){let o=new Error(`${n.label} does not exist`);throw o.code="ENOENT",o}let a=await Oc(r.projectRoot,n.label);return Mt(r.target,i,{...n,verify:async(o,s)=>{if(!da(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await jc(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var Dt=".comet/config.yaml";function Ip(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ha(t,e={}){return(await sn(t,e)).document}async function _p(t){try{return(await Oe(t,Dt,Ht,{label:Dt})).bytes}catch(e){if(Ip(e))return null;throw e}}function Op(t){return t?{exists:!0,sha256:Tp("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function sn(t,e={}){let i=await _p(t);return{document:i?Lt(i.toString("utf8"),e):null,identity:Op(i)}}var Iw=16*1024;import{promises as Ze}from"fs";import A from"path";import Fp from"os";var ln=".comet/config.yaml";async function va(t){try{return await Ze.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Mp(t){try{let e=await Ze.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function qt(t,e){let i=A.relative(t,e);return i===""||!A.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${A.sep}`)}async function Vt(t){let e=[],i=t;for(;!await va(i);){let r=A.dirname(i);if(r===i)break;e.push(A.basename(i)),i=r}let n=await Ze.realpath(i);return A.resolve(n,...e.reverse())}async function Hc(t){try{return(await Ze.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function un(t){let e=A.resolve(t);try{(await Ze.stat(e)).isDirectory()||(e=A.dirname(e))}catch(r){if(r.code!=="ENOENT")throw r}let i=e,n=A.resolve(Fp.homedir());for(;;){if(!(e===n&&i!==n)){let o=A.join(e,...ln.split("/")),s=e===i||await Mp(o);if(await va(o)&&s)return e}if(await va(A.join(e,".git")))return e;let a=A.dirname(e);if(a===e)return i;e=a}}function fn(t){return Ie(t)}async function Bp(t,e){let i=fn(e),n=A.resolve(t,...i.split("/")),r=await Ze.realpath(t),a=await Vt(n);if(!qt(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function ga(t,e){let i=fn(e),n=await Bp(t,i),r=A.join(n,"comet");if(await Hc(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([Vt(n),Vt(r)]);if(!qt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:A.resolve(t),configFile:A.join(t,...ln.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:A.join(r,"specs"),changesDir:A.join(r,"changes"),archiveDir:A.join(r,"archive"),runtimeDir:A.join(r,"runtime"),locksDir:A.join(r,"runtime","locks"),transactionsDir:A.join(r,"runtime","transactions")}}function re(t,e){return qt(A.resolve(t),A.resolve(e))}async function j(t,e){let i=A.resolve(t),n=A.resolve(e);if(!qt(i,n))throw new Error(`Path is outside the Native root: ${e}`);if(await Hc(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[r,a]=await Promise.all([Vt(i),Vt(n)]);if(!qt(r,a))throw new Error(`Path resolves outside the Native root: ${e}`);return n}var dn=tn;function qp(t="docs",e="en"){return nn(t,e)}async function Wt(t){let e=(await ha(t))?.config??null;return e?.native?e:null}async function Lc(t){let e=await un(t.startPath),i=await Wt(e);if(!i&&t.allowMissingConfig===!1)throw new Error(`${ln} was not found`);if(i?.native.pending_root_move)throw new Error(`Native root move ${i.native.pending_root_move.id} is incomplete; use comet native doctor --repair`);let n=t.explicitArtifactRoot?fn(t.explicitArtifactRoot):void 0;if(i&&n&&n!==i.native.artifact_root)throw new Error(`Configured Native artifact root is ${i.native.artifact_root}; refusing conflicting root ${n}`);let r=i??qp(n??"docs"),a=await ga(e,r.native.artifact_root);return{config:r,paths:a,configured:i!==null}}import{AsyncLocalStorage as Vp}from"async_hooks";var ty=16*1024;var iy=new Vp;import{TextDecoder as Xp}from"util";import{createHash as Wp}from"node:crypto";import{constants as hn,promises as X}from"node:fs";import Q from"node:path";import{TextDecoder as zp}from"node:util";function mn(t,e){let i=Q.relative(t,e);return i===""||!Q.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Q.sep}`)}function Jp(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Gp(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Kp(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function pn(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function ya(t,e){let i=await X.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await X.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Fc(t,e,i){let n=Q.resolve(t),r=Q.resolve(e);if(!mn(n,r))throw new Error(`${i} is outside its managed root`);let a=[await ya(n,i)],o=n;for(let s of Q.relative(n,r).split(Q.sep).filter(Boolean)){await Ne(a,i),o=Q.join(o,s);let c=await ya(o,i);if(!mn(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await Ne(a,i),a}async function Ne(t,e){for(let i of t){let n=await X.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Gp(i,n)||await X.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Up(t,e,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-r,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>e)throw new Error(`${i} exceeds ${e} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function et(t){let e=Jp(t.maxBytes),i=Q.resolve(t.file),n=await Fc(t.root,Q.dirname(i),t.label),r=await Promise.all((t.forbiddenRoots??[]).map(d=>ya(Q.resolve(d),t.label)));await t.hooks?.afterParentChainCaptured?.(),await Ne(n,t.label);let a=await X.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=Kp(a),s=await X.realpath(i);if(!mn(n[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(r.some(d=>mn(d.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?hn.O_RDONLY:hn.O_RDONLY|hn.O_NOFOLLOW|hn.O_NONBLOCK,l=await X.open(i,c);try{let d=await l.stat();await t.hooks?.afterOpen?.();let[u,f]=await Promise.all([X.lstat(i),X.realpath(i)]);if(await Ne(n,t.label),await Ne(r,t.label),!d.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!pn(o,d)||!pn(o,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await Up(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),X.lstat(i),X.realpath(i)]);if(await Ne(n,t.label),await Ne(r,t.label),!h.isFile()||h.isSymbolicLink()||p!==s||!pn(o,g)||!pn(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:Wp("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function Mc(t){let e=await et(t),i;try{i=new zp("utf-8",{fatal:!0}).decode(e.bytes)}catch(n){throw new Error(`${t.label} is not valid UTF-8`,{cause:n})}return{...e,text:i}}async function Na(t){let e=await Fc(t.root,t.directory,t.label);return{verify:()=>Ne(e,t.label)}}var wy=256*1024,yy=1024*1024,Ny=16*1024;var by=64*1024*1024;var ky=new Xp("utf-8",{fatal:!0});import gn from"path";import{createHash as Zp}from"crypto";function D(t){return Zp("sha256").update(t).digest("hex")}var By={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},tm=1e3,im=8*1024*1024,nm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,rm=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),am=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),om=new Set(["schema","include","exclude","hash"]),sm=new Set(["provider","gitSelection","physicalSelection","projection"]),cm=new Set(["provider","selection"]),lm=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),um=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),fm=new Set(["schema","status","before","after"]),dm=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),hm=new Set(["path","hash","size","type","gitObjectId"]),pm=new Set(["path","size","type","reason"]),mm=new Set(["ref","hash","count"]),vm=new Set(["change-created","legacy-migration","explicit"]),gm=new Set(["file","directory","other"]),wm=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),wn=/^[a-f0-9]{64}$/u,ym=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var Dy=64*1024,qy=64*1024;var Vy={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Wy={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function vn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var zy=(1n<<256n)-1n;function Nm(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function bm(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
|
|
143
|
+
`)}function km(t,e){return D(`comet.native.snapshot-policy.v1
|
|
144
|
+
${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function ka(t,e,i){let n=new Set(e),r=[...e];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!n.has(a+1)&&(n.add(a+1),r.push(a+1))}return n}function Sm(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function Wc(t){let e=dn(t,"Native snapshot pattern"),i=[];for(let n=0;n<e.length;n+=1){let r=e[n];r==="*"&&e[n+1]==="*"?(n+=1,e[n+1]==="/"?(n+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):r==="*"?i.push({kind:"star"}):r==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:r})}return(n,r)=>{let a=r?Sm(r):void 0;if(a&&!a())return!1;let o=ka(i,new Set([0]),a);if(o===null)return!1;for(let s of n){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let d=i[l];d&&(d.kind==="literal"&&d.value===s||d.kind==="question"&&s!=="/"?c.add(l+1):d.kind==="star"&&s!=="/"||d.kind==="globstar"?c.add(l):d.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=ka(i,c,a),o===null||o.size===0)return!1}return ka(i,o,a)?.has(i.length)??!1}}function Em(t){if(t===void 0)return;let e=[...new Set(t.include.map(r=>dn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(t.exclude.map(r=>dn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let n=km(e,i);if("hash"in t&&t.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:n},includeMatchers:e.map(Wc),excludeMatchers:i.map(Wc),excludedDirectoryPrefixes:i.flatMap(r=>{if(!r.endsWith("/**"))return[];let a=r.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((r,a)=>r.localeCompare(a,"en"))}}function W(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function z(t,e,i){let n=Object.keys(t).find(r=>!e.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function it(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function ae(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function Gc(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=gn.posix.normalize(t);if(i!==t||gn.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function Cm(t,e){let i=W(t,`Native snapshot entry ${e}`);z(i,hm,`Native snapshot entry ${e}`);let n=Gc(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!wn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let r={path:n,hash:i.hash,size:ae(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!ym.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function Rm(t,e){let i=W(t,`Native snapshot omission ${e}`);if(z(i,pm,`Native snapshot omission ${e}`),!gm.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!wm.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:Gc(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:ae(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function Pm(t){let e=W(t,"Native snapshot omission overflow");if(z(e,mm,"Native snapshot omission overflow"),typeof e.hash!="string"||!wn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:it(e.count,"Native snapshot omission overflow count")}}function tt(t,e){let i=W(t,e);if(z(i,um,e),typeof i.hash!="string"||!wn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let n=ae(i.recordCount,`${e} recordCount`),r=ae(i.storedRecordCount,`${e} storedRecordCount`),a=ae(i.stdoutBytes,`${e} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function zc(t){let e=W(t,"Native Git selection evidence");if(z(e,lm,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=tt(e.stageBefore,"Native Git selection stageBefore"),n=tt(e.combined,"Native Git selection combined"),r=tt(e.stageAfter,"Native Git selection stageAfter"),a=tt(e.finalStageBefore,"Native Git selection finalStageBefore"),o=tt(e.finalCombined,"Native Git selection finalCombined"),s=tt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(u=>u.overflow),l=!vn(i,r)||!vn(r,a)||!vn(n,o)||!vn(a,s),d=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==d)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:d,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function Jc(t,e){let i=W(t,e);if(z(i,dm,e),typeof i.hash!="string"||!wn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let n=ae(i.visitedNodeCount,`${e} visitedNodeCount`),r=ae(i.recordCount,`${e} recordCount`),a=ae(i.storedRecordCount,`${e} storedRecordCount`),o=ae(i.encodedBytes,`${e} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function Am(t){let e=W(t,"Native physical selection evidence");if(z(e,fm,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Jc(e.before,"Native physical selection before"),n=Jc(e.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!Nm(i,n);if(!r&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=r&&a?"overflow-and-changed":r?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:n}}function Kc(t){let e=W(t,"Native content snapshot manifest");if(z(e,rm,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!vm.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=W(e.capture,"Native content snapshot capture");if(z(v,sm,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let R=v.gitSelection===void 0?void 0:zc(v.gitSelection),b=v.physicalSelection===void 0?void 0:Am(v.physicalSelection),x=null;if(v.projection!==void 0){let M=W(v.projection,"Native content snapshot projection");if(z(M,cm,"Native content snapshot projection"),M.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");x={provider:"git",...M.selection===void 0?{}:{selection:zc(M.selection)}}}if(v.provider==="git"){if(b||x)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...R?{gitSelection:R}:{}}}else{if(R)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&x)throw new Error("Native physical-tree capture cannot combine selection and projection");i=x?{provider:"physical-tree",projection:x}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=W(e.limits,"Native content snapshot limits");z(n,am,"Native content snapshot limits");let r={maxFiles:it(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:it(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:it(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:it(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:it(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=W(e.policy,"Native snapshot policy");if(z(v,om,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=Em({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(Cm),s=e.omitted.map(Rm),c=ae(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:Pm(e.omissionOverflow);if(o.length>r.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>r.maxFileBytes)||o.reduce((v,R)=>v+R.size,0)>r.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>tm||c<s.length)throw new Error("Native content snapshot omission count is invalid");let d=c-s.length;if(d===0&&l||d>0&&l?.count!==d)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let u=s.filter(v=>v.reason==="git-enumeration-limit"),f=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...u,...f])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(u.length>1||f.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,g=m?.status==="overflow"||m?.status==="overflow-and-changed",h=m?.status==="changed"||m?.status==="overflow-and-changed";if(g!==(u.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(f.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let p=s.filter(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...y])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(p.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let N=i?.physicalSelection,k=N?.status==="overflow"||N?.status==="overflow-and-changed",S=N?.status==="changed"||N?.status==="overflow-and-changed";if(k!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(bm(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function xm(t,e){if(!nm.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=gn.join(t.changesDir,e);if(!re(t.changesDir,i))throw new Error("Native change path escaped");return gn.join(i,"runtime","baseline-manifest.json")}async function Uc(t,e){let i=xm(t,e);await j(t.nativeRoot,i);try{let n=await Mc({root:t.nativeRoot,file:i,maxBytes:im,label:"Native baseline snapshot manifest"});return Kc(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var $m=Cn(Ui(),1);var KN=256*1024;var sb={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 Eb=16*1024,Cb=process.platform;var $e="comet.native.v3",He="comet.native.v2",Le="comet.native.v1";var Qc=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Mm=new Set(Qc),Zc=new Set([...Qc,"minimum_runtime_version","revision"]),Bm=new Set([...Zc,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Dm=new Set(["capability","operation","source","base_hash"]),qm=new Set(["shape","build","verify","archive"]),Vm=new Set(["implicit","confirmed"]),Wm=new Set(["pending","pass","fail"]),Me="comet-state.yaml",Ea=/^[a-f0-9]{64}$/u,el=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,zm=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,Ca=class extends Error{constructor(i,n){super(`Native change ${i} uses ${n}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=n;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},Se=class extends Error{constructor(i,n){super(i!==$e||n===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${n}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=n;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},yn=class extends Error{constructor(i,n,r){super(`Native change ${i} revision conflict: expected ${n}, actual ${r}`);this.change=i;this.expectedRevision=n;this.actualRevision=r;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},Nn=class extends Error{constructor(i,n){super(`Native working directory already contains active change${n.length===1?"":"s"} ${n.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=n;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},bn=class extends Error{constructor(i,n,r,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${n} omitted entr${n===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=n;this.omittedByReason=r;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},Xb=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
|
|
145
|
+
`);function Jt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function tl(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function Gt(t){if(!el.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Jm(t){if(!el.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function il(t,e){if(t.length===0||Fe.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function Gm(t,e){let i=Jt(t,`spec_changes[${e}]`);if(tl(i,Dm,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(Jm(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let n=i.source,r=i.base_hash;if(n!==void 0&&typeof n!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof n=="string"&&il(n,`Spec source for ${i.capability}`),i.operation==="create"){if(!n)throw new Error(`Create spec ${i.capability} requires source`);if(r!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!n)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof r!="string"||!Ea.test(r))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(n!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof r!="string"||!Ea.test(r))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof n=="string"?{source:n}:{},base_hash:r}}function Km(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function Pa(t,e){if(tl(t,e,Me),typeof t.name!="string")throw new Error("Native change name is required");if(Gt(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!qm.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Vm.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(Gm),n=i.map(r=>r.capability).filter((r,a,o)=>o.indexOf(r)!==a);if(n.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(n)].join(", ")}`);if(typeof t.verification_result!="string"||!Wm.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&il(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!Km(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function Aa(t){let e=Jt(t,Me);if(e.schema!==Le)throw new Error(`Expected ${Le}`);return{schema:Le,...Pa(e,Mm)}}function zt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function Sa(t,e,i){if(t===null)return null;let n=typeof t=="string"?zm.exec(t):null;if(!n||n[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function Um(t){if(t==null)return null;if(typeof t!="string"||!Ea.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function Ym(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function xa(t){let e=Jt(t,Me);if(e.schema!==He)throw new Error(`Expected ${He}`);if(zt(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${He} minimum_runtime_version must be 2`);return{schema:He,minimum_runtime_version:2,revision:zt(e.revision,"Native v2 revision"),...Pa(e,Zc)}}function Ta(t){let e=Jt(t,Me);if(e.schema!==$e){if(e.schema===Le||e.schema===He){let o=e.schema===Le?Aa(e):xa(e);throw new Ca(o.name,o.schema)}throw new Se(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=zt(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Se(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let n=zt(e.revision,"Native revision"),r=Pa(e,Bm),a=Um(e.approved_contract_hash);if(r.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:$e,minimum_runtime_version:3,revision:n,verification_protocol:Ym(e.verification_protocol),...r,approved_contract_hash:a,implementation_scope:Sa(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:Sa(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:Sa(e.partial_allowance,"Native partial_allowance","allowances")}}function Xm(t){let e=Jt(t,Me);if(e.schema===Le){let r=Aa(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${$e}`}}if(e.schema===He){let r=xa(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${$e}`}}if(e.schema!==$e){let r=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new Se(typeof e.schema=="string"?e.schema:"(missing)",r).message}}let i=zt(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new Se(e.schema,i).message};let n=Ta(e);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function H(t,e){Gt(e);let i=Fe.join(t.changesDir,e);if(!re(t.changesDir,i))throw new Error("Native change path escaped");return i}async function Ia(t,e){let i=Fe.join(H(t,e),"runtime","schema-migration.json");await j(t.nativeRoot,i);try{return await Fm.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Qm=256*1024;async function Zm(t,e=Fe.dirname(t)){let i=Fe.relative(e,t).split(Fe.sep).join("/"),n=await Y({root:e,ref:i,maxBytes:Qm}),r=(0,Ra.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${r.errors[0].message}`);return r.toJS()}async function nl(t,e){let i=Fe.join(H(t,e),Me);await j(t.nativeRoot,i);let n=Xm(await Zm(i,t.nativeRoot));if(n.state&&n.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await Ia(t,e)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(n.status==="current"&&n.state&&await ev(t,n.state),n)}async function ev(t,e){if(await Uc(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}import{createHash as tv}from"crypto";function Z(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function iv(t,e){e.has(t)&&Z("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let n=0;n<t.length;n+=1)Object.prototype.hasOwnProperty.call(t,n)||Z("sparse arrays are not supported");return(i.length!==t.length||i.some((n,r)=>n!==String(r)))&&Z("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&Z("symbol properties are not supported"),`[${t.map(n=>_a(n,e)).join(",")}]`}finally{e.delete(t)}}function nv(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&Z("only plain objects are supported"),e.has(t)&&Z("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&Z("symbol properties are not supported"),e.add(t);try{let n=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=n[o];return(!s||!("value"in s))&&Z("accessor properties are not supported"),`${JSON.stringify(o)}:${_a(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function _a(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||Z("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?iv(t,e):nv(t,e);case"bigint":case"function":case"symbol":case"undefined":return Z(`${typeof t} values are not supported`)}return Z("unsupported value type")}function Oa(t){return _a(t,new Set)}function ee(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return tv("sha256").update(`${t}
|
|
146
|
+
${Oa(e)}`).digest("hex")}var ik=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),rl=Object.freeze({maxCriteria:1024});var lk={maxAcceptanceCriteria:rl.maxCriteria};var Be={maxSpecs:64,maxFileBytes:Xi,maxTotalBytes:4*1024*1024};import{promises as pl}from"fs";import ml from"path";var rv=["Outcome","Scope","Non-goals","Acceptance examples"],yk=[...rv,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var Tk={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var ol=1024*1024;var cl={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:[]},ov=D("comet-native-runtime:v3:semantic-repair-budget"),rS=[{skillVersion:"2",skillHash:D("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:D("comet-native-runtime:v1")}];var dl=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],LS=new Set(dl),fv=new Set([...dl,"minimum_runtime_version","revision"]),FS=new Set([...fv,"operation"]),MS=512*1024,dv=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),BS=new Set([...dv,"implementationScopeHash","repairScopeHash","repairStagnation"]);var vl=Be.maxSpecs*4;async function hv(t,e){let i=ml.join(H(t,e),"specs"),n;try{n=await Na({root:t.nativeRoot,directory:i,label:"Native proposed specs directory"})}catch(s){if(s.code==="ENOENT")return[];throw s}let r=[],a=0,o=await pl.opendir(i);try{for await(let s of o){if(a+=1,a>vl)throw new Error(`Native proposed specs directory exceeds ${vl} entries`);if(s.isSymbolicLink())throw new Error(`Proposed spec capability must not be a symbolic link: ${s.name}`);if(!s.isDirectory())continue;Gt(s.name);let c=ml.join(i,s.name,"spec.md");await j(t.nativeRoot,c);let l;try{l=await pl.lstat(c)}catch(d){if(d.code==="ENOENT")continue;throw d}if(l.isSymbolicLink()||!l.isFile())throw new Error(`Proposed spec must be a regular file: ${s.name}`);if(r.push(s.name),r.length>Be.maxSpecs)throw new Error("Native proposed specs exceed the spec-count budget")}}finally{await o.close().catch(s=>{if(s.code!=="ERR_DIR_CLOSED")throw s})}return await n.verify(),r.sort()}async function yl(t,e){let i=H(t,e),n={},r=0;for(let a of await hv(t,e)){let o=await Y({root:i,ref:`specs/${a}/spec.md`,maxBytes:Be.maxFileBytes});if(r+=o.size,r>Be.maxTotalBytes)throw new Error("Native proposed specs exceed the total byte budget");n[a]=o.text}return n}import _v from"path";var pv=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 Nl="scoped-text-safety",mv=1,vv=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var gv="comet.native.checker-policy.v1";var OE=ee(gv,{policy:Nl,version:mv,limits:vv,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var wv=["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"],jE=new Set(wv);var yv=ol,QE=3*yv;import{execFile as Rv,spawn as EC}from"node:child_process";import{promisify as Pv}from"node:util";var mC=512*1024;var Ut=class extends Error{recovery;constructor(e,i){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var MC=64*1024;var BC=3600*1e3;var DC=Pv(Rv);var qC=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_NATIVE_COMMAND_PAYLOAD","Remove-Item Env:COMET_NATIVE_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");var kn=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(n=>`${n.ref}${n.acceptanceId?`[${n.acceptanceId}]`:""} -> ${n.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var AR={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var MR=16*1024*1024,BR=256*1024,DR=16*1024;var WR=16*1024;var tP=16*1024;var qP=16*1024*1024,Sn=class extends Error{constructor(i,n,r,a){super(`Canonical spec conflict for ${i}: expected ${n??"(missing)"}, actual ${r??"(missing)"}`);this.capability=i;this.expectedHash=n;this.actualHash=r;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},En=class extends Error{constructor(i,n=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(n);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var bl=10*1024*1024,Ee=class extends Error{};function kl(t,e){let i=t.flatMap((n,r)=>n===e?[r]:[]);if(i.length>1)throw new Ee(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function Sl(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new Ee(`${e} may only be provided once`);if(i.length===0)return;let n=i[0],r=t[n+1];if(r===void 0||r.startsWith("--"))throw new Ee(`${e} requires a value`);return t.splice(n,2),r}function El(t){if(t.length>0)throw new Ee(`Unexpected argument: ${t[0]}`)}function Cl(t,e){let i=t.shift();if(!i||i.startsWith("--"))throw new Ee(`${e} is required`);return i}async function Rl(t){return t?_v.resolve(t):un(process.cwd())}async function Pl(t){let e=await Lc({startPath:t,allowMissingConfig:!1});return{config:e.config,paths:e.paths}}function $a(t,e,i){return{command:t,exitCode:0,data:e,text:i??JSON.stringify(e,null,2)+`
|
|
147
|
+
`}}function Al(t,e){if(e instanceof Ee)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof Sn)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof En)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof yn)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof Nn)return{command:t,exitCode:73,data:{requestedIsolation:e.requestedIsolation,activeChanges:e.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:e.message}};if(e instanceof bn)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof kn)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof Ut)return{command:t,exitCode:65,data:e.recovery,error:{code:"implementation-scope-stale",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let n=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:n?73:65,error:{code:n?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function xl(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
|
|
148
|
+
`}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function Tl(t,e){let i=Cl(t,"change name");El(t);let{paths:n}=await Pl(e),r=await nl(n,i);if(r.status==="migration-required")return $a("show",{name:i,schema:r.schema,minimumRuntimeVersion:r.minimumRuntimeVersion,migrationRequired:!0,message:r.message});if(r.status!=="current"||!r.state)throw new Se(r.schema,r.minimumRuntimeVersion);let a=r.state,o=H(n,i),s=await yl(n,i),c=await Y({root:o,ref:a.brief,maxBytes:Be.maxFileBytes}),l={state:a,brief:c.text,proposedSpecs:s};if(Buffer.byteLength(JSON.stringify(l),"utf8")>bl)throw new Error("Native show output exceeds its serialized byte budget");return $a("show",l)}function Ov(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
|
|
149
|
+
`}}async function Il(t,e,i=process.argv.slice(2)){let n=i.indexOf("--"),r=n<0?[...i]:i.slice(0,n),a=n<0?[]:i.slice(n),o=r.includes("--json"),s,c;try{kl(r,"--json"),s=Sl(r,"--project-root");let d=[...r,...a],u=await Rl(s);c=await e(d,u)}catch(d){c=Al(t,d)}let l=o?Ov(c):xl(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
|
|
150
150
|
`)?"":`
|
|
151
|
-
`)),l.exitCode}process.exitCode=await
|
|
151
|
+
`)),l.exitCode}process.exitCode=await Il("show",Tl);
|