@rpamis/comet 0.4.0-beta.12 → 0.4.0-beta.14
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/assets/manifest.json +15 -1
- package/assets/skills/comet/SKILL.md +5 -11
- package/assets/skills/comet/reference/comet-yaml-fields.md +1 -1
- package/assets/skills/comet/reference/context-recovery.md +3 -3
- package/assets/skills/comet/reference/decision-point.md +4 -5
- package/assets/skills/comet/reference/scripts.md +17 -47
- package/assets/skills/comet/reference/subagent-dispatch.md +8 -8
- package/assets/skills/comet/rules/comet-phase-guard.en.md +2 -2
- package/assets/skills/comet/rules/comet-phase-guard.md +2 -2
- package/assets/skills/comet/scripts/comet-archive.mjs +165 -2
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +146 -8071
- package/assets/skills/comet/scripts/comet-guard.mjs +207 -2
- package/assets/skills/comet/scripts/comet-handoff.mjs +165 -2
- package/assets/skills/comet/scripts/comet-hook-guard.mjs +151 -2
- package/assets/skills/comet/scripts/comet-hook-router.mjs +155 -12101
- package/assets/skills/comet/scripts/comet-intent.mjs +10 -2
- package/assets/skills/comet/scripts/comet-resume-probe.mjs +148 -2
- package/assets/skills/comet/scripts/comet-runtime.mjs +286 -19170
- package/assets/skills/comet/scripts/comet-state.mjs +164 -2
- package/assets/skills/comet/scripts/comet-yaml-validate.mjs +149 -2
- package/assets/skills/comet-archive/SKILL.md +1 -1
- package/assets/skills/comet-build/SKILL.md +13 -14
- package/assets/skills/comet-classic/SKILL.md +9 -9
- package/assets/skills/comet-design/SKILL.md +4 -4
- package/assets/skills/comet-hotfix/SKILL.md +2 -2
- package/assets/skills/comet-native/SKILL.md +17 -2
- package/assets/skills/comet-native/reference/commands.md +12 -0
- package/assets/skills/comet-native/reference/recovery.md +2 -0
- package/assets/skills/comet-native/scripts/comet-native-archive.mjs +178 -0
- package/assets/skills/comet-native/scripts/comet-native-check.mjs +173 -0
- package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +179 -0
- package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +207 -0
- package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +151 -0
- package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +150 -2
- package/assets/skills/comet-native/scripts/comet-native-init.mjs +171 -0
- package/assets/skills/comet-native/scripts/comet-native-new.mjs +200 -0
- package/assets/skills/comet-native/scripts/comet-native-next.mjs +182 -0
- package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +179 -0
- package/assets/skills/comet-native/scripts/comet-native-root.mjs +185 -0
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +227 -31299
- package/assets/skills/comet-native/scripts/comet-native-select.mjs +178 -0
- package/assets/skills/comet-native/scripts/comet-native-show.mjs +151 -0
- package/assets/skills/comet-native/scripts/comet-native-spec.mjs +181 -0
- package/assets/skills/comet-native/scripts/comet-native-status.mjs +175 -0
- package/assets/skills/comet-tweak/SKILL.md +2 -2
- package/assets/skills/comet-verify/SKILL.md +3 -3
- package/assets/skills-zh/comet/SKILL.md +5 -11
- package/assets/skills-zh/comet/reference/comet-yaml-fields.md +1 -1
- package/assets/skills-zh/comet/reference/context-recovery.md +3 -3
- package/assets/skills-zh/comet/reference/decision-point.md +4 -5
- package/assets/skills-zh/comet/reference/scripts.md +9 -39
- package/assets/skills-zh/comet/reference/subagent-dispatch.md +8 -8
- package/assets/skills-zh/comet-archive/SKILL.md +1 -1
- package/assets/skills-zh/comet-build/SKILL.md +13 -14
- package/assets/skills-zh/comet-classic/SKILL.md +7 -7
- package/assets/skills-zh/comet-design/SKILL.md +5 -5
- package/assets/skills-zh/comet-hotfix/SKILL.md +2 -2
- package/assets/skills-zh/comet-native/SKILL.md +17 -2
- package/assets/skills-zh/comet-native/reference/commands.md +12 -0
- package/assets/skills-zh/comet-native/reference/recovery.md +2 -0
- package/assets/skills-zh/comet-tweak/SKILL.md +2 -2
- package/assets/skills-zh/comet-verify/SKILL.md +3 -3
- package/bin/comet.js +5 -1
- package/bin/fast-runtime-router.js +82 -0
- package/dist/app/cli/index.js +57 -18
- package/dist/app/cli/index.js.map +1 -1
- package/dist/app/commands/dashboard.js +2 -2
- package/dist/app/commands/dashboard.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 +100 -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 +11 -5
- 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 +298 -69
- package/dist/app/commands/uninstall.js.map +1 -1
- package/dist/app/commands/update.d.ts +1 -0
- package/dist/app/commands/update.d.ts.map +1 -1
- package/dist/app/commands/update.js +205 -25
- package/dist/app/commands/update.js.map +1 -1
- package/dist/config/repository-layout.json +33 -3
- package/dist/domains/comet-classic/classic-archive-entry.js +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.js +8 -2
- package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
- package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-current-change.js +6 -1
- package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.js +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-guard.js +1 -1
- package/dist/domains/comet-classic/classic-guard.js.map +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.js +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard-entry.js +1 -1
- package/dist/domains/comet-classic/classic-hook-guard-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard.js +7 -4
- package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
- package/dist/domains/comet-classic/classic-intent-entry.js +1 -1
- package/dist/domains/comet-classic/classic-intent-entry.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 +26 -15
- package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
- package/dist/domains/comet-classic/classic-layout.d.ts +7 -4
- package/dist/domains/comet-classic/classic-layout.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-layout.js +10 -9
- package/dist/domains/comet-classic/classic-layout.js.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe-entry.js +1 -1
- package/dist/domains/comet-classic/classic-resume-probe-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.d.ts +2 -2
- package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.js +4 -3
- package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.js +6 -6
- package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-entry.js +1 -1
- package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-validate-entry.js +1 -1
- package/dist/domains/comet-classic/classic-validate-entry.js.map +1 -1
- package/dist/domains/comet-entry/entry-reads.d.ts +17 -0
- package/dist/domains/comet-entry/entry-reads.d.ts.map +1 -0
- package/dist/domains/comet-entry/entry-reads.js +20 -0
- package/dist/domains/comet-entry/entry-reads.js.map +1 -0
- package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router-entry.js +3 -1
- package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
- package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router.js +8 -3
- package/dist/domains/comet-entry/hook-router.js.map +1 -1
- package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
- package/dist/domains/comet-entry/init-workflow.js +9 -11
- package/dist/domains/comet-entry/init-workflow.js.map +1 -1
- package/dist/domains/comet-entry/resolve-entry.d.ts.map +1 -1
- package/dist/domains/comet-entry/resolve-entry.js +3 -4
- package/dist/domains/comet-entry/resolve-entry.js.map +1 -1
- package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-entry/resume-probe.js +16 -5
- package/dist/domains/comet-entry/resume-probe.js.map +1 -1
- package/dist/domains/comet-native/native-archive-command.d.ts +3 -0
- package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-archive-command.js +49 -0
- package/dist/domains/comet-native/native-archive-command.js.map +1 -0
- package/dist/domains/comet-native/native-archive-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-archive-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-archive-entry.js +4 -0
- package/dist/domains/comet-native/native-archive-entry.js.map +1 -0
- package/dist/domains/comet-native/native-check-command.d.ts +3 -0
- package/dist/domains/comet-native/native-check-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-check-command.js +30 -0
- package/dist/domains/comet-native/native-check-command.js.map +1 -0
- package/dist/domains/comet-native/native-check-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-check-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-check-entry.js +4 -0
- package/dist/domains/comet-native/native-check-entry.js.map +1 -0
- package/dist/domains/comet-native/native-checkpoint-command.d.ts +3 -0
- package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-checkpoint-command.js +39 -0
- package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -0
- package/dist/domains/comet-native/native-checkpoint-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-checkpoint-entry.js +4 -0
- package/dist/domains/comet-native/native-checkpoint-entry.js.map +1 -0
- package/dist/domains/comet-native/native-cli-shared.d.ts +40 -0
- package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -0
- package/dist/domains/comet-native/native-cli-shared.js +272 -0
- package/dist/domains/comet-native/native-cli-shared.js.map +1 -0
- package/dist/domains/comet-native/native-cli.d.ts +2 -5
- package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli.js +37 -785
- package/dist/domains/comet-native/native-cli.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-doctor-command.d.ts +3 -0
- package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-doctor-command.js +29 -0
- package/dist/domains/comet-native/native-doctor-command.js.map +1 -0
- package/dist/domains/comet-native/native-doctor-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-doctor-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-doctor-entry.js +4 -0
- package/dist/domains/comet-native/native-doctor-entry.js.map +1 -0
- package/dist/domains/comet-native/native-evidence-command.d.ts +3 -0
- package/dist/domains/comet-native/native-evidence-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-evidence-command.js +35 -0
- package/dist/domains/comet-native/native-evidence-command.js.map +1 -0
- package/dist/domains/comet-native/native-evidence-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-evidence-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-evidence-entry.js +4 -0
- package/dist/domains/comet-native/native-evidence-entry.js.map +1 -0
- package/dist/domains/comet-native/native-evidence-storage.d.ts +17 -6
- package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.js +89 -23
- 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 +18 -0
- package/dist/domains/comet-native/native-findings.js.map +1 -1
- package/dist/domains/comet-native/native-hook-guard-command.d.ts +3 -0
- package/dist/domains/comet-native/native-hook-guard-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-hook-guard-command.js +32 -0
- package/dist/domains/comet-native/native-hook-guard-command.js.map +1 -0
- package/dist/domains/comet-native/native-hook-guard-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-hook-guard-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-hook-guard-entry.js +4 -0
- package/dist/domains/comet-native/native-hook-guard-entry.js.map +1 -0
- package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.js +7 -1
- package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
- package/dist/domains/comet-native/native-init-command.d.ts +3 -0
- package/dist/domains/comet-native/native-init-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-init-command.js +29 -0
- package/dist/domains/comet-native/native-init-command.js.map +1 -0
- package/dist/domains/comet-native/native-init-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-init-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-init-entry.js +4 -0
- package/dist/domains/comet-native/native-init-entry.js.map +1 -0
- package/dist/domains/comet-native/native-new-command.d.ts +3 -0
- package/dist/domains/comet-native/native-new-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-new-command.js +35 -0
- package/dist/domains/comet-native/native-new-command.js.map +1 -0
- package/dist/domains/comet-native/native-new-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-new-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-new-entry.js +4 -0
- package/dist/domains/comet-native/native-new-entry.js.map +1 -0
- package/dist/domains/comet-native/native-next-command.d.ts +3 -0
- package/dist/domains/comet-native/native-next-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-next-command.js +82 -0
- package/dist/domains/comet-native/native-next-command.js.map +1 -0
- package/dist/domains/comet-native/native-next-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-next-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-next-entry.js +4 -0
- package/dist/domains/comet-native/native-next-entry.js.map +1 -0
- package/dist/domains/comet-native/native-receipt-command.d.ts +3 -0
- package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-receipt-command.js +107 -0
- package/dist/domains/comet-native/native-receipt-command.js.map +1 -0
- package/dist/domains/comet-native/native-receipt-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-receipt-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-receipt-entry.js +4 -0
- package/dist/domains/comet-native/native-receipt-entry.js.map +1 -0
- package/dist/domains/comet-native/native-receipt-refresh.d.ts +86 -0
- package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -0
- package/dist/domains/comet-native/native-receipt-refresh.js +232 -0
- package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -0
- package/dist/domains/comet-native/native-root-command.d.ts +3 -0
- package/dist/domains/comet-native/native-root-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-root-command.js +29 -0
- package/dist/domains/comet-native/native-root-command.js.map +1 -0
- package/dist/domains/comet-native/native-root-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-root-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-root-entry.js +4 -0
- package/dist/domains/comet-native/native-root-entry.js.map +1 -0
- package/dist/domains/comet-native/native-script-entry.d.ts +12 -0
- package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-script-entry.js +44 -0
- package/dist/domains/comet-native/native-script-entry.js.map +1 -0
- package/dist/domains/comet-native/native-select-command.d.ts +3 -0
- package/dist/domains/comet-native/native-select-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-select-command.js +15 -0
- package/dist/domains/comet-native/native-select-command.js.map +1 -0
- package/dist/domains/comet-native/native-select-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-select-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-select-entry.js +4 -0
- package/dist/domains/comet-native/native-select-entry.js.map +1 -0
- package/dist/domains/comet-native/native-show-command.d.ts +3 -0
- package/dist/domains/comet-native/native-show-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-show-command.js +41 -0
- package/dist/domains/comet-native/native-show-command.js.map +1 -0
- package/dist/domains/comet-native/native-show-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-show-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-show-entry.js +4 -0
- package/dist/domains/comet-native/native-show-entry.js.map +1 -0
- package/dist/domains/comet-native/native-snapshot.d.ts +9 -0
- package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-native/native-snapshot.js +141 -5
- package/dist/domains/comet-native/native-snapshot.js.map +1 -1
- package/dist/domains/comet-native/native-spec-command.d.ts +3 -0
- package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-spec-command.js +34 -0
- package/dist/domains/comet-native/native-spec-command.js.map +1 -0
- package/dist/domains/comet-native/native-spec-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-spec-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-spec-entry.js +4 -0
- package/dist/domains/comet-native/native-spec-entry.js.map +1 -0
- package/dist/domains/comet-native/native-status-command.d.ts +3 -0
- package/dist/domains/comet-native/native-status-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-status-command.js +36 -0
- package/dist/domains/comet-native/native-status-command.js.map +1 -0
- package/dist/domains/comet-native/native-status-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-status-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-status-entry.js +4 -0
- package/dist/domains/comet-native/native-status-entry.js.map +1 -0
- package/dist/domains/comet-native/native-transitions.d.ts +4 -0
- package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transitions.js +28 -4
- package/dist/domains/comet-native/native-transitions.js.map +1 -1
- package/dist/domains/comet-native/native-types.d.ts +8 -0
- package/dist/domains/comet-native/native-types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +14 -0
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.js +29 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.d.ts +28 -1
- package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.js +92 -14
- package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
- package/dist/domains/dashboard/collector.d.ts.map +1 -1
- package/dist/domains/dashboard/collector.js +53 -41
- package/dist/domains/dashboard/collector.js.map +1 -1
- package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
- package/dist/domains/dashboard/native-collector.js +13 -3
- package/dist/domains/dashboard/native-collector.js.map +1 -1
- package/dist/domains/dashboard/project-directory.d.ts +20 -0
- package/dist/domains/dashboard/project-directory.d.ts.map +1 -0
- package/dist/domains/dashboard/project-directory.js +87 -0
- package/dist/domains/dashboard/project-directory.js.map +1 -0
- package/dist/domains/dashboard/project-root.d.ts +8 -0
- package/dist/domains/dashboard/project-root.d.ts.map +1 -0
- package/dist/domains/dashboard/project-root.js +68 -0
- package/dist/domains/dashboard/project-root.js.map +1 -0
- package/dist/domains/dashboard/server.d.ts +1 -0
- package/dist/domains/dashboard/server.d.ts.map +1 -1
- package/dist/domains/dashboard/server.js +50 -10
- package/dist/domains/dashboard/server.js.map +1 -1
- package/dist/domains/dashboard/web/assets/{arc-BXDAG6Qx.js → arc-mNt_SS1l.js} +1 -1
- package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-Bc5akVD6.js +36 -0
- package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-STNPWdDl.js → blockDiagram-GPEHLZMM-C43zhVBe.js} +2 -2
- package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Bh-rUIcJ.js → c4Diagram-AAUBKEIU-dToETarK.js} +2 -2
- package/dist/domains/dashboard/web/assets/channel-b2wWDG4F.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-BRhFNAFH.js → chunk-2J33WTMH-C0oO137R.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-CwA3zkFS.js → chunk-4BX2VUAB-CGms1fgI.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-C1tqAl_E.js → chunk-55IACEB6-Bugl8v6f.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-DDefBoUS.js → chunk-727SXJPM-8ATNMlBG.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-Dq-0Yi9D.js → chunk-AQP2D5EJ-BNYjSSqU.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-DC-MVNgk.js → chunk-FMBD7UC4-_nJAqSbe.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-BLWZ8zWd.js → chunk-ND2GUHAM-lyxYm5NX.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-DaK5rvZu.js → chunk-QZHKN3VN-PUMVeWpd.js} +1 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-B9SWZywo.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-B9SWZywo.js +1 -0
- package/dist/domains/dashboard/web/assets/cose-bilkent-S5V4N54A-DzMqjexn.js +1 -0
- package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-CBaY4KFj.js → cynefin-VYW2F7L2-B67ET0eq.js} +1 -1
- package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-CQPMvRLK.js +4 -0
- package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-BRpLrFHM.js +43 -0
- package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-CPGWuGrE.js +10 -0
- package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BZcengGf.js → diagram-KO2AKTUF-D2wpX2iO.js} +2 -2
- package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-D54mAbDu.js +24 -0
- package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-ZGQDpSs_.js +24 -0
- package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-BBrwULhs.js → erDiagram-TEJ5UH35-C3qDo7sd.js} +2 -2
- package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-DiNn0Yzp.js → flowDiagram-I6XJVG4X-B7hStPd9.js} +2 -2
- package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-IqcLFbTK.js +292 -0
- package/dist/domains/dashboard/web/assets/gitGraphDiagram-PVQCEYII-YrMZpzUu.js +106 -0
- package/dist/domains/dashboard/web/assets/index-DhtBssCt.js +257 -0
- package/dist/domains/dashboard/web/assets/{index-QO0z6F4w.js → index-icxk8_BP.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-pr3axVDI.css +1 -0
- package/dist/domains/dashboard/web/assets/infoDiagram-5YYISTIA-CcIgGK_7.js +2 -0
- package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-DCPPspol.js → ishikawaDiagram-YF4QCWOH-1x3rNjGP.js} +2 -2
- package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C_v8b1Os.js → journeyDiagram-JHISSGLW-B2XiqMNP.js} +2 -2
- package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-CgpE9lG7.js → kanban-definition-UN3LZRKU-x46cGuo3.js} +2 -2
- package/dist/domains/dashboard/web/assets/{linear-jSddcREx.js → linear-DFLqGZWl.js} +1 -1
- package/dist/domains/dashboard/web/assets/{mermaid.core-5Ibr28Ig.js → mermaid.core-g3J6BACc.js} +69 -69
- package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-XPCohX0x.js → mindmap-definition-RKZ34NQL-CTdeKmcX.js} +2 -2
- package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-DvhxgQWl.js → pieDiagram-4H26LBE5-C_obwjIf.js} +2 -2
- package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CCUxdF-S.js → quadrantDiagram-W4KKPZXB-B6Gnfz9M.js} +4 -4
- package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-FS3TCmdX.js → requirementDiagram-4Y6WPE33-nX4PObnB.js} +2 -2
- package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-r129rscN.js → sankeyDiagram-5OEKKPKP-QjDwwHgl.js} +2 -2
- package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK--DCY0bvU.js → sequenceDiagram-3UESZ5HK-BEEe0j6B.js} +2 -2
- package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-CXfAaBgM.js +1 -0
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-CD3nS4cC.js +1 -0
- package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-NlqCuFuo.js → timeline-definition-PNZ67QCA-BOzX2EnD.js} +2 -2
- package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-B4W_d1Nq.js → vennDiagram-CIIHVFJN-C40vhXRq.js} +2 -2
- package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-Bex-_jWd.js → wardleyDiagram-YWT4CUSO-B1rm89JH.js} +2 -2
- package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-CmxeVM2Z.js → xychartDiagram-2RQKCTM6-BlMr59qK.js} +2 -2
- package/dist/domains/dashboard/web/index.html +2 -2
- package/dist/domains/integrations/openspec.d.ts +1 -0
- package/dist/domains/integrations/openspec.d.ts.map +1 -1
- package/dist/domains/integrations/openspec.js +11 -2
- package/dist/domains/integrations/openspec.js.map +1 -1
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +36 -6
- package/dist/domains/skill/platform-install.js.map +1 -1
- package/dist/domains/skill/uninstall.d.ts +10 -2
- package/dist/domains/skill/uninstall.d.ts.map +1 -1
- package/dist/domains/skill/uninstall.js +256 -23
- 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/index.d.ts +1 -1
- package/dist/domains/workflow-contract/index.d.ts.map +1 -1
- package/dist/domains/workflow-contract/index.js +1 -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 +2 -0
- package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config.js +54 -5
- package/dist/domains/workflow-contract/project-config.js.map +1 -1
- package/dist/platform/install/detect.d.ts +1 -0
- package/dist/platform/install/detect.d.ts.map +1 -1
- package/dist/platform/install/detect.js +2 -0
- package/dist/platform/install/detect.js.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/process/hook-read-cache.d.ts +45 -0
- package/dist/platform/process/hook-read-cache.d.ts.map +1 -0
- package/dist/platform/process/hook-read-cache.js +102 -0
- package/dist/platform/process/hook-read-cache.js.map +1 -0
- package/dist/platform/version/version.d.ts.map +1 -1
- package/dist/platform/version/version.js +9 -2
- package/dist/platform/version/version.js.map +1 -1
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +2 -0
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -0
- package/eval/local/tasks/comet-native-workflow/instruction.md +3 -3
- package/eval/local/tasks/comet-native-workflow/task.toml +4 -2
- package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +212 -75
- package/eval/local/tests/scaffold/test_native_wave_evaluations.py +114 -39
- package/eval/local/tests/scaffold/test_tasks.py +5 -1
- package/package.json +7 -3
- package/dist/domains/dashboard/web/assets/_commonjsHelpers-CqkleIqs.js +0 -1
- package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-R2JyCv0i.js +0 -36
- package/dist/domains/dashboard/web/assets/channel-XR_5gd6D.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CG_TnucZ.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CG_TnucZ.js +0 -1
- package/dist/domains/dashboard/web/assets/cose-bilkent-S5V4N54A-DCPgAyMU.js +0 -1
- package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-CLKQ6BQM.js +0 -4
- package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-DCup336F.js +0 -43
- package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-DgpDOFTE.js +0 -10
- package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-DSECilBo.js +0 -24
- package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-3FuzANXW.js +0 -24
- package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-DcvbTHnu.js +0 -292
- package/dist/domains/dashboard/web/assets/gitGraphDiagram-PVQCEYII-CgCY3MJo.js +0 -106
- package/dist/domains/dashboard/web/assets/index-BR3wUr2k.css +0 -1
- package/dist/domains/dashboard/web/assets/index-CovQUq5W.js +0 -24
- package/dist/domains/dashboard/web/assets/infoDiagram-5YYISTIA-hzBGAEue.js +0 -2
- package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-yHkUByrT.js +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-XHzDdqcm.js +0 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cometCreateRequire } from 'module';
|
|
3
|
+
const require = __cometCreateRequire(import.meta.url);
|
|
4
|
+
var Xu=Object.create;var $o=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var ef=Object.getPrototypeOf,tf=Object.prototype.hasOwnProperty;var Pi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var nf=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Zu(e))!tf.call(t,r)&&r!==i&&$o(t,r,{get:()=>e[r],enumerable:!(n=Qu(e,r))||n.enumerable});return t};var Ho=(t,e,i)=>(i=t!=null?Xu(ef(t)):{},nf(e||!t||!t.__esModule?$o(i,"default",{value:t,enumerable:!0}):i,t));var R=w(L=>{"use strict";var cr=Symbol.for("yaml.alias"),Mo=Symbol.for("yaml.document"),Ai=Symbol.for("yaml.map"),Lo=Symbol.for("yaml.pair"),lr=Symbol.for("yaml.scalar"),xi=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),rf=t=>!!t&&typeof t=="object"&&t[ge]===cr,af=t=>!!t&&typeof t=="object"&&t[ge]===Mo,of=t=>!!t&&typeof t=="object"&&t[ge]===Ai,sf=t=>!!t&&typeof t=="object"&&t[ge]===Lo,Do=t=>!!t&&typeof t=="object"&&t[ge]===lr,cf=t=>!!t&&typeof t=="object"&&t[ge]===xi;function Fo(t){if(t&&typeof t=="object")switch(t[ge]){case Ai:case xi:return!0}return!1}function lf(t){if(t&&typeof t=="object")switch(t[ge]){case cr:case Ai:case lr:case xi:return!0}return!1}var uf=t=>(Do(t)||Fo(t))&&!!t.anchor;L.ALIAS=cr;L.DOC=Mo;L.MAP=Ai;L.NODE_TYPE=ge;L.PAIR=Lo;L.SCALAR=lr;L.SEQ=xi;L.hasAnchor=uf;L.isAlias=rf;L.isCollection=Fo;L.isDocument=af;L.isMap=of;L.isNode=lf;L.isPair=sf;L.isScalar=Do;L.isSeq=cf});var Et=w(ur=>{"use strict";var M=R(),V=Symbol("break visit"),Bo=Symbol("skip children"),fe=Symbol("remove node");function Ti(t,e){let i=qo(e);M.isDocument(t)?it(null,t.contents,i,Object.freeze([t]))===fe&&(t.contents=null):it(null,t,i,Object.freeze([]))}Ti.BREAK=V;Ti.SKIP=Bo;Ti.REMOVE=fe;function it(t,e,i,n){let r=Vo(t,e,i,n);if(M.isNode(r)||M.isPair(r))return zo(t,n,r),it(t,r,i,n);if(typeof r!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=it(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(e.items.splice(a,1),a-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let a=it("key",e.key,i,n);if(a===V)return V;a===fe&&(e.key=null);let o=it("value",e.value,i,n);if(o===V)return V;o===fe&&(e.value=null)}}return r}async function _i(t,e){let i=qo(e);M.isDocument(t)?await nt(null,t.contents,i,Object.freeze([t]))===fe&&(t.contents=null):await nt(null,t,i,Object.freeze([]))}_i.BREAK=V;_i.SKIP=Bo;_i.REMOVE=fe;async function nt(t,e,i,n){let r=await Vo(t,e,i,n);if(M.isNode(r)||M.isPair(r))return zo(t,n,r),nt(t,r,i,n);if(typeof r!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let a=0;a<e.items.length;++a){let o=await nt(a,e.items[a],i,n);if(typeof o=="number")a=o-1;else{if(o===V)return V;o===fe&&(e.items.splice(a,1),a-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let a=await nt("key",e.key,i,n);if(a===V)return V;a===fe&&(e.key=null);let o=await nt("value",e.value,i,n);if(o===V)return V;o===fe&&(e.value=null)}}return r}function qo(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Vo(t,e,i,n){if(typeof i=="function")return i(t,e,n);if(M.isMap(e))return i.Map?.(t,e,n);if(M.isSeq(e))return i.Seq?.(t,e,n);if(M.isPair(e))return i.Pair?.(t,e,n);if(M.isScalar(e))return i.Scalar?.(t,e,n);if(M.isAlias(e))return i.Alias?.(t,e,n)}function zo(t,e,i){let n=e[e.length-1];if(M.isCollection(n))n.items[t]=i;else if(M.isPair(n))t==="key"?n.key=i:n.value=i;else if(M.isDocument(n))n.contents=i;else{let r=M.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}ur.visit=Ti;ur.visitAsync=_i});var fr=w(Jo=>{"use strict";var Wo=R(),ff=Et(),df={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},hf=t=>t.replace(/[!,[\]{}]/g,e=>df[e]),Rt=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[a,o]=n;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=n;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${r}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||i(`The ${e} tag has no suffix`);let a=this.tags[n];if(a)try{return a+decodeURIComponent(r)}catch(o){return i(String(o)),null}return n==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,n]of Object.entries(this.tags))if(e.startsWith(n))return i+hf(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Wo.isNode(e.contents)){let a={};ff.visit(e.contents,(o,s)=>{Wo.isNode(s)&&s.tag&&(a[s.tag]=!0)}),r=Object.keys(a)}else r=[];for(let[a,o]of n)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
|
|
5
|
+
`)}};Rt.defaultYaml={explicit:!1,version:"1.2"};Rt.defaultTags={"!!":"tag:yaml.org,2002:"};Jo.Directives=Rt});var Ii=w(Ct=>{"use strict";var Ko=R(),pf=Et();function mf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function Uo(t){let e=new Set;return pf.visit(t,{Value(i,n){n.anchor&&e.add(n.anchor)}}),e}function Go(t,e){for(let i=1;;++i){let n=`${t}${i}`;if(!e.has(n))return n}}function vf(t,e){let i=[],n=new Map,r=null;return{onAnchor:a=>{i.push(a),r??(r=Uo(t));let o=Go(e,r);return r.add(o),o},setAnchors:()=>{for(let a of i){let o=n.get(a);if(typeof o=="object"&&o.anchor&&(Ko.isScalar(o.node)||Ko.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:n}}Ct.anchorIsValid=mf;Ct.anchorNames=Uo;Ct.createNodeAnchors=vf;Ct.findNewAnchor=Go});var dr=w(Yo=>{"use strict";function Pt(t,e,i,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,a=n.length;r<a;++r){let o=n[r],s=Pt(t,n,String(r),o);s===void 0?delete n[r]:s!==o&&(n[r]=s)}else if(n instanceof Map)for(let r of Array.from(n.keys())){let a=n.get(r),o=Pt(t,n,r,a);o===void 0?n.delete(r):o!==a&&n.set(r,o)}else if(n instanceof Set)for(let r of Array.from(n)){let a=Pt(t,n,r,r);a===void 0?n.delete(r):a!==r&&(n.delete(r),n.add(a))}else for(let[r,a]of Object.entries(n)){let o=Pt(t,n,r,a);o===void 0?delete n[r]:o!==a&&(n[r]=o)}return t.call(e,i,n)}Yo.applyReviver=Pt});var Ne=w(Qo=>{"use strict";var gf=R();function Xo(t,e,i){if(Array.isArray(t))return t.map((n,r)=>Xo(n,String(r),i));if(t&&typeof t.toJSON=="function"){if(!i||!gf.hasAnchor(t))return t.toJSON(e,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(t,n),i.onCreate=a=>{n.res=a,delete i.onCreate};let r=t.toJSON(e,i);return i.onCreate&&i.onCreate(r),r}return typeof t=="bigint"&&!i?.keep?Number(t):t}Qo.toJS=Xo});var ji=w(es=>{"use strict";var wf=dr(),Zo=R(),yf=Ne(),hr=class{constructor(e){Object.defineProperty(this,Zo.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:a}={}){if(!Zo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},s=yf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof a=="function"?wf.applyReviver(a,{"":s},"",s):s}};es.NodeBase=hr});var At=w(ts=>{"use strict";var Nf=Ii(),bf=Et(),rt=R(),Sf=ji(),kf=Ne(),pr=class extends Sf.NodeBase{constructor(e){super(rt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;i?.aliasResolveCache?n=i.aliasResolveCache:(n=[],bf.visit(e,{Node:(a,o)=>{(rt.isAlias(o)||rt.hasAnchor(o))&&n.push(o)}}),i&&(i.aliasResolveCache=n));let r;for(let a of n){if(a===this)break;a.anchor===this.source&&(r=a)}return r}toJSON(e,i){if(!i)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:a}=i,o=this.resolve(r,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=n.get(o);if(s||(kf.toJS(o,null,i),s=n.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=Oi(r,o,n)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,n){let r=`*${this.source}`;if(e){if(Nf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${r} `}return r}};function Oi(t,e,i){if(rt.isAlias(e)){let n=e.resolve(t),r=i&&n&&i.get(n);return r?r.count*r.aliasCount:0}else if(rt.isCollection(e)){let n=0;for(let r of e.items){let a=Oi(t,r,i);a>n&&(n=a)}return n}else if(rt.isPair(e)){let n=Oi(t,e.key,i),r=Oi(t,e.value,i);return Math.max(n,r)}return 1}ts.Alias=pr});var $=w(mr=>{"use strict";var Ef=R(),Rf=ji(),Cf=Ne(),Pf=t=>!t||typeof t!="function"&&typeof t!="object",be=class extends Rf.NodeBase{constructor(e){super(Ef.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:Cf.toJS(this.value,e,i)}toString(){return String(this.value)}};be.BLOCK_FOLDED="BLOCK_FOLDED";be.BLOCK_LITERAL="BLOCK_LITERAL";be.PLAIN="PLAIN";be.QUOTE_DOUBLE="QUOTE_DOUBLE";be.QUOTE_SINGLE="QUOTE_SINGLE";mr.Scalar=be;mr.isScalarValue=Pf});var xt=w(ns=>{"use strict";var Af=At(),He=R(),is=$(),xf="tag:yaml.org,2002:";function Tf(t,e,i){if(e){let n=i.filter(a=>a.tag===e),r=n.find(a=>!a.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return i.find(n=>n.identify?.(t)&&!n.format)}function _f(t,e,i){if(He.isDocument(t)&&(t=t.contents),He.isNode(t))return t;if(He.isPair(t)){let f=i.schema[He.MAP].createNode?.(i.schema,null,i);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:r,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(n&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=r(t)),new Af.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=xf+e.slice(2));let l=Tf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new is.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?o[He.MAP]:Symbol.iterator in Object(t)?o[He.SEQ]:o[He.MAP]}a&&(a(l),delete i.onTagObj);let u=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new is.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}ns.createNode=_f});var Hi=w($i=>{"use strict";var If=xt(),de=R(),jf=ji();function vr(t,e,i){let n=i;for(let r=e.length-1;r>=0;--r){let a=e[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=n,n=o}else n=new Map([[a,n]])}return If.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var rs=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,gr=class extends jf.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(n=>de.isNode(n)||de.isPair(n)?n.clone(e):n),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(rs(e))this.add(i);else{let[n,...r]=e,a=this.get(n,!0);if(de.isCollection(a))a.addIn(r,i);else if(a===void 0&&this.schema)this.set(n,vr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[i,...n]=e;if(n.length===0)return this.delete(i);let r=this.get(i,!0);if(de.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}getIn(e,i){let[n,...r]=e,a=this.get(n,!0);return r.length===0?!i&&de.isScalar(a)?a.value:a:de.isCollection(a)?a.getIn(r,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!de.isPair(i))return!1;let n=i.value;return n==null||e&&de.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[i,...n]=e;if(n.length===0)return this.has(i);let r=this.get(i,!0);return de.isCollection(r)?r.hasIn(n):!1}setIn(e,i){let[n,...r]=e;if(r.length===0)this.set(n,i);else{let a=this.get(n,!0);if(de.isCollection(a))a.setIn(r,i);else if(a===void 0&&this.schema)this.set(n,vr(this.schema,r,i));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};$i.Collection=gr;$i.collectionFromPath=vr;$i.isEmptyPath=rs});var Tt=w(Mi=>{"use strict";var Of=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function wr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var $f=(t,e,i)=>t.endsWith(`
|
|
6
|
+
`)?wr(i,e):i.includes(`
|
|
7
|
+
`)?`
|
|
8
|
+
`+wr(i,e):(t.endsWith(" ")?"":" ")+i;Mi.indentComment=wr;Mi.lineComment=$f;Mi.stringifyComment=Of});var os=w(_t=>{"use strict";var Hf="flow",yr="block",Li="quoted";function Mf(t,e,i="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!r||r<0)return t;r<a&&(a=0);let c=Math.max(1+a,1+r-e.length);if(t.length<=c)return t;let l=[],u={},f=r-e.length;typeof n=="number"&&(n>r-Math.max(2,a)?l.push(0):f=r-n);let d,m,g=!1,h=-1,p=-1,y=-1;i===yr&&(h=as(t,h,e.length),h!==-1&&(f=h+c));for(let S;S=t[h+=1];){if(i===Li&&S==="\\"){switch(p=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(S===`
|
|
9
|
+
`)i===yr&&(h=as(t,h,e.length)),f=h+e.length+c,d=void 0;else{if(S===" "&&m&&m!==" "&&m!==`
|
|
10
|
+
`&&m!==" "){let k=t[h+1];k&&k!==" "&&k!==`
|
|
11
|
+
`&&k!==" "&&(d=h)}if(h>=f)if(d)l.push(d),f=d+c,d=void 0;else if(i===Li){for(;m===" "||m===" ";)m=S,S=t[h+=1],g=!0;let k=h>y+1?h-2:p-1;if(u[k])return t;l.push(k),u[k]=!0,f=k+c,d=void 0}else g=!0}m=S}if(g&&s&&s(),l.length===0)return t;o&&o();let N=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let k=l[S],E=l[S+1]||t.length;k===0?N=`
|
|
12
|
+
${e}${t.slice(0,E)}`:(i===Li&&u[k]&&(N+=`${t[k]}\\`),N+=`
|
|
13
|
+
${e}${t.slice(k+1,E)}`)}return N}function as(t,e,i){let n=e,r=e+1,a=t[r];for(;a===" "||a===" ";)if(e<r+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
|
|
14
|
+
`);n=e,r=e+1,a=t[r]}return n}_t.FOLD_BLOCK=yr;_t.FOLD_FLOW=Hf;_t.FOLD_QUOTED=Li;_t.foldFlowLines=Mf});var jt=w(ss=>{"use strict";var ie=$(),Se=os(),Fi=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Bi=t=>/^(%|---|\.\.\.)/m.test(t);function Lf(t,e,i){if(!e||e<0)return!1;let n=e-i,r=t.length;if(r<=n)return!1;for(let a=0,o=0;a<r;++a)if(t[a]===`
|
|
15
|
+
`){if(a-o>n)return!0;if(o=a+1,r-o<=n)return!1}return!0}function It(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Bi(t)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let u=i.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(n||i[c+2]==='"'||i.length<r)c+=1;else{for(o+=i.slice(s,c)+`
|
|
16
|
+
|
|
17
|
+
`;i[c+2]==="\\"&&i[c+3]==="n"&&i[c+4]!=='"';)o+=`
|
|
18
|
+
`,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,n?o:Se.foldFlowLines(o,a,Se.FOLD_QUOTED,Fi(e,!1))}function Nr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
19
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return It(t,e);let i=e.indent||(Bi(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
20
|
+
${i}`)+"'";return e.implicitKey?n:Se.foldFlowLines(n,i,Se.FOLD_FLOW,Fi(e,!1))}function at(t,e){let{singleQuote:i}=e.options,n;if(i===!1)n=It;else{let r=t.includes('"'),a=t.includes("'");r&&!a?n=Nr:a&&!r?n=It:n=i?Nr:It}return n(t,e)}var br;try{br=new RegExp(`(^|(?<!
|
|
21
|
+
))
|
|
22
|
+
+(?!
|
|
23
|
+
|$)`,"g")}catch{br=/\n+(?!\n|$)/g}function Di({comment:t,type:e,value:i},n,r,a){let{blockQuote:o,commentString:s,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(i))return at(i,n);let l=n.indent||(n.forceBlockIndent||Bi(i)?" ":""),u=o==="literal"?!0:o==="folded"||e===ie.Scalar.BLOCK_FOLDED?!1:e===ie.Scalar.BLOCK_LITERAL?!0:!Lf(i,c,l.length);if(!i)return u?`|
|
|
24
|
+
`:`>
|
|
25
|
+
`;let f,d;for(d=i.length;d>0;--d){let E=i[d-1];if(E!==`
|
|
26
|
+
`&&E!==" "&&E!==" ")break}let m=i.substring(d),g=m.indexOf(`
|
|
27
|
+
`);g===-1?f="-":i===m||g!==m.length-1?(f="+",a&&a()):f="",m&&(i=i.slice(0,-m.length),m[m.length-1]===`
|
|
28
|
+
`&&(m=m.slice(0,-1)),m=m.replace(br,`$&${l}`));let h=!1,p,y=-1;for(p=0;p<i.length;++p){let E=i[p];if(E===" ")h=!0;else if(E===`
|
|
29
|
+
`)y=p;else break}let N=i.substring(0,y<p?y+1:p);N&&(i=i.substring(N.length),N=N.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+f;if(t&&(k+=" "+s(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!u){let E=i.replace(/\n+/g,`
|
|
30
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,C=Fi(n,!0);o!=="folded"&&e!==ie.Scalar.BLOCK_FOLDED&&(C.onOverflow=()=>{v=!0});let b=Se.foldFlowLines(`${N}${E}${m}`,l,Se.FOLD_BLOCK,C);if(!v)return`>${k}
|
|
31
|
+
${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${k}
|
|
32
|
+
${l}${N}${i}${m}`}function Df(t,e,i,n){let{type:r,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=e;if(s&&a.includes(`
|
|
33
|
+
`)||u&&/[[\]{},]/.test(a))return at(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
34
|
+
`)?at(a,e):Di(t,e,i,n);if(!s&&!u&&r!==ie.Scalar.PLAIN&&a.includes(`
|
|
35
|
+
`))return Di(t,e,i,n);if(Bi(a)){if(c==="")return e.forceBlockIndent=!0,Di(t,e,i,n);if(s&&c===l)return at(a,e)}let f=a.replace(/\n+/g,`$&
|
|
36
|
+
${c}`);if(o){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:m,tags:g}=e.doc.schema;if(g.some(d)||m?.some(d))return at(a,e)}return s?f:Se.foldFlowLines(f,c,Se.FOLD_FLOW,Fi(e,!1))}function Ff(t,e,i,n){let{implicitKey:r,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ie.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return r||a?at(o.value,e):Di(o,e,i,n);case ie.Scalar.QUOTE_DOUBLE:return It(o.value,e);case ie.Scalar.QUOTE_SINGLE:return Nr(o.value,e);case ie.Scalar.PLAIN:return Df(o,e,i,n);default:return null}},l=c(s);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=r&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}ss.stringifyString=Ff});var Ot=w(Sr=>{"use strict";var Bf=Ii(),ke=R(),qf=Tt(),Vf=jt();function zf(t,e){let i=Object.assign({blockQuote:!0,commentString:qf.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(i.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:n,options:i}}function Wf(t,e){if(e.tag){let r=t.filter(a=>a.tag===e.tag);if(r.length>0)return r.find(a=>a.format===e.format)??r[0]}let i,n;if(ke.isScalar(e)){n=e.value;let r=t.filter(a=>a.identify?.(n));if(r.length>1){let a=r.filter(o=>o.test);a.length>0&&(r=a)}i=r.find(a=>a.format===e.format)??r.find(a=>!a.format)}else n=e,i=t.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!i){let r=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${r} value`)}return i}function Jf(t,e,{anchors:i,doc:n}){if(!n.directives)return"";let r=[],a=(ke.isScalar(t)||ke.isCollection(t))&&t.anchor;a&&Bf.anchorIsValid(a)&&(i.add(a),r.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function Kf(t,e,i,n){if(ke.isPair(t))return t.toString(e,i,n);if(ke.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,a=ke.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=Wf(e.doc.schema.tags,a));let o=Jf(a,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof r.stringify=="function"?r.stringify(a,e,i,n):ke.isScalar(a)?Vf.stringifyString(a,e,i,n):a.toString(e,i,n);return o?ke.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
|
|
37
|
+
${e.indent}${s}`:s}Sr.createStringifyContext=zf;Sr.stringify=Kf});var fs=w(us=>{"use strict";var we=R(),cs=$(),ls=Ot(),$t=Tt();function Uf({key:t,value:e},i,n,r){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=i,d=we.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let m=!f&&(!t||d&&e==null&&!i.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===cs.Scalar.BLOCK_FOLDED||t.type===cs.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!m&&(f||!a),indent:s+c});let g=!1,h=!1,p=ls.stringify(t,i,()=>g=!0,()=>h=!0);if(!m&&!i.inFlow&&p.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(i.inFlow){if(a||e==null)return g&&n&&n(),p===""?"?":m?`? ${p}`:p}else if(a&&!f||e==null&&m)return p=`? ${p}`,d&&!g?p+=$t.lineComment(p,i.indent,l(d)):h&&r&&r(),p;g&&(d=null),m?(d&&(p+=$t.lineComment(p,i.indent,l(d))),p=`? ${p}
|
|
38
|
+
${s}:`):(p=`${p}:`,d&&(p+=$t.lineComment(p,i.indent,l(d))));let y,N,S;we.isNode(e)?(y=!!e.spaceBefore,N=e.commentBefore,S=e.comment):(y=!1,N=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!m&&!d&&we.isScalar(e)&&(i.indentAtStart=p.length+1),h=!1,!u&&c.length>=2&&!i.inFlow&&!m&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let k=!1,E=ls.stringify(e,i,()=>k=!0,()=>h=!0),v=" ";if(d||y||N){if(v=y?`
|
|
39
|
+
`:"",N){let C=l(N);v+=`
|
|
40
|
+
${$t.indentComment(C,i.indent)}`}E===""&&!i.inFlow?v===`
|
|
41
|
+
`&&S&&(v=`
|
|
42
|
+
|
|
43
|
+
`):v+=`
|
|
44
|
+
${i.indent}`}else if(!m&&we.isCollection(e)){let C=E[0],b=E.indexOf(`
|
|
45
|
+
`),_=b!==-1,W=i.inFlow??e.flow??e.items.length===0;if(_||!W){let tt=!1;if(_&&(C==="&"||C==="!")){let H=E.indexOf(" ");C==="&"&&H!==-1&&H<b&&E[H+1]==="!"&&(H=E.indexOf(" ",H+1)),(H===-1||b<H)&&(tt=!0)}tt||(v=`
|
|
46
|
+
${i.indent}`)}}else(E===""||E[0]===`
|
|
47
|
+
`)&&(v="");return p+=v+E,i.inFlow?k&&n&&n():S&&!k?p+=$t.lineComment(p,i.indent,l(S)):h&&r&&r(),p}us.stringifyPair=Uf});var Er=w(kr=>{"use strict";var ds=Pi("process");function Gf(t,...e){t==="debug"&&console.log(...e)}function Yf(t,e){(t==="debug"||t==="warn")&&(typeof ds.emitWarning=="function"?ds.emitWarning(e):console.warn(e))}kr.debug=Gf;kr.warn=Yf});var Ji=w(Wi=>{"use strict";var zi=R(),hs=$(),qi="<<",Vi={identify:t=>t===qi||typeof t=="symbol"&&t.description===qi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new hs.Scalar(Symbol(qi)),{addToJSMap:ps}),stringify:()=>qi},Xf=(t,e)=>(Vi.identify(e)||zi.isScalar(e)&&(!e.type||e.type===hs.Scalar.PLAIN)&&Vi.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Vi.tag&&i.default);function ps(t,e,i){let n=ms(t,i);if(zi.isSeq(n))for(let r of n.items)Rr(t,e,r);else if(Array.isArray(n))for(let r of n)Rr(t,e,r);else Rr(t,e,n)}function Rr(t,e,i){let n=ms(t,i);if(!zi.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,t,Map);for(let[a,o]of r)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function ms(t,e){return t&&zi.isAlias(e)?e.resolve(t.doc,t):e}Wi.addMergeToJSMap=ps;Wi.isMergeKey=Xf;Wi.merge=Vi});var Pr=w(ws=>{"use strict";var Qf=Er(),vs=Ji(),Zf=Ot(),gs=R(),Cr=Ne();function ed(t,e,{key:i,value:n}){if(gs.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,n);else if(vs.isMergeKey(t,i))vs.addMergeToJSMap(t,e,n);else{let r=Cr.toJS(i,"",t);if(e instanceof Map)e.set(r,Cr.toJS(n,r,t));else if(e instanceof Set)e.add(r);else{let a=td(i,r,t),o=Cr.toJS(n,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function td(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(gs.isNode(t)&&i?.doc){let n=Zf.createStringifyContext(i.doc,{});n.anchors=new Set;for(let a of i.anchors.keys())n.anchors.add(a.anchor);n.inFlow=!0,n.inStringifyKey=!0;let r=t.toString(n);if(!i.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),Qf.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return r}return JSON.stringify(e)}ws.addPairToJSMap=ed});var Ee=w(Ar=>{"use strict";var ys=xt(),id=fs(),nd=Pr(),Ki=R();function rd(t,e,i){let n=ys.createNode(t,void 0,i),r=ys.createNode(e,void 0,i);return new Ui(n,r)}var Ui=class t{constructor(e,i=null){Object.defineProperty(this,Ki.NODE_TYPE,{value:Ki.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:n}=this;return Ki.isNode(i)&&(i=i.clone(e)),Ki.isNode(n)&&(n=n.clone(e)),new t(i,n)}toJSON(e,i){let n=i?.mapAsMap?new Map:{};return nd.addPairToJSMap(i,n,this)}toString(e,i,n){return e?.doc?id.stringifyPair(this,e,i,n):JSON.stringify(this)}};Ar.Pair=Ui;Ar.createPair=rd});var xr=w(bs=>{"use strict";var Me=R(),Ns=Ot(),Gi=Tt();function ad(t,e,i){return(e.inFlow??t.flow?sd:od)(t,e,i)}function od({comment:t,items:e},i,{blockItemPrefix:n,flowChars:r,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,u=Object.assign({},i,{indent:a,type:null}),f=!1,d=[];for(let g=0;g<e.length;++g){let h=e[g],p=null;if(Me.isNode(h))!f&&h.spaceBefore&&d.push(""),Yi(i,d,h.commentBefore,f),h.comment&&(p=h.comment);else if(Me.isPair(h)){let N=Me.isNode(h.key)?h.key:null;N&&(!f&&N.spaceBefore&&d.push(""),Yi(i,d,N.commentBefore,f))}f=!1;let y=Ns.stringify(h,u,()=>p=null,()=>f=!0);p&&(y+=Gi.lineComment(y,a,l(p))),f&&p&&(f=!1),d.push(n+y)}let m;if(d.length===0)m=r.start+r.end;else{m=d[0];for(let g=1;g<d.length;++g){let h=d[g];m+=h?`
|
|
48
|
+
${c}${h}`:`
|
|
49
|
+
`}}return t?(m+=`
|
|
50
|
+
`+Gi.indentComment(l(t),c),s&&s()):f&&o&&o(),m}function sd({items:t},e,{flowChars:i,itemIndent:n}){let{indent:r,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;n+=a;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<t.length;++g){let h=t[g],p=null;if(Me.isNode(h))h.spaceBefore&&f.push(""),Yi(e,f,h.commentBefore,!1),h.comment&&(p=h.comment);else if(Me.isPair(h)){let N=Me.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&f.push(""),Yi(e,f,N.commentBefore,!1),N.comment&&(l=!0));let S=Me.isNode(h.value)?h.value:null;S?(S.comment&&(p=S.comment),S.commentBefore&&(l=!0)):h.value==null&&N?.comment&&(p=N.comment)}p&&(l=!0);let y=Ns.stringify(h,c,()=>p=null);l||(l=f.length>u||y.includes(`
|
|
51
|
+
`)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((N,S)=>N+S.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),p&&(y+=Gi.lineComment(y,n,s(p))),f.push(y),u=f.length}let{start:d,end:m}=i;if(f.length===0)return d+m;if(!l){let g=f.reduce((h,p)=>h+p.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let h of f)g+=h?`
|
|
52
|
+
${a}${r}${h}`:`
|
|
53
|
+
`;return`${g}
|
|
54
|
+
${r}${m}`}else return`${d}${o}${f.join(" ")}${o}${m}`}function Yi({indent:t,options:{commentString:e}},i,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let a=Gi.indentComment(e(n),t);i.push(a.trimStart())}}bs.stringifyCollection=ad});var Ce=w(_r=>{"use strict";var cd=xr(),ld=Pr(),ud=Hi(),Re=R(),Xi=Ee(),fd=$();function Ht(t,e){let i=Re.isScalar(e)?e.value:e;for(let n of t)if(Re.isPair(n)&&(n.key===e||n.key===i||Re.isScalar(n.key)&&n.key.value===i))return n}var Tr=class extends ud.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Re.MAP,e),this.items=[]}static from(e,i,n){let{keepUndefined:r,replacer:a}=n,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||r)&&o.items.push(Xi.createPair(c,l,n))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let n;Re.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Xi.Pair(e,e?.value):n=new Xi.Pair(e.key,e.value);let r=Ht(this.items,n.key),a=this.schema?.sortMapEntries;if(r){if(!i)throw new Error(`Key ${n.key} already set`);Re.isScalar(r.value)&&fd.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(a){let o=this.items.findIndex(s=>a(n,s)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let i=Ht(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let r=Ht(this.items,e)?.value;return(!i&&Re.isScalar(r)?r.value:r)??void 0}has(e){return!!Ht(this.items,e)}set(e,i){this.add(new Xi.Pair(e,i),!0)}toJSON(e,i,n){let r=n?new n:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(r);for(let a of this.items)ld.addPairToJSMap(i,r,a);return r}toString(e,i,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Re.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),cd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:i})}};_r.YAMLMap=Tr;_r.findPair=Ht});var ot=w(ks=>{"use strict";var dd=R(),Ss=Ce(),hd={collection:"map",default:!0,nodeClass:Ss.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return dd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>Ss.YAMLMap.from(t,e,i)};ks.map=hd});var Pe=w(Es=>{"use strict";var pd=xt(),md=xr(),vd=Hi(),Zi=R(),gd=$(),wd=Ne(),Ir=class extends vd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Zi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=Qi(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let n=Qi(e);if(typeof n!="number")return;let r=this.items[n];return!i&&Zi.isScalar(r)?r.value:r}has(e){let i=Qi(e);return typeof i=="number"&&i<this.items.length}set(e,i){let n=Qi(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Zi.isScalar(r)&&gd.isScalarValue(i)?r.value=i:this.items[n]=i}toJSON(e,i){let n=[];i?.onCreate&&i.onCreate(n);let r=0;for(let a of this.items)n.push(wd.toJS(a,String(r++),i));return n}toString(e,i,n){return e?md.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:i}):JSON.stringify(this)}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof r=="function"){let c=i instanceof Set?s:String(o++);s=r.call(i,c,s)}a.items.push(pd.createNode(s,void 0,n))}}return a}};function Qi(t){let e=Zi.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Es.YAMLSeq=Ir});var st=w(Cs=>{"use strict";var yd=R(),Rs=Pe(),Nd={collection:"seq",default:!0,nodeClass:Rs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return yd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>Rs.YAMLSeq.from(t,e,i)};Cs.seq=Nd});var Mt=w(Ps=>{"use strict";var bd=jt(),Sd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,n){return e=Object.assign({actualString:!0},e),bd.stringifyString(t,e,i,n)}};Ps.string=Sd});var en=w(Ts=>{"use strict";var As=$(),xs={identify:t=>t==null,createNode:()=>new As.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new As.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&xs.test.test(t)?t:e.options.nullStr};Ts.nullTag=xs});var jr=w(Is=>{"use strict";var kd=$(),_s={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new kd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&_s.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?i.options.trueStr:i.options.falseStr}};Is.boolTag=_s});var ct=w(js=>{"use strict";function Ed({format:t,minFractionDigits:e,tag:i,value:n}){if(typeof n=="bigint")return String(n);let r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let a=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}js.stringifyNumber=Ed});var $r=w(tn=>{"use strict";var Rd=$(),Or=ct(),Cd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Or.stringifyNumber},Pd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Or.stringifyNumber(t)}},Ad={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Rd.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:Or.stringifyNumber};tn.float=Ad;tn.floatExp=Pd;tn.floatNaN=Cd});var Mr=w(rn=>{"use strict";var Os=ct(),nn=t=>typeof t=="bigint"||Number.isInteger(t),Hr=(t,e,i,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),i);function $s(t,e,i){let{value:n}=t;return nn(n)&&n>=0?i+n.toString(e):Os.stringifyNumber(t)}var xd={identify:t=>nn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>Hr(t,2,8,i),stringify:t=>$s(t,8,"0o")},Td={identify:nn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>Hr(t,0,10,i),stringify:Os.stringifyNumber},_d={identify:t=>nn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>Hr(t,2,16,i),stringify:t=>$s(t,16,"0x")};rn.int=Td;rn.intHex=_d;rn.intOct=xd});var Ms=w(Hs=>{"use strict";var Id=ot(),jd=en(),Od=st(),$d=Mt(),Hd=jr(),Lr=$r(),Dr=Mr(),Md=[Id.map,Od.seq,$d.string,jd.nullTag,Hd.boolTag,Dr.intOct,Dr.int,Dr.intHex,Lr.floatNaN,Lr.floatExp,Lr.float];Hs.schema=Md});var Fs=w(Ds=>{"use strict";var Ld=$(),Dd=ot(),Fd=st();function Ls(t){return typeof t=="bigint"||Number.isInteger(t)}var an=({value:t})=>JSON.stringify(t),Bd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:an},{identify:t=>t==null,createNode:()=>new Ld.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:an},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:an},{identify:Ls,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ls(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:an}],qd={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Vd=[Dd.map,Fd.seq].concat(Bd,qd);Ds.schema=Vd});var Br=w(Bs=>{"use strict";var Lt=Pi("buffer"),Fr=$(),zd=jt(),Wd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Lt.Buffer=="function")return Lt.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(i.length);for(let r=0;r<i.length;++r)n[r]=i.charCodeAt(r);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},n,r,a){if(!i)return"";let o=i,s;if(typeof Lt.Buffer=="function")s=o instanceof Lt.Buffer?o.toString("base64"):Lt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Fr.Scalar.BLOCK_LITERAL),e!==Fr.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(s.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=s.substr(d,c);s=u.join(e===Fr.Scalar.BLOCK_LITERAL?`
|
|
55
|
+
`:" ")}return zd.stringifyString({comment:t,type:e,value:s},n,r,a)}};Bs.binary=Wd});var cn=w(sn=>{"use strict";var on=R(),qr=Ee(),Jd=$(),Kd=Pe();function qs(t,e){if(on.isSeq(t))for(let i=0;i<t.items.length;++i){let n=t.items[i];if(!on.isPair(n)){if(on.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let r=n.items[0]||new qr.Pair(new Jd.Scalar(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
|
|
56
|
+
${r.key.commentBefore}`:n.commentBefore),n.comment){let a=r.value??r.key;a.comment=a.comment?`${n.comment}
|
|
57
|
+
${a.comment}`:n.comment}n=r}t.items[i]=on.isPair(n)?n:new qr.Pair(n)}}else e("Expected a sequence for this tag");return t}function Vs(t,e,i){let{replacer:n}=i,r=new Kd.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;r.items.push(qr.createPair(s,c,i))}return r}var Ud={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:qs,createNode:Vs};sn.createPairs=Vs;sn.pairs=Ud;sn.resolvePairs=qs});var Wr=w(zr=>{"use strict";var zs=R(),Vr=Ne(),Dt=Ce(),Gd=Pe(),Ws=cn(),Le=class t extends Gd.YAMLSeq{constructor(){super(),this.add=Dt.YAMLMap.prototype.add.bind(this),this.delete=Dt.YAMLMap.prototype.delete.bind(this),this.get=Dt.YAMLMap.prototype.get.bind(this),this.has=Dt.YAMLMap.prototype.has.bind(this),this.set=Dt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(zs.isPair(r)?(a=Vr.toJS(r.key,"",i),o=Vr.toJS(r.value,a,i)):a=Vr.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(e,i,n){let r=Ws.createPairs(e,i,n),a=new this;return a.items=r.items,a}};Le.tag="tag:yaml.org,2002:omap";var Yd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Le,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Ws.resolvePairs(t,e),n=[];for(let{key:r}of i.items)zs.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Le,i)},createNode:(t,e,i)=>Le.from(t,e,i)};zr.YAMLOMap=Le;zr.omap=Yd});var Ys=w(Jr=>{"use strict";var Js=$();function Ks({value:t,source:e},i){return e&&(t?Us:Gs).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Us={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Js.Scalar(!0),stringify:Ks},Gs={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Js.Scalar(!1),stringify:Ks};Jr.falseTag=Gs;Jr.trueTag=Us});var Xs=w(ln=>{"use strict";var Xd=$(),Kr=ct(),Qd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Kr.stringifyNumber},Zd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Kr.stringifyNumber(t)}},eh={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Xd.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let n=t.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Kr.stringifyNumber};ln.float=eh;ln.floatExp=Zd;ln.floatNaN=Qd});var Zs=w(Bt=>{"use strict";var Qs=ct(),Ft=t=>typeof t=="bigint"||Number.isInteger(t);function un(t,e,i,{intAsBigInt:n}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return r==="-"?-1*a:a}function Ur(t,e,i){let{value:n}=t;if(Ft(n)){let r=n.toString(e);return n<0?"-"+i+r.substr(1):i+r}return Qs.stringifyNumber(t)}var th={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>un(t,2,2,i),stringify:t=>Ur(t,2,"0b")},ih={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>un(t,1,8,i),stringify:t=>Ur(t,8,"0")},nh={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>un(t,0,10,i),stringify:Qs.stringifyNumber},rh={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>un(t,2,16,i),stringify:t=>Ur(t,16,"0x")};Bt.int=nh;Bt.intBin=th;Bt.intHex=rh;Bt.intOct=ih});var Yr=w(Gr=>{"use strict";var hn=R(),fn=Ee(),dn=Ce(),De=class t extends dn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;hn.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new fn.Pair(e.key,null):i=new fn.Pair(e,null),dn.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let n=dn.findPair(this.items,e);return!i&&hn.isPair(n)?hn.isScalar(n.key)?n.key.value:n.key:n}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=dn.findPair(this.items,e);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new fn.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(fn.createPair(o,null,n));return a}};De.tag="tag:yaml.org,2002:set";var ah={collection:"map",identify:t=>t instanceof Set,nodeClass:De,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>De.from(t,e,i),resolve(t,e){if(hn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new De,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Gr.YAMLSet=De;Gr.set=ah});var Qr=w(pn=>{"use strict";var oh=ct();function Xr(t,e){let i=t[0],n=i==="-"||i==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),a=n.replace(/_/g,"").split(":").reduce((o,s)=>o*r(60)+r(s),r(0));return i==="-"?r(-1)*a:a}function ec(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return oh.stringifyNumber(t);let n="";e<0&&(n="-",e*=i(-1));let r=i(60),a=[e%r];return e<60?a.unshift(0):(e=(e-a[0])/r,a.unshift(e%r),e>=60&&(e=(e-a[0])/r,a.unshift(e))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var sh={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:i})=>Xr(t,i),stringify:ec},ch={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Xr(t,!1),stringify:ec},tc={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(tc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),u=e[8];if(u&&u!=="Z"){let f=Xr(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};pn.floatTime=ch;pn.intTime=sh;pn.timestamp=tc});var rc=w(nc=>{"use strict";var lh=ot(),uh=en(),fh=st(),dh=Mt(),hh=Br(),ic=Ys(),Zr=Xs(),mn=Zs(),ph=Ji(),mh=Wr(),vh=cn(),gh=Yr(),ea=Qr(),wh=[lh.map,fh.seq,dh.string,uh.nullTag,ic.trueTag,ic.falseTag,mn.intBin,mn.intOct,mn.int,mn.intHex,Zr.floatNaN,Zr.floatExp,Zr.float,hh.binary,ph.merge,mh.omap,vh.pairs,gh.set,ea.intTime,ea.floatTime,ea.timestamp];nc.schema=wh});var pc=w(na=>{"use strict";var cc=ot(),yh=en(),lc=st(),Nh=Mt(),bh=jr(),ta=$r(),ia=Mr(),Sh=Ms(),kh=Fs(),uc=Br(),qt=Ji(),fc=Wr(),dc=cn(),ac=rc(),hc=Yr(),vn=Qr(),oc=new Map([["core",Sh.schema],["failsafe",[cc.map,lc.seq,Nh.string]],["json",kh.schema],["yaml11",ac.schema],["yaml-1.1",ac.schema]]),sc={binary:uc.binary,bool:bh.boolTag,float:ta.float,floatExp:ta.floatExp,floatNaN:ta.floatNaN,floatTime:vn.floatTime,int:ia.int,intHex:ia.intHex,intOct:ia.intOct,intTime:vn.intTime,map:cc.map,merge:qt.merge,null:yh.nullTag,omap:fc.omap,pairs:dc.pairs,seq:lc.seq,set:hc.set,timestamp:vn.timestamp},Eh={"tag:yaml.org,2002:binary":uc.binary,"tag:yaml.org,2002:merge":qt.merge,"tag:yaml.org,2002:omap":fc.omap,"tag:yaml.org,2002:pairs":dc.pairs,"tag:yaml.org,2002:set":hc.set,"tag:yaml.org,2002:timestamp":vn.timestamp};function Rh(t,e,i){let n=oc.get(e);if(n&&!t)return i&&!n.includes(qt.merge)?n.concat(qt.merge):n.slice();let r=n;if(!r)if(Array.isArray(t))r=[];else{let a=Array.from(oc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)r=r.concat(a);else typeof t=="function"&&(r=t(r.slice()));return i&&(r=r.concat(qt.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?sc[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(sc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}na.coreKnownTags=Eh;na.getTags=Rh});var oa=w(mc=>{"use strict";var ra=R(),Ch=ot(),Ph=st(),Ah=Mt(),gn=pc(),xh=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,aa=class t{constructor({compat:e,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?gn.getTags(e,"compat"):e?gn.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?gn.coreKnownTags:{},this.tags=gn.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,ra.MAP,{value:Ch.map}),Object.defineProperty(this,ra.SCALAR,{value:Ah.string}),Object.defineProperty(this,ra.SEQ,{value:Ph.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?xh:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};mc.Schema=aa});var gc=w(vc=>{"use strict";var Th=R(),sa=Ot(),Vt=Tt();function _h(t,e){let i=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&i.push("---");let r=sa.createStringifyContext(t,e),{commentString:a}=r.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(Vt.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(Th.isNode(t.contents)){if(t.contents.spaceBefore&&n&&i.push(""),t.contents.commentBefore){let u=a(t.contents.commentBefore);i.push(Vt.indentComment(u,""))}r.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=sa.stringify(t.contents,r,()=>s=null,c);s&&(l+=Vt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(sa.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
|
|
58
|
+
`)?(i.push("..."),i.push(Vt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Vt.indentComment(a(c),"")))}return i.join(`
|
|
59
|
+
`)+`
|
|
60
|
+
`}vc.stringifyDocument=_h});var zt=w(wc=>{"use strict";var Ih=At(),lt=Hi(),Y=R(),jh=Ee(),Oh=Ne(),$h=oa(),Hh=gc(),ca=Ii(),Mh=dr(),Lh=xt(),la=fr(),ua=class t{constructor(e,i,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let r=null;typeof i=="function"||Array.isArray(i)?r=i:n===void 0&&i&&(n=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new la.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let e=Object.create(t.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Y.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ut(this.contents)&&this.contents.add(e)}addIn(e,i){ut(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let n=ca.anchorNames(this);e.anchor=!i||n.has(i)?ca.findNewAnchor(i||"a",n):i}return new Ih.Alias(e.anchor)}createNode(e,i,n){let r;if(typeof i=="function")e=i.call({"":e},"",e),r=i;else if(Array.isArray(i)){let p=N=>typeof N=="number"||N instanceof String||N instanceof Number,y=i.filter(p).map(String);y.length>0&&(i=i.concat(y)),r=i}else n===void 0&&i&&(n=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:f,setAnchors:d,sourceObjects:m}=ca.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},h=Lh.createNode(e,u,g);return s&&Y.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,i,n={}){let r=this.createNode(e,null,n),a=this.createNode(i,null,n);return new jh.Pair(r,a)}delete(e){return ut(this.contents)?this.contents.delete(e):!1}deleteIn(e){return lt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ut(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return Y.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return lt.isEmptyPath(e)?!i&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return Y.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return lt.isEmptyPath(e)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=lt.collectionFromPath(this.schema,[e],i):ut(this.contents)&&this.contents.set(e,i)}setIn(e,i){lt.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=lt.collectionFromPath(this.schema,Array.from(e),i):ut(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new la.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new la.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(n)this.schema=new $h.Schema(Object.assign(n,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:n,maxAliasCount:r,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Oh.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:u}of s.anchors.values())a(u,l);return typeof o=="function"?Mh.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Hh.stringifyDocument(this,e)}};function ut(t){if(Y.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}wc.Document=ua});var Kt=w(Jt=>{"use strict";var Wt=class extends Error{constructor(e,i,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=i}},fa=class extends Wt{constructor(e,i,n){super("YAMLParseError",e,i,n)}},da=class extends Wt{constructor(e,i,n){super("YAMLWarning",e,i,n)}},Dh=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:n,col:r}=i.linePos[0];i.message+=` at line ${n}, column ${r}`;let a=r-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);s.length>80&&(s=s.substring(0,79)+`…
|
|
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
|
+
|
|
63
|
+
${o}
|
|
64
|
+
${l}
|
|
65
|
+
`}};Jt.YAMLError=Wt;Jt.YAMLParseError=fa;Jt.YAMLWarning=da;Jt.prettifyError=Dh});var Ut=w(yc=>{"use strict";function Fh(t,{flow:e,indicator:i,next:n,offset:r,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,f="",d="",m=!1,g=!1,h=null,p=null,y=null,N=null,S=null,k=null,E=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&a(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(l&&b.type!=="comment"&&b.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),b.type){case"space":!e&&(i!=="doc-start"||n?.type!=="flow-collection")&&b.source.includes(" ")&&(h=b),u=!0;break;case"comment":{u||a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let _=b.source.substring(1)||" ";f?f+=d+_:f=_,d="",l=!1;break}case"newline":l?f?f+=b.source:(!k||i!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,m=!0,(p||y)&&(N=b),u=!0;break;case"anchor":p&&a(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&a(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=b,E??(E=b.offset),l=!1,u=!1,g=!0;break;case"tag":{y&&a(b,"MULTIPLE_TAGS","A node can have at most one tag"),y=b,E??(E=b.offset),l=!1,u=!1,g=!0;break}case i:(p||y)&&a(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),k&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),k=b,l=i==="seq-item-ind"||i==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=b,l=!1,u=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,u=!1}let v=t[t.length-1],C=v?v.offset+v.source.length:r;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&a(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:k,spaceBefore:c,comment:f,hasNewline:m,anchor:p,tag:y,newlineAfterProp:N,end:C,start:E??C}}yc.resolveProps=Fh});var wn=w(Nc=>{"use strict";function ha(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
66
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(ha(e.key)||ha(e.value))return!0}return!1;default:return!0}}Nc.containsNewline=ha});var pa=w(bc=>{"use strict";var Bh=wn();function qh(t,e,i){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Bh.containsNewline(e)&&i(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}bc.flowIndentCheck=qh});var ma=w(kc=>{"use strict";var Sc=R();function Vh(t,e,i){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let r=typeof n=="function"?n:(a,o)=>a===o||Sc.isScalar(a)&&Sc.isScalar(o)&&a.value===o.value;return e.some(a=>r(a.key,i))}kc.mapIncludes=Vh});var xc=w(Ac=>{"use strict";var Ec=Ee(),zh=Ce(),Rc=Ut(),Wh=wn(),Cc=pa(),Jh=ma(),Pc="All mapping items must start at the same column";function Kh({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??zh.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:f,key:d,sep:m,value:g}=u,h=Rc.resolveProps(f,{indicator:"explicit-key-ind",next:d??m?.[0],offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0}),p=!h.found;if(p){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==n.indent&&r(c,"BAD_INDENT",Pc)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(s.comment?s.comment+=`
|
|
67
|
+
`+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||Wh.containsNewline(d))&&r(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&r(c,"BAD_INDENT",Pc);i.atKey=!0;let y=h.end,N=d?t(i,d,h,r):e(i,y,f,null,h,r);i.schema.compat&&Cc.flowIndentCheck(n.indent,d,r),i.atKey=!1,Jh.mapIncludes(i,s.items,N)&&r(y,"DUPLICATE_KEY","Map keys must be unique");let S=Rc.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:N.range[2],onError:r,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){p&&(g?.type==="block-map"&&!S.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<S.found.offset-1024&&r(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=g?t(i,g,S,r):e(i,c,m,null,S,r);i.schema.compat&&Cc.flowIndentCheck(n.indent,g,r),c=k.range[2];let E=new Ec.Pair(N,k);i.options.keepSourceTokens&&(E.srcToken=u),s.items.push(E)}else{p&&r(N.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(N.comment?N.comment+=`
|
|
68
|
+
`+S.comment:N.comment=S.comment);let k=new Ec.Pair(N);i.options.keepSourceTokens&&(k.srcToken=u),s.items.push(k)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[n.offset,c,l??c],s}Ac.resolveBlockMap=Kh});var _c=w(Tc=>{"use strict";var Uh=Pe(),Gh=Ut(),Yh=pa();function Xh({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=a?.nodeClass??Uh.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:f}of n.items){let d=Gh.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(s.comment=d.comment);continue}let m=f?t(i,f,d,r):e(i,d.end,u,null,d,r);i.schema.compat&&Yh.flowIndentCheck(n.indent,f,r),c=m.range[2],s.items.push(m)}return s.range=[n.offset,c,l??c],s}Tc.resolveBlockSeq=Xh});var ft=w(Ic=>{"use strict";function Qh(t,e,i,n){let r="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&n(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";r?r+=o+u:r=u,o="";break}case"newline":r&&(o+=c),a=!0;break;default:n(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}Ic.resolveEnd=Qh});var Hc=w($c=>{"use strict";var Zh=R(),ep=Ee(),jc=Ce(),tp=Pe(),ip=ft(),Oc=Ut(),np=wn(),rp=ma(),va="Block collections are not allowed within flow collections",ga=t=>t&&(t.type==="block-map"||t.type==="block-seq");function ap({composeNode:t,composeEmptyNode:e},i,n,r,a){let o=n.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?jc.YAMLMap:tp.YAMLSeq),l=new c(i.schema);l.flow=!0;let u=i.atRoot;u&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let f=n.offset+n.start.source.length;for(let p=0;p<n.items.length;++p){let y=n.items[p],{start:N,key:S,sep:k,value:E}=y,v=Oc.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:S??k?.[0],offset:f,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!k&&!E){p===0&&v.comma?r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):p<n.items.length-1&&r(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
|
|
69
|
+
`+v.comment:l.comment=v.comment),f=v.end;continue}!o&&i.options.strict&&np.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&r(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||r(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let C="";e:for(let b of N)switch(b.type){case"comma":case"space":break;case"comment":C=b.source.substring(1);break e;default:break e}if(C){let b=l.items[l.items.length-1];Zh.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
|
|
70
|
+
`+C:b.comment=C,v.comment=v.comment.substring(C.length+1)}}if(!o&&!k&&!v.found){let C=E?t(i,E,v,r):e(i,v.end,k,null,v,r);l.items.push(C),f=C.range[2],ga(E)&&r(C.range,"BLOCK_IN_FLOW",va)}else{i.atKey=!0;let C=v.end,b=S?t(i,S,v,r):e(i,C,N,null,v,r);ga(S)&&r(b.range,"BLOCK_IN_FLOW",va),i.atKey=!1;let _=Oc.resolveProps(k??[],{flow:s,indicator:"map-value-ind",next:E,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(_.found){if(!o&&!v.found&&i.options.strict){if(k)for(let H of k){if(H===_.found)break;if(H.type==="newline"){r(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<_.found.offset-1024&&r(_.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?r(E,"MISSING_CHAR",`Missing space after : in ${s}`):r(_.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let W=E?t(i,E,_,r):_.found?e(i,_.end,k,null,_,r):null;W?ga(E)&&r(W.range,"BLOCK_IN_FLOW",va):_.comment&&(b.comment?b.comment+=`
|
|
71
|
+
`+_.comment:b.comment=_.comment);let tt=new ep.Pair(b,W);if(i.options.keepSourceTokens&&(tt.srcToken=y),o){let H=l;rp.mapIncludes(i,H.items,b)&&r(C,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(tt)}else{let H=new jc.YAMLMap(i.schema);H.flow=!0,H.items.push(tt);let Oo=(W??b).range;H.range=[b.range[0],Oo[1],Oo[2]],l.items.push(H)}f=W?W.range[2]:_.end}}let d=o?"}":"]",[m,...g]=n.end,h=f;if(m?.source===d)h=m.offset+m.source.length;else{let p=s[0].toUpperCase()+s.substring(1),y=u?`${p} must end with a ${d}`:`${p} in block collection must be sufficiently indented and end with a ${d}`;r(f,u?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let p=ip.resolveEnd(g,h,i.options.strict,r);p.comment&&(l.comment?l.comment+=`
|
|
72
|
+
`+p.comment:l.comment=p.comment),l.range=[n.offset,h,p.offset]}else l.range=[n.offset,h,h];return l}$c.resolveFlowCollection=ap});var Lc=w(Mc=>{"use strict";var op=R(),sp=$(),cp=Ce(),lp=Pe(),up=xc(),fp=_c(),dp=Hc();function wa(t,e,i,n,r,a){let o=i.type==="block-map"?up.resolveBlockMap(t,e,i,n,a):i.type==="block-seq"?fp.resolveBlockSeq(t,e,i,n,a):dp.resolveFlowCollection(t,e,i,n,a),s=o.constructor;return r==="!"||r===s.tagName?(o.tag=s.tagName,o):(r&&(o.tag=r),o)}function hp(t,e,i,n,r){let a=n.tag,o=a?e.directives.tagName(a.source,d=>r(a,"TAG_RESOLVE_FAILED",d)):null;if(i.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=n,g=d&&a?d.offset>a.offset?d:a:d??a;g&&(!m||m.offset<g.offset)&&r(g,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===cp.YAMLMap.tagName&&s==="map"||o===lp.YAMLSeq.tagName&&s==="seq")return wa(t,e,i,r,o);let c=e.schema.tags.find(d=>d.tag===o&&d.collection===s);if(!c){let d=e.schema.knownTags[o];if(d?.collection===s)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(a,"BAD_COLLECTION_TYPE",`${d.tag} used for ${s} collection, but expects ${d.collection??"scalar"}`,!0):r(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),wa(t,e,i,r,o)}let l=wa(t,e,i,r,o,c),u=c.resolve?.(l,d=>r(a,"TAG_RESOLVE_FAILED",d),e.options)??l,f=op.isNode(u)?u:new sp.Scalar(u);return f.range=l.range,f.tag=o,c?.format&&(f.format=c.format),f}Mc.composeCollection=hp});var Na=w(Dc=>{"use strict";var ya=$();function pp(t,e,i){let n=e.offset,r=mp(e,t.options.strict,i);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let a=r.mode===">"?ya.Scalar.BLOCK_FOLDED:ya.Scalar.BLOCK_LITERAL,o=e.source?vp(e.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let p=o[h][1];if(p===""||p==="\r")s=h;else break}if(s===0){let h=r.chomp==="+"&&o.length>0?`
|
|
73
|
+
`.repeat(Math.max(1,o.length-1)):"",p=n+r.length;return e.source&&(p+=e.source.length),{value:h,type:a,comment:r.comment,range:[n,p,p]}}let c=e.indent+r.indent,l=e.offset+r.length,u=0;for(let h=0;h<s;++h){let[p,y]=o[h];if(y===""||y==="\r")r.indent===0&&p.length>c&&(c=p.length);else{p.length<c&&i(l+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=p.length),u=h,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+y.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let f="",d="",m=!1;for(let h=0;h<u;++h)f+=o[h][0].slice(c)+`
|
|
74
|
+
`;for(let h=u;h<s;++h){let[p,y]=o[h];l+=p.length+y.length+1;let N=y[y.length-1]==="\r";if(N&&(y=y.slice(0,-1)),y&&p.length<c){let k=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(N?2:1),"BAD_INDENT",k),p=""}a===ya.Scalar.BLOCK_LITERAL?(f+=d+p.slice(c)+y,d=`
|
|
75
|
+
`):p.length>c||y[0]===" "?(d===" "?d=`
|
|
76
|
+
`:!m&&d===`
|
|
77
|
+
`&&(d=`
|
|
78
|
+
|
|
79
|
+
`),f+=d+p.slice(c)+y,d=`
|
|
80
|
+
`,m=!0):y===""?d===`
|
|
81
|
+
`?f+=`
|
|
82
|
+
`:d=`
|
|
83
|
+
`:(f+=d+y,d=" ",m=!1)}switch(r.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)f+=`
|
|
84
|
+
`+o[h][0].slice(c);f[f.length-1]!==`
|
|
85
|
+
`&&(f+=`
|
|
86
|
+
`);break;default:f+=`
|
|
87
|
+
`}let g=n+r.length+e.source.length;return{value:f,type:a,comment:r.comment,range:[n,g,g]}}function mp({offset:t,props:e},i,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],a=r[0],o=0,s="",c=-1;for(let d=1;d<r.length;++d){let m=r[d];if(!s&&(m==="-"||m==="+"))s=m;else{let g=Number(m);!o&&g?o=g:c===-1&&(c=t+d)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,u="",f=r.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":l=!0;case"newline":f+=m.source.length;break;case"comment":i&&!l&&n(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,u=m.source.substring(1);break;case"error":n(m,"UNEXPECTED_TOKEN",m.message),f+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;n(m,"UNEXPECTED_TOKEN",g);let h=m.source;h&&typeof h=="string"&&(f+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:f}}function vp(t){let e=t.split(/\n( *)/),i=e[0],n=i.match(/^( *)/),a=[n?.[1]?[n[1],i.slice(n[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}Dc.resolveBlockScalar=pp});var Sa=w(Bc=>{"use strict";var ba=$(),gp=ft();function wp(t,e,i){let{offset:n,type:r,source:a,end:o}=t,s,c,l=(d,m,g)=>i(n+d,m,g);switch(r){case"scalar":s=ba.Scalar.PLAIN,c=yp(a,l);break;case"single-quoted-scalar":s=ba.Scalar.QUOTE_SINGLE,c=Np(a,l);break;case"double-quoted-scalar":s=ba.Scalar.QUOTE_DOUBLE,c=bp(a,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+a.length,n+a.length]}}let u=n+a.length,f=gp.resolveEnd(o,u,e,i);return{value:c,type:s,comment:f.comment,range:[n,u,f.offset]}}function yp(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Fc(t)}function Np(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Fc(t.slice(1,-1)).replace(/''/g,"'")}function Fc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
88
|
+
`,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
89
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let r=n[1],a=" ",o=e.lastIndex;for(i.lastIndex=o;n=i.exec(t);)n[1]===""?a===`
|
|
90
|
+
`?r+=a:a=`
|
|
91
|
+
`:(r+=a+n[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,n=s.exec(t),r+a+(n?.[1]??"")}function bp(t,e){let i="";for(let n=1;n<t.length-1;++n){let r=t[n];if(!(r==="\r"&&t[n+1]===`
|
|
92
|
+
`))if(r===`
|
|
93
|
+
`){let{fold:a,offset:o}=Sp(t,n);i+=a,n=o}else if(r==="\\"){let a=t[++n],o=kp[a];if(o)i+=o;else if(a===`
|
|
94
|
+
`)for(a=t[n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="\r"&&t[n+1]===`
|
|
95
|
+
`)for(a=t[++n+1];a===" "||a===" ";)a=t[++n+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Ep(t,n+1,s,e),n+=s}else{let s=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(r===" "||r===" "){let a=n,o=t[n+1];for(;o===" "||o===" ";)o=t[++n+1];o!==`
|
|
96
|
+
`&&!(o==="\r"&&t[n+2]===`
|
|
97
|
+
`)&&(i+=n>a?t.slice(a,n+1):r)}else i+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function Sp(t,e){let i="",n=t[e+1];for(;(n===" "||n===" "||n===`
|
|
98
|
+
`||n==="\r")&&!(n==="\r"&&t[e+2]!==`
|
|
99
|
+
`);)n===`
|
|
100
|
+
`&&(i+=`
|
|
101
|
+
`),e+=1,n=t[e+1];return i||(i=" "),{fold:i,offset:e}}var kp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
102
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ep(t,e,i,n){let r=t.substr(e,i),o=r.length===i&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}Bc.resolveFlowScalar=wp});var zc=w(Vc=>{"use strict";var Fe=R(),qc=$(),Rp=Na(),Cp=Sa();function Pp(t,e,i,n){let{value:r,type:a,comment:o,range:s}=e.type==="block-scalar"?Rp.resolveBlockScalar(t,e,n):Cp.resolveFlowScalar(e,t.options.strict,n),c=i?t.directives.tagName(i.source,f=>n(i,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Fe.SCALAR]:c?l=Ap(t.schema,r,c,i,n):e.type==="scalar"?l=xp(t,r,e,n):l=t.schema[Fe.SCALAR];let u;try{let f=l.resolve(r,d=>n(i??e,"TAG_RESOLVE_FAILED",d),t.options);u=Fe.isScalar(f)?f:new qc.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(i??e,"TAG_RESOLVE_FAILED",d),u=new qc.Scalar(r)}return u.range=s,u.source=r,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Ap(t,e,i,n,r){if(i==="!")return t[Fe.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[Fe.SCALAR])}function xp({atKey:t,directives:e,schema:i},n,r,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(n))||i[Fe.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(n))??i[Fe.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),u=`Value may be parsed as either ${c} or ${l}`;a(r,"TAG_RESOLVE_FAILED",u,!0)}}return o}Vc.composeScalar=Pp});var Jc=w(Wc=>{"use strict";function Tp(t,e,i){if(e){i??(i=e.length);for(let n=i-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++n];r?.type==="space";)t+=r.source.length,r=e[++n];break}}return t}Wc.emptyScalarPosition=Tp});var Gc=w(Ea=>{"use strict";var _p=At(),Ip=R(),jp=Lc(),Kc=zc(),Op=ft(),$p=Jc(),Hp={composeNode:Uc,composeEmptyNode:ka};function Uc(t,e,i,n){let r=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,u=!0;switch(e.type){case"alias":l=Mp(t,e,n),(s||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Kc.composeScalar(t,e,c,n),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=jp.composeCollection(Hp,t,e,i,n),s&&(l.anchor=s.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=ka(t,e.offset,void 0,null,i,n)),s&&l.anchor===""&&n(s,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!Ip.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function ka(t,e,i,n,{spaceBefore:r,comment:a,anchor:o,tag:s,end:c},l){let u={type:"scalar",offset:$p.emptyScalarPosition(e,i,n),indent:-1,source:""},f=Kc.composeScalar(t,u,s,l);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),a&&(f.comment=a,f.range[2]=c),f}function Mp({options:t},{offset:e,source:i,end:n},r){let a=new _p.Alias(i.substring(1));a.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=Op.resolveEnd(n,o,t.strict,r);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}Ea.composeEmptyNode=ka;Ea.composeNode=Uc});var Qc=w(Xc=>{"use strict";var Lp=zt(),Yc=Gc(),Dp=ft(),Fp=Ut();function Bp(t,e,{offset:i,start:n,value:r,end:a},o){let s=Object.assign({_directives:e},t),c=new Lp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Fp.resolveProps(n,{indicator:"doc-start",next:r??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Yc.composeNode(l,r,u,o):Yc.composeEmptyNode(l,u.end,n,null,u,o);let f=c.contents.range[2],d=Dp.resolveEnd(a,f,!1,o);return d.comment&&(c.comment=d.comment),c.range=[i,f,d.offset],c}Xc.composeDoc=Bp});var Ca=w(tl=>{"use strict";var qp=Pi("process"),Vp=fr(),zp=zt(),Gt=Kt(),Zc=R(),Wp=Qc(),Jp=ft();function Yt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function el(t){let e="",i=!1,n=!1;for(let r=0;r<t.length;++r){let a=t[r];switch(a[0]){case"#":e+=(e===""?"":n?`
|
|
103
|
+
|
|
104
|
+
`:`
|
|
105
|
+
`)+(a.substring(1)||" "),i=!0,n=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),i=!1;break;default:i||(n=!0),i=!1}}return{comment:e,afterEmptyLine:n}}var Ra=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,n,r,a)=>{let o=Yt(i);a?this.warnings.push(new Gt.YAMLWarning(o,n,r)):this.errors.push(new Gt.YAMLParseError(o,n,r))},this.directives=new Vp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:n,afterEmptyLine:r}=el(this.prelude);if(n){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
|
|
106
|
+
${n}`:n;else if(r||e.directives.docStart||!a)e.commentBefore=n;else if(Zc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Zc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${n}
|
|
107
|
+
${s}`:n}else{let o=a.commentBefore;a.commentBefore=o?`${n}
|
|
108
|
+
${o}`:n}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:el(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(i,n)}*next(e){switch(qp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,n,r)=>{let a=Yt(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=Wp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Gt.YAMLParseError(Yt(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Gt.YAMLParseError(Yt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let i=Jp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
109
|
+
${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Gt.YAMLParseError(Yt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),r=new zp.Document(void 0,n);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,i,i],this.decorate(r,!1),yield r}}};tl.Composer=Ra});var rl=w(yn=>{"use strict";var Kp=Na(),Up=Sa(),Gp=Kt(),il=jt();function Yp(t,e=!0,i){if(t){let n=(r,a,o)=>{let s=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(i)i(s,a,o);else throw new Gp.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Up.resolveFlowScalar(t,e,n);case"block-scalar":return Kp.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Xp(t,e){let{implicitKey:i=!1,indent:n,inFlow:r=!1,offset:a=-1,type:o="PLAIN"}=e,s=il.stringifyString({type:o,value:t},{implicitKey:i,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
110
|
+
`}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
|
|
111
|
+
`),u=s.substring(0,l),f=s.substring(l+1)+`
|
|
112
|
+
`,d=[{type:"block-scalar-header",offset:a,indent:n,source:u}];return nl(d,c)||d.push({type:"newline",offset:-1,indent:n,source:`
|
|
113
|
+
`}),{type:"block-scalar",offset:a,indent:n,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:a,indent:n,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:n,source:s,end:c};default:return{type:"scalar",offset:a,indent:n,source:s,end:c}}}function Qp(t,e,i={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(n&&typeof s=="number"&&(s+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=il.stringifyString({type:o,value:e},{implicitKey:r||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Zp(t,c);break;case'"':Pa(t,c,"double-quoted-scalar");break;case"'":Pa(t,c,"single-quoted-scalar");break;default:Pa(t,c,"scalar")}}function Zp(t,e){let i=e.indexOf(`
|
|
114
|
+
`),n=e.substring(0,i),r=e.substring(i+1)+`
|
|
115
|
+
`;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=n,t.source=r}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:n}];nl(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
|
|
116
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:r})}}function nl(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function Pa(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let a of n)a.offset+=r;delete t.props,Object.assign(t,{type:i,source:e,end:n});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
117
|
+
`};delete t.items,Object.assign(t,{type:i,source:e,end:[r]});break}default:{let n="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:n,source:e,end:r})}}}yn.createScalarToken=Xp;yn.resolveAsScalar=Yp;yn.setScalarValue=Qp});var ol=w(al=>{"use strict";var em=t=>"type"in t?bn(t):Nn(t);function bn(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=bn(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=Nn(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=Nn(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=Nn(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function Nn({start:t,key:e,sep:i,value:n}){let r="";for(let a of t)r+=a.source;if(e&&(r+=bn(e)),i)for(let a of i)r+=a.source;return n&&(r+=bn(n)),r}al.stringify=em});var ul=w(ll=>{"use strict";var Aa=Symbol("break visit"),tm=Symbol("skip children"),sl=Symbol("remove item");function Be(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),cl(Object.freeze([]),t,e)}Be.BREAK=Aa;Be.SKIP=tm;Be.REMOVE=sl;Be.itemAtPath=(t,e)=>{let i=t;for(let[n,r]of e){let a=i?.[n];if(a&&"items"in a)i=a.items[r];else return}return i};Be.parentCollection=(t,e)=>{let i=Be.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],r=i?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function cl(t,e,i){let n=i(e,t);if(typeof n=="symbol")return n;for(let r of["key","value"]){let a=e[r];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=cl(Object.freeze(t.concat([[r,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===Aa)return Aa;s===sl&&(a.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}ll.visit=Be});var Sn=w(z=>{"use strict";var xa=rl(),im=ol(),nm=ul(),Ta="\uFEFF",_a="",Ia="",ja="",rm=t=>!!t&&"items"in t,am=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function om(t){switch(t){case Ta:return"<BOM>";case _a:return"<DOC>";case Ia:return"<FLOW_END>";case ja:return"<SCALAR>";default:return JSON.stringify(t)}}function sm(t){switch(t){case Ta:return"byte-order-mark";case _a:return"doc-mode";case Ia:return"flow-error-end";case ja:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
118
|
+
`:case`\r
|
|
119
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}z.createScalarToken=xa.createScalarToken;z.resolveAsScalar=xa.resolveAsScalar;z.setScalarValue=xa.setScalarValue;z.stringify=im.stringify;z.visit=nm.visit;z.BOM=Ta;z.DOCUMENT=_a;z.FLOW_END=Ia;z.SCALAR=ja;z.isCollection=rm;z.isScalar=am;z.prettyToken=om;z.tokenType=sm});var Ha=w(dl=>{"use strict";var Xt=Sn();function ne(t){switch(t){case void 0:case" ":case`
|
|
120
|
+
`:case"\r":case" ":return!0;default:return!1}}var fl=new Set("0123456789ABCDEFabcdef"),cm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),kn=new Set(",[]{}"),lm=new Set(` ,[]{}
|
|
121
|
+
\r `),Oa=t=>!t||lm.has(t),$a=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,i=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!i;let n=this.next??"stream";for(;n&&(i||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
|
|
122
|
+
`?!0:i==="\r"?this.buffer[e+1]===`
|
|
123
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let n=0;for(;i===" ";)i=this.buffer[++n+e];if(i==="\r"){let r=this.buffer[n+e+1];if(r===`
|
|
124
|
+
`||!r&&!this.atEnd)return e+n+1}return i===`
|
|
125
|
+
`||n>=this.indentNext||!i&&!this.atEnd?e+n:-1}if(i==="-"||i==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&ne(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
126
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Xt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,n=e.indexOf("#");for(;n!==-1;){let a=e[n-1];if(a===" "||a===" "){i=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let r=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield Xt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&ne(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ne(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ne(i)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Oa),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,n=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=n=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&ne(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Xt.FLOW_END,yield*this.parseLineStart();let a=0;for(;r[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),r[a]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Oa),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ne(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let n=this.buffer.substring(0,i),r=n.indexOf(`
|
|
127
|
+
`,this.pos);if(r!==-1){for(;r!==-1;){let a=this.continueScalar(r+1);if(a===-1)break;r=n.indexOf(`
|
|
128
|
+
`,a)}r!==-1&&(i=r-(n[r-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>ne(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,n;e:for(let a=this.pos;n=this.buffer[a];++a)switch(n){case" ":i+=1;break;case`
|
|
129
|
+
`:e=a,i=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
130
|
+
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
|
|
131
|
+
`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
132
|
+
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
|
|
133
|
+
`&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield Xt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let a=this.buffer[n+1];if(ne(a)||e&&kn.has(a))break;i=n}else if(ne(r)){let a=this.buffer[n+1];if(r==="\r"&&(a===`
|
|
134
|
+
`?(n+=1,r=`
|
|
135
|
+
`,a=this.buffer[n+1]):i=n),a==="#"||e&&kn.has(a))break;if(r===`
|
|
136
|
+
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&kn.has(r))break;i=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Xt.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(i&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Oa),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,n=this.charAt(1);if(ne(n)||i&&kn.has(n)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,i=this.buffer[e];for(;!ne(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(cm.has(i))i=this.buffer[++e];else if(i==="%"&&fl.has(this.buffer[e+1])&&fl.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
137
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
138
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,n;do n=this.buffer[++i];while(n===" "||e&&n===" ");let r=i-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=i),r}*pushUntil(e){let i=this.pos,n=this.buffer[i];for(;!e(n);)n=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};dl.Lexer=$a});var La=w(hl=>{"use strict";var Ma=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,n=this.lineStarts.length;for(;i<n;){let a=i+n>>1;this.lineStarts[a]<e?i=a+1:n=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let r=this.lineStarts[i-1];return{line:i,col:e-r+1}}}};hl.LineCounter=Ma});var Fa=w(wl=>{"use strict";var um=Pi("process"),pl=Sn(),fm=Ha();function Ae(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function ml(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function gl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function En(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function dt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Rn(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function vl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ae(e.start,"explicit-key-ind")&&!Ae(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,gl(e.value)?e.value.end?Rn(e.value.end,e.sep):e.value.end=e.sep:Rn(e.start,e.sep),delete e.sep)}var Da=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new fm.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,i))yield*this.next(n);i||(yield*this.end())}*next(e){if(this.source=e,um.env.LOG_TOKENS&&console.log("|",pl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=pl.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let n=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in n?n.indent:0:i.type==="flow-collection"&&n.type==="document"&&(i.indent=0),i.type==="flow-collection"&&vl(i),n.type){case"document":n.value=i;break;case"block-scalar":n.props.push(i);break;case"block-map":{let r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=i;else{Object.assign(r,{key:i,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:i}):r.value=i;break}case"flow-collection":{let r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:i,sep:[]}):r.sep?r.value=i:Object.assign(r,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let r=i.items[i.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&ml(r.start)===-1&&(i.indent===0||r.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{ml(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let i=En(this.peek(2)),n=dt(i),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
|
|
139
|
+
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
140
|
+
`,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Rn(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(r&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||i.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):r||i.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ae(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(gl(i.key)&&!Ae(i.sep,"newline")){let o=dt(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(Ae(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=dt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||r?e.items.push({start:a,key:null,sep:[this.sourceToken]}):Ae(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||i.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ae(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let n="end"in i.value?i.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Rn(r,i.start),r.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||Ae(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:r,sep:[]}):i.sep?this.stack.push(r):Object.assign(i,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=En(n),a=dt(r);vl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
|
|
141
|
+
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
142
|
+
`,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=En(e),n=dt(i);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=En(e),n=dt(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};wl.Parser=Da});var kl=w(Zt=>{"use strict";var yl=Ca(),dm=zt(),Qt=Kt(),hm=Er(),pm=R(),mm=La(),Nl=Fa();function bl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new mm.LineCounter||null,prettyErrors:e}}function vm(t,e={}){let{lineCounter:i,prettyErrors:n}=bl(e),r=new Nl.Parser(i?.addNewLine),a=new yl.Composer(e),o=Array.from(a.compose(r.parse(t)));if(n&&i)for(let s of o)s.errors.forEach(Qt.prettifyError(t,i)),s.warnings.forEach(Qt.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function Sl(t,e={}){let{lineCounter:i,prettyErrors:n}=bl(e),r=new Nl.Parser(i?.addNewLine),a=new yl.Composer(e),o=null;for(let s of a.compose(r.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Qt.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(o.errors.forEach(Qt.prettifyError(t,i)),o.warnings.forEach(Qt.prettifyError(t,i))),o}function gm(t,e,i){let n;typeof e=="function"?n=e:i===void 0&&e&&typeof e=="object"&&(i=e);let r=Sl(t,i);if(!r)return null;if(r.warnings.forEach(a=>hm.warn(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},i))}function wm(t,e,i){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let r=Math.round(i);i=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=i??e??{};if(!r)return}return pm.isDocument(t)&&!n?t.toString(i):new dm.Document(t,n,i).toString(i)}Zt.parse=gm;Zt.parseAllDocuments=vm;Zt.parseDocument=Sl;Zt.stringify=wm});var qa=w(A=>{"use strict";var ym=Ca(),Nm=zt(),bm=oa(),Ba=Kt(),Sm=At(),xe=R(),km=Ee(),Em=$(),Rm=Ce(),Cm=Pe(),Pm=Sn(),Am=Ha(),xm=La(),Tm=Fa(),Cn=kl(),El=Et();A.Composer=ym.Composer;A.Document=Nm.Document;A.Schema=bm.Schema;A.YAMLError=Ba.YAMLError;A.YAMLParseError=Ba.YAMLParseError;A.YAMLWarning=Ba.YAMLWarning;A.Alias=Sm.Alias;A.isAlias=xe.isAlias;A.isCollection=xe.isCollection;A.isDocument=xe.isDocument;A.isMap=xe.isMap;A.isNode=xe.isNode;A.isPair=xe.isPair;A.isScalar=xe.isScalar;A.isSeq=xe.isSeq;A.Pair=km.Pair;A.Scalar=Em.Scalar;A.YAMLMap=Rm.YAMLMap;A.YAMLSeq=Cm.YAMLSeq;A.CST=Pm;A.Lexer=Am.Lexer;A.LineCounter=xm.LineCounter;A.Parser=Tm.Parser;A.parse=Cn.parse;A.parseAllDocuments=Cn.parseAllDocuments;A.parseDocument=Cn.parseDocument;A.stringify=Cn.stringify;A.visit=El.visit;A.visitAsync=El.visitAsync});import Zm from"path";var ti=Ho(qa(),1);import An from"path";var _n=64*1024,xn=1024,Tn=64,za=5,_m=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],J={include:["**/*"],exclude:[..._m],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4},Pn={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
|
|
143
|
+
# ambient_resume: true | false`,native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs, changes, and runtime data.","native.language":`# Artifact language used by Native workflow documents.
|
|
144
|
+
# language: en | zh-CN`,"native.clarification_mode":`# Controls whether Native asks one clarification at a time or every currently answerable question in a round.
|
|
145
|
+
# clarification_mode: sequential | batch`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
|
|
146
|
+
# archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed contract before Native stops the completion loop.","native.snapshot":"# Controls the auditable project scope and bounded work used by Native content snapshots.","native.snapshot.include":"# Selects the project-relative paths included in Native snapshots. Patterns use / and support *, **, and ?.","native.snapshot.exclude":"# Removes paths from the included scope. Exclusions are bound into each new change baseline.","native.snapshot.max_files":"# Bounds the number of files captured by one snapshot. Increase it for large monorepos.","native.snapshot.max_total_bytes":"# Bounds the total file content hashed by one snapshot. Content is streamed and does not depend on Git hashes.","native.snapshot.max_duration_ms":"# Bounds snapshot capture time in milliseconds. Increase it together with the byte budget on slower or larger repositories.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
|
|
147
|
+
# artifact_layout: legacy | docs`,"classic.language":`# Artifact language used by Classic workflow documents.
|
|
148
|
+
# language: en | zh-CN`,"classic.context_compression":`# Controls beta context compression for new Classic changes.
|
|
149
|
+
# context_compression: off | beta`,"classic.review_mode":`# Sets the default review depth for new Classic changes.
|
|
150
|
+
# review_mode: off | standard | thorough`,"classic.auto_transition":`# Automatically enters the next Classic phase after a phase passes.
|
|
151
|
+
# auto_transition: true | false`},"zh-CN":{schema:"# Comet 使用的配置格式版本,请勿修改此值。",default_workflow:"# `/comet` 默认进入的工作流;该值也必须出现在 workflows 中。",workflows:"# 此项目启用的工作流,可填写 native、classic 或同时启用两者。",ambient_resume:`# 是否启用只读的环境感知恢复探针,同时作用于 Native 和 Classic;设为 false 可关闭自动工作流恢复。
|
|
152
|
+
# ambient_resume: true | false`,native:"# Native 工作流配置,不会改变 Classic 的状态或行为。","native.artifact_root":"# Native 产物的存放根目录,包括规格、change 和运行时数据。","native.language":`# Native 工作流文档使用的产物语言。
|
|
153
|
+
# 可选值:en | zh-CN`,"native.clarification_mode":`# Native 每轮询问一个问题,或一次提出当前所有可回答的问题。
|
|
154
|
+
# 可选值:sequential | batch`,"native.archive_confirmation":`# Native 归档预演成功后自动归档,或等待用户明确确认。
|
|
155
|
+
# 可选值:automatic | required`,"native.max_verify_failures":"# 同一份已确认 contract 最多允许的 Verify 失败次数;达到上限后停止完成循环。","native.snapshot":"# Native 内容快照使用的可审计项目范围与有界工作预算。","native.snapshot.include":"# Native 快照纳入的项目相对路径;模式使用 /,支持 *、** 和 ?。","native.snapshot.exclude":"# 从纳入范围中排除路径;新 change 会把排除策略绑定到 baseline。","native.snapshot.max_files":"# 单次快照最多捕获的文件数;大型 monorepo 可按需提高。","native.snapshot.max_total_bytes":"# 单次快照最多哈希的文件内容总字节数;内容采用流式读取,不依赖 Git hash。","native.snapshot.max_duration_ms":"# 单次快照的最长执行时间(毫秒);较慢或更大的仓库应与字节预算一并提高。",classic:"# Classic 工作流配置,不会改变 Native 的状态或行为。","classic.artifact_layout":`# Classic 产物布局;默认使用 docs,update 检测到根目录 legacy 产物时予以保留。
|
|
156
|
+
# 可选值:legacy | docs`,"classic.language":`# Classic 工作流文档使用的产物语言。
|
|
157
|
+
# 可选值:en | zh-CN`,"classic.context_compression":`# 新建 Classic change 是否启用 beta 上下文压缩。
|
|
158
|
+
# 可选值:off | beta`,"classic.review_mode":`# 新建 Classic change 默认使用的审查深度。
|
|
159
|
+
# 可选值:off | standard | thorough`,"classic.auto_transition":`# Classic 阶段通过后是否自动进入下一阶段。
|
|
160
|
+
# 可选值:true | false`}};function Cl(t,e){return Pn[e][t]}function Im(t,e,i){let n=/^(\s*)([a-z_]+):/u.exec(t);if(!n)return null;let r=n[1].length,a=n[2];if(r===0&&a in Pn.en)return a;if(r===2&&e){let o=`${e}.${a}`;if(o in Pn.en)return o}if(r===4&&e==="native"&&i==="snapshot"){let o=`native.snapshot.${a}`;if(o in Pn.en)return o}return null}function In(t,e){let i=[],n=null,r=null;for(let a of(0,ti.stringify)(t).trimEnd().split(`
|
|
161
|
+
`)){let o=Im(a,n,r);if(o){let s=a.match(/^\s*/u)?.[0]??"";for(let c of Cl(o,e).split(`
|
|
162
|
+
`))i.push(`${s}${c}`)}i.push(a),/^[a-z_]+:/u.test(a)?(a.startsWith("native:")?n="native":a.startsWith("classic:")?n="classic":n=null,r=null):/^ {2}[a-z_]+:/u.test(a)&&n==="native"&&(r=a.startsWith(" snapshot:")?"snapshot":null)}return i.push(""),i.join(`
|
|
163
|
+
`)}function jm(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||An.posix.isAbsolute(i)||An.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function qe(t){let e=jm(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Pl(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function Wa(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||An.posix.isAbsolute(n)||An.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function ei(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Al(t,e,i){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function jn(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>xn)throw new Error(`${e} exceeds ${xn} characters`);let i=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?i+=1:t[n]==="*"&&(i+=1,t[n+1]==="*"&&(n+=1));if(i>Tn)throw new Error(`${e} contains more than ${Tn} wildcard tokens`);return t}function Rl(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>jn(n,e)))].sort((n,r)=>n.localeCompare(r,"en"))}function Va(t,e,i){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Om(t){if(t===void 0)return{...J,include:[...J.include],exclude:[...J.exclude]};let e=ei(t,"native.snapshot");return{include:Rl(e.include,"native.snapshot.include",J.include),exclude:Rl(e.exclude,"native.snapshot.exclude",J.exclude),max_files:Va(e.max_files,J.max_files,"native.snapshot.max_files"),max_total_bytes:Va(e.max_total_bytes,J.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Va(e.max_duration_ms,J.max_duration_ms,"native.snapshot.max_duration_ms")}}function $m(t){if(t===void 0)return;let e=ei(t,"native.pending_root_move"),i=e.id,n=e.from_artifact_root,r=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=ei(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,u=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:u}}return{id:i,fromArtifactRoot:qe(n),toArtifactRoot:qe(r),stage:a,...o?{cleanup:o}:{}}}function Hm(t,e={}){let i=ei(t,"native"),n=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let r=i.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??za;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=$m(i.pending_root_move);return{artifact_root:qe(n),language:Al(i.language,"en","native.language"),clarification_mode:r,archive_confirmation:a,max_verify_failures:o,snapshot:Om(i.snapshot),...s?{pending_root_move:s}:{}}}function Mm(t){let e=ei(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Pl(e.artifact_layout),language:Al(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function Lm(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Dm(t,e,i,n,r){let a=t.schema!==void 0;if(!(a||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!a)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:n,...e?{native:e}:{},...i?{classic:i}:{}}}function ii(t,e={}){let i=(0,ti.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let n=i.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=n,a=Lm(r.ambient_resume),o=r.native===void 0?void 0:Hm(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),s=r.classic===void 0?void 0:Mm(r.classic),c=Dm(r,o,s,a,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function xl(t){return{id:t.id,from_artifact_root:t.fromArtifactRoot,to_artifact_root:t.toArtifactRoot,stage:t.stage,...t.cleanup?{cleanup:{kind:t.cleanup.kind,state:t.cleanup.state,manifest_hash:t.cleanup.manifestHash}}:{}}}function Tl(t){return{schema:t.schema,default_workflow:t.default_workflow,workflows:t.workflows??[t.default_workflow],ambient_resume:t.ambient_resume,...t.native?{native:{artifact_root:t.native.artifact_root,language:t.native.language,clarification_mode:t.native.clarification_mode,archive_confirmation:t.native.archive_confirmation,max_verify_failures:t.native.max_verify_failures,snapshot:t.native.snapshot,...t.native.pending_root_move?{pending_root_move:xl(t.native.pending_root_move)}:{}}}:{},...t.classic?{classic:{artifact_layout:t.classic.artifact_layout,language:t.classic.language,context_compression:t.classic.context_compression,review_mode:t.classic.review_mode,auto_transition:t.classic.auto_transition}}:{}}}function ht(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function On(t,e){let i=Tl(e),n=ii((0,ti.stringify)(i)).config;if(!n)throw new Error("Unsupported Comet project schema");let r={...t,schema:n.schema,default_workflow:n.default_workflow,workflows:n.workflows,ambient_resume:n.ambient_resume};if(n.native){let a=ht(t.native),o=ht(a.snapshot),s={...a,artifact_root:n.native.artifact_root,language:n.native.language,clarification_mode:n.native.clarification_mode,archive_confirmation:n.native.archive_confirmation,max_verify_failures:n.native.max_verify_failures,snapshot:{...o,...n.native.snapshot}};if(n.native.pending_root_move){let c=ht(a.pending_root_move),l=xl(n.native.pending_root_move),u=ht(c.cleanup),f=ht(l.cleanup);s.pending_root_move={...c,...l,...l.cleanup?{cleanup:{...u,...f}}:{}}}else delete s.pending_root_move;r.native=s}return n.classic&&(r.classic={...ht(t.classic),artifact_layout:n.classic.artifact_layout,language:n.classic.language,context_compression:n.classic.context_compression,review_mode:n.classic.review_mode,auto_transition:n.classic.auto_transition}),r}function Ja(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:qe(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:za,snapshot:{...J,include:[...J.include],exclude:[...J.exclude]}}}}import{createHash as Bm}from"crypto";import{promises as Mn}from"fs";import _e from"path";import{constants as $n,promises as Ve}from"fs";function Te(t){return t!==0&&t!==0n&&t!=="0"}function K(t,e){return Te(t.dev)&&Te(e.dev)&&Te(t.ino)&&Te(e.ino)}function I(t,e){let i=Te(t.dev)&&Te(e.dev);if(i&&t.dev!==e.dev)return!1;let n=Te(t.ino)&&Te(e.ino);return n&&t.ino!==e.ino?!1:i&&n?!0:t.birthtime===e.birthtime}var re=class extends Error{reason;constructor(e,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=e}};function Ka(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function _l(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ni(t){return{dev:t.dev,ino:t.ino,birthtime:Ka(t)}}function Hn(t,e){let i=ni(t),n=ni(e);return K(i,n)?I(i,n):I(i,n)&&Ka(t)===Ka(e)&&_l(t)===_l(e)&&t.size===e.size}async function pt(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,a=await Ve.lstat(t,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new re("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new re("too-large",`${n} exceeds ${e} bytes`);let o=await Ve.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:ni(a)});let s=process.platform==="win32"?$n.O_RDONLY:$n.O_RDONLY|$n.O_NOFOLLOW|$n.O_NONBLOCK,c;try{c=await Ve.open(t,s)}catch(l){throw l.code==="ELOOP"?new re("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:r}),Ve.lstat(t,{bigint:r}),Ve.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==o||!Hn(a,l)||!Hn(a,u))throw new re("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:f,identity:ni(l)}),await i.hooks?.afterOpen?.();let d=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-m,{bytesRead:S}=await c.read(g,0,Math.min(g.length,N),null);if(S===0)break;if(m+=S,m>e)throw new re("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),Ve.lstat(t,{bigint:r}),Ve.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!Hn(a,h)||!Hn(a,p))throw new re("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:ni(h)}),{bytes:Buffer.concat(d,m),stat:h,realPath:y}}finally{await c.close()}}function Fm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ua(t,e){let i=_e.relative(t,e);return i===""||!_e.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${_e.sep}`)}async function Il(t,e){let i=_e.resolve(t),n=await Mn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Mn.realpath(i)}async function jl(t,e,i,n){let r=t;for(let a=0;a<i.length;a++){r=_e.join(r,i[a]);let o;try{o=await Mn.lstat(r)}catch(u){if(Fm(u))return{exists:!1,kind:"missing"};throw u}let s=_e.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${n.label} ancestor ${s} must be a real directory`);if(c&&(n.expected==="file"&&!o.isFile()||n.expected==="directory"&&!o.isDirectory()||n.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await Mn.realpath(r);if(!Ua(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function ri(t,e,i){let n=Wa(e,i.label),r=_e.resolve(t),a=await Il(r,i.label),o=n.split("/"),s=_e.resolve(r,...o);if(!Ua(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await jl(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function mt(t,e,i,n){let r=await ri(t,e,{label:n.label,expected:"file"});if(!r.exists){let o=new Error(`${n.label} does not exist`);throw o.code="ENOENT",o}let a=await Il(r.projectRoot,n.label);return pt(r.target,i,{...n,verify:async(o,s)=>{if(!Ua(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await jl(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var ai=".comet/config.yaml";function Ga(t,e){return t.exists===e.exists&&t.sha256===e.sha256}function qm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ya(t,e={}){return(await oi(t,e)).document}async function Ol(t){try{return(await mt(t,ai,_n,{label:ai})).bytes}catch(e){if(qm(e))return null;throw e}}function $l(t){return t?{exists:!0,sha256:Bm("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ln(t){return $l(await Ol(t))}async function oi(t,e={}){let i=await Ol(t);return{document:i?ii(i.toString("utf8"),e):null,identity:$l(i)}}var $N=16*1024;async function Qa(t,e){if(!e)return;let i=await Ln(t);if(!Ga(i,e))throw new Error("Project config changed before commit; rerun the operation")}import{randomUUID as Jm}from"crypto";import{promises as F}from"fs";import ae from"path";function eo(t,e){let i=ae.relative(t,e);return i===""||!ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ae.sep}`)}function Km(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Za(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return K(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Hl(t){let e=await F.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await F.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function si(t){for(let e of t){let i=await F.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!Km(e,i)||await F.realpath(e.path)!==e.realPath)throw new Error(`Native atomic write parent changed before commit: ${e.path}`)}}async function Um(t,e){let i=ae.resolve(t),n=ae.resolve(e);if(!eo(i,n))throw new Error(`Native atomic write parent is outside its managed root: ${e}`);let r=[await Hl(i)],a=ae.relative(i,n).split(ae.sep).filter(Boolean),o=i;for(let s of a){await si(r),o=ae.join(o,s);try{await F.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Hl(o);if(!eo(r[0].realPath,c.realPath))throw new Error(`Native atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await si(r),r}async function Gm(t){let e;try{e=await F.open(t,"r"),await e.sync()}catch(i){let n=i.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw i}finally{await e?.close()}}async function Ml(t,e,i={}){let n=ae.dirname(t),r=i.containedRoot?await Um(i.containedRoot,n):null;r||await F.mkdir(n,{recursive:!0});let a=ae.join(n,`.${ae.basename(t)}.${Jm()}.tmp`),o,s;try{if(await i.beforeTemporaryOpen?.(),o=await F.open(a,"wx"),s=await o.stat(),r){let[c,l]=await Promise.all([F.lstat(a),F.realpath(a)]);if(await si(r),!c.isFile()||c.isSymbolicLink()||!Za(s,c)||!eo(r[0].realPath,l))throw new Error("Native atomic write temporary file opened outside its managed parent")}if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),!Za(s,await o.stat()))throw new Error("Native atomic write temporary file changed while writing");if(await o.close(),o=void 0,await i.beforeCommit?.(),r){await si(r);let c=await F.lstat(a);if(!c.isFile()||c.isSymbolicLink()||!s||!Za(c,s))throw new Error("Native atomic write temporary file changed before commit")}i.exclusive?(await F.link(a,t),await F.unlink(a)):await F.rename(a,t),await Gm(n)}catch(c){if(await o?.close(),!r)await F.rm(a,{force:!0});else try{await si(r),await F.rm(a,{force:!0})}catch{}throw c}}async function he(t,e,i={}){await Ml(t,e,i)}async function Ll(t,e,i={}){await Ml(t,e,i)}async function oe(t,e,i={}){await he(t,JSON.stringify(e,null,2)+`
|
|
164
|
+
`,i)}import{promises as vt}from"fs";import x from"path";import Ym from"os";var Dn=".comet/config.yaml";async function to(t){try{return await vt.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Xm(t){try{let e=await vt.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function ci(t,e){let i=x.relative(t,e);return i===""||!x.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${x.sep}`)}async function li(t){let e=[],i=t;for(;!await to(i);){let r=x.dirname(i);if(r===i)break;e.push(x.basename(i)),i=r}let n=await vt.realpath(i);return x.resolve(n,...e.reverse())}async function Dl(t){try{return(await vt.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function io(t){let e=x.resolve(t);try{(await vt.stat(e)).isDirectory()||(e=x.dirname(e))}catch(r){if(r.code!=="ENOENT")throw r}let i=e,n=x.resolve(Ym.homedir());for(;;){if(!(e===n&&i!==n)){let o=x.join(e,...Dn.split("/")),s=e===i||await Xm(o);if(await to(o)&&s)return e}if(await to(x.join(e,".git")))return e;let a=x.dirname(e);if(a===e)return i;e=a}}function ui(t){return qe(t)}async function Qm(t,e){let i=ui(e),n=x.resolve(t,...i.split("/")),r=await vt.realpath(t),a=await li(n);if(!ci(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function ze(t,e){let i=ui(e),n=await Qm(t,i),r=x.join(n,"comet");if(await Dl(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([li(n),li(r)]);if(!ci(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:x.resolve(t),configFile:x.join(t,...Dn.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:x.join(r,"specs"),changesDir:x.join(r,"changes"),archiveDir:x.join(r,"archive"),runtimeDir:x.join(r,"runtime"),locksDir:x.join(r,"runtime","locks"),transactionsDir:x.join(r,"runtime","transactions")}}function U(t,e){return ci(x.resolve(t),x.resolve(e))}async function O(t,e){let i=x.resolve(t),n=x.resolve(e);if(!ci(i,n))throw new Error(`Path is outside the Native root: ${e}`);if(await Dl(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[r,a]=await Promise.all([li(i),li(n)]);if(!ci(r,a))throw new Error(`Path resolves outside the Native root: ${e}`);return n}var Fn=jn;function Fl(t="docs",e="en"){return Ja(t,e)}async function Ie(t){let e=(await Ya(t))?.config??null;return e?.native?e:null}async function fi(t,e,i={}){let n=await oi(t,{allowPartialProject:!0}),r=On(n.document?.value??{},e),a=Zm.join(t,...Dn.split("/"));await he(a,In(r,e.native.language==="zh-CN"?"zh-CN":"en"),{containedRoot:t,beforeCommit:async()=>{await i.beforeCommit?.(),await Qa(t,n.identity)}})}import{createHash as Xg,randomUUID as Qg}from"crypto";import{promises as et}from"fs";import j from"path";var No=Ho(qa(),1);import{promises as jg}from"fs";import Qe from"path";import{createHash as nv}from"node:crypto";import{promises as se}from"node:fs";import X from"node:path";import{TextDecoder as rv}from"node:util";var ev=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),tv=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function iv(t){return t.toLowerCase().startsWith(".env")}function di(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>iv(n))?"environment-file":i.some(n=>tv.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>ev.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}var qn=1024*1024;function no(t,e){let i=X.relative(t,e);return i===""||!X.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${X.sep}`)}function av(t){let e=X.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||X.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),n=di(t);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${t}`);return t}function ov(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function sv(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Bn(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return K(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Bl(t){let e=await se.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await se.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function cv(t,e){let i=X.resolve(t),n=X.resolve(e);if(!no(i,n))throw new Error("Native artifact path is outside its root");let r=[await Bl(i)],a=i;for(let o of X.relative(i,n).split(X.sep).filter(Boolean)){a=X.join(a,o);let s=await Bl(a);if(!no(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function ql(t){for(let e of t){let i=await se.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!sv(e,i)||await se.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function We(t){let e=av(t.ref),i=ov(t.maxBytes??qn),n=X.resolve(t.root,...e.split("/")),r=await cv(t.root,X.dirname(n));await t.hooks?.afterParentChainCaptured?.();let a=await se.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await se.realpath(n);if(!no(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await se.open(n,"r");try{let[c,l,u]=await Promise.all([s.stat(),se.lstat(n),se.realpath(n)]);if(await ql(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Bn(a,c)||!Bn(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let f=[],d=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let S=i+1-d,k=await s.read(m,0,Math.min(m.length,S),null);if(k.bytesRead===0)break;if(d+=k.bytesRead,d>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);f.push(Buffer.from(m.subarray(0,k.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),se.lstat(n),se.realpath(n)]);if(await ql(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Bn(c,g)||!Bn(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(f,d),N;try{N=new rv("utf-8",{fatal:!0}).decode(y)}catch(S){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:S})}return{ref:e,size:d,hash:nv("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}import{AsyncLocalStorage as lv}from"async_hooks";import{randomUUID as Wl}from"crypto";import{promises as Q}from"fs";import Jl from"os";import B from"path";var Vl=16*1024,Kl=".coordinator",uv=5e3,zl=new lv,Vn=new Map;function fv(t){if(!/^[a-z][a-z0-9-]*$/u.test(t))throw new Error(`Invalid Native lock name: ${t}`);return`${t}.lock`}function dv(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid Native lock metadata: ${e}`);let i=t;if(typeof i.id!="string"||i.id.length===0||typeof i.pid!="number"||!Number.isSafeInteger(i.pid)||i.pid<1||typeof i.hostname!="string"||i.hostname.length===0||typeof i.createdAt!="string"||i.createdAt.length===0||typeof i.operation!="string"||i.operation.length===0)throw new Error(`Invalid Native lock metadata: ${e}`);return i}function Ul(t){return{device:t.dev.toString(),inode:t.ino.toString(),size:t.size.toString(),birthtimeNs:t.birthtimeNs.toString(),ctimeNs:t.ctimeNs.toString(),mtimeNs:t.mtimeNs.toString()}}function ro(t,e){let i={dev:t.device,ino:t.inode,birthtime:t.birthtimeNs},n={dev:e.device,ino:e.inode,birthtime:e.birthtimeNs};return K(i,n)?I(i,n):I(i,n)&&t.size===e.size}function ao(t,e){return ro(t,e)&&t.size===e.size&&t.birthtimeNs===e.birthtimeNs&&t.ctimeNs===e.ctimeNs&&t.mtimeNs===e.mtimeNs}async function je(t){let e,i;try{let n=await pt(t,Vl,{bigint:!0,label:"Native lock"});e=n.bytes,i=n.stat}catch(n){if(n.code==="ENOENT")return null;throw n instanceof re?n.reason==="too-large"?new Error(`Native lock metadata exceeds ${Vl} bytes: ${t}`,{cause:n}):n.reason==="not-regular-file"?new Error(`Native lock must be a regular file: ${t}`,{cause:n}):new Error(`Native lock changed while reading: ${t}`,{cause:n}):n}return{file:t,owner:dv(JSON.parse(e.toString("utf8")),t),identity:Ul(i)}}async function hv(t){return(await je(t))?.owner??null}function pv(t){if(!t)return{status:"missing",owner:null,identity:null};if(t.owner.hostname!==Jl.hostname())return{status:"unknown",owner:t.owner,identity:t.identity};let e=Nv(t.owner.pid);return{status:e===!0?"active":e===!1?"stale":"unknown",owner:t.owner,identity:t.identity}}async function mv(t,e){try{await Q.lstat(e);return}catch(i){if(i.code!=="ENOENT")throw i}try{await Q.rename(t,e)}catch(i){if(i.code!=="ENOENT")throw i}}async function oo(t,e){let i=await je(t.file);if(!i)return"missing";if(i.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!ao(i.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);await Q.mkdir(e,{recursive:!0});let n=B.join(e,`${B.basename(t.file)}.${t.owner.id}.${Wl()}.removed`);try{await Q.rename(t.file,n)}catch(a){if(a.code==="ENOENT")return"missing";throw a}let r=await je(n);if(!r||r.owner.id!==t.owner.id||!ro(r.identity,t.identity))throw await mv(n,t.file),new Error(`Native lock changed before quarantine: ${t.file}`);return await Q.rm(n,{force:!0}),"removed"}function Gl(t){return{id:Wl(),pid:process.pid,hostname:Jl.hostname(),createdAt:new Date().toISOString(),operation:t}}async function Yl(t,e){let i;try{i=await Q.open(t,"wx")}catch(n){if(n.code==="EEXIST"){let r=await hv(t);throw new Error(`Native lock is already held: ${t}${r?` by pid ${r.pid} for ${r.operation}`:""}`,{cause:n})}throw n}try{return await i.writeFile(JSON.stringify(e,null,2)+`
|
|
165
|
+
`,"utf8"),await i.sync(),Ul(await i.stat({bigint:!0}))}finally{await i.close()}}async function vv(t,e){let i=await O(t.nativeRoot,t.locksDir);await Q.mkdir(i,{recursive:!0});let n=await O(t.nativeRoot,B.join(i,Kl));await Q.mkdir(n,{recursive:!0});let r=Gl(e),a=B.join(n,`.${r.id}.tmp`),o=B.join(n,`${r.id}.claim`);try{let s=await Yl(a,r);await Q.rename(a,o);let c=await je(o);if(!c||!ro(s,c.identity))throw new Error(`Native lock coordinator claim changed while publishing: ${o}`);return{file:o,nativeRoot:t.nativeRoot,locksDir:i,owner:r,identity:c.identity}}finally{await Q.rm(a,{force:!0})}}async function gv(t){let e=B.dirname(t.file),i=!1,n=B.basename(t.file);for(let r of await Q.readdir(e,{withFileTypes:!0})){if(!r.isFile()||r.isSymbolicLink()||!r.name.endsWith(".claim"))continue;let a=B.join(e,r.name);if(B.resolve(a)!==B.resolve(t.file))try{let o=await je(a),s=pv(o);if(s.status==="missing")continue;if(s.status==="stale"&&o){await oo(o,e);continue}r.name<n&&(i=!0)}catch{r.name<n&&(i=!0)}}return i}async function Xl(t){let e=await je(t.file);if(e){if(e.owner.id!==t.owner.id||!ao(e.identity,t.identity))throw new Error(`Native lock coordinator ownership changed: ${t.file}`);await oo(e,B.dirname(t.file))}}async function wv(t,e){let i=Date.now()+uv;for(;;){let n=await vv(t,e);if(!await gv(n))return n;if(await Xl(n),Date.now()>=i)throw new Error(`Native lock coordinator is busy: ${t.locksDir}`);await new Promise(r=>setTimeout(r,2+Math.floor(Math.random()*7)))}}async function yv(t){let e=Vn.get(t)??Promise.resolve(),i,n=new Promise(a=>{i=a}),r=e.then(()=>n);return Vn.set(t,r),await e,()=>{i(),Vn.get(t)===r&&Vn.delete(t)}}async function Ql(t,e,i){let n=B.resolve(t.locksDir),r=zl.getStore();if(r?.has(n))return i();let a=await yv(n);try{let o=await wv(t,e),s=new Map(r??[]);return s.set(n,o),await zl.run(s,async()=>{try{return await i()}finally{await Xl(o)}})}finally{a()}}async function hi(t,e,i){return Ql(t,`acquire ${e}`,async()=>{let n=await O(t.nativeRoot,t.locksDir);await Q.mkdir(n,{recursive:!0});let r=await O(t.nativeRoot,B.join(n,fv(e))),a=Gl(i),o=await Yl(r,a);return{file:r,nativeRoot:t.nativeRoot,locksDir:n,owner:a,identity:o}})}async function pi(t){await je(t.file)&&await Ql(t,`release ${B.basename(t.file)}`,async()=>{let e=await je(t.file);if(!e)return;if(e.owner.id!==t.owner.id)throw new Error(`Native lock ownership changed: ${t.file}`);if(!ao(e.identity,t.identity))throw new Error(`Native lock identity changed: ${t.file}`);let i=B.join(t.locksDir,Kl);await oo(e,i)})}function Nv(t){try{return process.kill(t,0),!0}catch(e){let i=e.code;return i==="ESRCH"?!1:i==="EPERM"?!0:null}}import{promises as Kn}from"fs";import ye from"path";import{TextDecoder as Rv}from"util";import{createHash as bv}from"node:crypto";import{constants as zn,promises as P}from"node:fs";import T from"node:path";import{TextDecoder as Sv}from"node:util";function pe(t,e){let i=T.relative(t,e);return i===""||!T.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${T.sep}`)}function Zl(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Wn(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function eu(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function gt(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Je(t,e){let i=await P.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await P.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function mi(t,e,i){let n=T.resolve(t),r=T.resolve(e);if(!pe(n,r))throw new Error(`${i} is outside its managed root`);let a=[await Je(n,i)],o=n;for(let s of T.relative(n,r).split(T.sep).filter(Boolean)){await D(a,i),o=T.join(o,s);let c=await Je(o,i);if(!pe(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await D(a,i),a}async function D(t,e){for(let i of t){let n=await P.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Wn(i,n)||await P.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function kv(t,e,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-r,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>e)throw new Error(`${i} exceeds ${e} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function q(t){let e=Zl(t.maxBytes),i=T.resolve(t.file),n=await mi(t.root,T.dirname(i),t.label),r=await Promise.all((t.forbiddenRoots??[]).map(u=>Je(T.resolve(u),t.label)));await t.hooks?.afterParentChainCaptured?.(),await D(n,t.label);let a=await P.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=eu(a),s=await P.realpath(i);if(!pe(n[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(r.some(u=>pe(u.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?zn.O_RDONLY:zn.O_RDONLY|zn.O_NOFOLLOW|zn.O_NONBLOCK,l=await P.open(i,c);try{let u=await l.stat();await t.hooks?.afterOpen?.();let[f,d]=await Promise.all([P.lstat(i),P.realpath(i)]);if(await D(n,t.label),await D(r,t.label),!u.isFile()||!f.isFile()||f.isSymbolicLink()||d!==s||!gt(o,u)||!gt(o,f))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await kv(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),P.lstat(i),P.realpath(i)]);if(await D(n,t.label),await D(r,t.label),!h.isFile()||h.isSymbolicLink()||p!==s||!gt(o,g)||!gt(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:bv("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function tu(t){let e=await q(t),i;try{i=new Sv("utf-8",{fatal:!0}).decode(e.bytes)}catch(n){throw new Error(`${t.label} is not valid UTF-8`,{cause:n})}return{...e,text:i}}async function Ke(t){let e=await mi(t.root,t.directory,t.label),i;if(t.maxEntries===void 0)i=await P.readdir(t.directory,{withFileTypes:!0});else{let n=Zl(t.maxEntries);i=[];let r=await P.opendir(t.directory);try{for await(let a of r)if(i.push(a),i.length>n)throw new Error(`${t.label} exceeds ${n} entries`)}finally{await r.close().catch(a=>{if(a.code!=="ERR_DIR_CLOSED")throw a})}}return await D(e,t.label),{entries:i,verify:()=>D(e,t.label)}}async function Ev(t){let e=T.resolve(t.directory),i=T.resolve(t.quarantine);if(T.dirname(i)!==T.dirname(e)||!pe(T.resolve(t.root),i)||i===e)throw new Error(`${t.label} quarantine must be a distinct sibling inside its root`);let n=await mi(t.root,T.dirname(e),t.label),r=await Je(e,t.label);if(!pe(n[0].realPath,r.realPath))throw new Error(`${t.label} resolves outside its managed root`);await t.beforeQuarantine?.(),await D(n,t.label);let a=await P.lstat(e);if(!a.isDirectory()||a.isSymbolicLink()||!Wn(r,a)||await P.realpath(e)!==r.realPath)throw new Error(`${t.label} changed before quarantine`);try{throw await P.lstat(i),new Error(`${t.label} quarantine path is occupied`)}catch(s){if(s.code!=="ENOENT")throw s}await P.rename(e,i),await D(n,t.label);let o=await P.lstat(i);if(!o.isDirectory()||o.isSymbolicLink()||!Wn(r,o))throw new Error(`${t.label} changed while quarantining`);await t.afterQuarantine?.(i);try{throw await P.lstat(e),new Error(`${t.label} path was recreated while quarantining`)}catch(s){if(s.code!=="ENOENT")throw s}return{quarantine:i,parentChain:n,identity:r}}async function iu(t){await Ev(t)}async function so(t){let e=T.resolve(t.file),i=await mi(t.root,T.dirname(e),t.label),n=await P.lstat(e);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);let r=eu(n),a=await P.realpath(e);if(!pe(i[0].realPath,a))throw new Error(`${t.label} resolves outside its managed root`);let o=await q({root:t.root,file:e,maxBytes:t.maxBytes,label:t.label});if(o.hash!==t.expectedHash||o.size!==t.expectedSize)throw new Error(`${t.label} changed before removal`);let[s,c]=await Promise.all([P.lstat(e),P.realpath(e)]);if(!s.isFile()||s.isSymbolicLink()||!gt(r,s)||c!==a)throw new Error(`${t.label} changed while verifying removal`);await t.beforeRemove?.(),await D(i,t.label);let[l,u]=await Promise.all([P.lstat(e),P.realpath(e)]);if(!l.isFile()||l.isSymbolicLink()||!gt(r,l)||u!==a)throw new Error(`${t.label} changed before removal`);await P.rm(e),await D(i,t.label)}async function co(t){let e=T.resolve(t.directory),i=await mi(t.root,T.dirname(e),t.label),n=await Je(e,t.label);if(!pe(i[0].realPath,n.realPath))throw new Error(`${t.label} resolves outside its managed root`);await t.beforeRemove?.(),await D(i,t.label);let r=await P.lstat(e);if(!r.isDirectory()||r.isSymbolicLink()||!Wn(n,r)||await P.realpath(e)!==n.realPath)throw new Error(`${t.label} changed before removal`);await P.rmdir(e),await D(i,t.label)}async function vi(t){let e=T.resolve(t.root),i=T.resolve(t.directory);if(!pe(e,i))throw new Error(`${t.label} is outside its managed root`);let n=[await Je(e,t.label)],r=e;for(let a of T.relative(e,i).split(T.sep).filter(Boolean)){await D(n,t.label),r=T.join(r,a);try{await P.mkdir(r)}catch(s){if(s.code!=="EEXIST")throw s}let o=await Je(r,t.label);if(!pe(n[0].realPath,o.realPath))throw new Error(`${t.label} resolves outside its managed root: ${r}`);n.push(o)}await D(n,t.label)}async function gi(t){let e=await q({root:t.sourceRoot,file:t.source,maxBytes:t.maxBytes,label:t.label,hooks:t.hooks,forbiddenRoots:t.forbiddenRoots});if(t.expectedHash!==void 0&&e.hash!==t.expectedHash)throw new Error(`${t.label} content changed before copy`);await Ll(t.target,e.bytes,{containedRoot:t.targetRoot,exclusive:t.exclusive,beforeCommit:async()=>{if(await t.hooks?.beforeTargetCommit?.(),t.expectedTargetHash===void 0)return;if(t.expectedTargetHash===null){try{await P.lstat(t.target)}catch(r){if(r.code==="ENOENT")return;throw r}throw new Error(`${t.label} target changed before commit`)}if((await q({root:t.targetRoot,file:t.target,maxBytes:t.maxBytes,label:`${t.label} existing target`})).hash!==t.expectedTargetHash)throw new Error(`${t.label} target changed before commit`)}});let i=await q({root:t.targetRoot,file:t.target,maxBytes:t.maxBytes,label:`${t.label} target`});if(i.hash!==e.hash||i.size!==e.size)throw new Error(`${t.label} target could not be verified`);return i}var Cv=new Set(["schema","id","kind","status","projectRoot","nativeRoot","change","createdAt","operations"]),Pv=new Set(["id","type","source","target","staged","backup"]),Av=new Set(["schema","id","kind","status","change","createdAt","preflightHash","operations"]),xv=new Set(["id","type","source","target","staged","backup","expectedSourceHash","expectedTargetHash","stagedHash"]),Tv=new Set(["sequence","timestamp","type","operationId"]),au=new Set(["prepared","applying","committed","rolling-back","rolled-back"]),ou=new Set(["prepared","operation-started","operation-completed","archive-finalization-started","archive-finalized","commit","rollback-started","rollback-completed"]),_v=256*1024,Iv=1024*1024,su=16*1024,Un=1024,Fb=64*1024*1024;var cu=new Rv("utf-8",{fatal:!0});function wi(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function yi(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function yt(t){if(typeof t!="string")return!1;let e=new Date(t);return!Number.isNaN(e.valueOf())&&e.toISOString()===t}function lo(t,e){if(typeof t!="string"||t.length===0||ye.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native root`)}function Jn(t,e){if(typeof t!="string"||!/^[a-f0-9]{64}$/u.test(t))throw new Error(`${e} must be a SHA-256 hash`)}function nu(t,e){if(lo(t,e),t.includes("\\")||t!==ye.posix.normalize(t)||t.split("/").includes(".")||t.endsWith("/")||Buffer.byteLength(t,"utf8")>1024)throw new Error(`${e} must be a normalized Native-relative ref`)}function jv(t,e){let i=wi(t,`transaction operations[${e}]`);if(yi(i,Pv,`transaction operations[${e}]`),typeof i.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.id))throw new Error(`transaction operations[${e}].id is invalid`);if(i.type!=="write"&&i.type!=="remove"&&i.type!=="move")throw new Error(`transaction operation ${i.id} has an invalid type`);lo(i.target,`transaction operation ${i.id} target`);for(let n of["source","staged","backup"])i[n]!==void 0&&lo(i[n],`transaction operation ${i.id} ${n}`);if(i.type==="write"){if(i.staged===void 0||i.source!==void 0)throw new Error(`write operation ${i.id} requires staged and forbids source`)}else if(i.type==="remove"){if(i.source!==void 0||i.staged!==void 0)throw new Error(`remove operation ${i.id} forbids source and staged`)}else if(i.source===void 0||i.staged!==void 0||i.backup!==void 0)throw new Error(`move operation ${i.id} requires source and forbids staged and backup`);return i}function lu(t){let e=wi(t,"Native Archive transaction journal");if(yi(e,Av,"Native Archive transaction journal"),e.schema!=="comet.native.transaction.v2")throw new Error("Unsupported Native Archive transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native Archive transaction id is invalid");if(e.kind!=="archive")throw new Error("Native v2 transaction kind must be archive");if(typeof e.status!="string"||!au.has(e.status))throw new Error("Native Archive transaction status is invalid");if(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change))throw new Error("Native Archive transaction change name is invalid");if(!yt(e.createdAt))throw new Error("Native Archive transaction createdAt is invalid");if(Jn(e.preflightHash,"Native Archive transaction preflightHash"),!Array.isArray(e.operations)||e.operations.length>65)throw new Error("Native Archive transaction operations must be an array");let i=e.operations.map((s,c)=>{let l=wi(s,`Archive transaction operations[${c}]`);if(yi(l,xv,`Archive transaction operations[${c}]`),typeof l.id!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(l.id))throw new Error(`Archive transaction operations[${c}].id is invalid`);if(l.type!=="write"&&l.type!=="remove"&&l.type!=="move")throw new Error(`Archive transaction operation ${l.id} has an invalid type`);nu(l.target,`Archive transaction operation ${l.id} target`);for(let u of["source","staged","backup"])l[u]!==void 0&&nu(l[u],`Archive transaction operation ${l.id} ${u}`);if(l.expectedTargetHash!==null&&Jn(l.expectedTargetHash,`Archive transaction operation ${l.id} expectedTargetHash`),l.type==="write"){if(l.staged===void 0||l.source!==void 0||l.expectedSourceHash!==void 0)throw new Error(`Archive write operation ${l.id} requires staged and forbids source`);if(Jn(l.stagedHash,`Archive write operation ${l.id} stagedHash`),l.expectedTargetHash===null!=(l.backup===void 0))throw new Error(`Archive write operation ${l.id} backup must match target existence`)}else if(l.type==="remove"){if(l.source!==void 0||l.staged!==void 0||l.stagedHash!==void 0||l.expectedSourceHash!==void 0||l.backup===void 0||l.expectedTargetHash===null)throw new Error(`Archive remove operation ${l.id} requires a bound target and backup`)}else{if(l.source===void 0||l.staged!==void 0||l.stagedHash!==void 0||l.backup!==void 0||l.expectedTargetHash!==null)throw new Error(`Archive move operation ${l.id} requires source and an absent target`);Jn(l.expectedSourceHash,`Archive move operation ${l.id} expectedSourceHash`)}return l}),n=i.map(s=>s.id);if(new Set(n).size!==n.length)throw new Error("Native Archive transaction operation ids must be unique");let r=`runtime/transactions/${e.id}`,a=i.filter(s=>s.type==="move");if(a.length!==1||a[0].id!=="archive-change"||a[0].source!==`changes/${e.change}`||!new RegExp(`^archive/\\d{4}-\\d{2}-\\d{2}-${e.change}$`,"u").test(a[0].target)||i.at(-1)!==a[0])throw new Error("Native Archive transaction must end with its exact change move");let o=new Set;for(let s of i.slice(0,-1)){if(s.type==="move"||!/^specs\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/spec\.md$/u.test(s.target)||o.has(s.target))throw new Error(`Native Archive transaction spec target is invalid: ${s.target}`);if(o.add(s.target),s.staged!==void 0&&!s.staged.startsWith(`${r}/staged/specs/`))throw new Error(`Native Archive transaction staged ref is invalid: ${s.staged}`);if(s.backup!==void 0&&!s.backup.startsWith(`${r}/backups/specs/`))throw new Error(`Native Archive transaction backup ref is invalid: ${s.backup}`)}return{schema:"comet.native.transaction.v2",id:e.id,kind:"archive",status:e.status,change:e.change,createdAt:e.createdAt,preflightHash:e.preflightHash,operations:i}}function uo(t){let e=wi(t,"Native transaction journal");if(e.schema==="comet.native.transaction.v2")return lu(e);if(yi(e,Cv,"Native transaction journal"),e.schema!=="comet.native.transaction.v1")throw new Error("Unsupported Native transaction schema");if(typeof e.id!="string"||!/^[a-f0-9-]{8,}$/u.test(e.id))throw new Error("Native transaction id is invalid");if(e.kind!=="archive"&&e.kind!=="root-move")throw new Error("Native transaction kind is invalid");if(typeof e.status!="string"||!au.has(e.status))throw new Error("Native transaction status is invalid");if(typeof e.projectRoot!="string"||!ye.isAbsolute(e.projectRoot)||typeof e.nativeRoot!="string"||!ye.isAbsolute(e.nativeRoot))throw new Error("Native transaction roots must be absolute paths");if(e.change!==void 0&&(typeof e.change!="string"||!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(e.change)))throw new Error("Native transaction change name is invalid");if(!yt(e.createdAt))throw new Error("Native transaction createdAt is invalid");if(!Array.isArray(e.operations))throw new Error("Native transaction operations must be an array");let i=e.operations.map(jv),n=i.map(r=>r.id);if(new Set(n).size!==n.length)throw new Error("Native transaction operation ids must be unique");return{schema:"comet.native.transaction.v1",id:e.id,kind:e.kind,status:e.status,projectRoot:e.projectRoot,nativeRoot:e.nativeRoot,...typeof e.change=="string"?{change:e.change}:{},createdAt:e.createdAt,operations:i}}function uu(t,e){let i=wi(t,`Native transaction event at line ${e}`);if(yi(i,Tv,`Native transaction event at line ${e}`),i.sequence!==e)throw new Error(`Native transaction event sequence at line ${e} must be ${e}`);if(!yt(i.timestamp))throw new Error(`Native transaction event timestamp at line ${e} is invalid`);if(typeof i.type!="string"||!ou.has(i.type))throw new Error(`Native transaction event type at line ${e} is invalid`);let n=i.type==="operation-started"||i.type==="operation-completed";if(n&&(typeof i.operationId!="string"||!/^[a-z0-9][a-z0-9-]*$/u.test(i.operationId)||Buffer.byteLength(i.operationId,"utf8")>256)||!n&&i.operationId!==void 0)throw new Error(`Native transaction event operationId at line ${e} is invalid`);return{sequence:i.sequence,timestamp:i.timestamp,type:i.type,...typeof i.operationId=="string"?{operationId:i.operationId}:{}}}function Ov(t){if(t.length>24)return!1;let e="0000-00-00T00:00:00.000Z";for(let n=0;n<t.length;n+=1){let r=e[n],a=t[n];if(r==="0"){if(!/[0-9]/u.test(a))return!1}else if(a!==r)return!1}let i=[[5,2,1,12],[8,2,1,31],[11,2,0,23],[14,2,0,59],[17,2,0,59],[20,3,0,999]];for(let[n,r,a,o]of i){if(t.length<=n)continue;let s=t.slice(n,Math.min(n+r,t.length));if(!Array.from({length:o-a+1},(l,u)=>String(a+u).padStart(r,"0")).some(l=>l.startsWith(s)))return!1}return t.length>=10&&!yt(`${t.slice(0,10)}T00:00:00.000Z`)?!1:t.length<24||yt(t)}function wt(t,e){return t.length<e.length&&e.startsWith(t)}function $v(t){let e='","operationId":"';if(wt(t,e))return!0;if(!t.startsWith(e))return!1;let i=t.slice(e.length),n=i.indexOf('"');if(n===-1)return i.length===0||/^[a-z0-9][a-z0-9-]*$/u.test(i);let r=i.slice(0,n);return/^[a-z0-9][a-z0-9-]*$/u.test(r)?wt(i.slice(n),'"}'):!1}function Hv(t,e){if(t.length===0||Buffer.byteLength(t,"utf8")>su)return!1;let i=`{"sequence":${e},"timestamp":"`;if(wt(t,i))return!0;if(!t.startsWith(i))return!1;let n=t.slice(i.length),r=n.slice(0,Math.min(24,n.length));if(!Ov(r))return!1;if(n.length<24)return!0;if(!yt(r))return!1;let a='","type":"',o=n.slice(24);if(wt(o,a))return!0;if(!o.startsWith(a))return!1;let s=o.slice(a.length);for(let c of ou){if(wt(s,c))return!0;if(!s.startsWith(c))continue;let l=s.slice(c.length);if(c==="operation-started"||c==="operation-completed"){if($v(l))return!0}else if(wt(l,'"}'))return!0}return!1}function Mv(t,e){if(t.length===0)throw new Error("Blank transaction event line");if(Buffer.byteLength(t,"utf8")>su)throw new Error(`Native transaction event at line ${e} is too large`);return uu(JSON.parse(t),e)}function Lv(t){let e=t.split(`
|
|
166
|
+
`),i=e.at(-1)==="";if(i&&e.pop(),e.length>Un)throw new Error(`Native transaction event log exceeds ${Un} events`);let n=[];for(let r=0;r<e.length;r+=1){let a=r+1,o=e[r],s=o.endsWith("\r")?o.slice(0,-1):o,c=!i&&r===e.length-1;try{n.push(Mv(s,a))}catch(l){if(c){let u=!1;try{JSON.parse(s),u=!0}catch{}if(!u&&Hv(s,a))break}throw new Error(`Invalid Native transaction event at line ${a}`,{cause:l})}}return n}function fu(t){return t.length===0?"":`${t.map(e=>JSON.stringify(e)).join(`
|
|
167
|
+
`)}
|
|
168
|
+
`}function Dv(t,e){if(!/^[a-f0-9-]{8,}$/u.test(e))throw new Error(`Invalid Native transaction id: ${e}`);return ye.join(t.transactionsDir,e)}function Gn(t,e){let i=Dv(t,e);return{directory:i,journal:ye.join(i,"transaction.json"),events:ye.join(i,"events.jsonl"),staged:ye.join(i,"staged"),backups:ye.join(i,"backups")}}async function Ue(t,e){let i=Gn(t,e);return await Promise.all(Object.values(i).map(n=>O(t.nativeRoot,n))),i}async function du(t,e,i={}){let n=await Ue(t,e);try{await Kn.lstat(n.events)}catch(r){if(r.code==="ENOENT")return{exists:!1,hash:null,size:0,events:[],canonicalSource:"",needsRepair:!1};throw r}try{let r=await q({root:t.nativeRoot,file:n.events,maxBytes:Iv,label:`Native transaction event log ${e}`,hooks:i.hooks}),a;try{a=cu.decode(r.bytes)}catch(c){throw new Error(`Native transaction event log ${e} is not valid UTF-8`,{cause:c})}let o=Lv(a),s=fu(o);return{exists:!0,hash:r.hash,size:r.size,events:o,canonicalSource:s,needsRepair:a!==s}}catch(r){throw r.code==="ENOENT"?new Error(`Native transaction event log ${e} changed while reading`,{cause:r}):r}}async function ru(t,e,i){let n=await du(t,e);if(n.exists!==i.exists||n.hash!==i.hash||n.size!==i.size)throw new Error(`Native transaction event log ${e} changed before append`)}async function fo(t,e,i,n){let r=await Ue(t,e),a=await du(t,e),o=a.events.find(c=>c.type===i&&c.operationId===n);if(o)return a.needsRepair&&await he(r.events,a.canonicalSource,{containedRoot:t.nativeRoot,beforeCommit:()=>ru(t,e,a)}),o;if(a.events.length>=Un)throw new Error(`Native transaction event log ${e} exceeds ${Un} events`);let s={sequence:a.events.length+1,timestamp:new Date().toISOString(),type:i,...n?{operationId:n}:{}};return uu(s,s.sequence),await Kn.mkdir(r.directory,{recursive:!0}),await he(r.events,fu([...a.events,s]),{containedRoot:t.nativeRoot,beforeCommit:()=>ru(t,e,a)}),s}async function hu(t,e){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");e=uo(e);let i=await Ue(t,e.id);await Kn.mkdir(i.staged,{recursive:!0}),await Kn.mkdir(i.backups,{recursive:!0}),await oe(i.journal,e),await fo(t,e.id,"prepared")}async function Ni(t,e,i={}){let n=await Ue(t,e),r=await q({root:t.nativeRoot,file:n.journal,maxBytes:_v,label:`Native transaction journal ${e}`,hooks:i.hooks}),a=JSON.parse(cu.decode(r.bytes)),o=uo(a);if(o.id!==e)throw new Error(`Invalid Native transaction journal: ${e}`);return o}async function Fv(t,e,i){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");let n=uo({...e,status:i});return await oe((await Ue(t,e.id)).journal,n),n}async function ho(t,e,i){if(e.schema!=="comet.native.transaction.v1")throw new Error("Native Archive v2 transactions require the content-bound transaction API");return await fo(t,e.id,i),i==="commit"?Fv(t,e,"committed"):e}import Xn from"path";import{createHash as Bv}from"crypto";function Z(t){return Bv("sha256").update(t).digest("hex")}var rS={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},Vv=1e3,zv=8*1024*1024,Wv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Jv=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),Kv=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),Uv=new Set(["schema","include","exclude","hash"]),Gv=new Set(["provider","gitSelection","physicalSelection","projection"]),Yv=new Set(["provider","selection"]),Xv=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),Qv=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),Zv=new Set(["schema","status","before","after"]),eg=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),tg=new Set(["path","hash","size","type","gitObjectId"]),ig=new Set(["path","size","type","reason"]),ng=new Set(["ref","hash","count"]),rg=new Set(["change-created","legacy-migration","explicit"]),ag=new Set(["file","directory","other"]),og=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),Qn=/^[a-f0-9]{64}$/u,sg=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var aS=64*1024,oS=64*1024;var sS={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},cS={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function Yn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var lS=(1n<<256n)-1n;function cg(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function lg(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
|
|
169
|
+
`)}function ug(t,e){return Z(`comet.native.snapshot-policy.v1
|
|
170
|
+
${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function po(t,e,i){let n=new Set(e),r=[...e];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!n.has(a+1)&&(n.add(a+1),r.push(a+1))}return n}function fg(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function mu(t){let e=Fn(t,"Native snapshot pattern"),i=[];for(let n=0;n<e.length;n+=1){let r=e[n];r==="*"&&e[n+1]==="*"?(n+=1,e[n+1]==="/"?(n+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):r==="*"?i.push({kind:"star"}):r==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:r})}return(n,r)=>{let a=r?fg(r):void 0;if(a&&!a())return!1;let o=po(i,new Set([0]),a);if(o===null)return!1;for(let s of n){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let u=i[l];u&&(u.kind==="literal"&&u.value===s||u.kind==="question"&&s!=="/"?c.add(l+1):u.kind==="star"&&s!=="/"||u.kind==="globstar"?c.add(l):u.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=po(i,c,a),o===null||o.size===0)return!1}return po(i,o,a)?.has(i.length)??!1}}function dg(t){if(t===void 0)return;let e=[...new Set(t.include.map(r=>Fn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(t.exclude.map(r=>Fn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let n=ug(e,i);if("hash"in t&&t.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:n},includeMatchers:e.map(mu),excludeMatchers:i.map(mu),excludedDirectoryPrefixes:i.flatMap(r=>{if(!r.endsWith("/**"))return[];let a=r.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((r,a)=>r.localeCompare(a,"en"))}}function ee(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function te(t,e,i){let n=Object.keys(t).find(r=>!e.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function bt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function me(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function wu(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=Xn.posix.normalize(t);if(i!==t||Xn.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function hg(t,e){let i=ee(t,`Native snapshot entry ${e}`);te(i,tg,`Native snapshot entry ${e}`);let n=wu(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!Qn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let r={path:n,hash:i.hash,size:me(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!sg.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function pg(t,e){let i=ee(t,`Native snapshot omission ${e}`);if(te(i,ig,`Native snapshot omission ${e}`),!ag.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!og.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:wu(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:me(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function mg(t){let e=ee(t,"Native snapshot omission overflow");if(te(e,ng,"Native snapshot omission overflow"),typeof e.hash!="string"||!Qn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:bt(e.count,"Native snapshot omission overflow count")}}function Nt(t,e){let i=ee(t,e);if(te(i,Qv,e),typeof i.hash!="string"||!Qn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let n=me(i.recordCount,`${e} recordCount`),r=me(i.storedRecordCount,`${e} storedRecordCount`),a=me(i.stdoutBytes,`${e} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function vu(t){let e=ee(t,"Native Git selection evidence");if(te(e,Xv,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=Nt(e.stageBefore,"Native Git selection stageBefore"),n=Nt(e.combined,"Native Git selection combined"),r=Nt(e.stageAfter,"Native Git selection stageAfter"),a=Nt(e.finalStageBefore,"Native Git selection finalStageBefore"),o=Nt(e.finalCombined,"Native Git selection finalCombined"),s=Nt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(f=>f.overflow),l=!Yn(i,r)||!Yn(r,a)||!Yn(n,o)||!Yn(a,s),u=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==u)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:u,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function gu(t,e){let i=ee(t,e);if(te(i,eg,e),typeof i.hash!="string"||!Qn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let n=me(i.visitedNodeCount,`${e} visitedNodeCount`),r=me(i.recordCount,`${e} recordCount`),a=me(i.storedRecordCount,`${e} storedRecordCount`),o=me(i.encodedBytes,`${e} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function vg(t){let e=ee(t,"Native physical selection evidence");if(te(e,Zv,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=gu(e.before,"Native physical selection before"),n=gu(e.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!cg(i,n);if(!r&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=r&&a?"overflow-and-changed":r?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:n}}function yu(t){let e=ee(t,"Native content snapshot manifest");if(te(e,Jv,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!rg.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=ee(e.capture,"Native content snapshot capture");if(te(v,Gv,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let C=v.gitSelection===void 0?void 0:vu(v.gitSelection),b=v.physicalSelection===void 0?void 0:vg(v.physicalSelection),_=null;if(v.projection!==void 0){let W=ee(v.projection,"Native content snapshot projection");if(te(W,Yv,"Native content snapshot projection"),W.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");_={provider:"git",...W.selection===void 0?{}:{selection:vu(W.selection)}}}if(v.provider==="git"){if(b||_)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...C?{gitSelection:C}:{}}}else{if(C)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&_)throw new Error("Native physical-tree capture cannot combine selection and projection");i=_?{provider:"physical-tree",projection:_}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=ee(e.limits,"Native content snapshot limits");te(n,Kv,"Native content snapshot limits");let r={maxFiles:bt(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:bt(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:bt(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:bt(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:bt(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=ee(e.policy,"Native snapshot policy");if(te(v,Uv,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=dg({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(hg),s=e.omitted.map(pg),c=me(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:mg(e.omissionOverflow);if(o.length>r.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>r.maxFileBytes)||o.reduce((v,C)=>v+C.size,0)>r.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>Vv||c<s.length)throw new Error("Native content snapshot omission count is invalid");let u=c-s.length;if(u===0&&l||u>0&&l?.count!==u)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let f=s.filter(v=>v.reason==="git-enumeration-limit"),d=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...f,...d])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(f.length>1||d.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,g=m?.status==="overflow"||m?.status==="overflow-and-changed",h=m?.status==="changed"||m?.status==="overflow-and-changed";if(g!==(f.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(d.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let p=s.filter(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...y])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(p.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let N=i?.physicalSelection,S=N?.status==="overflow"||N?.status==="overflow-and-changed",k=N?.status==="changed"||N?.status==="overflow-and-changed";if(S!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(k!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(lg(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function gg(t,e){if(!Wv.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=Xn.join(t.changesDir,e);if(!U(t.changesDir,i))throw new Error("Native change path escaped");return Xn.join(i,"runtime","baseline-manifest.json")}async function Nu(t,e){let i=gg(t,e);await O(t.nativeRoot,i);try{let n=await tu({root:t.nativeRoot,file:i,maxBytes:zv,label:"Native baseline snapshot manifest"});return yu(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var ZS=256*1024;var dk={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};import{createHash as Eg}from"node:crypto";import{promises as Zn}from"node:fs";import Oe from"node:path";var bi=/^[a-f0-9]{64}$/u,Pk=16*1024;function Rg(t,e){let i=Oe.relative(t,e);return Oe.isAbsolute(i)||i===".."||i.startsWith(`..${Oe.sep}`)?null:i.replaceAll("\\","/")||"."}function Cg(t){return Array.from(t).some(e=>{let i=e.codePointAt(0)??0;return i<=31||i===127})}function Pg(t,e){if(t.length===0||Cg(t)||t.includes("\\")||Oe.posix.isAbsolute(t)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes(".."))throw new Error(`${e} must be a portable project-relative path`);let i=Oe.posix.normalize(t);if(i!==t||i===".."||i.startsWith("../"))throw new Error(`${e} must be a normalized project-relative path`);return i}function mo(t,e){return Eg("sha256").update(`${t}
|
|
171
|
+
${e}`).digest("hex")}async function Su(t,e){let i=await Zn.realpath(e),n=await Zn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=process.platform==="win32"?Oe.normalize(i).toLowerCase():i;return mo(t,`${r}
|
|
172
|
+
${n.dev}
|
|
173
|
+
${n.ino}
|
|
174
|
+
${n.birthtimeMs}`)}async function ku(t,e){let i=await Zn.realpath(e),n=await Zn.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error("Native workspace identity requires a real directory");let r=process.platform==="win32"?Oe.normalize(i).toLowerCase():i;return mo(t,r)}function Ag(t){if(typeof t!="string")throw new Error("Native workspace capturedAt is invalid");let e=new Date(t);if(!Number.isFinite(e.getTime())||e.toISOString()!==t)throw new Error("Native workspace capturedAt is invalid");return t}function xg(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native workspace identity must be an object");let e=t,i=new Set(["schema","capturedAt","capturedRevision","nativeRootRef","projectRootId","nativeRootId","projectRootPathId","nativeRootPathId","sessionHash"]),n=Object.keys(e).filter(o=>!i.has(o));if(n.length>0)throw new Error(`Native workspace identity has unknown field(s): ${n.join(", ")}`);if(e.schema!=="comet.native.workspace.v2")throw new Error("Unsupported Native workspace identity");if(!Number.isSafeInteger(e.capturedRevision)||e.capturedRevision<1||typeof e.nativeRootRef!="string"||!bi.test(String(e.projectRootId))||!bi.test(String(e.nativeRootId)))throw new Error("Native workspace identity is invalid");Ag(e.capturedAt),Pg(e.nativeRootRef,"Native workspace root ref");let r=e.projectRootPathId!==void 0,a=e.nativeRootPathId!==void 0;if(r!==a)throw new Error("Native workspace path identities must be provided together");if(r&&!bi.test(String(e.projectRootPathId))||a&&!bi.test(String(e.nativeRootPathId)))throw new Error("Native workspace path identity is invalid");if(e.sessionHash!==void 0&&!bi.test(String(e.sessionHash)))throw new Error("Native workspace session hash is invalid")}function Tg(t,e){return Oe.join(t.changesDir,e,"runtime","workspace.json")}async function _g(t){if(!Number.isSafeInteger(t.revision)||t.revision<1)throw new Error("Native workspace revision must be a positive integer");let e=Rg(t.paths.projectRoot,t.paths.nativeRoot);if(!e)throw new Error("Native root is outside the project root");let[i,n,r,a]=await Promise.all([Su("comet.native.workspace-project-root.v2",t.paths.projectRoot),Su("comet.native.workspace-native-root.v2",t.paths.nativeRoot),ku("comet.native.workspace-project-root-path.v2",t.paths.projectRoot),ku("comet.native.workspace-native-root-path.v2",t.paths.nativeRoot)]),s={schema:"comet.native.workspace.v2",capturedAt:(t.now??new Date).toISOString(),capturedRevision:t.revision,nativeRootRef:e,projectRootId:i,nativeRootId:n,projectRootPathId:r,nativeRootPathId:a,...t.sessionId?{sessionHash:mo("comet.native.workspace-session.v2",`${i}
|
|
175
|
+
${n}
|
|
176
|
+
${t.sessionId}`)}:{}};return xg(s),s}async function vo(t){let e=await _g(t),i=Tg(t.paths,t.name);return await O(t.paths.nativeRoot,i),await oe(i,e,{containedRoot:t.paths.nativeRoot}),e}var Ge="comet.native.v3",Ye="comet.native.v2",Xe="comet.native.v1";var Eu=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Og=new Set(Eu),Ru=new Set([...Eu,"minimum_runtime_version","revision"]),$g=new Set([...Ru,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Hg=new Set(["capability","operation","source","base_hash"]),Mg=new Set(["shape","build","verify","archive"]),Lg=new Set(["implicit","confirmed"]),Dg=new Set(["pending","pass","fail"]),Ze="comet-state.yaml",wo=/^[a-f0-9]{64}$/u,Cu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Fg=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,yo=class extends Error{constructor(i,n){super(`Native change ${i} uses ${n}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=n;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},kt=class extends Error{constructor(i,n){super(i!==Ge||n===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${n}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=n;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},er=class extends Error{constructor(i,n,r){super(`Native change ${i} revision conflict: expected ${n}, actual ${r}`);this.change=i;this.expectedRevision=n;this.actualRevision=r;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},tr=class extends Error{constructor(i,n,r,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${n} omitted entr${n===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=n;this.omittedByReason=r;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},Kk=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
|
|
177
|
+
`);function ki(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Pu(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function bo(t){if(!Cu.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Bg(t){if(!Cu.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Au(t,e){if(t.length===0||Qe.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function qg(t,e){let i=ki(t,`spec_changes[${e}]`);if(Pu(i,Hg,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(Bg(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let n=i.source,r=i.base_hash;if(n!==void 0&&typeof n!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof n=="string"&&Au(n,`Spec source for ${i.capability}`),i.operation==="create"){if(!n)throw new Error(`Create spec ${i.capability} requires source`);if(r!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!n)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof r!="string"||!wo.test(r))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(n!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof r!="string"||!wo.test(r))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof n=="string"?{source:n}:{},base_hash:r}}function Vg(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function So(t,e){if(Pu(t,e,Ze),typeof t.name!="string")throw new Error("Native change name is required");if(bo(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!Mg.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Lg.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(qg),n=i.map(r=>r.capability).filter((r,a,o)=>o.indexOf(r)!==a);if(n.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(n)].join(", ")}`);if(typeof t.verification_result!="string"||!Dg.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Au(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!Vg(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function ko(t){let e=ki(t,Ze);if(e.schema!==Xe)throw new Error(`Expected ${Xe}`);return{schema:Xe,...So(e,Og)}}function Si(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function go(t,e,i){if(t===null)return null;let n=typeof t=="string"?Fg.exec(t):null;if(!n||n[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function zg(t){if(t==null)return null;if(typeof t!="string"||!wo.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function Wg(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function Eo(t){let e=ki(t,Ze);if(e.schema!==Ye)throw new Error(`Expected ${Ye}`);if(Si(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Ye} minimum_runtime_version must be 2`);return{schema:Ye,minimum_runtime_version:2,revision:Si(e.revision,"Native v2 revision"),...So(e,Ru)}}function Ro(t){let e=ki(t,Ze);if(e.schema!==Ge){if(e.schema===Xe||e.schema===Ye){let o=e.schema===Xe?ko(e):Eo(e);throw new yo(o.name,o.schema)}throw new kt(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=Si(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new kt(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let n=Si(e.revision,"Native revision"),r=So(e,$g),a=zg(e.approved_contract_hash);if(r.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Ge,minimum_runtime_version:3,revision:n,verification_protocol:Wg(e.verification_protocol),...r,approved_contract_hash:a,implementation_scope:go(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:go(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:go(e.partial_allowance,"Native partial_allowance","allowances")}}function Jg(t){let e=ki(t,Ze);if(e.schema===Xe){let r=ko(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${Ge}`}}if(e.schema===Ye){let r=Eo(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${Ge}`}}if(e.schema!==Ge){let r=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new kt(typeof e.schema=="string"?e.schema:"(missing)",r).message}}let i=Si(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new kt(e.schema,i).message};let n=Ro(e);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function ce(t,e){bo(e);let i=Qe.join(t.changesDir,e);if(!U(t.changesDir,i))throw new Error("Native change path escaped");return i}async function Co(t,e){let i=Qe.join(ce(t,e),"runtime","schema-migration.json");await O(t.nativeRoot,i);try{return await jg.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Kg=256*1024;async function Ug(t,e=Qe.dirname(t)){let i=Qe.relative(e,t).split(Qe.sep).join("/"),n=await We({root:e,ref:i,maxBytes:Kg}),r=(0,No.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${r.errors[0].message}`);return r.toJS()}async function xu(t,e){let i=Qe.join(ce(t,e),Ze);await O(t.nativeRoot,i);let n=Jg(await Ug(i,t.nativeRoot));if(n.state&&n.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await Co(t,e)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(n.status==="current"&&n.state&&await Gg(t,n.state),n)}async function Gg(t,e){if(await Nu(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}var Ao=64*1024*1024,oE=256*1024,ju=16*1024*1024;async function G(t){try{return await et.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Zg(t){let e;try{e=await et.readdir(t.transactionsDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of e){if(!i.isDirectory()||i.isSymbolicLink())continue;let n;try{n=await Ni(t,i.name)}catch(r){throw r.code==="ENOENT"?new Error(`Native transaction ${i.name} has no journal; run doctor before moving`,{cause:r}):r}if(n.status!=="committed"&&n.status!=="rolled-back")throw new Error(`Native transaction ${n.id} is unfinished; recover it before moving`)}}async function ew(t,e){for(let i of await et.readdir(t.locksDir,{withFileTypes:!0})){let n=j.join(t.locksDir,i.name);if(j.resolve(n)!==j.resolve(e)&&(i.isFile()||i.isSymbolicLink()))throw new Error(`Native lock must be diagnosed before moving the root: ${n}`)}}async function tw(t){let e;try{e=await et.readdir(t.changesDir,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;throw i}for(let i of e.sort((n,r)=>n.name.localeCompare(r.name))){if(!i.isDirectory()||i.isSymbolicLink())continue;let n;try{n=await xu(t,i.name)}catch{continue}n.status!=="current"||!n.state||!("revision"in n.state)||await vo({paths:t,name:i.name,revision:n.state.revision})}}async function Ri(t,e){let i=[];async function n(r){let a=await Ke({root:t,directory:r,label:"Native root tree"}),o=a.entries;o.sort((s,c)=>s.name.localeCompare(c.name));for(let s of o){await a.verify();let c=j.join(r,s.name);if(e.excludedFiles?.has(j.resolve(c))){await a.verify();continue}let l=await et.lstat(c);if(s.isSymbolicLink()||l.isSymbolicLink()){if(e.rejectSymlinks)throw new Error(`Native root contains a symlink: ${c}`);await a.verify();continue}if(s.isDirectory()&&l.isDirectory())i.push({ref:j.relative(t,c).split(j.sep).join("/"),type:"directory"}),await n(c);else if(s.isFile()&&l.isFile()){let u=await q({root:t,file:c,maxBytes:Ao,label:`Native root file ${j.relative(t,c)}`});i.push({ref:j.relative(t,c).split(j.sep).join("/"),type:"file",size:u.size,hash:u.hash})}else throw new Error(`Native root contains an unsupported file type: ${c}`);await a.verify()}}return await n(t),i.sort((r,a)=>r.ref.localeCompare(a.ref))}async function iw(t,e,i,n){await vi({root:n,directory:e,label:"Native root move staging directory"});async function r(a,o){let s=await Ke({root:t,directory:a,label:"Native root move source directory"}),c=s.entries;for(let l of c){await s.verify();let u=j.join(a,l.name);if(j.resolve(u)===j.resolve(i)){await s.verify();continue}let f=await et.lstat(u);if(l.isSymbolicLink()||f.isSymbolicLink())throw new Error(`Native root contains a symlink: ${u}`);let d=j.join(o,l.name);if(l.isDirectory()&&f.isDirectory())await vi({root:n,directory:d,label:"Native root move staging directory"}),await r(u,d);else if(l.isFile()&&f.isFile())await gi({sourceRoot:t,source:u,targetRoot:n,target:d,maxBytes:Ao,label:`Native root move file ${j.relative(t,u)}`,exclusive:!0,expectedTargetHash:null});else throw new Error(`Native root contains an unsupported file type: ${u}`);await s.verify()}}await r(t,e)}async function ir(t,e,i,n){let r=await Ri(t,{rejectSymlinks:!0,excludedFiles:i?new Set([j.resolve(i)]):void 0}),a=await Ri(e,{rejectSymlinks:!0,excludedFiles:n?new Set([j.resolve(n)]):void 0});if(JSON.stringify(r)!==JSON.stringify(a))throw new Error(`Native root copies differ; preserve both trees for manual recovery: ${t} and ${e}`)}function nw(t,e){return j.join(t.artifactRoot,`.comet-native-move-${e}`)}function rw(t,e){return j.join(t.artifactRoot,`.comet-native-source-${e}.removing`)}function aw(t){return`${t}.removing`}function Ou(t,e,i){return j.join(Gn(t,e).directory,`root-move-cleanup-${i}.json`)}function ow(t){return JSON.stringify(t,null,2)+`
|
|
178
|
+
`}function sw(t){return Xg("sha256").update(t).digest("hex")}function cw(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Native root-move cleanup manifest entry ${e} must be an object`);let i=t,n=Object.keys(i).sort(),r=i.type==="file"?["hash","ref","size","type"]:["ref","type"];if(JSON.stringify(n)!==JSON.stringify(r))throw new Error(`Native root-move cleanup manifest entry ${e} has invalid fields`);if(typeof i.ref!="string"||i.ref.length===0||i.ref.includes("\\")||j.posix.normalize(i.ref)!==i.ref||i.ref.startsWith("/")||i.ref.split("/").includes("..")||Buffer.byteLength(i.ref,"utf8")>4096)throw new Error(`Native root-move cleanup manifest entry ${e} has an invalid ref`);if(i.type==="directory")return{ref:i.ref,type:"directory"};if(i.type!=="file"||typeof i.size!="number"||!Number.isSafeInteger(i.size)||i.size<0||typeof i.hash!="string"||!/^[a-f0-9]{64}$/u.test(i.hash))throw new Error(`Native root-move cleanup manifest entry ${e} is invalid`);return{ref:i.ref,type:"file",size:i.size,hash:i.hash}}function lw(t,e,i){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Native root-move cleanup manifest must be an object");let n=t;if(JSON.stringify(Object.keys(n).sort())!==JSON.stringify(["entries","kind","schema","transactionId"])||n.schema!=="comet.native.root-move-cleanup.v1"||n.transactionId!==e||n.kind!==i||!Array.isArray(n.entries))throw new Error("Native root-move cleanup manifest binding is invalid");let r=n.entries.map(cw);for(let a=0;a<r.length;a+=1){if(a>0&&r[a-1].ref.localeCompare(r[a].ref)>=0)throw new Error("Native root-move cleanup manifest refs must be unique and sorted");let o=j.posix.dirname(r[a].ref);if(o!=="."&&!r.some(s=>s.ref===o&&s.type==="directory"))throw new Error(`Native root-move cleanup manifest parent is missing: ${o}`)}return{schema:"comet.native.root-move-cleanup.v1",transactionId:e,kind:i,entries:r}}async function uw(t){let e={schema:"comet.native.root-move-cleanup.v1",transactionId:t.id,kind:t.kind,entries:t.entries},i=ow(e);if(Buffer.byteLength(i,"utf8")>ju)throw new Error("Native root-move cleanup manifest exceeds its byte budget");return await he(Ou(t.paths,t.id,t.kind),i,{containedRoot:t.paths.nativeRoot}),sw(i)}async function fw(t){let e=await q({root:t.paths.nativeRoot,file:Ou(t.paths,t.id,t.cleanup.kind),maxBytes:ju,label:`Native root-move cleanup manifest ${t.cleanup.kind}`});if(e.hash!==t.cleanup.manifestHash)throw new Error("Native root-move cleanup manifest hash changed");return lw(JSON.parse(e.bytes.toString("utf8")),t.id,t.cleanup.kind)}async function Po(t){let e=await Ri(t.quarantine,{rejectSymlinks:!0}),i=new Map(t.manifest.entries.map(n=>[n.ref,n]));for(let n of e){let r=i.get(n.ref);if(!r||JSON.stringify(r)!==JSON.stringify(n))throw new Error(`Native root-move cleanup quarantine differs from its bound manifest: ${n.ref}`)}if(t.exact&&e.length!==t.manifest.entries.length)throw new Error("Native root-move cleanup quarantine is incomplete before deletion");return e}function Tu(t){return t.ref.split("/").length}async function dw(t){let i=[...await Po({quarantine:t.quarantine,manifest:t.manifest,exact:!1})].sort((r,a)=>Tu(a)-Tu(r)||(r.type===a.type?a.ref.localeCompare(r.ref):r.type==="file"?-1:1)),n=0;for(let r of i){let a=j.join(t.quarantine,...r.ref.split("/"));r.type==="file"?await so({root:t.projectRoot,file:a,maxBytes:Ao,expectedHash:r.hash,expectedSize:r.size,label:`Native root-move cleanup file ${r.ref}`}):await co({root:t.projectRoot,directory:a,label:`Native root-move cleanup directory ${r.ref}`}),n+=1,await t.hooks?.afterRootMoveCleanupEntryRemoved?.(t.manifest.kind,r.ref,n)}await Po({quarantine:t.quarantine,manifest:t.manifest,exact:!1}),await co({root:t.projectRoot,directory:t.quarantine,label:`Native root-move cleanup quarantine ${t.manifest.kind}`})}function nr(t,e,i=t.native.artifact_root){return{...t,native:{...t.native,artifact_root:i,pending_root_move:e}}}function hw(t){return{schema:"comet.native.transaction.v1",id:t.id,kind:"root-move",status:"prepared",projectRoot:t.paths.projectRoot,nativeRoot:t.paths.nativeRoot,createdAt:t.now.toISOString(),operations:[]}}async function _u(t){let e=nr(t.config,{...t.pending,stage:t.stage},t.activeArtifactRoot);return await fi(t.projectRoot,e),e}async function Ei(t){let e=t.config.native.pending_root_move;if(!e||e.id!==t.id)throw new Error(`Native root-move cleanup ${t.id} lost its pending configuration`);let i=nr(t.config,{id:e.id,fromArtifactRoot:e.fromArtifactRoot,toArtifactRoot:e.toArtifactRoot,stage:e.stage,...t.cleanup?{cleanup:t.cleanup}:{}},t.config.native.artifact_root);return await fi(t.projectRoot,i),i}async function Iu(t){let e=t.config,i=e.native.pending_root_move;if(!i||i.id!==t.id)throw new Error(`Native root-move cleanup ${t.id} lost its pending configuration`);let n=i.cleanup;if(n&&n.kind!==t.kind)throw new Error(`Native root move has unfinished ${n.kind} cleanup; cannot start ${t.kind}`);let r=await G(t.target),a=await G(t.quarantine);if(r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${t.kind}`);if(!n){if(!r&&!a)return e;if(!r&&a)throw new Error(`Native root-move cleanup quarantine is not transaction-bound: ${t.kind}`);let s=await uw({paths:t.stablePaths,id:t.id,kind:t.kind,entries:await Ri(t.target,{rejectSymlinks:!0})});n={kind:t.kind,state:"prepared",manifestHash:s},e=await Ei({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:n})}let o=await fw({paths:t.stablePaths,id:t.id,cleanup:n});if(r=await G(t.target),a=await G(t.quarantine),r&&a)throw new Error(`Native root-move cleanup target and quarantine both exist: ${t.kind}`);if(r){if(n.state!=="prepared")throw new Error(`Native root-move cleanup target reappeared after quarantine: ${t.kind}`);await iu({root:t.projectRoot,directory:t.target,quarantine:t.quarantine,label:t.label,beforeQuarantine:t.beforeQuarantine,afterQuarantine:t.afterQuarantine}),a=!0}if(!a){if(n.state!=="deleting")throw new Error(`Native root-move cleanup quarantine disappeared: ${t.kind}`);return Ei({projectRoot:t.projectRoot,config:e,id:t.id})}return await Po({quarantine:t.quarantine,manifest:o,exact:n.state!=="deleting"}),n.state==="prepared"&&(n={...n,state:"quarantined"},e=await Ei({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:n})),n.state==="quarantined"&&(n={...n,state:"deleting"},e=await Ei({projectRoot:t.projectRoot,config:e,id:t.id,cleanup:n})),await dw({projectRoot:t.projectRoot,quarantine:t.quarantine,manifest:o,hooks:t.hooks}),Ei({projectRoot:t.projectRoot,config:e,id:t.id})}async function pw(t){let e=t.config,i=e.native.pending_root_move.stage;if(i==="copying"){if(!await G(t.sourcePaths.nativeRoot))throw new Error(`Native source root is missing: ${t.sourcePaths.nativeRoot}`);let s=aw(t.staging);e=await Iu({projectRoot:t.projectRoot,config:e,id:t.pending.id,kind:"restart-staging",stablePaths:t.sourcePaths,target:t.staging,quarantine:s,label:"Native root move stale staging removal",hooks:t.hooks}),await Ri(t.sourcePaths.nativeRoot,{rejectSymlinks:!0,excludedFiles:new Set([j.resolve(t.lockFile)])}),await iw(t.sourcePaths.nativeRoot,t.staging,t.lockFile,t.destinationPaths.projectRoot),await ir(t.sourcePaths.nativeRoot,t.staging,t.lockFile),e=await _u({projectRoot:t.projectRoot,config:e,pending:t.pending,stage:"ready"}),i="ready",await t.hooks?.afterRootMoveStage?.("ready",t.journal)}if(i==="ready"){if(await G(t.destinationPaths.nativeRoot)){if(await G(t.staging))throw new Error(`Native destination is occupied: ${t.destinationPaths.nativeRoot}`);await ir(t.sourcePaths.nativeRoot,t.destinationPaths.nativeRoot,t.lockFile)}else{if(!await G(t.staging))throw new Error("Native move staging tree is missing");await ir(t.sourcePaths.nativeRoot,t.staging,t.lockFile),await et.rename(t.staging,t.destinationPaths.nativeRoot)}e=await _u({projectRoot:t.projectRoot,config:e,pending:t.pending,stage:"switched",activeArtifactRoot:t.pending.toArtifactRoot}),i="switched",await t.hooks?.afterRootMoveStage?.("switched",t.journal)}if(i!=="switched")throw new Error(`Unsupported Native root-move stage: ${i}`);if(!await G(t.destinationPaths.nativeRoot))throw new Error(`Native destination root is missing: ${t.destinationPaths.nativeRoot}`);let n=rw(t.sourcePaths,t.pending.id);!e.native.pending_root_move?.cleanup&&await G(t.sourcePaths.nativeRoot)&&await ir(t.sourcePaths.nativeRoot,t.destinationPaths.nativeRoot,t.lockFile),e=await Iu({projectRoot:t.projectRoot,config:e,id:t.pending.id,kind:"forward-source",stablePaths:t.destinationPaths,target:t.sourcePaths.nativeRoot,quarantine:n,label:"Native root move source removal",beforeQuarantine:()=>t.hooks?.beforeRootMoveSourceRemove?.(t.sourcePaths.nativeRoot),afterQuarantine:s=>t.hooks?.afterRootMoveSourceQuarantined?.(s),hooks:t.hooks}),await tw(t.destinationPaths);let r=await Ni(t.destinationPaths,t.pending.id);await ho(t.destinationPaths,r,"commit");let a={artifact_root:e.native.artifact_root,language:e.native.language,clarification_mode:e.native.clarification_mode,archive_confirmation:e.native.archive_confirmation,max_verify_failures:e.native.max_verify_failures,snapshot:e.native.snapshot},o={...e,native:{...a,artifact_root:t.pending.toArtifactRoot}};return await fi(t.projectRoot,o),o}async function $u(t){let e=await Ie(t.projectRoot)??Fl("docs");if(e.native.pending_root_move)throw new Error(`Native root move ${e.native.pending_root_move.id} is already incomplete`);let i=ui(t.toArtifactRoot);if(i===e.native.artifact_root)throw new Error(`Native artifact root is already ${i}`);let n=await ze(t.projectRoot,e.native.artifact_root),r=await ze(t.projectRoot,i);if(U(n.nativeRoot,r.nativeRoot)||U(r.nativeRoot,n.nativeRoot))throw new Error("Native source and destination roots must not overlap");if(!await G(n.nativeRoot))throw new Error(`Native source root does not exist: ${n.nativeRoot}`);if(await Zg(n),await G(r.nativeRoot))throw new Error(`Native destination is occupied: ${r.nativeRoot}`);let a=await hi(n,"root-move",`move root to ${i}`),o=Qg(),s={id:o,fromArtifactRoot:e.native.artifact_root,toArtifactRoot:i,stage:"copying"},c=hw({id:o,paths:n,now:t.now??new Date}),l=nw(r,o);try{if(await ew(n,a.file),await G(l))throw new Error(`Native move staging path is occupied: ${l}`);return await fi(t.projectRoot,nr(e,s)),await hu(n,c),await t.hooks?.afterRootMoveStage?.("copying",c),await pw({projectRoot:t.projectRoot,config:nr(e,s),pending:s,sourcePaths:n,destinationPaths:r,staging:l,journal:c,lockFile:a.file,hooks:t.hooks}),{fromNativeRoot:n.nativeRoot,toNativeRoot:r.nativeRoot,transactionId:o}}finally{await pi(a)}}import Uw from"path";var vw=["Outcome","Scope","Non-goals","Acceptance examples"],bE=[...vw,"Constraints and invariants","Decisions","Open questions","Verification expectations"];import{createHash as gw}from"crypto";function le(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function ww(t,e){e.has(t)&&le("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let n=0;n<t.length;n+=1)Object.prototype.hasOwnProperty.call(t,n)||le("sparse arrays are not supported");return(i.length!==t.length||i.some((n,r)=>n!==String(r)))&&le("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&le("symbol properties are not supported"),`[${t.map(n=>xo(n,e)).join(",")}]`}finally{e.delete(t)}}function yw(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&le("only plain objects are supported"),e.has(t)&&le("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&le("symbol properties are not supported"),e.add(t);try{let n=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=n[o];return(!s||!("value"in s))&&le("accessor properties are not supported"),`${JSON.stringify(o)}:${xo(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function xo(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||le("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?ww(t,e):yw(t,e);case"bigint":case"function":case"symbol":case"undefined":return le(`${typeof t} values are not supported`)}return le("unsupported value type")}function To(t){return xo(t,new Set)}function ue(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return gw("sha256").update(`${t}
|
|
179
|
+
${To(e)}`).digest("hex")}var Nw=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var Hu=1024*1024;var Lu="scoped-text-safety",bw=1,Sw=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var kw="comet.native.checker-policy.v1";var DE=ue(kw,{policy:Lu,version:bw,limits:Sw,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Ew=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],FE=new Set(Ew);var Cw=Hu,rR=3*Cw;var Du={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},Pw=Z("comet-native-runtime:v3:semantic-repair-budget"),jR=[{skillVersion:"2",skillHash:Z("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:Z("comet-native-runtime:v1")}];var Bu=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],hC=new Set(Bu),jw=new Set([...Bu,"minimum_runtime_version","revision"]),pC=new Set([...jw,"operation"]),mC=512*1024,Ow=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),vC=new Set([...Ow,"implementationScopeHash","repairScopeHash","repairStagnation"]);var yC=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),qu=Object.freeze({maxCriteria:1024});var CC={maxAcceptanceCriteria:qu.maxCriteria};var _C={maxSpecs:64,maxFileBytes:qn,maxTotalBytes:4*1024*1024};import{execFile as qw,spawn as gP}from"node:child_process";import{promisify as Vw}from"node:util";var qC={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var uP=512*1024;var _P=64*1024;var IP=3600*1e3;var jP=Vw(qw);var OP=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_NATIVE_COMMAND_PAYLOAD","Remove-Item Env:COMET_NATIVE_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");var ar=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(n=>`${n.ref}${n.acceptanceId?`[${n.acceptanceId}]`:""} -> ${n.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var NA={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var xA=16*1024*1024,TA=256*1024,_A=16*1024;var OA=16*1024;var WA=16*1024;var Tx=16*1024*1024,or=class extends Error{constructor(i,n,r,a){super(`Canonical spec conflict for ${i}: expected ${n??"(missing)"}, actual ${r??"(missing)"}`);this.capability=i;this.expectedHash=n;this.actualHash=r;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},sr=class extends Error{constructor(i,n=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(n);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var Fx=10*1024*1024,ve=class extends Error{};function zu(t,e){let i=t.flatMap((n,r)=>n===e?[r]:[]);if(i.length>1)throw new ve(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function Wu(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new ve(`${e} may only be provided once`);if(i.length===0)return;let n=i[0],r=t[n+1];if(r===void 0||r.startsWith("--"))throw new ve(`${e} requires a value`);return t.splice(n,2),r}function _o(t){if(t.length>0)throw new ve(`Unexpected argument: ${t[0]}`)}function Io(t,e){let i=t.shift();if(!i||i.startsWith("--"))throw new ve(`${e} is required`);return i}async function Ju(t){return t?Uw.resolve(t):io(process.cwd())}function jo(t,e,i){return{command:t,exitCode:0,data:e,text:i??JSON.stringify(e,null,2)+`
|
|
180
|
+
`}}function Ku(t,e){if(e instanceof ve)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof or)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof sr)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof er)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof tr)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof ar)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let n=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:n?73:65,error:{code:n?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function Uu(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
|
|
181
|
+
`}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function Gu(t,e){let i=Io(t,"root subcommand");if(i==="show"){_o(t);let n=await Ie(e);if(!n)throw new Error(".comet/config.yaml was not found");let r=await ze(e,n.native.artifact_root);return jo("root show",{projectRoot:e,artifactRoot:n.native.artifact_root,language:n.native.language,nativeRoot:r.nativeRoot,pendingRootMove:n.native.pending_root_move??null})}if(i==="move"){let n=Io(t,"artifact root");_o(t);let r=await $u({projectRoot:e,toArtifactRoot:n});return jo("root move",r,`Moved Comet Native to ${r.toNativeRoot}
|
|
182
|
+
`)}throw new ve(`Unknown root command: ${i}`)}function Gw(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
|
|
183
|
+
`}}async function Yu(t,e,i=process.argv.slice(2)){let n=i.indexOf("--"),r=n<0?[...i]:i.slice(0,n),a=n<0?[]:i.slice(n),o=r.includes("--json"),s,c;try{zu(r,"--json"),s=Wu(r,"--project-root");let u=[...r,...a],f=await Ju(s);c=await e(u,f)}catch(u){c=Ku(t,u)}let l=o?Gw(c):Uu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
|
|
184
|
+
`)?"":`
|
|
185
|
+
`)),l.exitCode}process.exitCode=await Yu("root",Gu);
|