From 187c0013a624ccb8c659ee710c92de5ebf440da6 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 20 Aug 2026 15:29:12 +0900 Subject: [PATCH 1/3] feat(toolchain): declare gate.language so a mislabelled repo keeps its spec truthful The manifest chain reads build orchestration, so a repo whose product language differs from its build host (a C++ SDK driven by Gradle) is mislabelled by construction. TECH_STACK_MISMATCH now cross-checks spec.project.language against .cladding/config.yaml::gate.language when declared, and still warns when the two disagree. --- CHANGELOG.md | 6 ++++ src/stages/detectors/tech-stack-mismatch.ts | 25 +++++++++++++++ src/stages/toolchain/gate-config.ts | 22 ++++++++++++- tests/stages/tech-stack-mismatch.test.ts | 34 +++++++++++++++++++++ tests/stages/toolchain/gate-config.test.ts | 12 ++++++++ 5 files changed, 98 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 660e4c8e..50a0bd11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to Cladding are documented here. Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- **`gate.language` in `.cladding/config.yaml` — a declared language label for the spec cross-check.** The manifest chain reads build orchestration, so a repository whose product language differs from its build host — a C++ SDK driven by Gradle, a Rust core shipped through npm — is mislabelled by construction, and the only way to green `TECH_STACK_MISMATCH` used to be rewriting `spec.yaml` to adopt the mislabel. Declaring the language keeps the spec truthful: the detector cross-checks `spec.project.language` against the declaration instead of the heuristic, and still warns when the two disagree, so the check keeps its teeth. + ## [0.9.4] — Live host health and reproducible verification (2026-08-10) **In one line:** cladding now proves that its host hooks actually fired, records what stopped or completed a run, pins generated CI to the current release line, and stamps every verified tree with the policy that earned it. diff --git a/src/stages/detectors/tech-stack-mismatch.ts b/src/stages/detectors/tech-stack-mismatch.ts index 8cb7b7cb..aa18fc22 100644 --- a/src/stages/detectors/tech-stack-mismatch.ts +++ b/src/stages/detectors/tech-stack-mismatch.ts @@ -5,8 +5,18 @@ // resolves from the actual project manifest. A mismatch means the spec // claims one language while the codebase is shaped like another — the // classic "we ported to TS but spec.yaml still says python" drift. +// +// `.cladding/config.yaml::gate.language` is the declared-label escape hatch. +// The manifest chain reads BUILD ORCHESTRATION, so a repository whose product +// language differs from its build host — a C++ SDK driven by Gradle, a Rust +// core shipped through npm — is mislabelled by construction, and the only way +// to green the check used to be rewriting spec.yaml to adopt the mislabel. +// With a declaration the spec stays truthful: the detector cross-checks the +// spec against the declaration instead of the heuristic, and still warns when +// the two disagree, so the check keeps its teeth. import {detectToolchain} from '../toolchain/detect.js'; +import {readGateConfig} from '../toolchain/gate-config.js'; import type {Spec} from '../../spec/types.js'; import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js'; import {withSpec} from './with-spec.js'; @@ -19,6 +29,21 @@ function runTechStackMismatch(opts: CommandStageOptions): readonly DriftFinding[ } function detect(spec: Spec, cwd: string): readonly DriftFinding[] { + const declared = readGateConfig(cwd).language; + if (declared !== undefined) { + // A declaration replaces the manifest heuristic entirely — including the + // no-manifest case, where the declaration IS the cross-check anchor. + if (spec.project.language === declared) return []; + return [ + { + detector: NAME, + severity: 'warn', + message: + `spec.project.language='${spec.project.language}' but` + + ` .cladding/config.yaml::gate.language declares '${declared}'`, + }, + ]; + } const detected = detectToolchain(cwd).language; if (detected === 'unknown') { return [ diff --git a/src/stages/toolchain/gate-config.ts b/src/stages/toolchain/gate-config.ts index 6b0c4a3a..f1503934 100644 --- a/src/stages/toolchain/gate-config.ts +++ b/src/stages/toolchain/gate-config.ts @@ -8,6 +8,7 @@ // scope: feature # feature (default) | repo (force whole-repo) // commands: # optional — replaces toolchain auto-detection // test: ["./gradlew", "{modules:test}"] +// language: cpp # optional — declared label for the spec cross-check // // The `{modules:TASK}` token expands to one `::TASK` argument per // focus-feature project. No config file, or no `gate:` block, means the @@ -48,6 +49,16 @@ export interface GateConfig { * Absent (or file missing) → the check degrades to existence-only UNTESTED_AC. */ readonly testReport?: string; + /** + * Declared toolchain-language label for the spec cross-check. The manifest + * chain reads build orchestration, so a repository whose product language + * differs from its build host (e.g. a C++ SDK built through Gradle) is + * mislabelled by construction. When set, TECH_STACK_MISMATCH compares + * `spec.project.language` against this declaration instead of the manifest + * heuristic — keeping the spec truthful without silencing the check. The + * value must match `spec.project.language` exactly (no normalisation). + */ + readonly language?: string; } const DEFAULT: GateConfig = {scope: 'feature'}; @@ -72,7 +83,13 @@ export function readGateConfig(cwd: string = '.'): GateConfig { if (!existsSync(path)) return DEFAULT; try { const parsed = parseYaml(readFileSync(path, 'utf8')) as { - gate?: {scope?: unknown; commands?: Record; coverage?: unknown; test_report?: unknown}; + gate?: { + scope?: unknown; + commands?: Record; + coverage?: unknown; + test_report?: unknown; + language?: unknown; + }; } | null; const gate = parsed?.gate; if (!gate) return DEFAULT; @@ -80,6 +97,8 @@ export function readGateConfig(cwd: string = '.'): GateConfig { const coverage: CoverageTool | undefined = gate.coverage === 'kover' || gate.coverage === 'jacoco' ? gate.coverage : undefined; const testReport = typeof gate.test_report === 'string' ? gate.test_report : undefined; + const language = + typeof gate.language === 'string' && gate.language.trim() !== '' ? gate.language.trim() : undefined; const commands: Partial> = {}; if (gate.commands && typeof gate.commands === 'object') { for (const key of STAGE_KEYS) { @@ -93,6 +112,7 @@ export function readGateConfig(cwd: string = '.'): GateConfig { if (Object.keys(commands).length > 0) (out as {commands?: unknown}).commands = commands; if (coverage) (out as {coverage?: unknown}).coverage = coverage; if (testReport) (out as {testReport?: unknown}).testReport = testReport; + if (language) (out as {language?: unknown}).language = language; return out; } catch { return DEFAULT; diff --git a/tests/stages/tech-stack-mismatch.test.ts b/tests/stages/tech-stack-mismatch.test.ts index b501e2c6..3638978d 100644 --- a/tests/stages/tech-stack-mismatch.test.ts +++ b/tests/stages/tech-stack-mismatch.test.ts @@ -85,4 +85,38 @@ describe('TECH_STACK_MISMATCH detector', () => { expect(findings[0].severity).toBe('info'); expect(findings[0].message).toContain('spec.yaml not loaded'); }); + + function declareLanguage(language: string): void { + mkdirSync(join(dir, '.cladding'), {recursive: true}); + writeFileSync(join(dir, '.cladding', 'config.yaml'), `gate:\n language: ${language}\n`); + } + + test('a matching gate.language declaration silences the manifest mismatch', () => { + // The manifest chain would say typescript (package.json), but the product + // language is declared — the exact repo shape the escape hatch exists for. + writeSpec(dir, 'cpp'); + writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + declareLanguage('cpp'); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); + + test('a gate.language declaration differing from the spec still warns', () => { + // Declaration does not silence the check — spec vs declaration must agree. + writeSpec(dir, 'cpp'); + writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + declareLanguage('java'); + const findings = techStackMismatch.run({cwd: dir}); + expect(findings).toHaveLength(1); + expect(findings[0].severity).toBe('warn'); + expect(findings[0].message).toContain("'cpp'"); + expect(findings[0].message).toContain("declares 'java'"); + }); + + test('a matching declaration also covers the no-manifest case (no info fallback)', () => { + // With a declaration the cross-check has an anchor even when no manifest + // matches, so the "cannot be cross-checked" info is not emitted. + writeSpec(dir, 'cpp'); + declareLanguage('cpp'); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); }); diff --git a/tests/stages/toolchain/gate-config.test.ts b/tests/stages/toolchain/gate-config.test.ts index 0bfab82b..6d271393 100644 --- a/tests/stages/toolchain/gate-config.test.ts +++ b/tests/stages/toolchain/gate-config.test.ts @@ -44,6 +44,18 @@ describe('readGateConfig', () => { expect(readGateConfig(dir)).toEqual({scope: 'feature'}); }); + test('parses gate.language as a trimmed string', () => { + writeConfig('gate:\n language: " cpp "\n'); + expect(readGateConfig(dir).language).toBe('cpp'); + }); + + test('ignores a non-string or empty gate.language', () => { + writeConfig('gate:\n language: 3\n'); + expect(readGateConfig(dir).language).toBeUndefined(); + writeConfig('gate:\n language: ""\n'); + expect(readGateConfig(dir).language).toBeUndefined(); + }); + test('parses scope: repo', () => { writeConfig('gate:\n scope: repo\n'); expect(readGateConfig(dir).scope).toBe('repo'); From 0b9d4dece763215d0f2bddcdd638218aecc57550 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 12:11:41 +0900 Subject: [PATCH 2/3] fix(toolchain): disclose the language override, and land the spec entry behind it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The declaration replaced the manifest verdict silently, so a stale declaration and a legitimate build-host mismatch produced the same empty finding list. Nothing mechanical separates the two, which makes the override a waiver — so it is now disclosed at info severity (never gate-failing, including under --strict) naming both labels and which one is in force. F-013's AC-021 claimed an unconditional warn on any manifest disagreement, which the declaration had made untrue; it is now scoped to the no-declaration case. The declaration itself gains a spec entry with its own criteria rather than riding on a detector it contradicted. Also repairs the release-record breakage the change introduced: README test counts across all six variants, and the Claude plugin bundle, which the build regenerates from source. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 2 +- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- plugins/claude-code/dist/clad.js | 510 +++++++++--------- spec.yaml | 2 +- spec/attestation.yaml | 25 +- spec/features/F-013.yaml | 6 +- ...olchain-language-declaration-d14f3cb0.yaml | 61 +++ spec/index.yaml | 1 + src/stages/detectors/tech-stack-mismatch.ts | 50 +- tests/stages/tech-stack-mismatch.test.ts | 41 +- 15 files changed, 424 insertions(+), 298 deletions(-) create mode 100644 spec/features/toolchain-language-declaration-d14f3cb0.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 50a0bd11..23eaafcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ### Added -- **`gate.language` in `.cladding/config.yaml` — a declared language label for the spec cross-check.** The manifest chain reads build orchestration, so a repository whose product language differs from its build host — a C++ SDK driven by Gradle, a Rust core shipped through npm — is mislabelled by construction, and the only way to green `TECH_STACK_MISMATCH` used to be rewriting `spec.yaml` to adopt the mislabel. Declaring the language keeps the spec truthful: the detector cross-checks `spec.project.language` against the declaration instead of the heuristic, and still warns when the two disagree, so the check keeps its teeth. +- **`gate.language` in `.cladding/config.yaml` — a declared language label for the spec cross-check.** The manifest chain reads build orchestration, so a repository whose product language differs from its build host — a C++ SDK driven by Gradle, a Rust core shipped through npm — is mislabelled by construction, and the only way to green `TECH_STACK_MISMATCH` used to be rewriting `spec.yaml` to adopt the mislabel. Declaring the language keeps the spec truthful: the detector cross-checks `spec.project.language` against the declaration instead of the heuristic, and still warns when those two disagree, so the check keeps its teeth. Because nothing mechanical separates a legitimate build-host mismatch from a declaration left behind by a real port, the override is never silent — when the declaration and the manifest disagree, the gate log says which label is in force and what the manifest saw, at a severity that never blocks. ## [0.9.4] — Live host health and reproducible verification (2026-08-10) diff --git a/README.html b/README.html index e26c2384..82717495 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -566,7 +566,7 @@

Status

tests
-
2845/2845
+
2852/2852
all pass
diff --git a/README.ja.md b/README.ja.md index a1896446..f376a92b 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.4(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2845 / 2845 | 15 段階 · 41 detectors | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2852 / 2852 | 15 段階 · 41 detectors | 277(273 done) | 253 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index bf0999ba..eb770adf 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -600,7 +600,7 @@

Status

tests
-
2845/2845
+
2852/2852
all pass
diff --git a/README.ko.md b/README.ko.md index 1ce9db49..a24ccfb0 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.4 · 2026-08 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2845 / 2845 · all pass | 15 단계 · 41 detectors | 277 · 273 done · 자기 스펙 | +| v0.9.4 · 2026-08 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2852 / 2852 · all pass | 15 단계 · 41 detectors | 277 · 273 done · 자기 스펙 | 253 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index 52158c1d..08bfed65 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.4 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2845 / 2845 | 15 stages · 41 detectors | 277 (273 done) | +| v0.9.4 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2852 / 2852 | 15 stages · 41 detectors | 277 (273 done) | 253 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 6d041b54..f2894dab 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.4(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2845 / 2845 | 15 阶段 · 41 检测器 | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2852 / 2852 | 15 阶段 · 41 检测器 | 277(273 done) | 253 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 24438a5f..624bc0c2 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,11 +4,11 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var wfe=Object.create;var MA=Object.defineProperty;var xfe=Object.getOwnPropertyDescriptor;var $fe=Object.getOwnPropertyNames;var kfe=Object.getPrototypeOf,Efe=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Nr=(t,e)=>{for(var r in e)MA(t,r,{get:e[r],enumerable:!0})},Afe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $fe(e))!Efe.call(t,i)&&i!==r&&MA(t,i,{get:()=>e[i],enumerable:!(n=xfe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?wfe(kfe(t)):{},Afe(e||!t||!t.__esModule?MA(r,"default",{value:t,enumerable:!0}):r,t));var uf=v(LA=>{var Ay=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},FA=class extends Ay{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};LA.CommanderError=Ay;LA.InvalidArgumentError=FA});var Ty=v(UA=>{var{InvalidArgumentError:Tfe}=uf(),zA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Tfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Ofe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}UA.Argument=zA;UA.humanReadableArgName=Ofe});var BA=v(HA=>{var{humanReadableArgName:Rfe}=Ty(),qA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>Rfe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +var wfe=Object.create;var MA=Object.defineProperty;var xfe=Object.getOwnPropertyDescriptor;var $fe=Object.getOwnPropertyNames;var kfe=Object.getPrototypeOf,Efe=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Nr=(t,e)=>{for(var r in e)MA(t,r,{get:e[r],enumerable:!0})},Afe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $fe(e))!Efe.call(t,i)&&i!==r&&MA(t,i,{get:()=>e[i],enumerable:!(n=xfe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?wfe(kfe(t)):{},Afe(e||!t||!t.__esModule?MA(r,"default",{value:t,enumerable:!0}):r,t));var ff=v(LA=>{var Ty=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},FA=class extends Ty{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};LA.CommanderError=Ty;LA.InvalidArgumentError=FA});var Oy=v(UA=>{var{InvalidArgumentError:Tfe}=ff(),zA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Tfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Ofe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}UA.Argument=zA;UA.humanReadableArgName=Ofe});var BA=v(HA=>{var{humanReadableArgName:Rfe}=Oy(),qA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>Rfe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` `)}displayWidth(e){return T4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function T4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}HA.Help=qA;HA.stripColor=T4});var WA=v(VA=>{var{InvalidArgumentError:Ife}=uf(),GA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=Pfe(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Ife(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?O4(this.name().replace(/^no-/,"")):O4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ZA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function O4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Pfe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function T4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}HA.Help=qA;HA.stripColor=T4});var WA=v(VA=>{var{InvalidArgumentError:Ife}=ff(),GA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=Pfe(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Ife(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?O4(this.name().replace(/^no-/,"")):O4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ZA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function O4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Pfe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} @@ -16,84 +16,84 @@ ${s}`)}boxWrap(e,r){if(r{function Cfe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function Dfe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=Cfe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}R4.suggestSimilar=Dfe});var N4=v(QA=>{var Nfe=Ge("node:events").EventEmitter,KA=Ge("node:child_process"),mo=Ge("node:path"),Oy=Ge("node:fs"),He=Ge("node:process"),{Argument:jfe,humanReadableArgName:Mfe}=Ty(),{CommanderError:JA}=uf(),{Help:Ffe,stripColor:Lfe}=BA(),{Option:P4,DualOptions:zfe}=WA(),{suggestSimilar:C4}=I4(),YA=class t extends Nfe{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>He.stdout.write(r),writeErr:r=>He.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>He.stdout.isTTY?He.stdout.columns:void 0,getErrHelpWidth:()=>He.stderr.isTTY?He.stderr.columns:void 0,getOutHasColors:()=>XA()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>XA()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Lfe(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Ffe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +(Did you mean ${n[0]}?)`:""}R4.suggestSimilar=Dfe});var N4=v(QA=>{var Nfe=Ge("node:events").EventEmitter,KA=Ge("node:child_process"),mo=Ge("node:path"),Ry=Ge("node:fs"),He=Ge("node:process"),{Argument:jfe,humanReadableArgName:Mfe}=Oy(),{CommanderError:JA}=ff(),{Help:Ffe,stripColor:Lfe}=BA(),{Option:P4,DualOptions:zfe}=WA(),{suggestSimilar:C4}=I4(),YA=class t extends Nfe{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>He.stdout.write(r),writeErr:r=>He.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>He.stdout.isTTY?He.stdout.columns:void 0,getErrHelpWidth:()=>He.stderr.isTTY?He.stderr.columns:void 0,getOutHasColors:()=>XA()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>XA()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Lfe(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Ffe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new jfe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new JA(e,r,n)),He.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new P4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof P4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){He.versions?.electron&&(r.from="electron");let i=He.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=He.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":He.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. -- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Oy.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist +- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Ry.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=mo.resolve(u,d);if(Oy.existsSync(f))return f;if(i.includes(mo.extname(d)))return;let p=i.find(m=>Oy.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Oy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=mo.resolve(mo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=mo.basename(this._scriptPath,mo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(mo.extname(s));let c;He.platform!=="win32"?n?(r.unshift(s),r=D4(He.execArgv).concat(r),c=KA.spawn(He.argv[0],r,{stdio:"inherit"})):c=KA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=D4(He.execArgv).concat(r),c=KA.spawn(He.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{He.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new JA(u,"commander.executeSubCommandAsync","(close)")):He.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)He.exit(1);else{let d=new JA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} + - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=mo.resolve(u,d);if(Ry.existsSync(f))return f;if(i.includes(mo.extname(d)))return;let p=i.find(m=>Ry.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ry.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=mo.resolve(mo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=mo.basename(this._scriptPath,mo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(mo.extname(s));let c;He.platform!=="win32"?n?(r.unshift(s),r=D4(He.execArgv).concat(r),c=KA.spawn(He.argv[0],r,{stdio:"inherit"})):c=KA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=D4(He.execArgv).concat(r),c=KA.spawn(He.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{He.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new JA(u,"commander.executeSubCommandAsync","(close)")):He.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)He.exit(1);else{let d=new JA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in He.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,He.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new zfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=C4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=C4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>Mfe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=mo.basename(e,mo.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(He.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function D4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function XA(){if(He.env.NO_COLOR||He.env.FORCE_COLOR==="0"||He.env.FORCE_COLOR==="false")return!1;if(He.env.FORCE_COLOR||He.env.CLICOLOR_FORCE!==void 0)return!0}QA.Command=YA;QA.useColor=XA});var L4=v(Rn=>{var{Argument:j4}=Ty(),{Command:eT}=N4(),{CommanderError:Ufe,InvalidArgumentError:M4}=uf(),{Help:qfe}=BA(),{Option:F4}=WA();Rn.program=new eT;Rn.createCommand=t=>new eT(t);Rn.createOption=(t,e)=>new F4(t,e);Rn.createArgument=(t,e)=>new j4(t,e);Rn.Command=eT;Rn.Option=F4;Rn.Argument=j4;Rn.Help=qfe;Rn.CommanderError=Ufe;Rn.InvalidArgumentError=M4;Rn.InvalidOptionArgumentError=M4});var De=v(er=>{"use strict";var rT=Symbol.for("yaml.alias"),H4=Symbol.for("yaml.document"),Ry=Symbol.for("yaml.map"),B4=Symbol.for("yaml.pair"),nT=Symbol.for("yaml.scalar"),Iy=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),Wfe=t=>!!t&&typeof t=="object"&&t[ho]===rT,Kfe=t=>!!t&&typeof t=="object"&&t[ho]===H4,Jfe=t=>!!t&&typeof t=="object"&&t[ho]===Ry,Yfe=t=>!!t&&typeof t=="object"&&t[ho]===B4,G4=t=>!!t&&typeof t=="object"&&t[ho]===nT,Xfe=t=>!!t&&typeof t=="object"&&t[ho]===Iy;function Z4(t){if(t&&typeof t=="object")switch(t[ho]){case Ry:case Iy:return!0}return!1}function Qfe(t){if(t&&typeof t=="object")switch(t[ho]){case rT:case Ry:case nT:case Iy:return!0}return!1}var epe=t=>(G4(t)||Z4(t))&&!!t.anchor;er.ALIAS=rT;er.DOC=H4;er.MAP=Ry;er.NODE_TYPE=ho;er.PAIR=B4;er.SCALAR=nT;er.SEQ=Iy;er.hasAnchor=epe;er.isAlias=Wfe;er.isCollection=Z4;er.isDocument=Kfe;er.isMap=Jfe;er.isNode=Qfe;er.isPair=Yfe;er.isScalar=G4;er.isSeq=Xfe});var df=v(iT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),V4=Symbol("skip children"),Ti=Symbol("remove node");function Py(t,e){let r=W4(e);Ut.isDocument(t)?rl(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):rl(null,t,r,Object.freeze([]))}Py.BREAK=jr;Py.SKIP=V4;Py.REMOVE=Ti;function rl(t,e,r,n){let i=K4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return J4(t,n,i),rl(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var Y4=De(),tpe=df(),rpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},npe=t=>t.replace(/[!,[\]{}]/g,e=>rpe[e]),ff=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}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,r){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]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+npe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&Y4.isNode(e.contents)){let o={};tpe.visit(e.contents,(s,a)=>{Y4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};ff.defaultYaml={explicit:!1,version:"1.2"};ff.defaultTags={"!!":"tag:yaml.org,2002:"};X4.Directives=ff});var Dy=v(pf=>{"use strict";var Q4=De(),ipe=df();function ope(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function eH(t){let e=new Set;return ipe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function tH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function spe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=eH(t));let s=tH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(Q4.isScalar(s.node)||Q4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}pf.anchorIsValid=ope;pf.anchorNames=eH;pf.createNodeAnchors=spe;pf.findNewAnchor=tH});var sT=v(rH=>{"use strict";function mf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var ape=De();function nH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>nH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!ape.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}iH.toJS=nH});var Ny=v(sH=>{"use strict";var cpe=sT(),oH=De(),lpe=Wo(),aT=class{constructor(e){Object.defineProperty(this,oH.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:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!oH.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=lpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?cpe.applyReviver(o,{"":a},"",a):a}};sH.NodeBase=aT});var hf=v(aH=>{"use strict";var upe=Dy(),dpe=df(),il=De(),fpe=Ny(),ppe=Wo(),cT=class extends fpe.NodeBase{constructor(e){super(il.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],dpe.visit(e,{Node:(o,s)=>{(il.isAlias(s)||il.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(ppe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=jy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(upe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function jy(t,e,r){if(il.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(il.isCollection(e)){let n=0;for(let i of e.items){let o=jy(t,i,r);o>n&&(n=o)}return n}else if(il.isPair(e)){let n=jy(t,e.key,r),i=jy(t,e.value,r);return Math.max(n,i)}return 1}aH.Alias=cT});var Dt=v(lT=>{"use strict";var mpe=De(),hpe=Ny(),gpe=Wo(),ype=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends hpe.NodeBase{constructor(e){super(mpe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:gpe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ko.BLOCK_FOLDED="BLOCK_FOLDED";Ko.BLOCK_LITERAL="BLOCK_LITERAL";Ko.PLAIN="PLAIN";Ko.QUOTE_DOUBLE="QUOTE_DOUBLE";Ko.QUOTE_SINGLE="QUOTE_SINGLE";lT.Scalar=Ko;lT.isScalarValue=ype});var gf=v(lH=>{"use strict";var _pe=hf(),ha=De(),cH=Dt(),bpe="tag:yaml.org,2002:";function vpe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Spe(t,e,r){if(ha.isDocument(t)&&(t=t.contents),ha.isNode(t))return t;if(ha.isPair(t)){let d=r.schema[ha.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new _pe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=bpe+e.slice(2));let l=vpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new cH.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ha.MAP]:Symbol.iterator in Object(t)?s[ha.SEQ]:s[ha.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new cH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}lH.createNode=Spe});var Fy=v(My=>{"use strict";var wpe=gf(),Oi=De(),xpe=Ny();function uT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return wpe.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 uH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,dT=class extends xpe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(uH(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,uT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,uT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};My.Collection=dT;My.collectionFromPath=uT;My.isEmptyPath=uH});var yf=v(Ly=>{"use strict";var $pe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function fT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var kpe=(t,e,r)=>t.endsWith(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function D4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function XA(){if(He.env.NO_COLOR||He.env.FORCE_COLOR==="0"||He.env.FORCE_COLOR==="false")return!1;if(He.env.FORCE_COLOR||He.env.CLICOLOR_FORCE!==void 0)return!0}QA.Command=YA;QA.useColor=XA});var L4=v(Rn=>{var{Argument:j4}=Oy(),{Command:eT}=N4(),{CommanderError:Ufe,InvalidArgumentError:M4}=ff(),{Help:qfe}=BA(),{Option:F4}=WA();Rn.program=new eT;Rn.createCommand=t=>new eT(t);Rn.createOption=(t,e)=>new F4(t,e);Rn.createArgument=(t,e)=>new j4(t,e);Rn.Command=eT;Rn.Option=F4;Rn.Argument=j4;Rn.Help=qfe;Rn.CommanderError=Ufe;Rn.InvalidArgumentError=M4;Rn.InvalidOptionArgumentError=M4});var De=v(er=>{"use strict";var rT=Symbol.for("yaml.alias"),H4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),B4=Symbol.for("yaml.pair"),nT=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),Wfe=t=>!!t&&typeof t=="object"&&t[ho]===rT,Kfe=t=>!!t&&typeof t=="object"&&t[ho]===H4,Jfe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,Yfe=t=>!!t&&typeof t=="object"&&t[ho]===B4,G4=t=>!!t&&typeof t=="object"&&t[ho]===nT,Xfe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function Z4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function Qfe(t){if(t&&typeof t=="object")switch(t[ho]){case rT:case Iy:case nT:case Py:return!0}return!1}var epe=t=>(G4(t)||Z4(t))&&!!t.anchor;er.ALIAS=rT;er.DOC=H4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=B4;er.SCALAR=nT;er.SEQ=Py;er.hasAnchor=epe;er.isAlias=Wfe;er.isCollection=Z4;er.isDocument=Kfe;er.isMap=Jfe;er.isNode=Qfe;er.isPair=Yfe;er.isScalar=G4;er.isSeq=Xfe});var pf=v(iT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),V4=Symbol("skip children"),Ti=Symbol("remove node");function Cy(t,e){let r=W4(e);Ut.isDocument(t)?nl(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):nl(null,t,r,Object.freeze([]))}Cy.BREAK=jr;Cy.SKIP=V4;Cy.REMOVE=Ti;function nl(t,e,r,n){let i=K4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return J4(t,n,i),nl(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var Y4=De(),tpe=pf(),rpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},npe=t=>t.replace(/[!,[\]{}]/g,e=>rpe[e]),mf=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}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,r){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]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+npe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&Y4.isNode(e.contents)){let o={};tpe.visit(e.contents,(s,a)=>{Y4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};mf.defaultYaml={explicit:!1,version:"1.2"};mf.defaultTags={"!!":"tag:yaml.org,2002:"};X4.Directives=mf});var Ny=v(hf=>{"use strict";var Q4=De(),ipe=pf();function ope(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function eH(t){let e=new Set;return ipe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function tH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function spe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=eH(t));let s=tH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(Q4.isScalar(s.node)||Q4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}hf.anchorIsValid=ope;hf.anchorNames=eH;hf.createNodeAnchors=spe;hf.findNewAnchor=tH});var sT=v(rH=>{"use strict";function gf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var ape=De();function nH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>nH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!ape.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}iH.toJS=nH});var jy=v(sH=>{"use strict";var cpe=sT(),oH=De(),lpe=Wo(),aT=class{constructor(e){Object.defineProperty(this,oH.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:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!oH.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=lpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?cpe.applyReviver(o,{"":a},"",a):a}};sH.NodeBase=aT});var yf=v(aH=>{"use strict";var upe=Ny(),dpe=pf(),ol=De(),fpe=jy(),ppe=Wo(),cT=class extends fpe.NodeBase{constructor(e){super(ol.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],dpe.visit(e,{Node:(o,s)=>{(ol.isAlias(s)||ol.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(ppe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=My(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(upe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function My(t,e,r){if(ol.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(ol.isCollection(e)){let n=0;for(let i of e.items){let o=My(t,i,r);o>n&&(n=o)}return n}else if(ol.isPair(e)){let n=My(t,e.key,r),i=My(t,e.value,r);return Math.max(n,i)}return 1}aH.Alias=cT});var Dt=v(lT=>{"use strict";var mpe=De(),hpe=jy(),gpe=Wo(),ype=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends hpe.NodeBase{constructor(e){super(mpe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:gpe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ko.BLOCK_FOLDED="BLOCK_FOLDED";Ko.BLOCK_LITERAL="BLOCK_LITERAL";Ko.PLAIN="PLAIN";Ko.QUOTE_DOUBLE="QUOTE_DOUBLE";Ko.QUOTE_SINGLE="QUOTE_SINGLE";lT.Scalar=Ko;lT.isScalarValue=ype});var _f=v(lH=>{"use strict";var _pe=yf(),ga=De(),cH=Dt(),bpe="tag:yaml.org,2002:";function vpe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Spe(t,e,r){if(ga.isDocument(t)&&(t=t.contents),ga.isNode(t))return t;if(ga.isPair(t)){let d=r.schema[ga.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new _pe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=bpe+e.slice(2));let l=vpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new cH.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ga.MAP]:Symbol.iterator in Object(t)?s[ga.SEQ]:s[ga.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new cH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}lH.createNode=Spe});var Ly=v(Fy=>{"use strict";var wpe=_f(),Oi=De(),xpe=jy();function uT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return wpe.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 uH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,dT=class extends xpe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(uH(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,uT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,uT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=dT;Fy.collectionFromPath=uT;Fy.isEmptyPath=uH});var bf=v(zy=>{"use strict";var $pe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function fT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var kpe=(t,e,r)=>t.endsWith(` `)?fT(r,e):r.includes(` `)?` -`+fT(r,e):(t.endsWith(" ")?"":" ")+r;Ly.indentComment=fT;Ly.lineComment=kpe;Ly.stringifyComment=$pe});var fH=v(_f=>{"use strict";var Epe="flow",pT="block",zy="quoted";function Ape(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===pT&&(h=dH(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===zy&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`+fT(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=fT;zy.lineComment=kpe;zy.stringifyComment=$pe});var fH=v(vf=>{"use strict";var Epe="flow",pT="block",Uy="quoted";function Ape(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===pT&&(h=dH(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Uy&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` `)r===pT&&(h=dH(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` `&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` -`&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===zy){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Uy){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Xn=Dt(),Jo=fH(),qy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Hy=t=>/^(%|---|\.\.\.)/m.test(t);function Tpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function bf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Hy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length{"use strict";var Xn=Dt(),Jo=fH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function Tpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function Sf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(By(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length `;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` `&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` `);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===` `&&(p=p.slice(0,-1)),p=p.replace(hT,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{R=!0});let T=Jo.foldFlowLines(`${_}${w}${p}`,l,Jo.FOLD_BLOCK,A);if(!R)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),R=!1,A=Hy(n,!0);s!=="folded"&&e!==Xn.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{R=!0});let T=Jo.foldFlowLines(`${_}${w}${p}`,l,Jo.FOLD_BLOCK,A);if(!R)return`>${x} ${l}${T}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function Ope(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` -`)||u&&/[[\]{},]/.test(o))return ol(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?ol(o,e):Uy(t,e,r,n);if(!a&&!u&&i!==Xn.Scalar.PLAIN&&o.includes(` -`))return Uy(t,e,r,n);if(Hy(o)){if(c==="")return e.forceBlockIndent=!0,Uy(t,e,r,n);if(a&&c===l)return ol(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return ol(o,e)}return a?d:Jo.foldFlowLines(d,c,Jo.FOLD_FLOW,qy(e,!1))}function Rpe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Xn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Xn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Xn.Scalar.BLOCK_FOLDED:case Xn.Scalar.BLOCK_LITERAL:return i||o?ol(s.value,e):Uy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return bf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return mT(s.value,e);case Xn.Scalar.PLAIN:return Ope(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}pH.stringifyString=Rpe});var Sf=v(gT=>{"use strict";var Ipe=Dy(),Yo=De(),Ppe=yf(),Cpe=vf();function Dpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Ppe.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(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Npe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Yo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function jpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Yo.isScalar(t)||Yo.isCollection(t))&&t.anchor;o&&Ipe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Mpe(t,e,r,n){if(Yo.isPair(t))return t.toString(e,r,n);if(Yo.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 i,o=Yo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Npe(e.doc.schema.tags,o));let s=jpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Yo.isScalar(o)?Cpe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Yo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}gT.createStringifyContext=Dpe;gT.stringify=Mpe});var yH=v(gH=>{"use strict";var go=De(),mH=Dt(),hH=Sf(),wf=yf();function Fpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=go.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(go.isCollection(t)||!go.isNode(t)&&typeof t=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||go.isCollection(t)||(go.isScalar(t)?t.type===mH.Scalar.BLOCK_FOLDED||t.type===mH.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=hH.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=wf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=wf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=wf.lineComment(g,r.indent,l(f))));let b,_,S;go.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&go.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&go.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=hH.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` +`)||u&&/[[\]{},]/.test(o))return sl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?sl(o,e):qy(t,e,r,n);if(!a&&!u&&i!==Xn.Scalar.PLAIN&&o.includes(` +`))return qy(t,e,r,n);if(By(o)){if(c==="")return e.forceBlockIndent=!0,qy(t,e,r,n);if(a&&c===l)return sl(o,e)}let d=o.replace(/\n+/g,`$& +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return sl(o,e)}return a?d:Jo.foldFlowLines(d,c,Jo.FOLD_FLOW,Hy(e,!1))}function Rpe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Xn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Xn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Xn.Scalar.BLOCK_FOLDED:case Xn.Scalar.BLOCK_LITERAL:return i||o?sl(s.value,e):qy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return Sf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return mT(s.value,e);case Xn.Scalar.PLAIN:return Ope(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}pH.stringifyString=Rpe});var xf=v(gT=>{"use strict";var Ipe=Ny(),Yo=De(),Ppe=bf(),Cpe=wf();function Dpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Ppe.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(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Npe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Yo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function jpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Yo.isScalar(t)||Yo.isCollection(t))&&t.anchor;o&&Ipe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function Mpe(t,e,r,n){if(Yo.isPair(t))return t.toString(e,r,n);if(Yo.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 i,o=Yo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Npe(e.doc.schema.tags,o));let s=jpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Yo.isScalar(o)?Cpe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Yo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}gT.createStringifyContext=Dpe;gT.stringify=Mpe});var yH=v(gH=>{"use strict";var go=De(),mH=Dt(),hH=xf(),$f=bf();function Fpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=go.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(go.isCollection(t)||!go.isNode(t)&&typeof t=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||go.isCollection(t)||(go.isScalar(t)?t.type===mH.Scalar.BLOCK_FOLDED||t.type===mH.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=hH.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=$f.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=$f.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=$f.lineComment(g,r.indent,l(f))));let b,_,S;go.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&go.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&go.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=hH.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` `:"",_){let A=l(_);R+=` -${wf.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` +${$f.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` `&&S&&(R=` `):R+=` ${r.indent}`}else if(!p&&go.isCollection(e)){let A=w[0],T=w.indexOf(` `),D=T!==-1,E=r.inFlow??e.flow??e.items.length===0;if(D||!E){let ae=!1;if(D&&(A==="&"||A==="!")){let X=w.indexOf(" ");A==="&"&&X!==-1&&X{"use strict";var _H=Ge("process");function Lpe(t,...e){t==="debug"&&console.log(...e)}function zpe(t,e){(t==="debug"||t==="warn")&&(typeof _H.emitWarning=="function"?_H.emitWarning(e):console.warn(e))}yT.debug=Lpe;yT.warn=zpe});var Wy=v(Vy=>{"use strict";var Zy=De(),bH=Dt(),By="<<",Gy={identify:t=>t===By||typeof t=="symbol"&&t.description===By,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new bH.Scalar(Symbol(By)),{addToJSMap:vH}),stringify:()=>By},Upe=(t,e)=>(Gy.identify(e)||Zy.isScalar(e)&&(!e.type||e.type===bH.Scalar.PLAIN)&&Gy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Gy.tag&&r.default);function vH(t,e,r){let n=SH(t,r);if(Zy.isSeq(n))for(let i of n.items)bT(t,e,i);else if(Array.isArray(n))for(let i of n)bT(t,e,i);else bT(t,e,n)}function bT(t,e,r){let n=SH(t,r);if(!Zy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function SH(t,e){return t&&Zy.isAlias(e)?e.resolve(t.doc,t):e}Vy.addMergeToJSMap=vH;Vy.isMergeKey=Upe;Vy.merge=Gy});var ST=v($H=>{"use strict";var qpe=_T(),wH=Wy(),Hpe=Sf(),xH=De(),vT=Wo();function Bpe(t,e,{key:r,value:n}){if(xH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(wH.isMergeKey(t,r))wH.addMergeToJSMap(t,e,n);else{let i=vT.toJS(r,"",t);if(e instanceof Map)e.set(i,vT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Gpe(r,i,t),s=vT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Gpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(xH.isNode(t)&&r?.doc){let n=Hpe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),qpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}$H.addPairToJSMap=Bpe});var Xo=v(wT=>{"use strict";var kH=gf(),Zpe=yH(),Vpe=ST(),Ky=De();function Wpe(t,e,r){let n=kH.createNode(t,void 0,r),i=kH.createNode(e,void 0,r);return new Jy(n,i)}var Jy=class t{constructor(e,r=null){Object.defineProperty(this,Ky.NODE_TYPE,{value:Ky.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ky.isNode(r)&&(r=r.clone(e)),Ky.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Vpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Zpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};wT.Pair=Jy;wT.createPair=Wpe});var xT=v(AH=>{"use strict";var ga=De(),EH=Sf(),Yy=yf();function Kpe(t,e,r){return(e.inFlow??t.flow?Ype:Jpe)(t,e,r)}function Jpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Yy.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var _H=Ge("process");function Lpe(t,...e){t==="debug"&&console.log(...e)}function zpe(t,e){(t==="debug"||t==="warn")&&(typeof _H.emitWarning=="function"?_H.emitWarning(e):console.warn(e))}yT.debug=Lpe;yT.warn=zpe});var Ky=v(Wy=>{"use strict";var Vy=De(),bH=Dt(),Gy="<<",Zy={identify:t=>t===Gy||typeof t=="symbol"&&t.description===Gy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new bH.Scalar(Symbol(Gy)),{addToJSMap:vH}),stringify:()=>Gy},Upe=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===bH.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function vH(t,e,r){let n=SH(t,r);if(Vy.isSeq(n))for(let i of n.items)bT(t,e,i);else if(Array.isArray(n))for(let i of n)bT(t,e,i);else bT(t,e,n)}function bT(t,e,r){let n=SH(t,r);if(!Vy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function SH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=vH;Wy.isMergeKey=Upe;Wy.merge=Zy});var ST=v($H=>{"use strict";var qpe=_T(),wH=Ky(),Hpe=xf(),xH=De(),vT=Wo();function Bpe(t,e,{key:r,value:n}){if(xH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(wH.isMergeKey(t,r))wH.addMergeToJSMap(t,e,n);else{let i=vT.toJS(r,"",t);if(e instanceof Map)e.set(i,vT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Gpe(r,i,t),s=vT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Gpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(xH.isNode(t)&&r?.doc){let n=Hpe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),qpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}$H.addPairToJSMap=Bpe});var Xo=v(wT=>{"use strict";var kH=_f(),Zpe=yH(),Vpe=ST(),Jy=De();function Wpe(t,e,r){let n=kH.createNode(t,void 0,r),i=kH.createNode(e,void 0,r);return new Yy(n,i)}var Yy=class t{constructor(e,r=null){Object.defineProperty(this,Jy.NODE_TYPE,{value:Jy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Jy.isNode(r)&&(r=r.clone(e)),Jy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Vpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Zpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};wT.Pair=Yy;wT.createPair=Wpe});var xT=v(AH=>{"use strict";var ya=De(),EH=xf(),Xy=bf();function Kpe(t,e,r){return(e.inFlow??t.flow?Ype:Jpe)(t,e,r)}function Jpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Xy.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` -`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Yy.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` +`+Xy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function Ype({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` +`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Xy.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Xy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Yy.indentComment(e(n),t);r.push(o.trimStart())}}AH.stringifyCollection=Kpe});var es=v(kT=>{"use strict";var Xpe=xT(),Qpe=ST(),eme=Fy(),Qo=De(),Qy=Xo(),tme=Dt();function xf(t,e){let r=Qo.isScalar(e)?e.value:e;for(let n of t)if(Qo.isPair(n)&&(n.key===e||n.key===r||Qo.isScalar(n.key)&&n.key.value===r))return n}var $T=class extends eme.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Qo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Qy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Qo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Qy.Pair(e,e?.value):n=new Qy.Pair(e.key,e.value);let i=xf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Qo.isScalar(i.value)&&tme.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=xf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=xf(this.items,e)?.value;return(!r&&Qo.isScalar(i)?i.value:i)??void 0}has(e){return!!xf(this.items,e)}set(e,r){this.add(new Qy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Qpe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Qo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Xpe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};kT.YAMLMap=$T;kT.findPair=xf});var sl=v(OH=>{"use strict";var rme=De(),TH=es(),nme={collection:"map",default:!0,nodeClass:TH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return rme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>TH.YAMLMap.from(t,e,r)};OH.map=nme});var ts=v(RH=>{"use strict";var ime=gf(),ome=xT(),sme=Fy(),t_=De(),ame=Dt(),cme=Wo(),ET=class extends sme.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(t_.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=e_(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=e_(e);if(typeof n!="number")return;let i=this.items[n];return!r&&t_.isScalar(i)?i.value:i}has(e){let r=e_(e);return typeof r=="number"&&r=0?e:null}RH.YAMLSeq=ET});var al=v(PH=>{"use strict";var lme=De(),IH=ts(),ume={collection:"seq",default:!0,nodeClass:IH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return lme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>IH.YAMLSeq.from(t,e,r)};PH.seq=ume});var $f=v(CH=>{"use strict";var dme=vf(),fme={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),dme.stringifyString(t,e,r,n)}};CH.string=fme});var r_=v(jH=>{"use strict";var DH=Dt(),NH={identify:t=>t==null,createNode:()=>new DH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new DH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&NH.test.test(t)?t:e.options.nullStr};jH.nullTag=NH});var AT=v(FH=>{"use strict";var pme=Dt(),MH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new pme.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&MH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};FH.boolTag=MH});var cl=v(LH=>{"use strict";function mme({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}LH.stringifyNumber=mme});var OT=v(n_=>{"use strict";var hme=Dt(),TT=cl(),gme={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:TT.stringifyNumber},yme={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():TT.stringifyNumber(t)}},_me={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 hme.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:TT.stringifyNumber};n_.float=_me;n_.floatExp=yme;n_.floatNaN=gme});var IT=v(o_=>{"use strict";var zH=cl(),i_=t=>typeof t=="bigint"||Number.isInteger(t),RT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function UH(t,e,r){let{value:n}=t;return i_(n)&&n>=0?r+n.toString(e):zH.stringifyNumber(t)}var bme={identify:t=>i_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>RT(t,2,8,r),stringify:t=>UH(t,8,"0o")},vme={identify:i_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>RT(t,0,10,r),stringify:zH.stringifyNumber},Sme={identify:t=>i_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>RT(t,2,16,r),stringify:t=>UH(t,16,"0x")};o_.int=vme;o_.intHex=Sme;o_.intOct=bme});var HH=v(qH=>{"use strict";var wme=sl(),xme=r_(),$me=al(),kme=$f(),Eme=AT(),PT=OT(),CT=IT(),Ame=[wme.map,$me.seq,kme.string,xme.nullTag,Eme.boolTag,CT.intOct,CT.int,CT.intHex,PT.floatNaN,PT.floatExp,PT.float];qH.schema=Ame});var ZH=v(GH=>{"use strict";var Tme=Dt(),Ome=sl(),Rme=al();function BH(t){return typeof t=="bigint"||Number.isInteger(t)}var s_=({value:t})=>JSON.stringify(t),Ime=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:s_},{identify:t=>t==null,createNode:()=>new Tme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:s_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:s_},{identify:BH,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>BH(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:s_}],Pme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Cme=[Ome.map,Rme.seq].concat(Ime,Pme);GH.schema=Cme});var NT=v(VH=>{"use strict";var kf=Ge("buffer"),DT=Dt(),Dme=vf(),Nme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof kf.Buffer=="function")return kf.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var a_=De(),jT=Xo(),jme=Dt(),Mme=ts();function WH(t,e){if(a_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new jT.Pair(new jme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Qy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Xy.indentComment(e(n),t);r.push(o.trimStart())}}AH.stringifyCollection=Kpe});var es=v(kT=>{"use strict";var Xpe=xT(),Qpe=ST(),eme=Ly(),Qo=De(),e_=Xo(),tme=Dt();function kf(t,e){let r=Qo.isScalar(e)?e.value:e;for(let n of t)if(Qo.isPair(n)&&(n.key===e||n.key===r||Qo.isScalar(n.key)&&n.key.value===r))return n}var $T=class extends eme.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Qo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(e_.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Qo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new e_.Pair(e,e?.value):n=new e_.Pair(e.key,e.value);let i=kf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Qo.isScalar(i.value)&&tme.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=kf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=kf(this.items,e)?.value;return(!r&&Qo.isScalar(i)?i.value:i)??void 0}has(e){return!!kf(this.items,e)}set(e,r){this.add(new e_.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Qpe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Qo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Xpe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};kT.YAMLMap=$T;kT.findPair=kf});var al=v(OH=>{"use strict";var rme=De(),TH=es(),nme={collection:"map",default:!0,nodeClass:TH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return rme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>TH.YAMLMap.from(t,e,r)};OH.map=nme});var ts=v(RH=>{"use strict";var ime=_f(),ome=xT(),sme=Ly(),r_=De(),ame=Dt(),cme=Wo(),ET=class extends sme.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(r_.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=t_(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=t_(e);if(typeof n!="number")return;let i=this.items[n];return!r&&r_.isScalar(i)?i.value:i}has(e){let r=t_(e);return typeof r=="number"&&r=0?e:null}RH.YAMLSeq=ET});var cl=v(PH=>{"use strict";var lme=De(),IH=ts(),ume={collection:"seq",default:!0,nodeClass:IH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return lme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>IH.YAMLSeq.from(t,e,r)};PH.seq=ume});var Ef=v(CH=>{"use strict";var dme=wf(),fme={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),dme.stringifyString(t,e,r,n)}};CH.string=fme});var n_=v(jH=>{"use strict";var DH=Dt(),NH={identify:t=>t==null,createNode:()=>new DH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new DH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&NH.test.test(t)?t:e.options.nullStr};jH.nullTag=NH});var AT=v(FH=>{"use strict";var pme=Dt(),MH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new pme.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&MH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};FH.boolTag=MH});var ll=v(LH=>{"use strict";function mme({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}LH.stringifyNumber=mme});var OT=v(i_=>{"use strict";var hme=Dt(),TT=ll(),gme={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:TT.stringifyNumber},yme={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():TT.stringifyNumber(t)}},_me={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 hme.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:TT.stringifyNumber};i_.float=_me;i_.floatExp=yme;i_.floatNaN=gme});var IT=v(s_=>{"use strict";var zH=ll(),o_=t=>typeof t=="bigint"||Number.isInteger(t),RT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function UH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):zH.stringifyNumber(t)}var bme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>RT(t,2,8,r),stringify:t=>UH(t,8,"0o")},vme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>RT(t,0,10,r),stringify:zH.stringifyNumber},Sme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>RT(t,2,16,r),stringify:t=>UH(t,16,"0x")};s_.int=vme;s_.intHex=Sme;s_.intOct=bme});var HH=v(qH=>{"use strict";var wme=al(),xme=n_(),$me=cl(),kme=Ef(),Eme=AT(),PT=OT(),CT=IT(),Ame=[wme.map,$me.seq,kme.string,xme.nullTag,Eme.boolTag,CT.intOct,CT.int,CT.intHex,PT.floatNaN,PT.floatExp,PT.float];qH.schema=Ame});var ZH=v(GH=>{"use strict";var Tme=Dt(),Ome=al(),Rme=cl();function BH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Ime=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new Tme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:a_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:a_},{identify:BH,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>BH(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:a_}],Pme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Cme=[Ome.map,Rme.seq].concat(Ime,Pme);GH.schema=Cme});var NT=v(VH=>{"use strict";var Af=Ge("buffer"),DT=Dt(),Dme=wf(),Nme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Af.Buffer=="function")return Af.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var c_=De(),jT=Xo(),jme=Dt(),Mme=ts();function WH(t,e){if(c_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new jT.Pair(new jme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=a_.isPair(n)?n:new jT.Pair(n)}}else e("Expected a sequence for this tag");return t}function KH(t,e,r){let{replacer:n}=r,i=new Mme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(jT.createPair(a,c,r))}return i}var Fme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:WH,createNode:KH};c_.createPairs=KH;c_.pairs=Fme;c_.resolvePairs=WH});var LT=v(FT=>{"use strict";var JH=De(),MT=Wo(),Ef=es(),Lme=ts(),YH=l_(),ya=class t extends Lme.YAMLSeq{constructor(){super(),this.add=Ef.YAMLMap.prototype.add.bind(this),this.delete=Ef.YAMLMap.prototype.delete.bind(this),this.get=Ef.YAMLMap.prototype.get.bind(this),this.has=Ef.YAMLMap.prototype.has.bind(this),this.set=Ef.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(JH.isPair(i)?(o=MT.toJS(i.key,"",r),s=MT.toJS(i.value,o,r)):o=MT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=YH.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ya.tag="tag:yaml.org,2002:omap";var zme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ya,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=YH.resolvePairs(t,e),n=[];for(let{key:i}of r.items)JH.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ya,r)},createNode:(t,e,r)=>ya.from(t,e,r)};FT.YAMLOMap=ya;FT.omap=zme});var r6=v(zT=>{"use strict";var XH=Dt();function QH({value:t,source:e},r){return e&&(t?e6:t6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var e6={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 XH.Scalar(!0),stringify:QH},t6={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 XH.Scalar(!1),stringify:QH};zT.falseTag=t6;zT.trueTag=e6});var n6=v(u_=>{"use strict";var Ume=Dt(),UT=cl(),qme={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:UT.stringifyNumber},Hme={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():UT.stringifyNumber(t)}},Bme={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 Ume.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:UT.stringifyNumber};u_.float=Bme;u_.floatExp=Hme;u_.floatNaN=qme});var o6=v(Tf=>{"use strict";var i6=cl(),Af=t=>typeof t=="bigint"||Number.isInteger(t);function d_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function qT(t,e,r){let{value:n}=t;if(Af(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return i6.stringifyNumber(t)}var Gme={identify:Af,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>d_(t,2,2,r),stringify:t=>qT(t,2,"0b")},Zme={identify:Af,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>d_(t,1,8,r),stringify:t=>qT(t,8,"0")},Vme={identify:Af,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>d_(t,0,10,r),stringify:i6.stringifyNumber},Wme={identify:Af,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>d_(t,2,16,r),stringify:t=>qT(t,16,"0x")};Tf.int=Vme;Tf.intBin=Gme;Tf.intHex=Wme;Tf.intOct=Zme});var BT=v(HT=>{"use strict";var m_=De(),f_=Xo(),p_=es(),_a=class t extends p_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;m_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new f_.Pair(e.key,null):r=new f_.Pair(e,null),p_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=p_.findPair(this.items,e);return!r&&m_.isPair(n)?m_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=p_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new f_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(f_.createPair(s,null,n));return o}};_a.tag="tag:yaml.org,2002:set";var Kme={collection:"map",identify:t=>t instanceof Set,nodeClass:_a,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>_a.from(t,e,r),resolve(t,e){if(m_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new _a,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};HT.YAMLSet=_a;HT.set=Kme});var ZT=v(h_=>{"use strict";var Jme=cl();function GT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function s6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Jme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Yme={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:r})=>GT(t,r),stringify:s6},Xme={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=>GT(t,!1),stringify:s6},a6={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(a6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=GT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};h_.floatTime=Xme;h_.intTime=Yme;h_.timestamp=a6});var u6=v(l6=>{"use strict";var Qme=sl(),ehe=r_(),the=al(),rhe=$f(),nhe=NT(),c6=r6(),VT=n6(),g_=o6(),ihe=Wy(),ohe=LT(),she=l_(),ahe=BT(),WT=ZT(),che=[Qme.map,the.seq,rhe.string,ehe.nullTag,c6.trueTag,c6.falseTag,g_.intBin,g_.intOct,g_.int,g_.intHex,VT.floatNaN,VT.floatExp,VT.float,nhe.binary,ihe.merge,ohe.omap,she.pairs,ahe.set,WT.intTime,WT.floatTime,WT.timestamp];l6.schema=che});var v6=v(YT=>{"use strict";var m6=sl(),lhe=r_(),h6=al(),uhe=$f(),dhe=AT(),KT=OT(),JT=IT(),fhe=HH(),phe=ZH(),g6=NT(),Of=Wy(),y6=LT(),_6=l_(),d6=u6(),b6=BT(),y_=ZT(),f6=new Map([["core",fhe.schema],["failsafe",[m6.map,h6.seq,uhe.string]],["json",phe.schema],["yaml11",d6.schema],["yaml-1.1",d6.schema]]),p6={binary:g6.binary,bool:dhe.boolTag,float:KT.float,floatExp:KT.floatExp,floatNaN:KT.floatNaN,floatTime:y_.floatTime,int:JT.int,intHex:JT.intHex,intOct:JT.intOct,intTime:y_.intTime,map:m6.map,merge:Of.merge,null:lhe.nullTag,omap:y6.omap,pairs:_6.pairs,seq:h6.seq,set:b6.set,timestamp:y_.timestamp},mhe={"tag:yaml.org,2002:binary":g6.binary,"tag:yaml.org,2002:merge":Of.merge,"tag:yaml.org,2002:omap":y6.omap,"tag:yaml.org,2002:pairs":_6.pairs,"tag:yaml.org,2002:set":b6.set,"tag:yaml.org,2002:timestamp":y_.timestamp};function hhe(t,e,r){let n=f6.get(e);if(n&&!t)return r&&!n.includes(Of.merge)?n.concat(Of.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(f6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Of.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?p6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(p6).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}YT.coreKnownTags=mhe;YT.getTags=hhe});var eO=v(S6=>{"use strict";var XT=De(),ghe=sl(),yhe=al(),_he=$f(),__=v6(),bhe=(t,e)=>t.keye.key?1:0,QT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?__.getTags(e,"compat"):e?__.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?__.coreKnownTags:{},this.tags=__.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,XT.MAP,{value:ghe.map}),Object.defineProperty(this,XT.SCALAR,{value:_he.string}),Object.defineProperty(this,XT.SEQ,{value:yhe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?bhe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};S6.Schema=QT});var x6=v(w6=>{"use strict";var vhe=De(),tO=Sf(),Rf=yf();function She(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=tO.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Rf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(vhe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Rf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=tO.stringify(t.contents,i,()=>a=null,c);a&&(l+=Rf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(tO.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(Rf.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Rf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=c_.isPair(n)?n:new jT.Pair(n)}}else e("Expected a sequence for this tag");return t}function KH(t,e,r){let{replacer:n}=r,i=new Mme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(jT.createPair(a,c,r))}return i}var Fme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:WH,createNode:KH};l_.createPairs=KH;l_.pairs=Fme;l_.resolvePairs=WH});var LT=v(FT=>{"use strict";var JH=De(),MT=Wo(),Tf=es(),Lme=ts(),YH=u_(),_a=class t extends Lme.YAMLSeq{constructor(){super(),this.add=Tf.YAMLMap.prototype.add.bind(this),this.delete=Tf.YAMLMap.prototype.delete.bind(this),this.get=Tf.YAMLMap.prototype.get.bind(this),this.has=Tf.YAMLMap.prototype.has.bind(this),this.set=Tf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(JH.isPair(i)?(o=MT.toJS(i.key,"",r),s=MT.toJS(i.value,o,r)):o=MT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=YH.createPairs(e,r,n),o=new this;return o.items=i.items,o}};_a.tag="tag:yaml.org,2002:omap";var zme={collection:"seq",identify:t=>t instanceof Map,nodeClass:_a,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=YH.resolvePairs(t,e),n=[];for(let{key:i}of r.items)JH.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new _a,r)},createNode:(t,e,r)=>_a.from(t,e,r)};FT.YAMLOMap=_a;FT.omap=zme});var r6=v(zT=>{"use strict";var XH=Dt();function QH({value:t,source:e},r){return e&&(t?e6:t6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var e6={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 XH.Scalar(!0),stringify:QH},t6={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 XH.Scalar(!1),stringify:QH};zT.falseTag=t6;zT.trueTag=e6});var n6=v(d_=>{"use strict";var Ume=Dt(),UT=ll(),qme={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:UT.stringifyNumber},Hme={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():UT.stringifyNumber(t)}},Bme={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 Ume.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:UT.stringifyNumber};d_.float=Bme;d_.floatExp=Hme;d_.floatNaN=qme});var o6=v(Rf=>{"use strict";var i6=ll(),Of=t=>typeof t=="bigint"||Number.isInteger(t);function f_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function qT(t,e,r){let{value:n}=t;if(Of(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return i6.stringifyNumber(t)}var Gme={identify:Of,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>f_(t,2,2,r),stringify:t=>qT(t,2,"0b")},Zme={identify:Of,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>f_(t,1,8,r),stringify:t=>qT(t,8,"0")},Vme={identify:Of,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>f_(t,0,10,r),stringify:i6.stringifyNumber},Wme={identify:Of,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>f_(t,2,16,r),stringify:t=>qT(t,16,"0x")};Rf.int=Vme;Rf.intBin=Gme;Rf.intHex=Wme;Rf.intOct=Zme});var BT=v(HT=>{"use strict";var h_=De(),p_=Xo(),m_=es(),ba=class t extends m_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;h_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new p_.Pair(e.key,null):r=new p_.Pair(e,null),m_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=m_.findPair(this.items,e);return!r&&h_.isPair(n)?h_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=m_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new p_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(p_.createPair(s,null,n));return o}};ba.tag="tag:yaml.org,2002:set";var Kme={collection:"map",identify:t=>t instanceof Set,nodeClass:ba,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ba.from(t,e,r),resolve(t,e){if(h_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ba,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};HT.YAMLSet=ba;HT.set=Kme});var ZT=v(g_=>{"use strict";var Jme=ll();function GT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function s6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Jme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Yme={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:r})=>GT(t,r),stringify:s6},Xme={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=>GT(t,!1),stringify:s6},a6={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(a6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=GT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};g_.floatTime=Xme;g_.intTime=Yme;g_.timestamp=a6});var u6=v(l6=>{"use strict";var Qme=al(),ehe=n_(),the=cl(),rhe=Ef(),nhe=NT(),c6=r6(),VT=n6(),y_=o6(),ihe=Ky(),ohe=LT(),she=u_(),ahe=BT(),WT=ZT(),che=[Qme.map,the.seq,rhe.string,ehe.nullTag,c6.trueTag,c6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,VT.floatNaN,VT.floatExp,VT.float,nhe.binary,ihe.merge,ohe.omap,she.pairs,ahe.set,WT.intTime,WT.floatTime,WT.timestamp];l6.schema=che});var v6=v(YT=>{"use strict";var m6=al(),lhe=n_(),h6=cl(),uhe=Ef(),dhe=AT(),KT=OT(),JT=IT(),fhe=HH(),phe=ZH(),g6=NT(),If=Ky(),y6=LT(),_6=u_(),d6=u6(),b6=BT(),__=ZT(),f6=new Map([["core",fhe.schema],["failsafe",[m6.map,h6.seq,uhe.string]],["json",phe.schema],["yaml11",d6.schema],["yaml-1.1",d6.schema]]),p6={binary:g6.binary,bool:dhe.boolTag,float:KT.float,floatExp:KT.floatExp,floatNaN:KT.floatNaN,floatTime:__.floatTime,int:JT.int,intHex:JT.intHex,intOct:JT.intOct,intTime:__.intTime,map:m6.map,merge:If.merge,null:lhe.nullTag,omap:y6.omap,pairs:_6.pairs,seq:h6.seq,set:b6.set,timestamp:__.timestamp},mhe={"tag:yaml.org,2002:binary":g6.binary,"tag:yaml.org,2002:merge":If.merge,"tag:yaml.org,2002:omap":y6.omap,"tag:yaml.org,2002:pairs":_6.pairs,"tag:yaml.org,2002:set":b6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function hhe(t,e,r){let n=f6.get(e);if(n&&!t)return r&&!n.includes(If.merge)?n.concat(If.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(f6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(If.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?p6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(p6).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}YT.coreKnownTags=mhe;YT.getTags=hhe});var eO=v(S6=>{"use strict";var XT=De(),ghe=al(),yhe=cl(),_he=Ef(),b_=v6(),bhe=(t,e)=>t.keye.key?1:0,QT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?b_.getTags(e,"compat"):e?b_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?b_.coreKnownTags:{},this.tags=b_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,XT.MAP,{value:ghe.map}),Object.defineProperty(this,XT.SCALAR,{value:_he.string}),Object.defineProperty(this,XT.SEQ,{value:yhe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?bhe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};S6.Schema=QT});var x6=v(w6=>{"use strict";var vhe=De(),tO=xf(),Pf=bf();function She(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=tO.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Pf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(vhe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Pf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=tO.stringify(t.contents,i,()=>a=null,c);a&&(l+=Pf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(tO.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(Pf.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Pf.indentComment(o(c),"")))}return r.join(` `)+` -`}w6.stringifyDocument=She});var If=v($6=>{"use strict";var whe=hf(),ll=Fy(),In=De(),xhe=Xo(),$he=Wo(),khe=eO(),Ehe=x6(),rO=Dy(),Ahe=sT(),The=gf(),nO=oT(),iO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,In.NODE_TYPE,{value:In.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new nO.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[In.NODE_TYPE]:{value:In.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=In.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ul(this.contents)&&this.contents.add(e)}addIn(e,r){ul(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=rO.anchorNames(this);e.anchor=!r||n.has(r)?rO.findNewAnchor(r||"a",n):r}return new whe.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=rO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=The.createNode(e,u,m);return a&&In.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new xhe.Pair(i,o)}delete(e){return ul(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ll.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ul(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return In.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return ll.isEmptyPath(e)?!r&&In.isScalar(this.contents)?this.contents.value:this.contents:In.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return In.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ll.isEmptyPath(e)?this.contents!==void 0:In.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=ll.collectionFromPath(this.schema,[e],r):ul(this.contents)&&this.contents.set(e,r)}setIn(e,r){ll.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=ll.collectionFromPath(this.schema,Array.from(e),r):ul(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new nO.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 nO.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new khe.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=$he.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Ahe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}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 r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Ehe.stringifyDocument(this,e)}};function ul(t){if(In.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}$6.Document=iO});var Df=v(Cf=>{"use strict";var Pf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},oO=class extends Pf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},sO=class extends Pf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Ohe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}w6.stringifyDocument=She});var Cf=v($6=>{"use strict";var whe=yf(),ul=Ly(),In=De(),xhe=Xo(),$he=Wo(),khe=eO(),Ehe=x6(),rO=Ny(),Ahe=sT(),The=_f(),nO=oT(),iO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,In.NODE_TYPE,{value:In.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new nO.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[In.NODE_TYPE]:{value:In.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=In.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){dl(this.contents)&&this.contents.add(e)}addIn(e,r){dl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=rO.anchorNames(this);e.anchor=!r||n.has(r)?rO.findNewAnchor(r||"a",n):r}return new whe.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=rO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=The.createNode(e,u,m);return a&&In.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new xhe.Pair(i,o)}delete(e){return dl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ul.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):dl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return In.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return ul.isEmptyPath(e)?!r&&In.isScalar(this.contents)?this.contents.value:this.contents:In.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return In.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ul.isEmptyPath(e)?this.contents!==void 0:In.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=ul.collectionFromPath(this.schema,[e],r):dl(this.contents)&&this.contents.set(e,r)}setIn(e,r){ul.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=ul.collectionFromPath(this.schema,Array.from(e),r):dl(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new nO.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 nO.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new khe.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=$he.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Ahe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}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 r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Ehe.stringifyDocument(this,e)}};function dl(t){if(In.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}$6.Document=iO});var jf=v(Nf=>{"use strict";var Df=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},oO=class extends Df{constructor(e,r,n){super("YAMLParseError",e,r,n)}},sO=class extends Df{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Ohe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};Cf.YAMLError=Pf;Cf.YAMLParseError=oO;Cf.YAMLWarning=sO;Cf.prettifyError=Ohe});var Nf=v(k6=>{"use strict";function Rhe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let T of t)switch(m&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&o(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&T.type!=="comment"&&T.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),T.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&T.source.includes(" ")&&(h=T),u=!0;break;case"comment":{u||o(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=T.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=T.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=T.source,l=!0,p=!0,(g||b)&&(_=T),u=!0;break;case"anchor":g&&o(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&o(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=T,w??(w=T.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(T,"MULTIPLE_TAGS","A node can have at most one tag"),b=T,w??(w=T.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),x&&o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),x=T,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=T,l=!1,u=!1;break}default:o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),l=!1,u=!1}let R=t[t.length-1],A=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:A,start:w??A}}k6.resolveProps=Rhe});var b_=v(E6=>{"use strict";function aO(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))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 r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(aO(e.key)||aO(e.value))return!0}return!1;default:return!0}}E6.containsNewline=aO});var cO=v(A6=>{"use strict";var Ihe=b_();function Phe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ihe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}A6.flowIndentCheck=Phe});var lO=v(O6=>{"use strict";var T6=De();function Che(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||T6.isScalar(o)&&T6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}O6.mapIncludes=Che});var N6=v(D6=>{"use strict";var R6=Xo(),Dhe=es(),I6=Nf(),Nhe=b_(),P6=cO(),jhe=lO(),C6="All mapping items must start at the same column";function Mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Dhe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=I6.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",C6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`}};Nf.YAMLError=Df;Nf.YAMLParseError=oO;Nf.YAMLWarning=sO;Nf.prettifyError=Ohe});var Mf=v(k6=>{"use strict";function Rhe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let T of t)switch(m&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&o(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&T.type!=="comment"&&T.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),T.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&T.source.includes(" ")&&(h=T),u=!0;break;case"comment":{u||o(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=T.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=T.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=T.source,l=!0,p=!0,(g||b)&&(_=T),u=!0;break;case"anchor":g&&o(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&o(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=T,w??(w=T.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(T,"MULTIPLE_TAGS","A node can have at most one tag"),b=T,w??(w=T.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),x&&o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),x=T,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=T,l=!1,u=!1;break}default:o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),l=!1,u=!1}let R=t[t.length-1],A=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:A,start:w??A}}k6.resolveProps=Rhe});var v_=v(E6=>{"use strict";function aO(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))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 r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(aO(e.key)||aO(e.value))return!0}return!1;default:return!0}}E6.containsNewline=aO});var cO=v(A6=>{"use strict";var Ihe=v_();function Phe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ihe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}A6.flowIndentCheck=Phe});var lO=v(O6=>{"use strict";var T6=De();function Che(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||T6.isScalar(o)&&T6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}O6.mapIncludes=Che});var N6=v(D6=>{"use strict";var R6=Xo(),Dhe=es(),I6=Mf(),Nhe=v_(),P6=cO(),jhe=lO(),C6="All mapping items must start at the same column";function Mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Dhe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=I6.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",C6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Nhe.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",C6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&P6.flowIndentCheck(n.indent,f,i),r.atKey=!1,jhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=I6.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var Fhe=ts(),Lhe=Nf(),zhe=cO();function Uhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Fhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=Lhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&zhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}j6.resolveBlockSeq=Uhe});var dl=v(F6=>{"use strict";function qhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}F6.resolveEnd=qhe});var q6=v(U6=>{"use strict";var Hhe=De(),Bhe=Xo(),L6=es(),Ghe=ts(),Zhe=dl(),z6=Nf(),Vhe=b_(),Whe=lO(),uO="Block collections are not allowed within flow collections",dO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Khe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?L6.YAMLMap:Ghe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g{"use strict";var Fhe=ts(),Lhe=Mf(),zhe=cO();function Uhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Fhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=Lhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&zhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}j6.resolveBlockSeq=Uhe});var fl=v(F6=>{"use strict";function qhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}F6.resolveEnd=qhe});var q6=v(U6=>{"use strict";var Hhe=De(),Bhe=Xo(),L6=es(),Ghe=ts(),Zhe=fl(),z6=Mf(),Vhe=v_(),Whe=lO(),uO="Block collections are not allowed within flow collections",dO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Khe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?L6.YAMLMap:Ghe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=Zhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` @@ -112,7 +112,7 @@ ${l} `+s[h][0].slice(c);d[d.length-1]!==` `&&(d+=` `);break;default:d+=` -`}let m=n+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function oge({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let f=1;f{"use strict";var hO=Dt(),age=dl();function cge(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=hO.Scalar.PLAIN,c=lge(o,l);break;case"single-quoted-scalar":a=hO.Scalar.QUOTE_SINGLE,c=uge(o,l);break;case"double-quoted-scalar":a=hO.Scalar.QUOTE_DOUBLE,c=dge(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=age.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function lge(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Z6(t)}function uge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Z6(t.slice(1,-1)).replace(/''/g,"'")}function Z6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var hO=Dt(),age=fl();function cge(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=hO.Scalar.PLAIN,c=lge(o,l);break;case"single-quoted-scalar":a=hO.Scalar.QUOTE_SINGLE,c=uge(o,l);break;case"double-quoted-scalar":a=hO.Scalar.QUOTE_DOUBLE,c=dge(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=age.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function lge(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Z6(t)}function uge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Z6(t.slice(1,-1)).replace(/''/g,"'")}function Z6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var ba=De(),W6=Dt(),hge=mO(),gge=gO();function yge(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?hge.resolveBlockScalar(t,e,n):gge.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ba.SCALAR]:c?l=_ge(t.schema,i,c,r,n):e.type==="scalar"?l=bge(t,i,e,n):l=t.schema[ba.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ba.isScalar(d)?d:new W6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new W6.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function _ge(t,e,r,n,i){if(r==="!")return t[ba.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ba.SCALAR])}function bge({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ba.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ba.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}K6.composeScalar=yge});var X6=v(Y6=>{"use strict";function vge(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}Y6.emptyScalarPosition=vge});var tB=v(_O=>{"use strict";var Sge=hf(),wge=De(),xge=B6(),Q6=J6(),$ge=dl(),kge=X6(),Ege={composeNode:eB,composeEmptyNode:yO};function eB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Age(t,e,n),(a||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=Q6.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=xge.composeCollection(Ege,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=yO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!wge.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"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function yO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:kge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=Q6.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Age({options:t},{offset:e,source:r,end:n},i){let o=new Sge.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=$ge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}_O.composeEmptyNode=yO;_O.composeNode=eB});var iB=v(nB=>{"use strict";var Tge=If(),rB=tB(),Oge=dl(),Rge=Nf();function Ige(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Tge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Rge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?rB.composeNode(l,i,u,s):rB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Oge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}nB.composeDoc=Ige});var vO=v(aB=>{"use strict";var Pge=Ge("process"),Cge=oT(),Dge=If(),jf=Df(),oB=De(),Nge=iB(),jge=dl();function Mf(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:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function sB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var va=De(),W6=Dt(),hge=mO(),gge=gO();function yge(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?hge.resolveBlockScalar(t,e,n):gge.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[va.SCALAR]:c?l=_ge(t.schema,i,c,r,n):e.type==="scalar"?l=bge(t,i,e,n):l=t.schema[va.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=va.isScalar(d)?d:new W6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new W6.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function _ge(t,e,r,n,i){if(r==="!")return t[va.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[va.SCALAR])}function bge({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[va.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[va.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}K6.composeScalar=yge});var X6=v(Y6=>{"use strict";function vge(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}Y6.emptyScalarPosition=vge});var tB=v(_O=>{"use strict";var Sge=yf(),wge=De(),xge=B6(),Q6=J6(),$ge=fl(),kge=X6(),Ege={composeNode:eB,composeEmptyNode:yO};function eB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Age(t,e,n),(a||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=Q6.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=xge.composeCollection(Ege,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=yO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!wge.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"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function yO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:kge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=Q6.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Age({options:t},{offset:e,source:r,end:n},i){let o=new Sge.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=$ge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}_O.composeEmptyNode=yO;_O.composeNode=eB});var iB=v(nB=>{"use strict";var Tge=Cf(),rB=tB(),Oge=fl(),Rge=Mf();function Ige(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Tge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Rge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?rB.composeNode(l,i,u,s):rB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Oge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}nB.composeDoc=Ige});var vO=v(aB=>{"use strict";var Pge=Ge("process"),Cge=oT(),Dge=Cf(),Ff=jf(),oB=De(),Nge=iB(),jge=fl();function Lf(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:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function sB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Mf(r);o?this.warnings.push(new jf.YAMLWarning(s,n,i)):this.errors.push(new jf.YAMLParseError(s,n,i))},this.directives=new Cge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=sB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var bO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Lf(r);o?this.warnings.push(new Ff.YAMLWarning(s,n,i)):this.errors.push(new Ff.YAMLParseError(s,n,i))},this.directives=new Cge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=sB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} ${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(oB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];oB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=Mf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Nge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new jf.YAMLParseError(Mf(e),"UNEXPECTED_TOKEN",r);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 jf.YAMLParseError(Mf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=jge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new jf.YAMLParseError(Mf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-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),i=new Dge.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};aB.Composer=bO});var uB=v(v_=>{"use strict";var Mge=mO(),Fge=gO(),Lge=Df(),cB=vf();function zge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new Lge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Fge.resolveFlowScalar(t,e,n);case"block-scalar":return Mge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Uge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=cB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=Lf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Nge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Ff.YAMLParseError(Lf(e),"UNEXPECTED_TOKEN",r);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 Ff.YAMLParseError(Lf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=jge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Ff.YAMLParseError(Lf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-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),i=new Dge.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};aB.Composer=bO});var uB=v(S_=>{"use strict";var Mge=mO(),Fge=gO(),Lge=jf(),cB=wf();function zge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new Lge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Fge.resolveFlowScalar(t,e,n);case"block-scalar":return Mge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Uge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=cB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` `,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return lB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` @@ -142,57 +142,57 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `),n=e.substring(0,r),i=e.substring(r+1)+` `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];lB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function lB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function SO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}v_.createScalarToken=Uge;v_.resolveAsScalar=zge;v_.setScalarValue=qge});var fB=v(dB=>{"use strict";var Bge=t=>"type"in t?w_(t):S_(t);function w_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=w_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=S_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=S_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=S_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function S_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=w_(e)),r)for(let o of r)i+=o.source;return n&&(i+=w_(n)),i}dB.stringify=Bge});var gB=v(hB=>{"use strict";var wO=Symbol("break visit"),Gge=Symbol("skip children"),pB=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),mB(Object.freeze([]),t,e)}va.BREAK=wO;va.SKIP=Gge;va.REMOVE=pB;va.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};va.parentCollection=(t,e)=>{let r=va.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function mB(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var xO=uB(),Zge=fB(),Vge=gB(),$O="\uFEFF",kO="",EO="",AO="",Wge=t=>!!t&&"items"in t,Kge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Jge(t){switch(t){case $O:return"";case kO:return"";case EO:return"";case AO:return"";default:return JSON.stringify(t)}}function Yge(t){switch(t){case $O:return"byte-order-mark";case kO:return"doc-mode";case EO:return"flow-error-end";case AO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}S_.createScalarToken=Uge;S_.resolveAsScalar=zge;S_.setScalarValue=qge});var fB=v(dB=>{"use strict";var Bge=t=>"type"in t?x_(t):w_(t);function x_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=x_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=w_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=w_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=w_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function w_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=x_(e)),r)for(let o of r)i+=o.source;return n&&(i+=x_(n)),i}dB.stringify=Bge});var gB=v(hB=>{"use strict";var wO=Symbol("break visit"),Gge=Symbol("skip children"),pB=Symbol("remove item");function Sa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),mB(Object.freeze([]),t,e)}Sa.BREAK=wO;Sa.SKIP=Gge;Sa.REMOVE=pB;Sa.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Sa.parentCollection=(t,e)=>{let r=Sa.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function mB(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var xO=uB(),Zge=fB(),Vge=gB(),$O="\uFEFF",kO="",EO="",AO="",Wge=t=>!!t&&"items"in t,Kge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Jge(t){switch(t){case $O:return"";case kO:return"";case EO:return"";case AO:return"";default:return JSON.stringify(t)}}function Yge(t){switch(t){case $O:return"byte-order-mark";case kO:return"doc-mode";case EO:return"flow-error-end";case AO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`: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}Mr.createScalarToken=xO.createScalarToken;Mr.resolveAsScalar=xO.resolveAsScalar;Mr.setScalarValue=xO.setScalarValue;Mr.stringify=Zge.stringify;Mr.visit=Vge.visit;Mr.BOM=$O;Mr.DOCUMENT=kO;Mr.FLOW_END=EO;Mr.SCALAR=AO;Mr.isCollection=Wge;Mr.isScalar=Kge;Mr.prettyToken=Jge;Mr.tokenType=Yge});var RO=v(_B=>{"use strict";var Ff=x_();function Qn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var yB=new Set("0123456789ABCDEFabcdef"),Xge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),$_=new Set(",[]{}"),Qge=new Set(` ,[]{} +`: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}Mr.createScalarToken=xO.createScalarToken;Mr.resolveAsScalar=xO.resolveAsScalar;Mr.setScalarValue=xO.setScalarValue;Mr.stringify=Zge.stringify;Mr.visit=Vge.visit;Mr.BOM=$O;Mr.DOCUMENT=kO;Mr.FLOW_END=EO;Mr.SCALAR=AO;Mr.isCollection=Wge;Mr.isScalar=Kge;Mr.prettyToken=Jge;Mr.tokenType=Yge});var RO=v(_B=>{"use strict";var zf=$_();function Qn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var yB=new Set("0123456789ABCDEFabcdef"),Xge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),Qge=new Set(` ,[]{} \r `),TO=t=>!t||Qge.has(t),OO=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,r=!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=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` `||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Qn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Qn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Qn(r)){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 r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);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(TO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&nthis.indentValue&&!Qn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Qn(r)){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 r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);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(TO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Qn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===` -`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Ff.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Qn(o)||e&&$_.has(o))break;r=n}else if(Qn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield zf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Qn(o)||e&&k_.has(o))break;r=n}else if(Qn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&$_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&$_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ff.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(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(TO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Qn(n)||r&&$_.has(n)){r?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,r=this.buffer[e];for(;!Qn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Xge.has(r))r=this.buffer[++e];else if(r==="%"&&yB.has(this.buffer[e+1])&&yB.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`,o=this.buffer[n+1]):r=n),o==="#"||e&&k_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&k_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield zf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(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(TO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Qn(n)||r&&k_.has(n)){r?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,r=this.buffer[e];for(;!Qn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Xge.has(r))r=this.buffer[++e];else if(r==="%"&&yB.has(this.buffer[e+1])&&yB.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};_B.Lexer=OO});var PO=v(bB=>{"use strict";var IO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var eye=Ge("process"),vB=x_(),tye=RO();function rs(t,e){for(let r=0;r=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 E_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)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 r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&wB(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&SB(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};_B.Lexer=OO});var PO=v(bB=>{"use strict";var IO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var eye=Ge("process"),vB=$_(),tye=RO();function rs(t,e){for(let r=0;r=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 A_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)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 r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&wB(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&SB(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,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(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(rs(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(xB(r.key)&&!rs(r.sep,"newline")){let s=fl(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(rs(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=fl(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):rs(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!rs(r.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:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.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 r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){E_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||rs(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.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 r=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":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,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 i=k_(n),o=fl(i);wB(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.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 r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){A_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,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(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(rs(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(xB(r.key)&&!rs(r.sep,"newline")){let s=pl(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(rs(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=pl(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):rs(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!rs(r.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:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.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 r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){A_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||rs(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.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 r=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":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,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 i=E_(n),o=pl(i);wB(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+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 r=k_(e),n=fl(r);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 r=k_(e),n=fl(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!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())}}};$B.Parser=CO});var OB=v(zf=>{"use strict";var kB=vO(),rye=If(),Lf=Df(),nye=_T(),iye=De(),oye=PO(),EB=DO();function AB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new oye.LineCounter||null,prettyErrors:e}}function sye(t,e={}){let{lineCounter:r,prettyErrors:n}=AB(e),i=new EB.Parser(r?.addNewLine),o=new kB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Lf.prettifyError(t,r)),a.warnings.forEach(Lf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function TB(t,e={}){let{lineCounter:r,prettyErrors:n}=AB(e),i=new EB.Parser(r?.addNewLine),o=new kB.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Lf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Lf.prettifyError(t,r)),s.warnings.forEach(Lf.prettifyError(t,r))),s}function aye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=TB(t,r);if(!i)return null;if(i.warnings.forEach(o=>nye.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function cye(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return iye.isDocument(t)&&!n?t.toString(r):new rye.Document(t,n,r).toString(r)}zf.parse=aye;zf.parseAllDocuments=sye;zf.parseDocument=TB;zf.stringify=cye});var tr=v(Ze=>{"use strict";var lye=vO(),uye=If(),dye=eO(),NO=Df(),fye=hf(),ns=De(),pye=Xo(),mye=Dt(),hye=es(),gye=ts(),yye=x_(),_ye=RO(),bye=PO(),vye=DO(),A_=OB(),RB=df();Ze.Composer=lye.Composer;Ze.Document=uye.Document;Ze.Schema=dye.Schema;Ze.YAMLError=NO.YAMLError;Ze.YAMLParseError=NO.YAMLParseError;Ze.YAMLWarning=NO.YAMLWarning;Ze.Alias=fye.Alias;Ze.isAlias=ns.isAlias;Ze.isCollection=ns.isCollection;Ze.isDocument=ns.isDocument;Ze.isMap=ns.isMap;Ze.isNode=ns.isNode;Ze.isPair=ns.isPair;Ze.isScalar=ns.isScalar;Ze.isSeq=ns.isSeq;Ze.Pair=pye.Pair;Ze.Scalar=mye.Scalar;Ze.YAMLMap=hye.YAMLMap;Ze.YAMLSeq=gye.YAMLSeq;Ze.CST=yye;Ze.Lexer=_ye.Lexer;Ze.LineCounter=bye.LineCounter;Ze.Parser=vye.Parser;Ze.parse=A_.parse;Ze.parseAllDocuments=A_.parseAllDocuments;Ze.parseDocument=A_.parseDocument;Ze.stringify=A_.stringify;Ze.visit=RB.visit;Ze.visitAsync=RB.visitAsync});import{execFileSync as jO}from"node:child_process";import{existsSync as T_}from"node:fs";import{join as O_,resolve as Sye}from"node:path";function wye(t){try{let e=jO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Sye(t,e):null}catch{return null}}function MO(t){let e=wye(t);if(!e)return null;try{if(T_(O_(e,"MERGE_HEAD")))return"merge";if(T_(O_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(T_(O_(e,"rebase-merge"))||T_(O_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function Sa(t){return MO(t)!==null}function Uf(t,e){try{let r=jO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function R_(t,e){return Uf(t,e)!==null}function IB(t,e){try{let r=jO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var wa=y(()=>{"use strict"});import{execFileSync as xye}from"node:child_process";import{existsSync as $ye,readFileSync as kye}from"node:fs";import{join as CB}from"node:path";function hl(t,e){return xye("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function is(t){try{let e=hl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function os(t,e){DB(t,e);let r=hl(t,["rev-parse","HEAD"]).trim(),n=Eye(t,e);return{groups:Aye(t,n),head:r,inventory:{after:PB(P_(t,"spec.yaml")),before:PB(qf(t,e,"spec.yaml"))},since:e,unsharded_commits:Iye(t,e)}}function FO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function DB(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!R_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function Eye(t,e){let r=hl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!I_(c)&&!I_(a)))if(s.startsWith("A")){let l=ml(P_(t,c));if(!l)continue;l.status==="done"?n.push(pl(l,"added-as-done")):l.status==="archived"&&n.push(pl(l,"archived"))}else if(s.startsWith("D")){let l=ml(qf(t,e,a));l&&n.push(pl(l,"archived"))}else{let l=ml(P_(t,c));if(!l)continue;let d=ml(qf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(pl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(pl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(pl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function I_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function NB(t,e){DB(t,e);let r=hl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!I_(c)&&!I_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?ml(qf(t,"HEAD",c)):null,f=l?null:ml(qf(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function pl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>FO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function ml(t){if(t===null)return null;let e;try{e=(0,C_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function P_(t,e){let r=CB(t,e);if(!$ye(r))return null;try{return kye(r,"utf8")}catch{return null}}function qf(t,e,r){try{return hl(t,["show",`${e}:${r}`])}catch{return null}}function Aye(t,e){let r=Tye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function Tye(t){let e=P_(t,CB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,C_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function PB(t){let e={};if(t!==null)try{let n=(0,C_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function Iye(t,e){let r=hl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);Oye.test(a)&&(Rye.test(a)||n.push({hash:s,subject:a}))}return n}var C_,Oye,Rye,gl=y(()=>{"use strict";C_=wt(tr(),1);wa();Oye=/^(feat|fix)(\([^)]*\))?!?:/,Rye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as jB}from"node:child_process";import{appendFileSync as Pye,existsSync as LO,mkdirSync as Cye,readFileSync as Dye,renameSync as Nye,statSync as jye}from"node:fs";import{userInfo as Mye}from"node:os";import{dirname as Fye,join as UO}from"node:path";function qO(t){return UO(t,MB,Lye)}function rn(t,e){let r=qO(t),n=Fye(r);LO(n)||Cye(n,{recursive:!0});try{LO(r)&&jye(r).size>zye&&Nye(r,UO(n,FB))}catch{}Pye(r,`${JSON.stringify(e)} +`,r)+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 r=E_(e),n=pl(r);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 r=E_(e),n=pl(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!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())}}};$B.Parser=CO});var OB=v(qf=>{"use strict";var kB=vO(),rye=Cf(),Uf=jf(),nye=_T(),iye=De(),oye=PO(),EB=DO();function AB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new oye.LineCounter||null,prettyErrors:e}}function sye(t,e={}){let{lineCounter:r,prettyErrors:n}=AB(e),i=new EB.Parser(r?.addNewLine),o=new kB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Uf.prettifyError(t,r)),a.warnings.forEach(Uf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function TB(t,e={}){let{lineCounter:r,prettyErrors:n}=AB(e),i=new EB.Parser(r?.addNewLine),o=new kB.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Uf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Uf.prettifyError(t,r)),s.warnings.forEach(Uf.prettifyError(t,r))),s}function aye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=TB(t,r);if(!i)return null;if(i.warnings.forEach(o=>nye.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function cye(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return iye.isDocument(t)&&!n?t.toString(r):new rye.Document(t,n,r).toString(r)}qf.parse=aye;qf.parseAllDocuments=sye;qf.parseDocument=TB;qf.stringify=cye});var tr=v(Ze=>{"use strict";var lye=vO(),uye=Cf(),dye=eO(),NO=jf(),fye=yf(),ns=De(),pye=Xo(),mye=Dt(),hye=es(),gye=ts(),yye=$_(),_ye=RO(),bye=PO(),vye=DO(),T_=OB(),RB=pf();Ze.Composer=lye.Composer;Ze.Document=uye.Document;Ze.Schema=dye.Schema;Ze.YAMLError=NO.YAMLError;Ze.YAMLParseError=NO.YAMLParseError;Ze.YAMLWarning=NO.YAMLWarning;Ze.Alias=fye.Alias;Ze.isAlias=ns.isAlias;Ze.isCollection=ns.isCollection;Ze.isDocument=ns.isDocument;Ze.isMap=ns.isMap;Ze.isNode=ns.isNode;Ze.isPair=ns.isPair;Ze.isScalar=ns.isScalar;Ze.isSeq=ns.isSeq;Ze.Pair=pye.Pair;Ze.Scalar=mye.Scalar;Ze.YAMLMap=hye.YAMLMap;Ze.YAMLSeq=gye.YAMLSeq;Ze.CST=yye;Ze.Lexer=_ye.Lexer;Ze.LineCounter=bye.LineCounter;Ze.Parser=vye.Parser;Ze.parse=T_.parse;Ze.parseAllDocuments=T_.parseAllDocuments;Ze.parseDocument=T_.parseDocument;Ze.stringify=T_.stringify;Ze.visit=RB.visit;Ze.visitAsync=RB.visitAsync});import{execFileSync as jO}from"node:child_process";import{existsSync as O_}from"node:fs";import{join as R_,resolve as Sye}from"node:path";function wye(t){try{let e=jO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Sye(t,e):null}catch{return null}}function MO(t){let e=wye(t);if(!e)return null;try{if(O_(R_(e,"MERGE_HEAD")))return"merge";if(O_(R_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(O_(R_(e,"rebase-merge"))||O_(R_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function wa(t){return MO(t)!==null}function Hf(t,e){try{let r=jO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function I_(t,e){return Hf(t,e)!==null}function IB(t,e){try{let r=jO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var xa=y(()=>{"use strict"});import{execFileSync as xye}from"node:child_process";import{existsSync as $ye,readFileSync as kye}from"node:fs";import{join as CB}from"node:path";function gl(t,e){return xye("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function is(t){try{let e=gl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function os(t,e){DB(t,e);let r=gl(t,["rev-parse","HEAD"]).trim(),n=Eye(t,e);return{groups:Aye(t,n),head:r,inventory:{after:PB(C_(t,"spec.yaml")),before:PB(Bf(t,e,"spec.yaml"))},since:e,unsharded_commits:Iye(t,e)}}function FO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function DB(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!I_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function Eye(t,e){let r=gl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!P_(c)&&!P_(a)))if(s.startsWith("A")){let l=hl(C_(t,c));if(!l)continue;l.status==="done"?n.push(ml(l,"added-as-done")):l.status==="archived"&&n.push(ml(l,"archived"))}else if(s.startsWith("D")){let l=hl(Bf(t,e,a));l&&n.push(ml(l,"archived"))}else{let l=hl(C_(t,c));if(!l)continue;let d=hl(Bf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ml(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ml(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ml(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function P_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function NB(t,e){DB(t,e);let r=gl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!P_(c)&&!P_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?hl(Bf(t,"HEAD",c)):null,f=l?null:hl(Bf(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function ml(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>FO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function hl(t){if(t===null)return null;let e;try{e=(0,D_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function C_(t,e){let r=CB(t,e);if(!$ye(r))return null;try{return kye(r,"utf8")}catch{return null}}function Bf(t,e,r){try{return gl(t,["show",`${e}:${r}`])}catch{return null}}function Aye(t,e){let r=Tye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function Tye(t){let e=C_(t,CB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function PB(t){let e={};if(t!==null)try{let n=(0,D_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function Iye(t,e){let r=gl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);Oye.test(a)&&(Rye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Oye,Rye,yl=y(()=>{"use strict";D_=wt(tr(),1);xa();Oye=/^(feat|fix)(\([^)]*\))?!?:/,Rye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as jB}from"node:child_process";import{appendFileSync as Pye,existsSync as LO,mkdirSync as Cye,readFileSync as Dye,renameSync as Nye,statSync as jye}from"node:fs";import{userInfo as Mye}from"node:os";import{dirname as Fye,join as UO}from"node:path";function qO(t){return UO(t,MB,Lye)}function rn(t,e){let r=qO(t),n=Fye(r);LO(n)||Cye(n,{recursive:!0});try{LO(r)&&jye(r).size>zye&&Nye(r,UO(n,FB))}catch{}Pye(r,`${JSON.stringify(e)} `,"utf8")}function zO(t){if(!LO(t))return[];let e=Dye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return zO(qO(t))}function D_(t){return[...zO(UO(t,MB,FB)),...zO(qO(t))]}function nn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function Uye(t){let e;try{e=jB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Mye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function qye(t){try{return jB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Hf(t,e){try{let r=ss(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function Jt(t,e,r){try{let n=qye(t),i=Uye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=ss(t),a=-1;for(let u=s.length-1;u>=0;u--)if(s[u].type==="gate_run"){a=u;break}let c=a>=0?s[a]:void 0,l=a>=0&&s.slice(a+1).some(u=>u.type==="stop_blocked");if(c&&!l&&c.payload.head===n&&c.payload.tier===r.tier&&c.payload.strict===r.strict&&c.payload.worst===r.worst&&c.payload.stopFingerprint===r.stopFingerprint&&JSON.stringify(c.payload.blockers??[])===JSON.stringify(r.blockers??[]))return}rn(t,nn(e,o))}catch{}}var MB,Lye,FB,zye,Fr=y(()=>{"use strict";MB=".cladding",Lye="events.log.jsonl",FB="events.log.1.jsonl",zye=5*1024*1024});import{execFileSync as Hye}from"node:child_process";import{existsSync as LB,readdirSync as Bye,readFileSync as Gye,statSync as zB}from"node:fs";import{createHash as Zye}from"node:crypto";import{join as HO}from"node:path";function xa(t){try{return Hye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function BO(t){let e=[],r=HO(t,"spec.yaml");LB(r)&&zB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=HO(t,"spec",i);if(!(!LB(o)||!zB(o).isDirectory()))for(let s of Bye(o))s.endsWith(".yaml")&&e.push(HO(o,s))}e.sort();let n=Zye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Gye(i)),n.update("\0")}return n.digest("hex")}function N_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:BO(t),timestamp:new Date().toISOString()};return rn(t,nn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function j_(t,e){let r=ss(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function M_(t,e,r,n){let i=nn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return rn(t,i),i}var Bf=y(()=>{"use strict";Fr()});import{readFileSync as Vye,statSync as Wye}from"node:fs";import{extname as Kye,resolve as GO,sep as Jye}from"node:path";function on(t){return Math.ceil(t.length/4)}function Qye(t,e){let r=GO(e),n=GO(r,t);return n===r||n.startsWith(r+Jye)}function qB(t,e,r,n){if(!Qye(t,e))return{path:t,omitted:"unsafe-path"};if(!Yye.has(Kye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>UB)return{path:t,omitted:"too-large",bytes:o}}else{let l=GO(e,t);try{o=Wye(l).size}catch{return{path:t,omitted:"missing"}}if(o>UB)return{path:t,omitted:"too-large",bytes:o};try{i=Vye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Xye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return zO(qO(t))}function N_(t){return[...zO(UO(t,MB,FB)),...zO(qO(t))]}function nn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function Uye(t){let e;try{e=jB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Mye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function qye(t){try{return jB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Gf(t,e){try{let r=ss(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function Jt(t,e,r){try{let n=qye(t),i=Uye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=ss(t),a=-1;for(let u=s.length-1;u>=0;u--)if(s[u].type==="gate_run"){a=u;break}let c=a>=0?s[a]:void 0,l=a>=0&&s.slice(a+1).some(u=>u.type==="stop_blocked");if(c&&!l&&c.payload.head===n&&c.payload.tier===r.tier&&c.payload.strict===r.strict&&c.payload.worst===r.worst&&c.payload.stopFingerprint===r.stopFingerprint&&JSON.stringify(c.payload.blockers??[])===JSON.stringify(r.blockers??[]))return}rn(t,nn(e,o))}catch{}}var MB,Lye,FB,zye,Fr=y(()=>{"use strict";MB=".cladding",Lye="events.log.jsonl",FB="events.log.1.jsonl",zye=5*1024*1024});import{execFileSync as Hye}from"node:child_process";import{existsSync as LB,readdirSync as Bye,readFileSync as Gye,statSync as zB}from"node:fs";import{createHash as Zye}from"node:crypto";import{join as HO}from"node:path";function $a(t){try{return Hye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function BO(t){let e=[],r=HO(t,"spec.yaml");LB(r)&&zB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=HO(t,"spec",i);if(!(!LB(o)||!zB(o).isDirectory()))for(let s of Bye(o))s.endsWith(".yaml")&&e.push(HO(o,s))}e.sort();let n=Zye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Gye(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:$a(t),specDigest:BO(t),timestamp:new Date().toISOString()};return rn(t,nn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function M_(t,e){let r=ss(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function F_(t,e,r,n){let i=nn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return rn(t,i),i}var Zf=y(()=>{"use strict";Fr()});import{readFileSync as Vye,statSync as Wye}from"node:fs";import{extname as Kye,resolve as GO,sep as Jye}from"node:path";function on(t){return Math.ceil(t.length/4)}function Qye(t,e){let r=GO(e),n=GO(r,t);return n===r||n.startsWith(r+Jye)}function qB(t,e,r,n){if(!Qye(t,e))return{path:t,omitted:"unsafe-path"};if(!Yye.has(Kye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>UB)return{path:t,omitted:"too-large",bytes:o}}else{let l=GO(e,t);try{o=Wye(l).size}catch{return{path:t,omitted:"missing"}}if(o>UB)return{path:t,omitted:"too-large",bytes:o};try{i=Vye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Xye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` /* ... clipped (${o} bytes total) ... */ -`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var Yye,UB,Xye,F_=y(()=>{"use strict";Yye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),UB=2e6,Xye="\0"});function Gf(t){for(let i of e_e)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function ZO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function t_e(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])ZO(e,s,o);for(let s of i.modules??[])ZO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Gf(a);c&&ZO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Pn(t){let e=HB.get(t);return e||(e=t_e(t),HB.set(t,e)),e}var e_e,HB,as=y(()=>{"use strict";e_e=["derived:","fixture:","script:","self-dogfood:"];HB=new WeakMap});function VO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function xr(t,e,r={}){let n=r.depth??1/0,i=Pn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=r_e(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=VO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:WO(i)}}var $a=y(()=>{"use strict";as()});function BB(t){return t.impacted.length}function z_(t,e,r={}){let n=r.initialDepth??L_.initialDepth,i=r.maxDepth??L_.maxDepth,o=r.coverageThreshold??L_.coverageThreshold,s=r.marginYieldThreshold??L_.marginYieldThreshold,a=Pn(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=xr(t,e,{depth:1});return"not_found"in b,b}let d=VO(l,a.dependents,1/0).size;if(d===0){let b=xr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=xr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=BB(_),x=S-p,w=S>0?x/S:0;f.push(w);let R=d>0?S/d:1,A=x===0&&b>n,T={frontierExhausted:A,coverage:R,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:T};if(R>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:T};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var L_,KO=y(()=>{"use strict";$a();as();L_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function n_e(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function GB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=n_e(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var ZB=y(()=>{"use strict"});function i_e(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function yl(t,e){let r=i_e(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=GB(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var U_=y(()=>{"use strict";ZB()});import{existsSync as WB,readdirSync as o_e,readFileSync as s_e}from"node:fs";import{join as YO}from"node:path";function XO(t,e=c_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function l_e(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:XO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:XO(`done reverted \u2014 pre-push strict gate red${r}`)}}function VB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function u_e(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return XO(n)}function d_e(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>VB(m)-VB(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-a_e).map(l_e),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?u_e(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function JO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function f_e(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` -`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function p_e(t,e,r){let n=JO(t,/_Rolled back at_\s*`([^`]+)`/),i=JO(t,/Last failed gate:\s*`([^`]+)`/),o=JO(t,/Retry attempts:\s*(\d+)/),s=f_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function m_e(t,e){let r=YO(t,".cladding","post-mortems");if(!WB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of o_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(p_e(s_e(YO(r,o),"utf8"),e,o))}catch{}return i}function KB(t,e){try{let r=D_(t),n=m_e(t,e),i=WB(YO(t,".cladding","events.log.1.jsonl"));return d_e(r,n,e,{truncated:i})}catch{return}}var a_e,c_e,JB=y(()=>{"use strict";Fr();a_e=5,c_e=120});function q_(t,e,r){return on(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ka(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:h_e,o=e,s,a=Pn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=yl(t,o);if("not_found"in c)return c;let l=c.focus,u=KB(n,l.id),d=a&&a.size>0?e:l.id,f=z_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},R=[...c.ancestors];for(;R.length>g_e&&q_(w,R,[])>i;)R.pop();R.lengthi){x.push(`code: omitted ${se} (budget)`);continue}T.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}A>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Ce,Kt,fr)=>{let Qt=Kt+fr>0?[`breaks: omitted ${Kt} feature(s) / ${fr} test(s)`]:[],fo={...w,needs:R,must_edit:{...w.must_edit,code:T},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Qt]}};return on(JSON.stringify(fo))>i},ae=m,X=h;if(E(ae,X,0,0)){let se=xr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(fe=>fe.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Qt=[...m.filter(fe=>Ce.has(fe.id)),...m.filter(fe=>!Ce.has(fe.id))],fo=0;for(;Qt.length>Ce.size&&E(Qt,X,fo,0);)Qt=Qt.slice(0,-1),fo++;let ki=[...h],tn=0;for(;E(Qt,ki,fo,tn);){let fe=-1;for(let po=ki.length-1;po>=0;po--)if(!Kt.has(ki[po])){fe=po;break}if(fe<0)break;ki.splice(fe,1),tn++}ae=Qt,X=ki,fo+tn>0&&x.push(`breaks: omitted ${fo} feature(s) / ${tn} test(s)`),E(ae,X,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let J=D(ae,X),P={...w,needs:R,must_edit:{...w.must_edit,code:T},breaks_if_changed:J},C=P;if(u){let se={...P,prior_attempts:u};on(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let dr=on(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:dr,truncated:x}}}var h_e,g_e,H_=y(()=>{"use strict";F_();U_();KO();JB();$a();as();h_e=3e3,g_e=3});function ei(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function y_e(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function YB(t,e,r="."){let n=Pn(t),i=t.features??[],o=[];for(let f of i){let p=ka(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ka(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=z_(t,f.id),g=!("not_found"in h),b=on(JSON.stringify(p)),_="not_found"in m?b:on(JSON.stringify(m)),S=on(JSON.stringify(f));for(let R of f.modules??[]){let A=e(R);A&&(S+=on(A))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(ei(s)*1e3)/1e3,medianShrinkFactor:Math.round(ei(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(ei(a(c))*10)/10,medianShrinkTruncated:Math.round(ei(a(l))*10)/10,medianStructuralRatio:Math.round(ei(u)*100)/100,medianSliceTokens:Math.round(ei(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(ei(o.map(f=>f.naiveTokens)))},search:{medianDepth:ei(o.map(f=>f.searchDepth)),p95Depth:y_e(o.map(f=>f.searchDepth),95),medianEdges:ei(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(ei(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:ei(o.map(f=>f.regressionTests))},features:o}}var _l,B_=y(()=>{"use strict";F_();KO();H_();as();_l="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as __e,existsSync as QO,mkdirSync as b_e,readFileSync as XB}from"node:fs";import{dirname as v_e,join as S_e}from"node:path";function eR(t){return S_e(t,w_e,x_e)}function $_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:BO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function QB(t,e){try{let r=$_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=tR(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=eR(t),s=v_e(o);return QO(s)||b_e(s,{recursive:!0}),__e(o,`${JSON.stringify(r)} +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var Yye,UB,Xye,L_=y(()=>{"use strict";Yye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),UB=2e6,Xye="\0"});function Vf(t){for(let i of e_e)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function ZO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function t_e(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])ZO(e,s,o);for(let s of i.modules??[])ZO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vf(a);c&&ZO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Pn(t){let e=HB.get(t);return e||(e=t_e(t),HB.set(t,e)),e}var e_e,HB,as=y(()=>{"use strict";e_e=["derived:","fixture:","script:","self-dogfood:"];HB=new WeakMap});function VO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function xr(t,e,r={}){let n=r.depth??1/0,i=Pn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=r_e(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=VO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:WO(i)}}var ka=y(()=>{"use strict";as()});function BB(t){return t.impacted.length}function U_(t,e,r={}){let n=r.initialDepth??z_.initialDepth,i=r.maxDepth??z_.maxDepth,o=r.coverageThreshold??z_.coverageThreshold,s=r.marginYieldThreshold??z_.marginYieldThreshold,a=Pn(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=xr(t,e,{depth:1});return"not_found"in b,b}let d=VO(l,a.dependents,1/0).size;if(d===0){let b=xr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=xr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=BB(_),x=S-p,w=S>0?x/S:0;f.push(w);let R=d>0?S/d:1,A=x===0&&b>n,T={frontierExhausted:A,coverage:R,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:T};if(R>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:T};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var z_,KO=y(()=>{"use strict";ka();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function n_e(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function GB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=n_e(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var ZB=y(()=>{"use strict"});function i_e(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function _l(t,e){let r=i_e(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=GB(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var q_=y(()=>{"use strict";ZB()});import{existsSync as WB,readdirSync as o_e,readFileSync as s_e}from"node:fs";import{join as YO}from"node:path";function XO(t,e=c_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function l_e(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:XO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:XO(`done reverted \u2014 pre-push strict gate red${r}`)}}function VB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function u_e(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return XO(n)}function d_e(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>VB(m)-VB(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-a_e).map(l_e),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?u_e(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function JO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function f_e(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` +`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function p_e(t,e,r){let n=JO(t,/_Rolled back at_\s*`([^`]+)`/),i=JO(t,/Last failed gate:\s*`([^`]+)`/),o=JO(t,/Retry attempts:\s*(\d+)/),s=f_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function m_e(t,e){let r=YO(t,".cladding","post-mortems");if(!WB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of o_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(p_e(s_e(YO(r,o),"utf8"),e,o))}catch{}return i}function KB(t,e){try{let r=N_(t),n=m_e(t,e),i=WB(YO(t,".cladding","events.log.1.jsonl"));return d_e(r,n,e,{truncated:i})}catch{return}}var a_e,c_e,JB=y(()=>{"use strict";Fr();a_e=5,c_e=120});function H_(t,e,r){return on(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function Ea(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:h_e,o=e,s,a=Pn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=_l(t,o);if("not_found"in c)return c;let l=c.focus,u=KB(n,l.id),d=a&&a.size>0?e:l.id,f=U_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},R=[...c.ancestors];for(;R.length>g_e&&H_(w,R,[])>i;)R.pop();R.lengthi){x.push(`code: omitted ${se} (budget)`);continue}T.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}A>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Ce,Kt,fr)=>{let Qt=Kt+fr>0?[`breaks: omitted ${Kt} feature(s) / ${fr} test(s)`]:[],fo={...w,needs:R,must_edit:{...w.must_edit,code:T},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Qt]}};return on(JSON.stringify(fo))>i},ae=m,X=h;if(E(ae,X,0,0)){let se=xr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(fe=>fe.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Qt=[...m.filter(fe=>Ce.has(fe.id)),...m.filter(fe=>!Ce.has(fe.id))],fo=0;for(;Qt.length>Ce.size&&E(Qt,X,fo,0);)Qt=Qt.slice(0,-1),fo++;let ki=[...h],tn=0;for(;E(Qt,ki,fo,tn);){let fe=-1;for(let po=ki.length-1;po>=0;po--)if(!Kt.has(ki[po])){fe=po;break}if(fe<0)break;ki.splice(fe,1),tn++}ae=Qt,X=ki,fo+tn>0&&x.push(`breaks: omitted ${fo} feature(s) / ${tn} test(s)`),E(ae,X,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let J=D(ae,X),P={...w,needs:R,must_edit:{...w.must_edit,code:T},breaks_if_changed:J},C=P;if(u){let se={...P,prior_attempts:u};on(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let dr=on(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:dr,truncated:x}}}var h_e,g_e,B_=y(()=>{"use strict";L_();q_();KO();JB();ka();as();h_e=3e3,g_e=3});function ei(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function y_e(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function YB(t,e,r="."){let n=Pn(t),i=t.features??[],o=[];for(let f of i){let p=Ea(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=Ea(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=U_(t,f.id),g=!("not_found"in h),b=on(JSON.stringify(p)),_="not_found"in m?b:on(JSON.stringify(m)),S=on(JSON.stringify(f));for(let R of f.modules??[]){let A=e(R);A&&(S+=on(A))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(ei(s)*1e3)/1e3,medianShrinkFactor:Math.round(ei(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(ei(a(c))*10)/10,medianShrinkTruncated:Math.round(ei(a(l))*10)/10,medianStructuralRatio:Math.round(ei(u)*100)/100,medianSliceTokens:Math.round(ei(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(ei(o.map(f=>f.naiveTokens)))},search:{medianDepth:ei(o.map(f=>f.searchDepth)),p95Depth:y_e(o.map(f=>f.searchDepth),95),medianEdges:ei(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(ei(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:ei(o.map(f=>f.regressionTests))},features:o}}var bl,G_=y(()=>{"use strict";L_();KO();B_();as();bl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as __e,existsSync as QO,mkdirSync as b_e,readFileSync as XB}from"node:fs";import{dirname as v_e,join as S_e}from"node:path";function eR(t){return S_e(t,w_e,x_e)}function $_e(t,e){return{timestamp:new Date().toISOString(),head:$a(t),spec_digest:BO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function QB(t,e){try{let r=$_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=tR(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=eR(t),s=v_e(o);return QO(s)||b_e(s,{recursive:!0}),__e(o,`${JSON.stringify(r)} `,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function eG(t){let e=[];for(let r of t.split(` -`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function tR(t,e){let r=eR(t);if(!QO(r))return[];let n;try{n=XB(r,"utf8")}catch{return[]}let i=eG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function tG(t){let e=eR(t);if(!QO(e))return{snapshots:[],unreadable:!1};let r;try{r=XB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=eG(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Zf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function rG(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Zf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${_l}`),i.join(` -`)}var w_e,x_e,Vf=y(()=>{"use strict";Bf();B_();w_e=".cladding",x_e="measure.jsonl"});import{existsSync as k_e}from"node:fs";import{join as E_e}from"node:path";function bl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${A_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function tR(t,e){let r=eR(t);if(!QO(r))return[];let n;try{n=XB(r,"utf8")}catch{return[]}let i=eG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function tG(t){let e=eR(t);if(!QO(e))return{snapshots:[],unreadable:!1};let r;try{r=XB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=eG(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Wf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function rG(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Wf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${bl}`),i.join(` +`)}var w_e,x_e,Kf=y(()=>{"use strict";Zf();G_();w_e=".cladding",x_e="measure.jsonl"});import{existsSync as k_e}from"node:fs";import{join as E_e}from"node:path";function vl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${A_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` `)}function iG(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` -`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Zf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Zf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Zf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",_l),r.join(` -`)}function vl(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${O_e(l,r)} |`)}return n.join(` -`)}function O_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of T_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${k_e(E_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Sl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),nG(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)nG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function nG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=FO(r);n&&t.push(`- ${n}`)}t.push("")}var A_e,T_e,G_=y(()=>{"use strict";Vf();B_();gl();A_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};T_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as R_e}from"node:fs";function Ri(t="./spec.yaml"){let e=R_e(t,"utf8");return(0,oG.parse)(e)}var oG,Z_=y(()=>{"use strict";oG=wt(tr(),1)});var cs=v((Lr,oR)=>{"use strict";var rR=Lr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+aG(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};rR.prototype.toString=function(){return this.property+" "+this.message};var V_=Lr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};V_.prototype.addError=function(e){var r;if(typeof e=="string")r=new rR(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new rR(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Ea(this);if(this.throwError)throw r;return r};V_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function I_e(t,e){return e+": "+t.toString()+` -`}V_.prototype.toString=function(e){return this.errors.map(I_e).join("")};Object.defineProperty(V_.prototype,"valid",{get:function(){return!this.errors.length}});oR.exports.ValidatorResultError=Ea;function Ea(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ea),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Ea.prototype=new Error;Ea.prototype.constructor=Ea;Ea.prototype.name="Validation Error";var sG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};sG.prototype=Object.create(Error.prototype,{constructor:{value:sG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var nR=Lr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+aG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};nR.prototype.resolve=function(e){return cG(this.base,e)};nR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=cG(this.base,i||"");var s=new nR(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ti=Lr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ti.regexp=ti.regex;ti.pattern=ti.regex;ti.ipv4=ti["ip-address"];Lr.isFormat=function(e,r,n){if(typeof e=="string"&&ti[r]!==void 0){if(ti[r]instanceof RegExp)return ti[r].test(e);if(typeof ti[r]=="function")return ti[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var aG=Lr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Lr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function P_e(t,e,r,n){typeof r=="object"?e[n]=iR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function C_e(t,e,r){e[r]=t[r]}function D_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=iR(t[n],e[n]):r[n]=e[n]}function iR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(P_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(C_e.bind(null,t,n)),Object.keys(e).forEach(D_e.bind(null,t,e,n))),n}oR.exports.deepMerge=iR;Lr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function N_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(N_e).join("")};Lr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Lr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var cG=Lr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var fG=v((qQe,dG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,sR={};sR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=sR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function aR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new ls("anyOf must be an array");if(!r.anyOf.some(aR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new ls("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new ls("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(aR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!sn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=aR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!sn.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!sn.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function cR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!sn.isSchema(s))throw new ls('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(cR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new ls('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=cR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function lG(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new ls('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&lG.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)lG.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!sn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function j_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var lR=cs();uR.exports.SchemaScanResult=pG;function pG(t,e){this.id=t,this.ref=e}uR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=lR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=lR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!lR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var mG=fG(),us=cs(),hG=W_().scan,gG=us.ValidatorResult,M_e=us.ValidatorResultError,Wf=us.SchemaError,yG=us.SchemaContext,F_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(mG.validators)};Yt.prototype.customFormats={};Yt.prototype.schemas=null;Yt.prototype.types=null;Yt.prototype.attributes=null;Yt.prototype.unresolvedRefs=null;Yt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=hG(r||F_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Yt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=us.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Wf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Yt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Wf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ii=Yt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};bG.exports=Yt});var SG=v((GQe,yo)=>{"use strict";var L_e=yo.exports.Validator=vG();yo.exports.ValidatorResult=cs().ValidatorResult;yo.exports.ValidatorResultError=cs().ValidatorResultError;yo.exports.ValidationError=cs().ValidationError;yo.exports.SchemaError=cs().SchemaError;yo.exports.SchemaScanResult=W_().SchemaScanResult;yo.exports.scan=W_().scan;yo.exports.validate=function(t,e,r){var n=new L_e;return n.validate(t,e,r)}});import{readFileSync as z_e}from"node:fs";import{dirname as U_e,join as q_e}from"node:path";import{fileURLToPath as H_e}from"node:url";function W_e(t){let e=V_e.validate(t,Z_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function xG(t){let e=W_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Wf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Wf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Wf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",bl),r.join(` +`)}function Sl(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${O_e(l,r)} |`)}return n.join(` +`)}function O_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of T_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${k_e(E_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function wl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),nG(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)nG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function nG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=FO(r);n&&t.push(`- ${n}`)}t.push("")}var A_e,T_e,Z_=y(()=>{"use strict";Kf();G_();yl();A_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};T_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as R_e}from"node:fs";function Ri(t="./spec.yaml"){let e=R_e(t,"utf8");return(0,oG.parse)(e)}var oG,V_=y(()=>{"use strict";oG=wt(tr(),1)});var cs=v((Lr,oR)=>{"use strict";var rR=Lr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+aG(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};rR.prototype.toString=function(){return this.property+" "+this.message};var W_=Lr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};W_.prototype.addError=function(e){var r;if(typeof e=="string")r=new rR(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new rR(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Aa(this);if(this.throwError)throw r;return r};W_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function I_e(t,e){return e+": "+t.toString()+` +`}W_.prototype.toString=function(e){return this.errors.map(I_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});oR.exports.ValidatorResultError=Aa;function Aa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Aa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Aa.prototype=new Error;Aa.prototype.constructor=Aa;Aa.prototype.name="Validation Error";var sG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};sG.prototype=Object.create(Error.prototype,{constructor:{value:sG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var nR=Lr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+aG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};nR.prototype.resolve=function(e){return cG(this.base,e)};nR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=cG(this.base,i||"");var s=new nR(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ti=Lr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ti.regexp=ti.regex;ti.pattern=ti.regex;ti.ipv4=ti["ip-address"];Lr.isFormat=function(e,r,n){if(typeof e=="string"&&ti[r]!==void 0){if(ti[r]instanceof RegExp)return ti[r].test(e);if(typeof ti[r]=="function")return ti[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var aG=Lr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Lr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function P_e(t,e,r,n){typeof r=="object"?e[n]=iR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function C_e(t,e,r){e[r]=t[r]}function D_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=iR(t[n],e[n]):r[n]=e[n]}function iR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(P_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(C_e.bind(null,t,n)),Object.keys(e).forEach(D_e.bind(null,t,e,n))),n}oR.exports.deepMerge=iR;Lr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function N_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(N_e).join("")};Lr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Lr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var cG=Lr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var fG=v((qQe,dG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,sR={};sR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=sR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function aR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new ls("anyOf must be an array");if(!r.anyOf.some(aR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new ls("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new ls("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(aR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!sn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=aR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!sn.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!sn.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function cR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!sn.isSchema(s))throw new ls('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(cR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new ls('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=cR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function lG(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new ls('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&lG.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)lG.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!sn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function j_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var lR=cs();uR.exports.SchemaScanResult=pG;function pG(t,e){this.id=t,this.ref=e}uR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=lR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=lR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!lR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var mG=fG(),us=cs(),hG=K_().scan,gG=us.ValidatorResult,M_e=us.ValidatorResultError,Jf=us.SchemaError,yG=us.SchemaContext,F_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(mG.validators)};Yt.prototype.customFormats={};Yt.prototype.schemas=null;Yt.prototype.types=null;Yt.prototype.attributes=null;Yt.prototype.unresolvedRefs=null;Yt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=hG(r||F_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Yt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=us.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Jf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Yt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Jf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ii=Yt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};bG.exports=Yt});var SG=v((GQe,yo)=>{"use strict";var L_e=yo.exports.Validator=vG();yo.exports.ValidatorResult=cs().ValidatorResult;yo.exports.ValidatorResultError=cs().ValidatorResultError;yo.exports.ValidationError=cs().ValidationError;yo.exports.SchemaError=cs().SchemaError;yo.exports.SchemaScanResult=K_().SchemaScanResult;yo.exports.scan=K_().scan;yo.exports.validate=function(t,e,r){var n=new L_e;return n.validate(t,e,r)}});import{readFileSync as z_e}from"node:fs";import{dirname as U_e,join as q_e}from"node:path";import{fileURLToPath as H_e}from"node:url";function W_e(t){let e=V_e.validate(t,Z_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function xG(t){let e=W_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var wG,B_e,G_e,Z_e,V_e,$G=y(()=>{"use strict";wG=wt(SG(),1),B_e=U_e(H_e(import.meta.url)),G_e=q_e(B_e,"schema.json"),Z_e=JSON.parse(z_e(G_e,"utf8")),V_e=new wG.Validator});import{existsSync as dR,readdirSync as K_e}from"node:fs";import{dirname as J_e,join as Aa,resolve as EG}from"node:path";function kG(t){return dR(t)?K_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Ta(t,e){K_=e?{cwd:EG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return K_&&e==="spec.yaml"&&EG(t)===K_.cwd?K_.spec:Y_e(t,e)}function Y_e(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,J_e(e),"spec");if(!n.features||n.features.length===0){let o=kG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=kG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");dR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(dR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return xG(n),n}var K_,Ue=y(()=>{"use strict";Z_();$G();K_=null});import wl from"node:process";function mR(){return!!wl.stdout.isTTY}function L(t,e,r=""){let n=AG[t],i=r?` ${r}`:"";mR()?wl.stdout.write(`${fR[t]}${n}${pR} ${e}${i} -`):wl.stdout.write(`${n} ${e}${i} -`)}function Kf(t,e,r=""){if(!mR())return;let n=r?` ${r}`:"";wl.stdout.write(`${TG}${fR.start}\xB7${pR} ${t} \xB7 ${e}${n}`)}function Oa(t,e,r=""){let n=AG[t],i=r?` ${r}`:"";mR()?wl.stdout.write(`${TG}${fR[t]}${n}${pR} ${e}${i} -`):wl.stdout.write(`${n} ${e}${i} -`)}var AG,fR,pR,TG,Pi=y(()=>{"use strict";AG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},fR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},pR="\x1B[0m",TG="\r\x1B[K"});import{createHash as yR}from"node:crypto";import{existsSync as Nbe,readFileSync as _R,writeFileSync as jbe}from"node:fs";import{join as J_}from"node:path";function eZ(t){let e=yR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} -`)}),e.digest("hex")}function Mbe(t,e){let r=yR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(_R(J_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function tZ(t,e){let r=yR("sha256");try{r.update(_R(J_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=J_(t,...QG);if(!Nbe(e))return null;let r;try{r=_R(e,"utf8")}catch{return null}let n=null,i=null,o=null,s={},a="other";for(let l of r.split(` -`)){if(l==="policy:"){a="policy";continue}if(l==="attested:"){a="v1",n??=new Map;continue}if(l==="attested_modules:"){a="modules",i??=new Map;continue}if(l==="attested_features:"){a="features",o??=new Set;continue}if(!(l.startsWith("#")||l.trim()==="")){if(a==="policy"){let u=l.match(/^ {2}cladding: "([^"]+)"$/),d=l.match(/^ {2}blocking: (strict)$/),f=l.match(/^ {2}detectors_sha256: ([0-9a-f]{64})$/);u&&(s.cladding=u[1]),d&&(s.blocking=d[1]),f&&(s.detectorsSha256=f[1])}else if(a==="v1"){let u=l.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);u&&n.set(u[1],u[2])}else if(a==="modules"){let u=l.match(/^ {2}(.+): ([0-9a-f]{16})$/);u&&i.set(u[1],u[2])}else if(a==="features"){let u=l.match(/^ {2}(F-[\w-]+): ok$/);u&&o.add(u[1])}}}return{policy:s.cladding!==void 0&&s.blocking==="strict"&&s.detectorsSha256!==void 0?{cladding:s.cladding,blocking:s.blocking,detectorsSha256:s.detectorsSha256}:null,v1:n,modules:i,features:o}}function Y_(t){return t.features?.size??t.v1?.size??0}function X_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==tZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Mbe(e,n)?{state:"fresh"}:{state:"stale"}}function rZ(t,e,r){let n=(e.features??[]).filter(c=>c.status==="done"&&(c.modules??[]).length>0);if(n.length===0)return!1;let i=new Set;for(let c of n)for(let l of c.modules??[])i.add(l);let o=[...i].sort().map(c=>` ${c}: ${tZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Fbe+(r?`policy: + `)}`)}var wG,B_e,G_e,Z_e,V_e,$G=y(()=>{"use strict";wG=wt(SG(),1),B_e=U_e(H_e(import.meta.url)),G_e=q_e(B_e,"schema.json"),Z_e=JSON.parse(z_e(G_e,"utf8")),V_e=new wG.Validator});import{existsSync as dR,readdirSync as K_e}from"node:fs";import{dirname as J_e,join as Ta,resolve as EG}from"node:path";function kG(t){return dR(t)?K_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Ta(t,r))):[]}function Oa(t,e){J_=e?{cwd:EG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&EG(t)===J_.cwd?J_.spec:Y_e(t,e)}function Y_e(t,e){let r=Ta(t,e),n=Ri(r),i=Ta(t,J_e(e),"spec");if(!n.features||n.features.length===0){let o=kG(Ta(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=kG(Ta(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Ta(i,"architecture.yaml");dR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Ta(i,"capabilities.yaml");if(dR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return xG(n),n}var J_,Ue=y(()=>{"use strict";V_();$G();J_=null});import xl from"node:process";function mR(){return!!xl.stdout.isTTY}function L(t,e,r=""){let n=AG[t],i=r?` ${r}`:"";mR()?xl.stdout.write(`${fR[t]}${n}${pR} ${e}${i} +`):xl.stdout.write(`${n} ${e}${i} +`)}function Yf(t,e,r=""){if(!mR())return;let n=r?` ${r}`:"";xl.stdout.write(`${TG}${fR.start}\xB7${pR} ${t} \xB7 ${e}${n}`)}function Ra(t,e,r=""){let n=AG[t],i=r?` ${r}`:"";mR()?xl.stdout.write(`${TG}${fR[t]}${n}${pR} ${e}${i} +`):xl.stdout.write(`${n} ${e}${i} +`)}var AG,fR,pR,TG,Pi=y(()=>{"use strict";AG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},fR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},pR="\x1B[0m",TG="\r\x1B[K"});import{createHash as yR}from"node:crypto";import{existsSync as Nbe,readFileSync as _R,writeFileSync as jbe}from"node:fs";import{join as Y_}from"node:path";function eZ(t){let e=yR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} +`)}),e.digest("hex")}function Mbe(t,e){let r=yR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(_R(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function tZ(t,e){let r=yR("sha256");try{r.update(_R(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...QG);if(!Nbe(e))return null;let r;try{r=_R(e,"utf8")}catch{return null}let n=null,i=null,o=null,s={},a="other";for(let l of r.split(` +`)){if(l==="policy:"){a="policy";continue}if(l==="attested:"){a="v1",n??=new Map;continue}if(l==="attested_modules:"){a="modules",i??=new Map;continue}if(l==="attested_features:"){a="features",o??=new Set;continue}if(!(l.startsWith("#")||l.trim()==="")){if(a==="policy"){let u=l.match(/^ {2}cladding: "([^"]+)"$/),d=l.match(/^ {2}blocking: (strict)$/),f=l.match(/^ {2}detectors_sha256: ([0-9a-f]{64})$/);u&&(s.cladding=u[1]),d&&(s.blocking=d[1]),f&&(s.detectorsSha256=f[1])}else if(a==="v1"){let u=l.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);u&&n.set(u[1],u[2])}else if(a==="modules"){let u=l.match(/^ {2}(.+): ([0-9a-f]{16})$/);u&&i.set(u[1],u[2])}else if(a==="features"){let u=l.match(/^ {2}(F-[\w-]+): ok$/);u&&o.add(u[1])}}}return{policy:s.cladding!==void 0&&s.blocking==="strict"&&s.detectorsSha256!==void 0?{cladding:s.cladding,blocking:s.blocking,detectorsSha256:s.detectorsSha256}:null,v1:n,modules:i,features:o}}function X_(t){return t.features?.size??t.v1?.size??0}function Q_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==tZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Mbe(e,n)?{state:"fresh"}:{state:"stale"}}function rZ(t,e,r){let n=(e.features??[]).filter(c=>c.status==="done"&&(c.modules??[]).length>0);if(n.length===0)return!1;let i=new Set;for(let c of n)for(let l of c.modules??[])i.add(l);let o=[...i].sort().map(c=>` ${c}: ${tZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Fbe+(r?`policy: cladding: ${JSON.stringify(r.cladding)} blocking: ${r.blocking} detectors_sha256: ${r.detectorsSha256} @@ -202,7 +202,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus attested_features: `+s.join(` `)+` -`;return jbe(J_(t,...QG),a,"utf8"),!0}var QG,Fbe,$l=y(()=>{"use strict";QG=["spec","attestation.yaml"];Fbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return jbe(Y_(t,...QG),a,"utf8"),!0}var QG,Fbe,kl=y(()=>{"use strict";QG=["spec","attestation.yaml"];Fbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN # \`clad check --tier=pre-push --strict\` gate \u2014 the file's one honest author. # Do not edit by hand. # @@ -219,105 +219,105 @@ attested_features: # Merge conflict here? NEVER hand-resolve the hashes \u2014 keep either side and run # \`clad check --tier=pre-push --strict\`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. -`});import{resolve as bR}from"node:path";function Q_(t){fs={cwd:bR(t),results:new Map}}function nZ(t,e,r){!fs||fs.cwd!==bR(e)||fs.results.set(t,r)}function eb(t,e){return!fs||fs.cwd!==bR(e)?null:fs.results.get(t)??null}function tb(){fs=null}var fs,kl=y(()=>{"use strict";fs=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var bo=y(()=>{});import{fileURLToPath as Lbe}from"node:url";var El,zbe,vR,SR,Al=y(()=>{El=(t,e)=>{let r=SR(zbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},zbe=t=>vR(t)?t.toString():t,vR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,SR=t=>t instanceof URL?Lbe(t):t});var rb,wR=y(()=>{bo();Al();rb=(t,e=[],r={})=>{let n=El(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Ube}from"node:string_decoder";var iZ,oZ,qt,vo,qbe,sZ,Hbe,nb,aZ,Bbe,Yf,Gbe,xR,Zbe,an=y(()=>{({toString:iZ}=Object.prototype),oZ=t=>iZ.call(t)==="[object ArrayBuffer]",qt=t=>iZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),qbe=new TextEncoder,sZ=t=>qbe.encode(t),Hbe=new TextDecoder,nb=t=>Hbe.decode(t),aZ=(t,e)=>Bbe(t,e).join(""),Bbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Ube(e),n=t.map(o=>typeof o=="string"?sZ(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Yf=t=>t.length===1&&qt(t[0])?t[0]:xR(Gbe(t)),Gbe=t=>t.map(e=>typeof e=="string"?sZ(e):e),xR=t=>{let e=new Uint8Array(Zbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Zbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Vbe}from"node:child_process";var dZ,fZ,Wbe,Kbe,cZ,Jbe,lZ,uZ,Ybe,pZ=y(()=>{bo();an();dZ=t=>Array.isArray(t)&&Array.isArray(t.raw),fZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Wbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Wbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=Kbe(i,t.raw[n]),c=lZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>uZ(d)):[uZ(l)];return lZ(c,u,a)},Kbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=cZ.has(e[0]);for(let s=0,a=0;s{"use strict";fs=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var bo=y(()=>{});import{fileURLToPath as Lbe}from"node:url";var Al,zbe,vR,SR,Tl=y(()=>{Al=(t,e)=>{let r=SR(zbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},zbe=t=>vR(t)?t.toString():t,vR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,SR=t=>t instanceof URL?Lbe(t):t});var nb,wR=y(()=>{bo();Tl();nb=(t,e=[],r={})=>{let n=Al(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Ube}from"node:string_decoder";var iZ,oZ,qt,vo,qbe,sZ,Hbe,ib,aZ,Bbe,Qf,Gbe,xR,Zbe,an=y(()=>{({toString:iZ}=Object.prototype),oZ=t=>iZ.call(t)==="[object ArrayBuffer]",qt=t=>iZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),qbe=new TextEncoder,sZ=t=>qbe.encode(t),Hbe=new TextDecoder,ib=t=>Hbe.decode(t),aZ=(t,e)=>Bbe(t,e).join(""),Bbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Ube(e),n=t.map(o=>typeof o=="string"?sZ(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Qf=t=>t.length===1&&qt(t[0])?t[0]:xR(Gbe(t)),Gbe=t=>t.map(e=>typeof e=="string"?sZ(e):e),xR=t=>{let e=new Uint8Array(Zbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Zbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Vbe}from"node:child_process";var dZ,fZ,Wbe,Kbe,cZ,Jbe,lZ,uZ,Ybe,pZ=y(()=>{bo();an();dZ=t=>Array.isArray(t)&&Array.isArray(t.raw),fZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Wbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Wbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=Kbe(i,t.raw[n]),c=lZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>uZ(d)):[uZ(l)];return lZ(c,u,a)},Kbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=cZ.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],uZ=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return Ybe(t);throw t instanceof Vbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Ybe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return nb(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import $R from"node:process";var ri,ib,Cn,ob,So=y(()=>{ri=t=>ib.includes(t),ib=[$R.stdin,$R.stdout,$R.stderr],Cn=["stdin","stdout","stderr"],ob=t=>Cn[t]??`stdio[${t}]`});import{debuglog as Xbe}from"node:util";var hZ,kR,Qbe,eve,tve,rve,mZ,nve,ER,ive,ove,sve,ave,AR,wo,xo=y(()=>{bo();So();hZ=t=>{let e={...t};for(let r of AR)e[r]=kR(t,r);return e},kR=(t,e)=>{let r=Array.from({length:Qbe(t)+1}),n=eve(t[e],r,e);return ove(n,e)},Qbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Cn.length):Cn.length,eve=(t,e,r)=>Ot(t)?tve(t,e,r):e.fill(t),tve=(t,e,r)=>{for(let n of Object.keys(t).sort(rve))for(let i of nve(n,r,e))e[i]=t[n];return e},rve=(t,e)=>mZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,nve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=ER(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`]),Jbe={x:3,u:5},lZ=(t,e,r)=>r||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],uZ=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return Ybe(t);throw t instanceof Vbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Ybe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return ib(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import $R from"node:process";var ri,ob,Cn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[$R.stdin,$R.stdout,$R.stderr],Cn=["stdin","stdout","stderr"],sb=t=>Cn[t]??`stdio[${t}]`});import{debuglog as Xbe}from"node:util";var hZ,kR,Qbe,eve,tve,rve,mZ,nve,ER,ive,ove,sve,ave,AR,wo,xo=y(()=>{bo();So();hZ=t=>{let e={...t};for(let r of AR)e[r]=kR(t,r);return e},kR=(t,e)=>{let r=Array.from({length:Qbe(t)+1}),n=eve(t[e],r,e);return ove(n,e)},Qbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Cn.length):Cn.length,eve=(t,e,r)=>Ot(t)?tve(t,e,r):e.fill(t),tve=(t,e,r)=>{for(let n of Object.keys(t).sort(rve))for(let i of nve(n,r,e))e[i]=t[n];return e},rve=(t,e)=>mZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,nve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=ER(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},ER=t=>{if(t==="all")return t;if(Cn.includes(t))return Cn.indexOf(t);let e=ive.exec(t);if(e!==null)return Number(e[1])},ive=/^fd(\d+)$/,ove=(t,e)=>t.map(r=>r===void 0?ave[e]:r),sve=Xbe("execa").enabled?"full":"none",ave={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:sve,stripFinalNewline:!0},AR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Tl,Ol,gZ,TR,cve,sb,ab,ps=y(()=>{xo();Tl=({verbose:t},e)=>TR(t,e)!=="none",Ol=({verbose:t},e)=>!["none","short"].includes(TR(t,e)),gZ=({verbose:t},e)=>{let r=TR(t,e);return sb(r)?r:void 0},TR=(t,e)=>e===void 0?cve(t):wo(t,e),cve=t=>t.find(e=>sb(e))??ab.findLast(e=>t.includes(e)),sb=t=>typeof t=="function",ab=["none","short","full"]});import{platform as lve}from"node:process";import{stripVTControlCharacters as uve}from"node:util";var yZ,Xf,_Z,dve,fve,pve,mve,hve,gve,yve,cb=y(()=>{yZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>gve(_Z(o))).join(" ");return{command:n,escapedCommand:i}},Xf=t=>uve(t).split(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},ER=t=>{if(t==="all")return t;if(Cn.includes(t))return Cn.indexOf(t);let e=ive.exec(t);if(e!==null)return Number(e[1])},ive=/^fd(\d+)$/,ove=(t,e)=>t.map(r=>r===void 0?ave[e]:r),sve=Xbe("execa").enabled?"full":"none",ave={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:sve,stripFinalNewline:!0},AR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Ol,Rl,gZ,TR,cve,ab,cb,ps=y(()=>{xo();Ol=({verbose:t},e)=>TR(t,e)!=="none",Rl=({verbose:t},e)=>!["none","short"].includes(TR(t,e)),gZ=({verbose:t},e)=>{let r=TR(t,e);return ab(r)?r:void 0},TR=(t,e)=>e===void 0?cve(t):wo(t,e),cve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as lve}from"node:process";import{stripVTControlCharacters as uve}from"node:util";var yZ,ep,_Z,dve,fve,pve,mve,hve,gve,yve,lb=y(()=>{yZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>gve(_Z(o))).join(" ");return{command:n,escapedCommand:i}},ep=t=>uve(t).split(` `).map(e=>_Z(e)).join(` -`),_Z=t=>t.replaceAll(pve,e=>dve(e)),dve=t=>{let e=mve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=hve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},fve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},pve=fve(),mve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},hve=65535,gve=t=>yve.test(t)?t:lve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,yve=/^[\w./-]+$/});import bZ from"node:process";function OR(){let{env:t}=bZ,{TERM:e,TERM_PROGRAM:r}=t;return bZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vZ=y(()=>{});var SZ,wZ,_ve,bve,vve,Sve,wve,lb,ett,xZ=y(()=>{vZ();SZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},wZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},_ve={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},bve={...SZ,...wZ},vve={...SZ,..._ve},Sve=OR(),wve=Sve?bve:vve,lb=wve,ett=Object.entries(wZ)});import xve from"node:tty";var $ve,ve,ntt,$Z,itt,ott,stt,att,ctt,ltt,utt,dtt,ftt,ptt,mtt,htt,gtt,ytt,_tt,ub,btt,vtt,Stt,wtt,xtt,$tt,ktt,Ett,Att,kZ,Ttt,EZ,Ott,Rtt,Itt,Ptt,Ctt,Dtt,Ntt,jtt,Mtt,Ftt,Ltt,RR=y(()=>{$ve=xve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!$ve)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},ntt=ve(0,0),$Z=ve(1,22),itt=ve(2,22),ott=ve(3,23),stt=ve(4,24),att=ve(53,55),ctt=ve(7,27),ltt=ve(8,28),utt=ve(9,29),dtt=ve(30,39),ftt=ve(31,39),ptt=ve(32,39),mtt=ve(33,39),htt=ve(34,39),gtt=ve(35,39),ytt=ve(36,39),_tt=ve(37,39),ub=ve(90,39),btt=ve(40,49),vtt=ve(41,49),Stt=ve(42,49),wtt=ve(43,49),xtt=ve(44,49),$tt=ve(45,49),ktt=ve(46,49),Ett=ve(47,49),Att=ve(100,49),kZ=ve(91,39),Ttt=ve(92,39),EZ=ve(93,39),Ott=ve(94,39),Rtt=ve(95,39),Itt=ve(96,39),Ptt=ve(97,39),Ctt=ve(101,49),Dtt=ve(102,49),Ntt=ve(103,49),jtt=ve(104,49),Mtt=ve(105,49),Ftt=ve(106,49),Ltt=ve(107,49)});var AZ=y(()=>{RR();RR()});var RZ,Eve,db,TZ,Ave,OZ,Tve,IZ=y(()=>{xZ();AZ();RZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Eve(r),c=Ave[t]({failed:o,reject:s,piped:n}),l=Tve[t]({reject:s});return`${ub(`[${a}]`)} ${ub(`[${i}]`)} ${l(c)} ${l(e)}`},Eve=t=>`${db(t.getHours(),2)}:${db(t.getMinutes(),2)}:${db(t.getSeconds(),2)}.${db(t.getMilliseconds(),3)}`,db=(t,e)=>String(t).padStart(e,"0"),TZ=({failed:t,reject:e})=>t?e?lb.cross:lb.warning:lb.tick,Ave={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:TZ,duration:TZ},OZ=t=>t,Tve={command:()=>$Z,output:()=>OZ,ipc:()=>OZ,error:({reject:t})=>t?kZ:EZ,duration:()=>ub}});var PZ,Ove,Rve,CZ=y(()=>{ps();PZ=(t,e,r)=>{let n=gZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Ove(i,o,n)).filter(i=>i!==void 0).map(i=>Rve(i)).join("")},Ove=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Rve=t=>t.endsWith(` +`),_Z=t=>t.replaceAll(pve,e=>dve(e)),dve=t=>{let e=mve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=hve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},fve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},pve=fve(),mve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},hve=65535,gve=t=>yve.test(t)?t:lve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,yve=/^[\w./-]+$/});import bZ from"node:process";function OR(){let{env:t}=bZ,{TERM:e,TERM_PROGRAM:r}=t;return bZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vZ=y(()=>{});var SZ,wZ,_ve,bve,vve,Sve,wve,ub,ett,xZ=y(()=>{vZ();SZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},wZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},_ve={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},bve={...SZ,...wZ},vve={...SZ,..._ve},Sve=OR(),wve=Sve?bve:vve,ub=wve,ett=Object.entries(wZ)});import xve from"node:tty";var $ve,ve,ntt,$Z,itt,ott,stt,att,ctt,ltt,utt,dtt,ftt,ptt,mtt,htt,gtt,ytt,_tt,db,btt,vtt,Stt,wtt,xtt,$tt,ktt,Ett,Att,kZ,Ttt,EZ,Ott,Rtt,Itt,Ptt,Ctt,Dtt,Ntt,jtt,Mtt,Ftt,Ltt,RR=y(()=>{$ve=xve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!$ve)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},ntt=ve(0,0),$Z=ve(1,22),itt=ve(2,22),ott=ve(3,23),stt=ve(4,24),att=ve(53,55),ctt=ve(7,27),ltt=ve(8,28),utt=ve(9,29),dtt=ve(30,39),ftt=ve(31,39),ptt=ve(32,39),mtt=ve(33,39),htt=ve(34,39),gtt=ve(35,39),ytt=ve(36,39),_tt=ve(37,39),db=ve(90,39),btt=ve(40,49),vtt=ve(41,49),Stt=ve(42,49),wtt=ve(43,49),xtt=ve(44,49),$tt=ve(45,49),ktt=ve(46,49),Ett=ve(47,49),Att=ve(100,49),kZ=ve(91,39),Ttt=ve(92,39),EZ=ve(93,39),Ott=ve(94,39),Rtt=ve(95,39),Itt=ve(96,39),Ptt=ve(97,39),Ctt=ve(101,49),Dtt=ve(102,49),Ntt=ve(103,49),jtt=ve(104,49),Mtt=ve(105,49),Ftt=ve(106,49),Ltt=ve(107,49)});var AZ=y(()=>{RR();RR()});var RZ,Eve,fb,TZ,Ave,OZ,Tve,IZ=y(()=>{xZ();AZ();RZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Eve(r),c=Ave[t]({failed:o,reject:s,piped:n}),l=Tve[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},Eve=t=>`${fb(t.getHours(),2)}:${fb(t.getMinutes(),2)}:${fb(t.getSeconds(),2)}.${fb(t.getMilliseconds(),3)}`,fb=(t,e)=>String(t).padStart(e,"0"),TZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Ave={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:TZ,duration:TZ},OZ=t=>t,Tve={command:()=>$Z,output:()=>OZ,ipc:()=>OZ,error:({reject:t})=>t?kZ:EZ,duration:()=>db}});var PZ,Ove,Rve,CZ=y(()=>{ps();PZ=(t,e,r)=>{let n=gZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Ove(i,o,n)).filter(i=>i!==void 0).map(i=>Rve(i)).join("")},Ove=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Rve=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Ive}from"node:util";var Ci,Pve,Cve,Dve,fb,Nve,Rl=y(()=>{cb();IZ();CZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Pve({type:t,result:i,verboseInfo:n}),s=Cve(e,o),a=PZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Pve=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),Cve=(t,e)=>t.split(` -`).map(r=>Dve({...e,message:r})),Dve=t=>({verboseLine:RZ(t),verboseObject:t}),fb=t=>{let e=typeof t=="string"?t:Ive(t);return Xf(e).replaceAll(" "," ".repeat(Nve))},Nve=2});var DZ,NZ=y(()=>{ps();Rl();DZ=(t,e)=>{Tl(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var jZ,jve,Mve,Fve,MZ=y(()=>{ps();jZ=(t,e,r)=>{Fve(t);let n=jve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},jve=t=>Tl({verbose:t})?Mve++:void 0,Mve=0n,Fve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!ab.includes(e)&&!sb(e)){let r=ab.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as FZ}from"node:process";var pb,IR,mb=y(()=>{pb=()=>FZ.bigint(),IR=t=>Number(FZ.bigint()-t)/1e6});var hb,PR=y(()=>{NZ();MZ();mb();cb();xo();hb=(t,e,r)=>{let n=pb(),{command:i,escapedCommand:o}=yZ(t,e),s=kR(r,"verbose"),a=jZ(s,o,{...r});return DZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var HZ=v((drt,qZ)=>{qZ.exports=UZ;UZ.sync=zve;var LZ=Ge("fs");function Lve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{VZ.exports=GZ;GZ.sync=Uve;var BZ=Ge("fs");function GZ(t,e,r){BZ.stat(t,function(n,i){r(n,n?!1:ZZ(i,e))})}function Uve(t,e){return ZZ(BZ.statSync(t),e)}function ZZ(t,e){return t.isFile()&&qve(t,e)}function qve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var JZ=v((mrt,KZ)=>{var prt=Ge("fs"),gb;process.platform==="win32"||global.TESTING_WINDOWS?gb=HZ():gb=WZ();KZ.exports=CR;CR.sync=Hve;function CR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){CR(t,e||{},function(o,s){o?i(o):n(s)})})}gb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Hve(t,e){try{return gb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var nV=v((hrt,rV)=>{var Il=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",YZ=Ge("path"),Bve=Il?";":":",XZ=JZ(),QZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),eV=(t,e)=>{let r=e.colon||Bve,n=t.match(/\//)||Il&&t.match(/\\/)?[""]:[...Il?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Il?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Il?i.split(r):[""];return Il&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},tV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=eV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(QZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=YZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];XZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},Gve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=eV(t,e),o=[];for(let s=0;s{"use strict";var iV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};DR.exports=iV;DR.exports.default=iV});var lV=v((yrt,cV)=>{"use strict";var sV=Ge("path"),Zve=nV(),Vve=oV();function aV(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Zve.sync(t.command,{path:r[Vve({env:r})],pathExt:e?sV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=sV.resolve(i?t.options.cwd:"",s)),s}function Wve(t){return aV(t)||aV(t,!0)}cV.exports=Wve});var uV=v((_rt,jR)=>{"use strict";var NR=/([()\][%!^"`<>&|;, *?])/g;function Kve(t){return t=t.replace(NR,"^$1"),t}function Jve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(NR,"^$1"),e&&(t=t.replace(NR,"^$1")),t}jR.exports.command=Kve;jR.exports.argument=Jve});var fV=v((brt,dV)=>{"use strict";dV.exports=/^#!(.*)/});var mV=v((vrt,pV)=>{"use strict";var Yve=fV();pV.exports=(t="")=>{let e=t.match(Yve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var gV=v((Srt,hV)=>{"use strict";var MR=Ge("fs"),Xve=mV();function Qve(t){let r=Buffer.alloc(150),n;try{n=MR.openSync(t,"r"),MR.readSync(n,r,0,150,0),MR.closeSync(n)}catch{}return Xve(r.toString())}hV.exports=Qve});var vV=v((wrt,bV)=>{"use strict";var eSe=Ge("path"),yV=lV(),_V=uV(),tSe=gV(),rSe=process.platform==="win32",nSe=/\.(?:com|exe)$/i,iSe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function oSe(t){t.file=yV(t);let e=t.file&&tSe(t.file);return e?(t.args.unshift(t.file),t.command=e,yV(t)):t.file}function sSe(t){if(!rSe)return t;let e=oSe(t),r=!nSe.test(e);if(t.options.forceShell||r){let n=iSe.test(e);t.command=eSe.normalize(t.command),t.command=_V.command(t.command),t.args=t.args.map(o=>_V.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function aSe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:sSe(n)}bV.exports=aSe});var xV=v((xrt,wV)=>{"use strict";var FR=process.platform==="win32";function LR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function cSe(t,e){if(!FR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=SV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function SV(t,e){return FR&&t===1&&!e.file?LR(e.original,"spawn"):null}function lSe(t,e){return FR&&t===1&&!e.file?LR(e.original,"spawnSync"):null}wV.exports={hookChildProcess:cSe,verifyENOENT:SV,verifyENOENTSync:lSe,notFoundError:LR}});var EV=v(($rt,Pl)=>{"use strict";var $V=Ge("child_process"),zR=vV(),UR=xV();function kV(t,e,r){let n=zR(t,e,r),i=$V.spawn(n.command,n.args,n.options);return UR.hookChildProcess(i,n),i}function uSe(t,e,r){let n=zR(t,e,r),i=$V.spawnSync(n.command,n.args,n.options);return i.error=i.error||UR.verifyENOENTSync(i.status,n),i}Pl.exports=kV;Pl.exports.spawn=kV;Pl.exports.sync=uSe;Pl.exports._parse=zR;Pl.exports._enoent=UR});function yb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var AV=y(()=>{});var TV=y(()=>{});import{promisify as dSe}from"node:util";import{execFile as fSe,execFileSync as Ort}from"node:child_process";import OV from"node:path";import{fileURLToPath as pSe}from"node:url";function _b(t){return t instanceof URL?pSe(t):t}function RV(t){return{*[Symbol.iterator](){let e=OV.resolve(_b(t)),r;for(;r!==e;)yield e,r=e,e=OV.resolve(e,"..")}}}var Prt,Crt,IV=y(()=>{TV();Prt=dSe(fSe);Crt=10*1024*1024});import bb from"node:process";import Ca from"node:path";var mSe,hSe,gSe,PV,CV=y(()=>{AV();IV();mSe=({cwd:t=bb.cwd(),path:e=bb.env[yb()],preferLocal:r=!0,execPath:n=bb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(_b(t)),s=[],a=e.split(Ca.delimiter);return r&&hSe(s,a,o),i&&gSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},hSe=(t,e,r)=>{for(let n of RV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},gSe=(t,e,r,n)=>{let i=Ca.resolve(n,_b(r),"..");e.includes(i)||t.push(i)},PV=({env:t=bb.env,...e}={})=>{t={...t};let r=yb({env:t});return e.path=t[r],t[r]=mSe(e),t}});var DV,ni,NV,jV,MV,vb,Qf,ep,Da=y(()=>{DV=(t,e,r)=>{let n=r?ep:Qf,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},NV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,MV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},jV=t=>vb(t)&&MV in t,MV=Symbol("isExecaError"),vb=t=>Object.prototype.toString.call(t)==="[object Error]",Qf=class extends Error{};NV(Qf,Qf.name);ep=class extends Error{};NV(ep,ep.name)});var FV,ySe,LV,zV,UV=y(()=>{FV=()=>{let t=zV-LV+1;return Array.from({length:t},ySe)},ySe=(t,e)=>({name:`SIGRT${e+1}`,number:LV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),LV=34,zV=64});var qV,HV=y(()=>{qV=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as _Se}from"node:os";var qR,bSe,BV=y(()=>{HV();UV();qR=()=>{let t=FV();return[...qV,...t].map(bSe)},bSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=_Se,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as vSe}from"node:os";var SSe,wSe,GV,xSe,$Se,kSe,Jrt,ZV=y(()=>{BV();SSe=()=>{let t=qR();return Object.fromEntries(t.map(wSe))},wSe=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],GV=SSe(),xSe=()=>{let t=qR(),e=65,r=Array.from({length:e},(n,i)=>$Se(i,t));return Object.assign({},...r)},$Se=(t,e)=>{let r=kSe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},kSe=(t,e)=>{let r=e.find(({name:n})=>vSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Jrt=xSe()});import{constants as tp}from"node:os";var WV,KV,JV,ESe,ASe,VV,TSe,HR,OSe,RSe,Sb,rp=y(()=>{ZV();WV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return JV(t,e)},KV=t=>t===0?t:JV(t,"`subprocess.kill()`'s argument"),JV=(t,e)=>{if(Number.isInteger(t))return ESe(t,e);if(typeof t=="string")return TSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +`});import{inspect as Ive}from"node:util";var Ci,Pve,Cve,Dve,pb,Nve,Il=y(()=>{lb();IZ();CZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Pve({type:t,result:i,verboseInfo:n}),s=Cve(e,o),a=PZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Pve=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),Cve=(t,e)=>t.split(` +`).map(r=>Dve({...e,message:r})),Dve=t=>({verboseLine:RZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Ive(t);return ep(e).replaceAll(" "," ".repeat(Nve))},Nve=2});var DZ,NZ=y(()=>{ps();Il();DZ=(t,e)=>{Ol(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var jZ,jve,Mve,Fve,MZ=y(()=>{ps();jZ=(t,e,r)=>{Fve(t);let n=jve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},jve=t=>Ol({verbose:t})?Mve++:void 0,Mve=0n,Fve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!cb.includes(e)&&!ab(e)){let r=cb.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as FZ}from"node:process";var mb,IR,hb=y(()=>{mb=()=>FZ.bigint(),IR=t=>Number(FZ.bigint()-t)/1e6});var gb,PR=y(()=>{NZ();MZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=yZ(t,e),s=kR(r,"verbose"),a=jZ(s,o,{...r});return DZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var HZ=v((drt,qZ)=>{qZ.exports=UZ;UZ.sync=zve;var LZ=Ge("fs");function Lve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{VZ.exports=GZ;GZ.sync=Uve;var BZ=Ge("fs");function GZ(t,e,r){BZ.stat(t,function(n,i){r(n,n?!1:ZZ(i,e))})}function Uve(t,e){return ZZ(BZ.statSync(t),e)}function ZZ(t,e){return t.isFile()&&qve(t,e)}function qve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var JZ=v((mrt,KZ)=>{var prt=Ge("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=HZ():yb=WZ();KZ.exports=CR;CR.sync=Hve;function CR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){CR(t,e||{},function(o,s){o?i(o):n(s)})})}yb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Hve(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var nV=v((hrt,rV)=>{var Pl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",YZ=Ge("path"),Bve=Pl?";":":",XZ=JZ(),QZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),eV=(t,e)=>{let r=e.colon||Bve,n=t.match(/\//)||Pl&&t.match(/\\/)?[""]:[...Pl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Pl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Pl?i.split(r):[""];return Pl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},tV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=eV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(QZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=YZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];XZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},Gve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=eV(t,e),o=[];for(let s=0;s{"use strict";var iV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};DR.exports=iV;DR.exports.default=iV});var lV=v((yrt,cV)=>{"use strict";var sV=Ge("path"),Zve=nV(),Vve=oV();function aV(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Zve.sync(t.command,{path:r[Vve({env:r})],pathExt:e?sV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=sV.resolve(i?t.options.cwd:"",s)),s}function Wve(t){return aV(t)||aV(t,!0)}cV.exports=Wve});var uV=v((_rt,jR)=>{"use strict";var NR=/([()\][%!^"`<>&|;, *?])/g;function Kve(t){return t=t.replace(NR,"^$1"),t}function Jve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(NR,"^$1"),e&&(t=t.replace(NR,"^$1")),t}jR.exports.command=Kve;jR.exports.argument=Jve});var fV=v((brt,dV)=>{"use strict";dV.exports=/^#!(.*)/});var mV=v((vrt,pV)=>{"use strict";var Yve=fV();pV.exports=(t="")=>{let e=t.match(Yve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var gV=v((Srt,hV)=>{"use strict";var MR=Ge("fs"),Xve=mV();function Qve(t){let r=Buffer.alloc(150),n;try{n=MR.openSync(t,"r"),MR.readSync(n,r,0,150,0),MR.closeSync(n)}catch{}return Xve(r.toString())}hV.exports=Qve});var vV=v((wrt,bV)=>{"use strict";var eSe=Ge("path"),yV=lV(),_V=uV(),tSe=gV(),rSe=process.platform==="win32",nSe=/\.(?:com|exe)$/i,iSe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function oSe(t){t.file=yV(t);let e=t.file&&tSe(t.file);return e?(t.args.unshift(t.file),t.command=e,yV(t)):t.file}function sSe(t){if(!rSe)return t;let e=oSe(t),r=!nSe.test(e);if(t.options.forceShell||r){let n=iSe.test(e);t.command=eSe.normalize(t.command),t.command=_V.command(t.command),t.args=t.args.map(o=>_V.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function aSe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:sSe(n)}bV.exports=aSe});var xV=v((xrt,wV)=>{"use strict";var FR=process.platform==="win32";function LR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function cSe(t,e){if(!FR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=SV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function SV(t,e){return FR&&t===1&&!e.file?LR(e.original,"spawn"):null}function lSe(t,e){return FR&&t===1&&!e.file?LR(e.original,"spawnSync"):null}wV.exports={hookChildProcess:cSe,verifyENOENT:SV,verifyENOENTSync:lSe,notFoundError:LR}});var EV=v(($rt,Cl)=>{"use strict";var $V=Ge("child_process"),zR=vV(),UR=xV();function kV(t,e,r){let n=zR(t,e,r),i=$V.spawn(n.command,n.args,n.options);return UR.hookChildProcess(i,n),i}function uSe(t,e,r){let n=zR(t,e,r),i=$V.spawnSync(n.command,n.args,n.options);return i.error=i.error||UR.verifyENOENTSync(i.status,n),i}Cl.exports=kV;Cl.exports.spawn=kV;Cl.exports.sync=uSe;Cl.exports._parse=zR;Cl.exports._enoent=UR});function _b(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var AV=y(()=>{});var TV=y(()=>{});import{promisify as dSe}from"node:util";import{execFile as fSe,execFileSync as Ort}from"node:child_process";import OV from"node:path";import{fileURLToPath as pSe}from"node:url";function bb(t){return t instanceof URL?pSe(t):t}function RV(t){return{*[Symbol.iterator](){let e=OV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=OV.resolve(e,"..")}}}var Prt,Crt,IV=y(()=>{TV();Prt=dSe(fSe);Crt=10*1024*1024});import vb from"node:process";import Da from"node:path";var mSe,hSe,gSe,PV,CV=y(()=>{AV();IV();mSe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Da.resolve(bb(t)),s=[],a=e.split(Da.delimiter);return r&&hSe(s,a,o),i&&gSe(s,a,n,o),e===""||e===Da.delimiter?`${s.join(Da.delimiter)}${e}`:[...s,e].join(Da.delimiter)},hSe=(t,e,r)=>{for(let n of RV(r)){let i=Da.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},gSe=(t,e,r,n)=>{let i=Da.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},PV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=mSe(e),t}});var DV,ni,NV,jV,MV,Sb,tp,rp,Na=y(()=>{DV=(t,e,r)=>{let n=r?rp:tp,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},NV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,MV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},jV=t=>Sb(t)&&MV in t,MV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",tp=class extends Error{};NV(tp,tp.name);rp=class extends Error{};NV(rp,rp.name)});var FV,ySe,LV,zV,UV=y(()=>{FV=()=>{let t=zV-LV+1;return Array.from({length:t},ySe)},ySe=(t,e)=>({name:`SIGRT${e+1}`,number:LV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),LV=34,zV=64});var qV,HV=y(()=>{qV=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as _Se}from"node:os";var qR,bSe,BV=y(()=>{HV();UV();qR=()=>{let t=FV();return[...qV,...t].map(bSe)},bSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=_Se,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as vSe}from"node:os";var SSe,wSe,GV,xSe,$Se,kSe,Jrt,ZV=y(()=>{BV();SSe=()=>{let t=qR();return Object.fromEntries(t.map(wSe))},wSe=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],GV=SSe(),xSe=()=>{let t=qR(),e=65,r=Array.from({length:e},(n,i)=>$Se(i,t));return Object.assign({},...r)},$Se=(t,e)=>{let r=kSe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},kSe=(t,e)=>{let r=e.find(({name:n})=>vSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Jrt=xSe()});import{constants as np}from"node:os";var WV,KV,JV,ESe,ASe,VV,TSe,HR,OSe,RSe,wb,ip=y(()=>{ZV();WV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return JV(t,e)},KV=t=>t===0?t:JV(t,"`subprocess.kill()`'s argument"),JV=(t,e)=>{if(Number.isInteger(t))return ESe(t,e);if(typeof t=="string")return TSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. ${HR()}`)},ESe=(t,e)=>{if(VV.has(t))return VV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${HR()}`)},ASe=()=>new Map(Object.entries(tp.signals).reverse().map(([t,e])=>[e,t])),VV=ASe(),TSe=(t,e)=>{if(t in tp.signals)return t;throw t.toUpperCase()in tp.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${HR()}`)},ASe=()=>new Map(Object.entries(np.signals).reverse().map(([t,e])=>[e,t])),VV=ASe(),TSe=(t,e)=>{if(t in np.signals)return t;throw t.toUpperCase()in np.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. ${HR()}`)},HR=()=>`Available signal names: ${OSe()}. -Available signal numbers: ${RSe()}.`,OSe=()=>Object.keys(tp.signals).sort().map(t=>`'${t}'`).join(", "),RSe=()=>[...new Set(Object.values(tp.signals).sort((t,e)=>t-e))].join(", "),Sb=t=>GV[t].description});import{setTimeout as ISe}from"node:timers/promises";var YV,PSe,XV,CSe,DSe,NSe,BR,wb=y(()=>{Da();rp();YV=t=>{if(t===!1)return t;if(t===!0)return PSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},PSe=1e3*5,XV=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=CSe(s,a,r);DSe(l,n);let u=t(c);return NSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},CSe=(t,e,r)=>{let[n=r,i]=vb(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!vb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:KV(n),error:i}},DSe=(t,e)=>{t!==void 0&&e.reject(t)},NSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&BR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},BR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await ISe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as jSe}from"node:events";var xb,GR=y(()=>{xb=async(t,e)=>{t.aborted||await jSe(t,"abort",{signal:e})}});var QV,e9,MSe,ZR=y(()=>{GR();QV=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},e9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[MSe(t,e,n,i)],MSe=async(t,e,r,{signal:n})=>{throw await xb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Cl,FSe,VR,t9,r9,$b,n9,i9,o9,s9,a9,c9,LSe,zSe,USe,ii,qSe,ms,Dl,Nl=y(()=>{Cl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{FSe(t,e,r),VR(t,e,n)},FSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},VR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},t9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},r9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is sending a message too, instead of listening to incoming messages. +Available signal numbers: ${RSe()}.`,OSe=()=>Object.keys(np.signals).sort().map(t=>`'${t}'`).join(", "),RSe=()=>[...new Set(Object.values(np.signals).sort((t,e)=>t-e))].join(", "),wb=t=>GV[t].description});import{setTimeout as ISe}from"node:timers/promises";var YV,PSe,XV,CSe,DSe,NSe,BR,xb=y(()=>{Na();ip();YV=t=>{if(t===!1)return t;if(t===!0)return PSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},PSe=1e3*5,XV=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=CSe(s,a,r);DSe(l,n);let u=t(c);return NSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},CSe=(t,e,r)=>{let[n=r,i]=Sb(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!Sb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:KV(n),error:i}},DSe=(t,e)=>{t!==void 0&&e.reject(t)},NSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&BR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},BR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await ISe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as jSe}from"node:events";var $b,GR=y(()=>{$b=async(t,e)=>{t.aborted||await jSe(t,"abort",{signal:e})}});var QV,e9,MSe,ZR=y(()=>{GR();QV=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},e9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[MSe(t,e,n,i)],MSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Dl,FSe,VR,t9,r9,kb,n9,i9,o9,s9,a9,c9,LSe,zSe,USe,ii,qSe,ms,Nl,jl=y(()=>{Dl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{FSe(t,e,r),VR(t,e,n)},FSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},VR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},t9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},r9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ ${ii("getOneMessage",t)}, ${ii("sendMessage",t,"message, {strict: true}")}, -]);`)},$b=(t,e)=>new Error(`${ii("sendMessage",e)} failed when sending an acknowledgment response to the ${ms(e)}.`,{cause:t}),n9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},i9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},o9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),s9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},a9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ii(e,r)} cannot be used: the ${ms(r)} is disconnecting.`,{cause:t})},c9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(LSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},LSe=({code:t,message:e})=>zSe.has(t)||USe.some(r=>e.includes(r)),zSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),USe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${qSe(e)}${t}(${r})`,qSe=t=>t?"":"subprocess.",ms=t=>t?"parent process":"subprocess",Dl=t=>{t.connected&&t.disconnect()}});var Di,jl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Eb,Ml,Ni,l9,HSe,BSe,u9,GSe,d9,np,kb,hs=y(()=>{xo();Eb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=l9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(u9(o,e,n,!0));return s},Ml=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=l9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(u9(o,e,n,!1));return s},Ni=new WeakMap,l9=(t,e,r)=>{let n=HSe(e,r);return BSe(n,e,r,t),n},HSe=(t,e)=>{let r=ER(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${np(e)}" must not be "${t}". +]);`)},kb=(t,e)=>new Error(`${ii("sendMessage",e)} failed when sending an acknowledgment response to the ${ms(e)}.`,{cause:t}),n9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},i9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},o9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),s9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},a9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ii(e,r)} cannot be used: the ${ms(r)} is disconnecting.`,{cause:t})},c9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(LSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},LSe=({code:t,message:e})=>zSe.has(t)||USe.some(r=>e.includes(r)),zSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),USe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${qSe(e)}${t}(${r})`,qSe=t=>t?"":"subprocess.",ms=t=>t?"parent process":"subprocess",Nl=t=>{t.connected&&t.disconnect()}});var Di,Ml=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Ab,Fl,Ni,l9,HSe,BSe,u9,GSe,d9,op,Eb,hs=y(()=>{xo();Ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=l9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(u9(o,e,n,!0));return s},Fl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=l9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(u9(o,e,n,!1));return s},Ni=new WeakMap,l9=(t,e,r)=>{let n=HSe(e,r);return BSe(n,e,r,t),n},HSe=(t,e)=>{let r=ER(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${op(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},BSe=(t,e,r,n)=>{let i=n[d9(t)];if(i===void 0)throw new TypeError(`"${np(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${np(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${np(r)}" must not be ${e}. It must be a writable stream, not readable.`)},u9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=GSe(t,r);return`The "${i}: ${kb(o)}" option is incompatible with using "${np(n)}: ${kb(e)}". -Please set this option with "pipe" instead.`},GSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=d9(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},d9=t=>t==="all"?1:t,np=t=>t?"to":"from",kb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as ZSe}from"node:events";var Na,Ab=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),ZSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Tb,WR,Ob,KR,f9,p9,ip=y(()=>{Tb=(t,e)=>{e&&WR(t)},WR=t=>{t.refCounted()},Ob=(t,e)=>{e&&KR(t)},KR=t=>{t.unrefCounted()},f9=(t,e)=>{e&&(KR(t),KR(t))},p9=(t,e)=>{e&&(WR(t),WR(t))}});import{once as VSe}from"node:events";import{scheduler as WSe}from"node:timers/promises";var m9,h9,Rb,g9=y(()=>{Pb();ip();Ib();Cb();m9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(_9(i)||v9(i))return;Rb.has(t)||Rb.set(t,[]);let o=Rb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await b9(t,n,i),await WSe.yield();let s=await y9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},h9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{JR();let o=Rb.get(t);for(;o?.length>0;)await VSe(n,"message:done");t.removeListener("message",i),p9(e,r),n.connected=!1,n.emit("disconnect")},Rb=new WeakMap});import{EventEmitter as KSe}from"node:events";var gs,Db,JSe,Nb,op=y(()=>{g9();ip();gs=(t,e,r)=>{if(Db.has(t))return Db.get(t);let n=new KSe;return n.connected=!0,Db.set(t,n),JSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Db=new WeakMap,JSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=m9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",h9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),f9(r,n)},Nb=t=>{let e=Db.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as YSe}from"node:events";var S9,XSe,w9,y9,_9,x9,jb,QSe,Mb,$9,Ib=y(()=>{jl();Ab();zb();Nl();op();Pb();S9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=gs(t,e,r),s=Fb(t,o);return{id:XSe++,type:Mb,message:n,hasListeners:s}},XSe=0n,w9=(t,e)=>{if(!(e?.type!==Mb||e.hasListeners))for(let{id:r}of t)r!==void 0&&jb[r].resolve({isDeadlock:!0,hasListeners:!1})},y9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Mb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:$9,message:Fb(e,i)};try{await Lb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},_9=t=>{if(t?.type!==$9)return!1;let{id:e,message:r}=t;return jb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},x9=async(t,e,r)=>{if(t?.type!==Mb)return;let n=Di();jb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,QSe(e,r,i)]);o&&r9(r),s||n9(r)}finally{i.abort(),delete jb[t.id]}},jb={},QSe=async(t,e,{signal:r})=>{Na(t,1,r),await YSe(t,"disconnect",{signal:r}),i9(e)},Mb="execa:ipc:request",$9="execa:ipc:response"});var k9,E9,b9,sp,Fb,ewe,Pb=y(()=>{jl();xo();hs();Ib();k9=(t,e,r)=>{sp.has(t)||sp.set(t,new Set);let n=sp.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},E9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},b9=async(t,e,r)=>{for(;!Fb(t,e)&&sp.get(t)?.size>0;){let n=[...sp.get(t)];w9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},sp=new WeakMap,Fb=(t,e)=>e.listenerCount("message")>ewe(t),ewe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as twe}from"node:util";var Lb,rwe,XR,nwe,YR,zb=y(()=>{Nl();Pb();Ib();Lb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Cl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),rwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},rwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=S9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=k9(t,s,o);try{await XR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Dl(t),c}finally{E9(a)}},XR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=nwe(t);try{await Promise.all([x9(n,t,r),o(n)])}catch(s){throw a9({error:s,methodName:e,isSubprocess:r}),c9({error:s,methodName:e,isSubprocess:r,message:i}),s}},nwe=t=>{if(YR.has(t))return YR.get(t);let e=twe(t.send.bind(t));return YR.set(t,e),e},YR=new WeakMap});import{scheduler as iwe}from"node:timers/promises";var T9,O9,owe,A9,v9,R9,JR,QR,Cb=y(()=>{zb();op();Nl();T9=(t,e)=>{let r="cancelSignal";return VR(r,!1,t.connected),XR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:R9,message:e},message:e})},O9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await owe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),QR.signal),owe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!A9){if(A9=!0,!n){s9();return}if(e===null){JR();return}gs(t,e,r),await iwe.yield()}},A9=!1,v9=t=>t?.type!==R9?!1:(QR.abort(t.message),!0),R9="execa:ipc:cancel",JR=()=>{QR.abort(o9())},QR=new AbortController});var I9,P9,swe,awe,eI=y(()=>{GR();Cb();wb();I9=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},P9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[swe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],swe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await xb(e,i);let o=awe(e);throw await T9(t,o),BR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},awe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as cwe}from"node:timers/promises";var C9,D9,lwe,tI=y(()=>{Da();C9=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},D9=(t,e,r,n)=>e===0||e===void 0?[]:[lwe(t,e,r,n)],lwe=async(t,e,r,{signal:n})=>{throw await cwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as uwe,execArgv as dwe}from"node:process";import N9 from"node:path";var j9,M9,rI=y(()=>{Al();j9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},M9=(t,e,{node:r=!1,nodePath:n=uwe,nodeOptions:i=dwe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=El(n,'The "nodePath" option'),l=N9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(N9.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as fwe}from"node:v8";var F9,pwe,mwe,hwe,L9,nI=y(()=>{F9=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");hwe[r](t)}},pwe=t=>{try{fwe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},mwe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},hwe={advanced:pwe,json:mwe},L9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var U9,gwe,cn,iI,ywe,z9,Ub,ja=y(()=>{U9=({encoding:t})=>{if(iI.has(t))return;let e=ywe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Ub(t)}\`. -Please rename it to ${Ub(e)}.`);let r=[...iI].map(n=>Ub(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Ub(t)}\`. -Please rename it to one of: ${r}.`)},gwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),iI=new Set([...gwe,...cn]),ywe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in z9)return z9[e];if(iI.has(e))return e},z9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Ub=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as _we}from"node:fs";import bwe from"node:path";import vwe from"node:process";var q9,H9,B9,oI=y(()=>{Al();q9=(t=H9())=>{let e=El(t,'The "cwd" option');return bwe.resolve(e)},H9=()=>{try{return vwe.cwd()}catch(t){throw t.message=`The current directory does not exist. +It is optional and defaults to "${i}".`)},BSe=(t,e,r,n)=>{let i=n[d9(t)];if(i===void 0)throw new TypeError(`"${op(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${op(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${op(r)}" must not be ${e}. It must be a writable stream, not readable.`)},u9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=GSe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${op(n)}: ${Eb(e)}". +Please set this option with "pipe" instead.`},GSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=d9(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},d9=t=>t==="all"?1:t,op=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as ZSe}from"node:events";var ja,Tb=y(()=>{ja=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),ZSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Ob,WR,Rb,KR,f9,p9,sp=y(()=>{Ob=(t,e)=>{e&&WR(t)},WR=t=>{t.refCounted()},Rb=(t,e)=>{e&&KR(t)},KR=t=>{t.unrefCounted()},f9=(t,e)=>{e&&(KR(t),KR(t))},p9=(t,e)=>{e&&(WR(t),WR(t))}});import{once as VSe}from"node:events";import{scheduler as WSe}from"node:timers/promises";var m9,h9,Ib,g9=y(()=>{Cb();sp();Pb();Db();m9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(_9(i)||v9(i))return;Ib.has(t)||Ib.set(t,[]);let o=Ib.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await b9(t,n,i),await WSe.yield();let s=await y9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},h9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{JR();let o=Ib.get(t);for(;o?.length>0;)await VSe(n,"message:done");t.removeListener("message",i),p9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as KSe}from"node:events";var gs,Nb,JSe,jb,ap=y(()=>{g9();sp();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new KSe;return n.connected=!0,Nb.set(t,n),JSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,JSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=m9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",h9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),f9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as YSe}from"node:events";var S9,XSe,w9,y9,_9,x9,Mb,QSe,Fb,$9,Pb=y(()=>{Ml();Tb();Ub();jl();ap();Cb();S9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=gs(t,e,r),s=Lb(t,o);return{id:XSe++,type:Fb,message:n,hasListeners:s}},XSe=0n,w9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},y9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Fb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:$9,message:Lb(e,i)};try{await zb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},_9=t=>{if(t?.type!==$9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},x9=async(t,e,r)=>{if(t?.type!==Fb)return;let n=Di();Mb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,QSe(e,r,i)]);o&&r9(r),s||n9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},QSe=async(t,e,{signal:r})=>{ja(t,1,r),await YSe(t,"disconnect",{signal:r}),i9(e)},Fb="execa:ipc:request",$9="execa:ipc:response"});var k9,E9,b9,cp,Lb,ewe,Cb=y(()=>{Ml();xo();hs();Pb();k9=(t,e,r)=>{cp.has(t)||cp.set(t,new Set);let n=cp.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},E9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},b9=async(t,e,r)=>{for(;!Lb(t,e)&&cp.get(t)?.size>0;){let n=[...cp.get(t)];w9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},cp=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>ewe(t),ewe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as twe}from"node:util";var zb,rwe,XR,nwe,YR,Ub=y(()=>{jl();Cb();Pb();zb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Dl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),rwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},rwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=S9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=k9(t,s,o);try{await XR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Nl(t),c}finally{E9(a)}},XR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=nwe(t);try{await Promise.all([x9(n,t,r),o(n)])}catch(s){throw a9({error:s,methodName:e,isSubprocess:r}),c9({error:s,methodName:e,isSubprocess:r,message:i}),s}},nwe=t=>{if(YR.has(t))return YR.get(t);let e=twe(t.send.bind(t));return YR.set(t,e),e},YR=new WeakMap});import{scheduler as iwe}from"node:timers/promises";var T9,O9,owe,A9,v9,R9,JR,QR,Db=y(()=>{Ub();ap();jl();T9=(t,e)=>{let r="cancelSignal";return VR(r,!1,t.connected),XR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:R9,message:e},message:e})},O9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await owe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),QR.signal),owe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!A9){if(A9=!0,!n){s9();return}if(e===null){JR();return}gs(t,e,r),await iwe.yield()}},A9=!1,v9=t=>t?.type!==R9?!1:(QR.abort(t.message),!0),R9="execa:ipc:cancel",JR=()=>{QR.abort(o9())},QR=new AbortController});var I9,P9,swe,awe,eI=y(()=>{GR();Db();xb();I9=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},P9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[swe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],swe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=awe(e);throw await T9(t,o),BR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},awe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as cwe}from"node:timers/promises";var C9,D9,lwe,tI=y(()=>{Na();C9=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},D9=(t,e,r,n)=>e===0||e===void 0?[]:[lwe(t,e,r,n)],lwe=async(t,e,r,{signal:n})=>{throw await cwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as uwe,execArgv as dwe}from"node:process";import N9 from"node:path";var j9,M9,rI=y(()=>{Tl();j9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},M9=(t,e,{node:r=!1,nodePath:n=uwe,nodeOptions:i=dwe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=Al(n,'The "nodePath" option'),l=N9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(N9.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as fwe}from"node:v8";var F9,pwe,mwe,hwe,L9,nI=y(()=>{F9=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");hwe[r](t)}},pwe=t=>{try{fwe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},mwe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},hwe={advanced:pwe,json:mwe},L9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var U9,gwe,cn,iI,ywe,z9,qb,Ma=y(()=>{U9=({encoding:t})=>{if(iI.has(t))return;let e=ywe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to ${qb(e)}.`);let r=[...iI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to one of: ${r}.`)},gwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),iI=new Set([...gwe,...cn]),ywe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in z9)return z9[e];if(iI.has(e))return e},z9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},qb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as _we}from"node:fs";import bwe from"node:path";import vwe from"node:process";var q9,H9,B9,oI=y(()=>{Tl();q9=(t=H9())=>{let e=Al(t,'The "cwd" option');return bwe.resolve(e)},H9=()=>{try{return vwe.cwd()}catch(t){throw t.message=`The current directory does not exist. ${t.message}`,t}},B9=(t,e)=>{if(e===H9())return t;let r;try{r=_we(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import Swe from"node:path";import G9 from"node:process";var Z9,qb,wwe,xwe,sI=y(()=>{Z9=wt(EV(),1);CV();wb();rp();ZR();eI();tI();rI();nI();ja();oI();Al();xo();qb=(t,e,r)=>{r.cwd=q9(r.cwd);let[n,i,o]=M9(t,e,r),{command:s,args:a,options:c}=Z9.default._parse(n,i,o),l=hZ(c),u=wwe(l);return C9(u),U9(u),F9(u),QV(u),I9(u),u.shell=SR(u.shell),u.env=xwe(u),u.killSignal=WV(u.killSignal),u.forceKillAfterDelay=YV(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),G9.platform==="win32"&&Swe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},wwe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),xwe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...G9.env,...t}:t;return r||n?PV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Hb,aI=y(()=>{Hb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Fl(t){if(typeof t=="string")return $we(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return kwe(t)}var $we,kwe,V9,Ewe,W9,Awe,cI=y(()=>{$we=t=>t.at(-1)===V9?t.slice(0,t.at(-2)===W9?-2:-1):t,kwe=t=>t.at(-1)===Ewe?t.subarray(0,t.at(-2)===Awe?-2:-1):t,V9=` -`,Ewe=V9.codePointAt(0),W9="\r",Awe=W9.codePointAt(0)});function oi(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function lI(t,{checkOpen:e=!0}={}){return oi(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Ma(t,{checkOpen:e=!0}={}){return oi(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function uI(t,e){return lI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function K9(){return this[fI].next()}function J9(t){return this[fI].return(t)}function pI({preventCancel:t=!1}={}){let e=this.getReader(),r=new dI(e,t),n=Object.create(Owe);return n[fI]=r,n}var Twe,dI,fI,Owe,Y9=y(()=>{Twe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),dI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},fI=Symbol();Object.defineProperty(K9,"name",{value:"next"});Object.defineProperty(J9,"name",{value:"return"});Owe=Object.create(Twe,{next:{enumerable:!0,configurable:!0,writable:!0,value:K9},return:{enumerable:!0,configurable:!0,writable:!0,value:J9}})});var X9=y(()=>{});var Q9=y(()=>{Y9();X9()});var eW,Rwe,Iwe,Pwe,ap,mI=y(()=>{Fa();Q9();eW=t=>{if(Ma(t,{checkOpen:!1})&&ap.on!==void 0)return Iwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Rwe.call(t)==="[object ReadableStream]")return pI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Rwe}=Object.prototype,Iwe=async function*(t){let e=new AbortController,r={};Pwe(t,e,r);try{for await(let[n]of ap.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},Pwe=async(t,e,r)=>{try{await ap.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},ap={}});var Ll,Cwe,nW,tW,Dwe,rW,ji,cp=y(()=>{mI();Ll=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=eW(t),u=e();u.length=0;try{for await(let d of l){let f=Dwe(d),p=r[f](d,u);nW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Cwe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},Cwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&nW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},nW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){tW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&tW(c,e,i,o),new ji},tW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Dwe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=rW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&rW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:rW}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var $o,lp,Bb,Gb,Zb,Vb=y(()=>{$o=t=>t,lp=()=>{},Bb=({contents:t})=>t,Gb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Zb=t=>t.length});async function Wb(t,e){return Ll(t,Fwe,e)}var Nwe,jwe,Mwe,Fwe,iW=y(()=>{cp();Vb();Nwe=()=>({contents:[]}),jwe=()=>1,Mwe=(t,{contents:e})=>(e.push(t),e),Fwe={init:Nwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:jwe,truncateChunk:lp,addChunk:Mwe,getFinalChunk:lp,finalize:Bb}});async function Kb(t,e){return Ll(t,Vwe,e)}var Lwe,zwe,Uwe,oW,sW,qwe,Hwe,Bwe,Gwe,cW,aW,Zwe,lW,Vwe,uW=y(()=>{cp();Vb();Lwe=()=>({contents:new ArrayBuffer(0)}),zwe=t=>Uwe.encode(t),Uwe=new TextEncoder,oW=t=>new Uint8Array(t),sW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),qwe=(t,e)=>t.slice(0,e),Hwe=(t,{contents:e,length:r},n)=>{let i=lW()?Gwe(e,n):Bwe(e,n);return new Uint8Array(i).set(t,r),i},Bwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(cW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Gwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:cW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},cW=t=>aW**Math.ceil(Math.log(t)/Math.log(aW)),aW=2,Zwe=({contents:t,length:e})=>lW()?t:t.slice(0,e),lW=()=>"resize"in ArrayBuffer.prototype,Vwe={init:Lwe,convertChunk:{string:zwe,buffer:oW,arrayBuffer:oW,dataView:sW,typedArray:sW,others:Gb},getSize:Zb,truncateChunk:qwe,addChunk:Hwe,getFinalChunk:lp,finalize:Zwe}});async function Yb(t,e){return Ll(t,Xwe,e)}var Wwe,Jb,Kwe,Jwe,Ywe,Xwe,dW=y(()=>{cp();Vb();Wwe=()=>({contents:"",textDecoder:new TextDecoder}),Jb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Kwe=(t,{contents:e})=>e+t,Jwe=(t,e)=>t.slice(0,e),Ywe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Xwe={init:Wwe,convertChunk:{string:$o,buffer:Jb,arrayBuffer:Jb,dataView:Jb,typedArray:Jb,others:Gb},getSize:Zb,truncateChunk:Jwe,addChunk:Kwe,getFinalChunk:Ywe,finalize:Bb}});var fW=y(()=>{iW();uW();dW();cp()});import{on as Qwe}from"node:events";import{finished as exe}from"node:stream/promises";var Xb=y(()=>{mI();fW();Object.assign(ap,{on:Qwe,finished:exe})});var pW,txe,mW,hW,rxe,gW,yW,Qb,La=y(()=>{Xb();So();xo();pW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=txe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},txe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",mW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},hW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=rxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},rxe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=wo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:ob(r),threshold:i,unit:n}},gW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Qb(r)),yW=(t,e,r)=>{if(!e)return t;let n=Qb(r);return t.length>n?t.slice(0,n):t},Qb=([,t])=>t});import{inspect as nxe}from"node:util";var bW,ixe,oxe,sxe,axe,cxe,_W,vW=y(()=>{cI();an();oI();cb();La();rp();Da();bW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=ixe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=sxe(n,b),w=x===void 0?"":` +${t}`}});import Swe from"node:path";import G9 from"node:process";var Z9,Hb,wwe,xwe,sI=y(()=>{Z9=wt(EV(),1);CV();xb();ip();ZR();eI();tI();rI();nI();Ma();oI();Tl();xo();Hb=(t,e,r)=>{r.cwd=q9(r.cwd);let[n,i,o]=M9(t,e,r),{command:s,args:a,options:c}=Z9.default._parse(n,i,o),l=hZ(c),u=wwe(l);return C9(u),U9(u),F9(u),QV(u),I9(u),u.shell=SR(u.shell),u.env=xwe(u),u.killSignal=WV(u.killSignal),u.forceKillAfterDelay=YV(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),G9.platform==="win32"&&Swe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},wwe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),xwe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...G9.env,...t}:t;return r||n?PV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,aI=y(()=>{Bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Ll(t){if(typeof t=="string")return $we(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return kwe(t)}var $we,kwe,V9,Ewe,W9,Awe,cI=y(()=>{$we=t=>t.at(-1)===V9?t.slice(0,t.at(-2)===W9?-2:-1):t,kwe=t=>t.at(-1)===Ewe?t.subarray(0,t.at(-2)===Awe?-2:-1):t,V9=` +`,Ewe=V9.codePointAt(0),W9="\r",Awe=W9.codePointAt(0)});function oi(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function lI(t,{checkOpen:e=!0}={}){return oi(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Fa(t,{checkOpen:e=!0}={}){return oi(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function uI(t,e){return lI(t,e)&&Fa(t,e)}var La=y(()=>{});function K9(){return this[fI].next()}function J9(t){return this[fI].return(t)}function pI({preventCancel:t=!1}={}){let e=this.getReader(),r=new dI(e,t),n=Object.create(Owe);return n[fI]=r,n}var Twe,dI,fI,Owe,Y9=y(()=>{Twe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),dI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},fI=Symbol();Object.defineProperty(K9,"name",{value:"next"});Object.defineProperty(J9,"name",{value:"return"});Owe=Object.create(Twe,{next:{enumerable:!0,configurable:!0,writable:!0,value:K9},return:{enumerable:!0,configurable:!0,writable:!0,value:J9}})});var X9=y(()=>{});var Q9=y(()=>{Y9();X9()});var eW,Rwe,Iwe,Pwe,lp,mI=y(()=>{La();Q9();eW=t=>{if(Fa(t,{checkOpen:!1})&&lp.on!==void 0)return Iwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Rwe.call(t)==="[object ReadableStream]")return pI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Rwe}=Object.prototype,Iwe=async function*(t){let e=new AbortController,r={};Pwe(t,e,r);try{for await(let[n]of lp.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},Pwe=async(t,e,r)=>{try{await lp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},lp={}});var zl,Cwe,nW,tW,Dwe,rW,ji,up=y(()=>{mI();zl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=eW(t),u=e();u.length=0;try{for await(let d of l){let f=Dwe(d),p=r[f](d,u);nW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Cwe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},Cwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&nW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},nW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){tW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&tW(c,e,i,o),new ji},tW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Dwe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=rW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&rW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:rW}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var $o,dp,Gb,Zb,Vb,Wb=y(()=>{$o=t=>t,dp=()=>{},Gb=({contents:t})=>t,Zb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Vb=t=>t.length});async function Kb(t,e){return zl(t,Fwe,e)}var Nwe,jwe,Mwe,Fwe,iW=y(()=>{up();Wb();Nwe=()=>({contents:[]}),jwe=()=>1,Mwe=(t,{contents:e})=>(e.push(t),e),Fwe={init:Nwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:jwe,truncateChunk:dp,addChunk:Mwe,getFinalChunk:dp,finalize:Gb}});async function Jb(t,e){return zl(t,Vwe,e)}var Lwe,zwe,Uwe,oW,sW,qwe,Hwe,Bwe,Gwe,cW,aW,Zwe,lW,Vwe,uW=y(()=>{up();Wb();Lwe=()=>({contents:new ArrayBuffer(0)}),zwe=t=>Uwe.encode(t),Uwe=new TextEncoder,oW=t=>new Uint8Array(t),sW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),qwe=(t,e)=>t.slice(0,e),Hwe=(t,{contents:e,length:r},n)=>{let i=lW()?Gwe(e,n):Bwe(e,n);return new Uint8Array(i).set(t,r),i},Bwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(cW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Gwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:cW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},cW=t=>aW**Math.ceil(Math.log(t)/Math.log(aW)),aW=2,Zwe=({contents:t,length:e})=>lW()?t:t.slice(0,e),lW=()=>"resize"in ArrayBuffer.prototype,Vwe={init:Lwe,convertChunk:{string:zwe,buffer:oW,arrayBuffer:oW,dataView:sW,typedArray:sW,others:Zb},getSize:Vb,truncateChunk:qwe,addChunk:Hwe,getFinalChunk:dp,finalize:Zwe}});async function Xb(t,e){return zl(t,Xwe,e)}var Wwe,Yb,Kwe,Jwe,Ywe,Xwe,dW=y(()=>{up();Wb();Wwe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Kwe=(t,{contents:e})=>e+t,Jwe=(t,e)=>t.slice(0,e),Ywe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Xwe={init:Wwe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:Jwe,addChunk:Kwe,getFinalChunk:Ywe,finalize:Gb}});var fW=y(()=>{iW();uW();dW();up()});import{on as Qwe}from"node:events";import{finished as exe}from"node:stream/promises";var Qb=y(()=>{mI();fW();Object.assign(lp,{on:Qwe,finished:exe})});var pW,txe,mW,hW,rxe,gW,yW,ev,za=y(()=>{Qb();So();xo();pW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=txe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},txe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",mW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},hW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=rxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},rxe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=wo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:sb(r),threshold:i,unit:n}},gW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),yW=(t,e,r)=>{if(!e)return t;let n=ev(r);return t.length>n?t.slice(0,n):t},ev=([,t])=>t});import{inspect as nxe}from"node:util";var bW,ixe,oxe,sxe,axe,cxe,_W,vW=y(()=>{cI();an();oI();lb();za();ip();Na();bW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=ixe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=sxe(n,b),w=x===void 0?"":` ${x}`,R=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],T=[R,...A,...t.slice(3),r.map(D=>axe(D)).join(` -`)].map(D=>Xf(Fl(cxe(D)))).filter(Boolean).join(` +`)].map(D=>ep(Ll(cxe(D)))).filter(Boolean).join(` -`);return{originalMessage:x,shortMessage:R,message:T}},ixe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=oxe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${hW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Sb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},oxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",sxe=(t,e)=>{if(t instanceof ni)return;let r=jV(t)?t.originalMessage:String(t?.message??t),n=Xf(B9(r,e));return n===""?void 0:n},axe=t=>typeof t=="string"?t:nxe(t),cxe=t=>Array.isArray(t)?t.map(e=>Fl(_W(e))).filter(Boolean).join(` -`):_W(t),_W=t=>typeof t=="string"?t:qt(t)?nb(t):""});var ev,zl,up,lxe,SW,uxe,dp=y(()=>{rp();mb();Da();vW();ev=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>SW({command:t,escapedCommand:e,cwd:o,durationMs:IR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),zl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>up({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),up=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:R,signalDescription:A}=uxe(l,u),{originalMessage:T,shortMessage:D,message:E}=bW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:A,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ae=DV(t,E,x);return Object.assign(ae,lxe({error:ae,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:T,shortMessage:D})),ae},lxe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>SW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:IR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),SW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),uxe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Sb(e);return{exitCode:r,signal:n,signalDescription:i}}});function dxe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(wW(t*1e3)%1e3),nanoseconds:Math.trunc(wW(t*1e6)%1e3)}}function fxe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function hI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return dxe(t);break}case"bigint":return fxe(t)}throw new TypeError("Expected a finite number or bigint")}var wW,xW=y(()=>{wW=t=>Number.isFinite(t)?t:0});function gI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+hxe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&pxe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+mxe(d,u):f;i.push(p)}},a=hI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%gxe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var pxe,mxe,hxe,gxe,$W=y(()=>{xW();pxe=t=>t===0||t===0n,mxe=(t,e)=>e===1||e===1n?t:`${t}s`,hxe=1e-7,gxe=24n*60n*60n*1000n});var kW,EW=y(()=>{Rl();kW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var AW,yxe,TW=y(()=>{$W();ps();Rl();EW();AW=(t,e)=>{Tl(e)&&(kW(t,e),yxe(t,e))},yxe=(t,e)=>{let r=`(done in ${gI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ul,tv=y(()=>{TW();Ul=(t,e,{reject:r})=>{if(AW(t,e),t.failed&&r)throw t;return t}});var IW,_xe,bxe,PW,CW,OW,vxe,yI,RW,za,DW,Sxe,rv,NW,wxe,xxe,_I,jW,$xe,MW,nv,kxe,bI,Exe,Axe,FW,Dn,iv,vI,LW,zW,ys,$r=y(()=>{Fa();bo();an();IW=(t,e)=>za(t)?"asyncGenerator":DW(t)?"generator":rv(t)?"fileUrl":wxe(t)?"filePath":kxe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Exe(t)?"asyncIterable":Axe(t)?"iterable":bI(t)?PW({transform:t},e):Sxe(t)?_xe(t,e):"native",_xe=(t,e)=>uI(t.transform,{checkOpen:!1})?bxe(t,e):bI(t.transform)?PW(t,e):vxe(t,e),bxe=(t,e)=>(CW(t,e,"Duplex stream"),"duplex"),PW=(t,e)=>(CW(t,e,"web TransformStream"),"webTransform"),CW=({final:t,binary:e,objectMode:r},n,i)=>{OW(t,`${n}.final`,i),OW(e,`${n}.binary`,i),yI(r,`${n}.objectMode`)},OW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},vxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!RW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(uI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(bI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!RW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return yI(r,`${i}.binary`),yI(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},yI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},RW=t=>za(t)||DW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",DW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Sxe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),rv=t=>Object.prototype.toString.call(t)==="[object URL]",NW=t=>rv(t)&&t.protocol!=="file:",wxe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>xxe.has(e))&&_I(t.file),xxe=new Set(["file","append"]),_I=t=>typeof t=="string",jW=(t,e)=>t==="native"&&typeof e=="string"&&!$xe.has(e),$xe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),MW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",nv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",kxe=t=>MW(t)||nv(t),bI=t=>MW(t?.readable)&&nv(t?.writable),Exe=t=>FW(t)&&typeof t[Symbol.asyncIterator]=="function",Axe=t=>FW(t)&&typeof t[Symbol.iterator]=="function",FW=t=>typeof t=="object"&&t!==null,Dn=new Set(["generator","asyncGenerator","duplex","webTransform"]),iv=new Set(["fileUrl","filePath","fileNumber"]),vI=new Set(["fileUrl","filePath"]),LW=new Set([...vI,"webStream","nodeStream"]),zW=new Set(["webTransform","duplex"]),ys={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var SI,Txe,Oxe,UW,wI=y(()=>{$r();SI=(t,e,r,n)=>n==="output"?Txe(t,e,r):Oxe(t,e,r),Txe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Oxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},UW=(t,e)=>{let r=t.findLast(({type:n})=>Dn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var qW,Rxe,Ixe,Pxe,Cxe,Dxe,Nxe,HW=y(()=>{bo();ja();$r();wI();qW=(t,e,r,n)=>[...t.filter(({type:i})=>!Dn.has(i)),...Rxe(t,e,r,n)],Rxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Dn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Ixe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Nxe(o,r)},Ixe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Pxe({stdioItem:t,optionName:i}):e==="webTransform"?Cxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Dxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Pxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},Cxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=SI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Dxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||cn.has(o),{writableObjectMode:f,readableObjectMode:p}=SI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Nxe=(t,e)=>e==="input"?t.reverse():t});import xI from"node:process";var BW,jxe,Mxe,ql,$I,GW,Fxe,Lxe,ZW=y(()=>{Fa();$r();BW=(t,e,r)=>{let n=t.map(i=>jxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Lxe},jxe=({type:t,value:e},r)=>Mxe[r]??GW[t](e),Mxe=["input","output","output"],ql=()=>{},$I=()=>"input",GW={generator:ql,asyncGenerator:ql,fileUrl:ql,filePath:ql,iterable:$I,asyncIterable:$I,uint8Array:$I,webStream:t=>nv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?lI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:ql,duplex:ql,native(t){let e=Fxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return GW.nodeStream(t)}},Fxe=t=>{if([0,xI.stdin].includes(t))return"input";if([1,2,xI.stdout,xI.stderr].includes(t))return"output"},Lxe="output"});var VW,WW=y(()=>{VW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var KW,zxe,Uxe,JW,qxe,Hxe,YW=y(()=>{So();WW();ps();KW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=zxe(t,n).map((a,c)=>JW(a,c));return o?qxe(s,r,i):VW(s,e)},zxe=(t,e)=>{if(t===void 0)return Cn.map(n=>e[n]);if(Uxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Cn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Cn.length);return Array.from({length:r},(n,i)=>t[i])},Uxe=t=>Cn.some(e=>t[e]!==void 0),JW=(t,e)=>Array.isArray(t)?t.map(r=>JW(r,e)):t??(e>=Cn.length?"ignore":"pipe"),qxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Ol(r,i)&&Hxe(n)?"ignore":n),Hxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Bxe}from"node:fs";import Gxe from"node:tty";var QW,Zxe,Vxe,Wxe,Kxe,XW,eK=y(()=>{Fa();So();an();hs();QW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Zxe({stdioItem:t,fdNumber:n,direction:i}):Kxe({stdioItem:t,fdNumber:n}),Zxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Vxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(oi(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Vxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Wxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Gxe.isatty(i))throw new TypeError(`The \`${e}: ${kb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:vo(Bxe(i)),optionName:e}}},Wxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ib.indexOf(t);if(r!==-1)return r},Kxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:XW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:XW(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,XW=(t,e,r)=>{let n=ib[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var tK,Jxe,Yxe,Xxe,Qxe,rK=y(()=>{Fa();an();$r();tK=({input:t,inputFile:e},r)=>r===0?[...Jxe(t),...Xxe(e)]:[],Jxe=t=>t===void 0?[]:[{type:Yxe(t),value:t,optionName:"input"}],Yxe=t=>{if(Ma(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Xxe=t=>t===void 0?[]:[{...Qxe(t),optionName:"inputFile"}],Qxe=t=>{if(rv(t))return{type:"fileUrl",value:t};if(_I(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var nK,iK,e0e,t0e,oK,r0e,n0e,sK,aK=y(()=>{$r();nK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),iK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=e0e(i,t);if(s.length!==0){if(o){t0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(LW.has(t))return oK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});zW.has(t)&&n0e({otherStdioItems:s,type:t,value:e,optionName:r})}},e0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),t0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{vI.has(e)&&oK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},oK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>r0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return sK(s,n,e),i==="output"?o[0].stream:void 0},r0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,n0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);sK(i,n,e)},sK=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ys[r]} that is the same.`)}});var ov,i0e,o0e,s0e,a0e,c0e,l0e,u0e,d0e,f0e,p0e,m0e,kI,h0e,sv=y(()=>{So();HW();wI();$r();ZW();YW();eK();rK();aK();ov=(t,e,r,n)=>{let o=KW(e,r,n).map((a,c)=>i0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=f0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>h0e(a)),s},i0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=ob(e),{stdioItems:o,isStdioArray:s}=o0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=BW(o,e,i),c=o.map(d=>QW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=qW(c,i,a,r),u=UW(l,a);return d0e(l,u),{direction:a,objectMode:u,stdioItems:l}},o0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>s0e(c,n)),...tK(r,e)],s=nK(o),a=s.length>1;return a0e(s,a,n),l0e(s),{stdioItems:s,isStdioArray:a}},s0e=(t,e)=>({type:IW(t,e),value:t,optionName:e}),a0e=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(c0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},c0e=new Set(["ignore","ipc"]),l0e=t=>{for(let e of t)u0e(e)},u0e=({type:t,value:e,optionName:r})=>{if(NW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(jW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},d0e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>iv.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},f0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(p0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw kI(i),o}},p0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>m0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},m0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=iK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},kI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},h0e=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as cK}from"node:fs";var uK,Mi,g0e,dK,lK,y0e,fK=y(()=>{an();sv();$r();uK=(t,e)=>ov(y0e,t,e,!0),Mi=({type:t,optionName:e})=>{dK(e,ys[t])},g0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&dK(t,`"${e}"`),{}),dK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},lK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:g0e},y0e={input:{...lK,fileUrl:({value:t})=>({contents:[vo(cK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(cK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...lK,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var ko,EI,fp=y(()=>{cI();ko=(t,{stripFinalNewline:e},r)=>EI(e,r)&&t!==void 0&&!Array.isArray(t)?Fl(t):t,EI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var av,TI,pK,mK,_0e,b0e,v0e,hK,S0e,AI,w0e,x0e,$0e,cv=y(()=>{av=(t,e,r,n)=>t||r?void 0:mK(e,n),TI=(t,e,r)=>r?t.flatMap(n=>pK(n,e)):pK(t,e),pK=(t,e)=>{let{transform:r,final:n}=mK(e,{});return[...r(t),...n()]},mK=(t,e)=>(e.previousChunks="",{transform:_0e.bind(void 0,e,t),final:v0e.bind(void 0,e)}),_0e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=AI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=AI(n,r.slice(i+1))),t.previousChunks=n},b0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),v0e=function*({previousChunks:t}){t.length>0&&(yield t)},hK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:S0e.bind(void 0,n)},S0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?w0e:$0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},AI=(t,e)=>`${t}${e}`,w0e={windowsNewline:`\r +`);return{originalMessage:x,shortMessage:R,message:T}},ixe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=oxe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${hW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${wb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},oxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",sxe=(t,e)=>{if(t instanceof ni)return;let r=jV(t)?t.originalMessage:String(t?.message??t),n=ep(B9(r,e));return n===""?void 0:n},axe=t=>typeof t=="string"?t:nxe(t),cxe=t=>Array.isArray(t)?t.map(e=>Ll(_W(e))).filter(Boolean).join(` +`):_W(t),_W=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,Ul,fp,lxe,SW,uxe,pp=y(()=>{ip();hb();Na();vW();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>SW({command:t,escapedCommand:e,cwd:o,durationMs:IR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ul=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>fp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),fp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:R,signalDescription:A}=uxe(l,u),{originalMessage:T,shortMessage:D,message:E}=bW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:A,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ae=DV(t,E,x);return Object.assign(ae,lxe({error:ae,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:T,shortMessage:D})),ae},lxe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>SW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:IR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),SW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),uxe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:wb(e);return{exitCode:r,signal:n,signalDescription:i}}});function dxe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(wW(t*1e3)%1e3),nanoseconds:Math.trunc(wW(t*1e6)%1e3)}}function fxe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function hI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return dxe(t);break}case"bigint":return fxe(t)}throw new TypeError("Expected a finite number or bigint")}var wW,xW=y(()=>{wW=t=>Number.isFinite(t)?t:0});function gI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+hxe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&pxe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+mxe(d,u):f;i.push(p)}},a=hI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%gxe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var pxe,mxe,hxe,gxe,$W=y(()=>{xW();pxe=t=>t===0||t===0n,mxe=(t,e)=>e===1||e===1n?t:`${t}s`,hxe=1e-7,gxe=24n*60n*60n*1000n});var kW,EW=y(()=>{Il();kW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var AW,yxe,TW=y(()=>{$W();ps();Il();EW();AW=(t,e)=>{Ol(e)&&(kW(t,e),yxe(t,e))},yxe=(t,e)=>{let r=`(done in ${gI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var ql,rv=y(()=>{TW();ql=(t,e,{reject:r})=>{if(AW(t,e),t.failed&&r)throw t;return t}});var IW,_xe,bxe,PW,CW,OW,vxe,yI,RW,Ua,DW,Sxe,nv,NW,wxe,xxe,_I,jW,$xe,MW,iv,kxe,bI,Exe,Axe,FW,Dn,ov,vI,LW,zW,ys,$r=y(()=>{La();bo();an();IW=(t,e)=>Ua(t)?"asyncGenerator":DW(t)?"generator":nv(t)?"fileUrl":wxe(t)?"filePath":kxe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Exe(t)?"asyncIterable":Axe(t)?"iterable":bI(t)?PW({transform:t},e):Sxe(t)?_xe(t,e):"native",_xe=(t,e)=>uI(t.transform,{checkOpen:!1})?bxe(t,e):bI(t.transform)?PW(t,e):vxe(t,e),bxe=(t,e)=>(CW(t,e,"Duplex stream"),"duplex"),PW=(t,e)=>(CW(t,e,"web TransformStream"),"webTransform"),CW=({final:t,binary:e,objectMode:r},n,i)=>{OW(t,`${n}.final`,i),OW(e,`${n}.binary`,i),yI(r,`${n}.objectMode`)},OW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},vxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!RW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(uI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(bI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!RW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return yI(r,`${i}.binary`),yI(n,`${i}.objectMode`),Ua(t)||Ua(e)?"asyncGenerator":"generator"},yI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},RW=t=>Ua(t)||DW(t),Ua=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",DW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Sxe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",NW=t=>nv(t)&&t.protocol!=="file:",wxe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>xxe.has(e))&&_I(t.file),xxe=new Set(["file","append"]),_I=t=>typeof t=="string",jW=(t,e)=>t==="native"&&typeof e=="string"&&!$xe.has(e),$xe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),MW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",kxe=t=>MW(t)||iv(t),bI=t=>MW(t?.readable)&&iv(t?.writable),Exe=t=>FW(t)&&typeof t[Symbol.asyncIterator]=="function",Axe=t=>FW(t)&&typeof t[Symbol.iterator]=="function",FW=t=>typeof t=="object"&&t!==null,Dn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),vI=new Set(["fileUrl","filePath"]),LW=new Set([...vI,"webStream","nodeStream"]),zW=new Set(["webTransform","duplex"]),ys={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var SI,Txe,Oxe,UW,wI=y(()=>{$r();SI=(t,e,r,n)=>n==="output"?Txe(t,e,r):Oxe(t,e,r),Txe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Oxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},UW=(t,e)=>{let r=t.findLast(({type:n})=>Dn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var qW,Rxe,Ixe,Pxe,Cxe,Dxe,Nxe,HW=y(()=>{bo();Ma();$r();wI();qW=(t,e,r,n)=>[...t.filter(({type:i})=>!Dn.has(i)),...Rxe(t,e,r,n)],Rxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Dn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Ixe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Nxe(o,r)},Ixe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Pxe({stdioItem:t,optionName:i}):e==="webTransform"?Cxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Dxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Pxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},Cxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=SI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Dxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||cn.has(o),{writableObjectMode:f,readableObjectMode:p}=SI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Nxe=(t,e)=>e==="input"?t.reverse():t});import xI from"node:process";var BW,jxe,Mxe,Hl,$I,GW,Fxe,Lxe,ZW=y(()=>{La();$r();BW=(t,e,r)=>{let n=t.map(i=>jxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Lxe},jxe=({type:t,value:e},r)=>Mxe[r]??GW[t](e),Mxe=["input","output","output"],Hl=()=>{},$I=()=>"input",GW={generator:Hl,asyncGenerator:Hl,fileUrl:Hl,filePath:Hl,iterable:$I,asyncIterable:$I,uint8Array:$I,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Fa(t,{checkOpen:!1})?lI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Hl,duplex:Hl,native(t){let e=Fxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return GW.nodeStream(t)}},Fxe=t=>{if([0,xI.stdin].includes(t))return"input";if([1,2,xI.stdout,xI.stderr].includes(t))return"output"},Lxe="output"});var VW,WW=y(()=>{VW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var KW,zxe,Uxe,JW,qxe,Hxe,YW=y(()=>{So();WW();ps();KW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=zxe(t,n).map((a,c)=>JW(a,c));return o?qxe(s,r,i):VW(s,e)},zxe=(t,e)=>{if(t===void 0)return Cn.map(n=>e[n]);if(Uxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Cn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Cn.length);return Array.from({length:r},(n,i)=>t[i])},Uxe=t=>Cn.some(e=>t[e]!==void 0),JW=(t,e)=>Array.isArray(t)?t.map(r=>JW(r,e)):t??(e>=Cn.length?"ignore":"pipe"),qxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Rl(r,i)&&Hxe(n)?"ignore":n),Hxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Bxe}from"node:fs";import Gxe from"node:tty";var QW,Zxe,Vxe,Wxe,Kxe,XW,eK=y(()=>{La();So();an();hs();QW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Zxe({stdioItem:t,fdNumber:n,direction:i}):Kxe({stdioItem:t,fdNumber:n}),Zxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Vxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(oi(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Vxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Wxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Gxe.isatty(i))throw new TypeError(`The \`${e}: ${Eb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:vo(Bxe(i)),optionName:e}}},Wxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},Kxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:XW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:XW(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,XW=(t,e,r)=>{let n=ob[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var tK,Jxe,Yxe,Xxe,Qxe,rK=y(()=>{La();an();$r();tK=({input:t,inputFile:e},r)=>r===0?[...Jxe(t),...Xxe(e)]:[],Jxe=t=>t===void 0?[]:[{type:Yxe(t),value:t,optionName:"input"}],Yxe=t=>{if(Fa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Xxe=t=>t===void 0?[]:[{...Qxe(t),optionName:"inputFile"}],Qxe=t=>{if(nv(t))return{type:"fileUrl",value:t};if(_I(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var nK,iK,e$e,t$e,oK,r$e,n$e,sK,aK=y(()=>{$r();nK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),iK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=e$e(i,t);if(s.length!==0){if(o){t$e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(LW.has(t))return oK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});zW.has(t)&&n$e({otherStdioItems:s,type:t,value:e,optionName:r})}},e$e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),t$e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{vI.has(e)&&oK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},oK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>r$e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return sK(s,n,e),i==="output"?o[0].stream:void 0},r$e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,n$e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);sK(i,n,e)},sK=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ys[r]} that is the same.`)}});var sv,i$e,o$e,s$e,a$e,c$e,l$e,u$e,d$e,f$e,p$e,m$e,kI,h$e,av=y(()=>{So();HW();wI();$r();ZW();YW();eK();rK();aK();sv=(t,e,r,n)=>{let o=KW(e,r,n).map((a,c)=>i$e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=f$e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>h$e(a)),s},i$e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=o$e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=BW(o,e,i),c=o.map(d=>QW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=qW(c,i,a,r),u=UW(l,a);return d$e(l,u),{direction:a,objectMode:u,stdioItems:l}},o$e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>s$e(c,n)),...tK(r,e)],s=nK(o),a=s.length>1;return a$e(s,a,n),l$e(s),{stdioItems:s,isStdioArray:a}},s$e=(t,e)=>({type:IW(t,e),value:t,optionName:e}),a$e=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(c$e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},c$e=new Set(["ignore","ipc"]),l$e=t=>{for(let e of t)u$e(e)},u$e=({type:t,value:e,optionName:r})=>{if(NW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(jW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},d$e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>ov.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},f$e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(p$e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw kI(i),o}},p$e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>m$e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},m$e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=iK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},kI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},h$e=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as cK}from"node:fs";var uK,Mi,g$e,dK,lK,y$e,fK=y(()=>{an();av();$r();uK=(t,e)=>sv(y$e,t,e,!0),Mi=({type:t,optionName:e})=>{dK(e,ys[t])},g$e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&dK(t,`"${e}"`),{}),dK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},lK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:g$e},y$e={input:{...lK,fileUrl:({value:t})=>({contents:[vo(cK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(cK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...lK,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var ko,EI,mp=y(()=>{cI();ko=(t,{stripFinalNewline:e},r)=>EI(e,r)&&t!==void 0&&!Array.isArray(t)?Ll(t):t,EI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,TI,pK,mK,_$e,b$e,v$e,hK,S$e,AI,w$e,x$e,$$e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:mK(e,n),TI=(t,e,r)=>r?t.flatMap(n=>pK(n,e)):pK(t,e),pK=(t,e)=>{let{transform:r,final:n}=mK(e,{});return[...r(t),...n()]},mK=(t,e)=>(e.previousChunks="",{transform:_$e.bind(void 0,e,t),final:v$e.bind(void 0,e)}),_$e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=AI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=AI(n,r.slice(i+1))),t.previousChunks=n},b$e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),v$e=function*({previousChunks:t}){t.length>0&&(yield t)},hK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:S$e.bind(void 0,n)},S$e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?w$e:$$e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},AI=(t,e)=>`${t}${e}`,w$e={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:AI},x0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},$0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:x0e}});import{Buffer as k0e}from"node:buffer";var gK,E0e,yK,A0e,T0e,_K,bK=y(()=>{an();gK=(t,e)=>t?void 0:E0e.bind(void 0,e),E0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!k0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},yK=(t,e)=>t?A0e.bind(void 0,e):T0e.bind(void 0,e),A0e=function*(t,e){_K(t,e),yield e},T0e=function*(t,e){if(_K(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},_K=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:AI},x$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},$$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:x$e}});import{Buffer as k$e}from"node:buffer";var gK,E$e,yK,A$e,T$e,_K,bK=y(()=>{an();gK=(t,e)=>t?void 0:E$e.bind(void 0,e),E$e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!k$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},yK=(t,e)=>t?A$e.bind(void 0,e):T$e.bind(void 0,e),A$e=function*(t,e){_K(t,e),yield e},T$e=function*(t,e){if(_K(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},_K=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as O0e}from"node:buffer";import{StringDecoder as R0e}from"node:string_decoder";var lv,I0e,P0e,C0e,OI=y(()=>{an();lv=(t,e,r)=>{if(r)return;if(t)return{transform:I0e.bind(void 0,new TextEncoder)};let n=new R0e(e);return{transform:P0e.bind(void 0,n),final:C0e.bind(void 0,n)}},I0e=function*(t,e){O0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},P0e=function*(t,e){yield qt(e)?t.write(e):e},C0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as vK}from"node:util";var RI,uv,SK,D0e,wK,N0e,xK=y(()=>{RI=vK(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),uv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=N0e}=e[r];for await(let i of n(t))yield*uv(i,e,r+1)},SK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*D0e(r,Number(e),t)},D0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*uv(n,r,e+1)},wK=vK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),N0e=function*(t){yield t}});var II,$K,Ua,pp,j0e,M0e,PI=y(()=>{II=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},$K=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...pp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=M0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},pp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*j0e(r,Number(e),t)},j0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ua(n,r,e+1)},M0e=function*(t){yield t}});import{Transform as F0e,getDefaultHighWaterMark as kK}from"node:stream";var CI,dv,EK,fv=y(()=>{$r();cv();bK();OI();xK();PI();CI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=EK(t,s,o),l=za(e),u=za(r),d=l?RI.bind(void 0,uv,a):II.bind(void 0,Ua),f=l||u?RI.bind(void 0,SK,a):II.bind(void 0,pp),p=l||u?wK.bind(void 0,a):void 0;return{stream:new F0e({writableObjectMode:n,writableHighWaterMark:kK(n),readableObjectMode:i,readableHighWaterMark:kK(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},dv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=EK(s,r,a);t=$K(c,t)}return t},EK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:gK(n,a)},lv(r,s,n),av(r,o,n,c),{transform:t,final:e},{transform:yK(i,a)},hK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var AK,L0e,z0e,U0e,q0e,TK=y(()=>{fv();an();$r();AK=(t,e)=>{for(let r of L0e(t))z0e(t,r,e)},L0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),z0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${ys[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>U0e(a,n));r.input=Yf(s)},U0e=(t,e)=>{let r=dv(t,e,"utf8",!0);return q0e(r),Yf(r)},q0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var pv,H0e,B0e,OK,RK,G0e,IK,DI=y(()=>{ja();$r();Rl();ps();pv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ol(r,n)&&!cn.has(e)&&H0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&B0e.has(o))||t.every(({type:i})=>Dn.has(i))),H0e=t=>t===1||t===2,B0e=new Set(["pipe","overlapped"]),OK=async(t,e,r,n)=>{for await(let i of t)G0e(e)||IK(i,r,n)},RK=(t,e,r)=>{for(let n of t)IK(n,e,r)},G0e=t=>t._readableState.pipes.length>0,IK=(t,e,r)=>{let n=fb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Z0e,appendFileSync as V0e}from"node:fs";var PK,W0e,K0e,J0e,Y0e,X0e,CK=y(()=>{DI();fv();cv();an();$r();La();PK=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>W0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},W0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=yW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=K0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=J0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Y0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&X0e(b,m,i),S}catch(x){return n.error=x,S}},K0e=(t,e,r,n)=>{try{return dv(t,e,r,!1)}catch(i){return n.error=i,t}},J0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Yf(t)};let s=aZ(t,r);return n[o]?{serializedResult:s,finalResult:TI(s,!i[o],e)}:{serializedResult:s}},Y0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!pv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=TI(t,!1,s);try{RK(a,e,n)}catch(c){r.error??=c}},X0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>iv.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?V0e(n,t):(r.add(o),Z0e(n,t))}}});var DK,NK=y(()=>{an();fp();DK=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ko(e,r,"all")]:Array.isArray(e)?[ko(t,r,"all"),...e]:qt(t)&&qt(e)?xR([t,e]):`${t}${e}`}});import{once as NI}from"node:events";var jK,Q0e,MK,FK,e$e,jI,MI=y(()=>{Da();jK=async(t,e)=>{let[r,n]=await Q0e(t);return e.isForcefullyTerminated??=!1,[r,n]},Q0e=async t=>{let[e,r]=await Promise.allSettled([NI(t,"spawn"),NI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?MK(t):r.value},MK=async t=>{try{return await NI(t,"exit")}catch{return MK(t)}},FK=async t=>{let[e,r]=await t;if(!e$e(e,r)&&jI(e,r))throw new ni;return[e,r]},e$e=(t,e)=>t===void 0&&e===void 0,jI=(t,e)=>t!==0||e!==null});var LK,t$e,zK=y(()=>{Da();La();MI();LK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=t$e(t,e,r),s=o?.code==="ETIMEDOUT",a=gW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},t$e=(t,e,r)=>t!==void 0?t:jI(e,r)?new ni:void 0});import{spawnSync as r$e}from"node:child_process";var UK,n$e,i$e,o$e,mv,s$e,a$e,c$e,l$e,qK=y(()=>{PR();sI();aI();dp();tv();fK();fp();TK();CK();La();NK();zK();UK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=n$e(t,e,r),d=s$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ul(d,c,l)},n$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=hb(t,e,r),a=i$e(r),{file:c,commandArguments:l,options:u}=qb(t,e,a);o$e(u);let d=uK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},i$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,o$e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&mv("ipcInput"),t&&mv("ipc: true"),r&&mv("detached: true"),n&&mv("cancelSignal")},mv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},s$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=a$e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=LK(c,r),{output:m,error:h=l}=PK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(DK(m,r),r,"all");return l$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},a$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{AK(o,r);let a=c$e(r);return r$e(...Hb(t,e,a))}catch(a){return zl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},c$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Qb(e)}),l$e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?ev({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):up({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as FI,on as u$e}from"node:events";var HK,d$e,f$e,p$e,m$e,BK=y(()=>{Nl();op();ip();HK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Cl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Nb(t)}),d$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),d$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Tb(e,i);let o=gs(t,e,r),s=new AbortController;try{return await Promise.race([f$e(o,n,s),p$e(o,r,s),m$e(o,r,s)])}catch(a){throw Dl(t),a}finally{s.abort(),Ob(e,i)}},f$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await FI(t,"message",{signal:r});return n}for await(let[n]of u$e(t,"message",{signal:r}))if(e(n))return n},p$e=async(t,e,{signal:r})=>{await FI(t,"disconnect",{signal:r}),t9(e)},m$e=async(t,e,{signal:r})=>{let[n]=await FI(t,"strict:error",{signal:r});throw $b(n,e)}});import{once as ZK,on as h$e}from"node:events";var VK,LI,g$e,y$e,_$e,GK,zI=y(()=>{Nl();op();ip();VK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>LI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),LI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Cl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Nb(t)}),Tb(e,o);let s=gs(t,e,r),a=new AbortController,c={};return g$e(t,s,a),y$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),_$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},g$e=async(t,e,r)=>{try{await ZK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},y$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await ZK(t,"strict:error",{signal:r.signal});n.error=$b(i,e),r.abort()}catch{}},_$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of h$e(r,"message",{signal:o.signal}))GK(s),yield c}catch{GK(s)}finally{o.abort(),Ob(e,a),n||Dl(t),i&&await t}},GK=({error:t})=>{if(t)throw t}});import WK from"node:process";var KK,JK,YK,UI=y(()=>{zb();BK();zI();Cb();KK=(t,{ipc:e})=>{Object.assign(t,YK(t,!1,e))},JK=()=>{let t=WK,e=!0,r=WK.channel!==void 0;return{...YK(t,e,r),getCancelSignal:O9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},YK=(t,e,r)=>({sendMessage:Lb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:HK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:VK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as b$e}from"node:child_process";import{PassThrough as v$e,Readable as S$e,Writable as w$e,Duplex as x$e}from"node:stream";var XK,$$e,mp,k$e,E$e,A$e,T$e,QK=y(()=>{sv();dp();tv();XK=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{kI(n);let a=new b$e;$$e(a,n),Object.assign(a,{readable:k$e,writable:E$e,duplex:A$e});let c=zl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=T$e(c,s,i);return{subprocess:a,promise:l}},$$e=(t,e)=>{let r=mp(),n=mp(),i=mp(),o=Array.from({length:e.length-3},mp),s=mp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},mp=()=>{let t=new v$e;return t.end(),t},k$e=()=>new S$e({read(){}}),E$e=()=>new w$e({write(){}}),A$e=()=>new x$e({read(){},write(){}}),T$e=async(t,e,r)=>Ul(t,e,r)});import{createReadStream as e3,createWriteStream as t3}from"node:fs";import{Buffer as O$e}from"node:buffer";import{Readable as hp,Writable as R$e,Duplex as I$e}from"node:stream";var n3,gp,r3,P$e,i3=y(()=>{fv();sv();$r();n3=(t,e)=>ov(P$e,t,e,!1),gp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},r3={fileNumber:gp,generator:CI,asyncGenerator:CI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:I$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},P$e={input:{...r3,fileUrl:({value:t})=>({stream:e3(t)}),filePath:({value:{file:t}})=>({stream:e3(t)}),webStream:({value:t})=>({stream:hp.fromWeb(t)}),iterable:({value:t})=>({stream:hp.from(t)}),asyncIterable:({value:t})=>({stream:hp.from(t)}),string:({value:t})=>({stream:hp.from(t)}),uint8Array:({value:t})=>({stream:hp.from(O$e.from(t))})},output:{...r3,fileUrl:({value:t})=>({stream:t3(t)}),filePath:({value:{file:t,append:e}})=>({stream:t3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:R$e.fromWeb(t)}),iterable:gp,asyncIterable:gp,string:gp,uint8Array:gp}}});import{on as C$e,once as o3}from"node:events";import{PassThrough as D$e,getDefaultHighWaterMark as N$e}from"node:stream";import{finished as c3}from"node:stream/promises";function qa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)HI(i);let e=t.some(({readableObjectMode:i})=>i),r=j$e(t,e),n=new qI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var j$e,qI,M$e,F$e,L$e,HI,z$e,U$e,q$e,H$e,B$e,l3,u3,BI,d3,G$e,hv,s3,a3,gv=y(()=>{j$e=(t,e)=>{if(t.length===0)return N$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},qI=class extends D$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(HI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=M$e(this,this.#t,this.#o);let r=z$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(HI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},M$e=async(t,e,r)=>{hv(t,s3);let n=new AbortController;try{await Promise.race([F$e(t,n),L$e(t,e,r,n)])}finally{n.abort(),hv(t,-s3)}},F$e=async(t,{signal:e})=>{try{await c3(t,{signal:e,cleanup:!0})}catch(r){throw l3(t,r),r}},L$e=async(t,e,r,{signal:n})=>{for await(let[i]of C$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},HI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},z$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{hv(t,a3);let a=new AbortController;try{await Promise.race([U$e(o,e,a),q$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),H$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),hv(t,-a3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?BI(t):B$e(t))},U$e=async(t,e,{signal:r})=>{try{await t,r.aborted||BI(e)}catch(n){r.aborted||l3(e,n)}},q$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await c3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;u3(s)?i.add(e):d3(t,s)}},H$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await o3(t,i,{signal:o}),!t.readable)return o3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},B$e=t=>{t.writable&&t.end()},l3=(t,e)=>{u3(e)?BI(t):d3(t,e)},u3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",BI=t=>{(t.readable||t.writable)&&t.destroy()},d3=(t,e)=>{t.destroyed||(t.once("error",G$e),t.destroy(e))},G$e=()=>{},hv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},s3=2,a3=1});import{finished as f3}from"node:stream/promises";var Hl,Z$e,GI,V$e,ZI,yv=y(()=>{So();Hl=(t,e)=>{t.pipe(e),Z$e(t,e),V$e(t,e)},Z$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await f3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}GI(e)}},GI=t=>{t.writable&&t.end()},V$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await f3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}ZI(t)}},ZI=t=>{t.readable&&t.destroy()}});var p3,W$e,K$e,J$e,Y$e,X$e,m3=y(()=>{gv();So();Ab();$r();yv();p3=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Dn.has(c)))W$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Dn.has(c)))J$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:qa(o);Hl(s,i)}},W$e=(t,e,r,n)=>{r==="output"?Hl(t.stdio[n],e):Hl(e,t.stdio[n]);let i=K$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},K$e=["stdin","stdout","stderr"],J$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Y$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Y$e=(t,{signal:e})=>{ri(t)&&Na(t,X$e,e)},X$e=2});var Ha,h3=y(()=>{Ha=[];Ha.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ha.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ha.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var _v,VI,WI,Q$e,KI,bv,eke,JI,YI,XI,g3,Cct,Dct,y3=y(()=>{h3();_v=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",VI=Symbol.for("signal-exit emitter"),WI=globalThis,Q$e=Object.defineProperty.bind(Object),KI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(WI[VI])return WI[VI];Q$e(WI,VI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},bv=class{},eke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),JI=class extends bv{onExit(){return()=>{}}load(){}unload(){}},YI=class extends bv{#t=XI.platform==="win32"?"SIGINT":"SIGHUP";#r=new KI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ha)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!_v(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ha)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ha.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return _v(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&_v(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},XI=globalThis.process,{onExit:g3,load:Cct,unload:Dct}=eke(_v(XI)?new YI(XI):new JI)});import{addAbortListener as tke}from"node:events";var _3,b3=y(()=>{y3();_3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=g3(()=>{t.kill()});tke(n,()=>{i()})}});var S3,rke,nke,v3,ike,w3=y(()=>{wR();mb();hs();Al();S3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=pb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=rke(r,n,i),{sourceStream:d,sourceError:f}=ike(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},rke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=nke(t,e,...r),a=Eb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},nke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(v3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||vR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=rb(r,...n);return{destination:e(v3)(i,o,s),pipeOptions:s}}if(Ni.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},v3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ike=(t,e)=>{try{return{sourceStream:Ml(t,e)}}catch(r){return{sourceError:r}}}});var $3,oke,QI,x3,eP=y(()=>{dp();yv();$3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=oke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw QI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},oke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return ZI(t),n;if(e!==void 0)return GI(r),e},QI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>zl({error:t,command:x3,escapedCommand:x3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),x3="source.pipe(destination)"});var k3,E3=y(()=>{k3=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as ske}from"node:stream/promises";var A3,ake,cke,lke,vv,uke,dke,T3=y(()=>{gv();Ab();yv();A3=(t,e,r)=>{let n=vv.has(e)?cke(t,e):ake(t,e);return Na(t,uke,r.signal),Na(e,dke,r.signal),lke(e),n},ake=(t,e)=>{let r=qa([t]);return Hl(r,e),vv.set(e,r),r},cke=(t,e)=>{let r=vv.get(e);return r.add(t),r},lke=async t=>{try{await ske(t,{cleanup:!0,readable:!1,writable:!0})}catch{}vv.delete(t)},vv=new WeakMap,uke=2,dke=1});import{aborted as fke}from"node:util";var O3,pke,R3=y(()=>{eP();O3=(t,e)=>t===void 0?[]:[pke(t,e)],pke=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await fke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw QI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Sv,mke,hke,I3=y(()=>{bo();w3();eP();E3();T3();R3();Sv=(t,...e)=>{if(Ot(e[0]))return Sv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=S3(t,...e),i=mke({...n,destination:r});return i.pipe=Sv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},mke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=hke(t,i);$3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=A3(e,o,d);return await Promise.race([k3(u),...O3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},hke=(t,e)=>Promise.allSettled([t,e])});import{on as gke}from"node:events";import{getDefaultHighWaterMark as yke}from"node:stream";var wv,_ke,tP,bke,C3,rP,P3,vke,Ske,xv=y(()=>{OI();cv();PI();wv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return _ke(e,s),C3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},_ke=async(t,e)=>{try{await t}catch{}finally{e.abort()}},tP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;bke(e,s,t);let a=t.readableObjectMode&&!o;return C3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},bke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},C3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=gke(t,"data",{signal:e.signal,highWaterMark:P3,highWatermark:P3});return vke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},rP=yke(!0),P3=rP,vke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Ske({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ua(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*pp(a)}},Ske=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[lv(t,r,!e),av(t,i,!n,{})].filter(Boolean)});import{setImmediate as wke}from"node:timers/promises";var D3,xke,$ke,kke,nP,N3,iP=y(()=>{Xb();an();DI();xv();La();fp();D3=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=xke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([$ke(t),d]);return}let f=EI(c,r),p=tP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([kke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},xke=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!pv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=tP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await OK(a,t,r,o)},$ke=async t=>{await wke(),t.readableFlowing===null&&t.resume()},kke=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Wb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Kb(r,{maxBuffer:o})):await Yb(r,{maxBuffer:o})}catch(a){return N3(pW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},nP=async t=>{try{return await t}catch(e){return N3(e)}},N3=({bufferedData:t})=>oZ(t)?new Uint8Array(t):t});import{finished as Eke}from"node:stream/promises";var yp,Ake,Tke,Oke,Rke,Ike,oP,$v,j3,kv=y(()=>{yp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Ake(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Eke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Rke(a,e,r,n)}finally{s.abort()}},Ake=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Tke(t,r,n),n},Tke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Oke(e,r),n.call(t,...i)}},Oke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Rke=(t,e,r,n)=>{if(!Ike(t,e,r,n))throw t},Ike=(t,e,r,n=!0)=>r.propagating?j3(t)||$v(t):(r.propagating=!0,oP(r,e)===n?j3(t):$v(t)),oP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",$v=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",j3=t=>t?.code==="EPIPE"});var M3,sP,aP=y(()=>{iP();kv();M3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>sP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),sP=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=yp(t,e,l);if(oP(l,e)){await u;return}let[d]=await Promise.all([D3({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var F3,L3,Pke,Cke,cP=y(()=>{gv();aP();F3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,L3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>sP({...Pke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Cke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Pke=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Cke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var z3,U3,q3=y(()=>{Rl();ps();z3=t=>Ol(t,"ipc"),U3=(t,e)=>{let r=fb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var H3,B3,G3=y(()=>{La();q3();xo();zI();H3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=z3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of LI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(mW(t,i,c),i.push(l)),s&&U3(l,o);return i},B3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Dke}from"node:events";var Z3,Nke,jke,Mke,V3=y(()=>{Fa();tI();ZR();eI();So();$r();iP();G3();nI();cP();aP();MI();kv();Z3=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=jK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=M3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=L3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=H3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Nke(h,t,S),D=jke(m,S);try{return await Promise.race([Promise.all([{},FK(_),Promise.all(x),w,A,L9(t,d),...T,...D]),g,Mke(t,b),...D9(t,o,f,b),...e9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...P9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(E){return f.terminationReason??="other",Promise.all([{error:E},_,Promise.all(x.map(ae=>nP(ae))),nP(w),B3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Nke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:yp(n,i,r)),jke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>oi(o,{checkOpen:!1})&&!ri(o)).map(({type:i,value:o,stream:s=o})=>yp(s,n,e,{isSameDirection:Dn.has(i),stopOnExit:i==="native"}))),Mke=async(t,{signal:e})=>{let[r]=await Dke(t,"error",{signal:e});throw r}});var W3,_p,Bl,Ev=y(()=>{jl();W3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),_p=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Bl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as K3}from"node:stream/promises";var lP,J3,uP,dP,Av,Tv,fP=y(()=>{kv();lP=async t=>{if(t!==void 0)try{await uP(t)}catch{}},J3=async t=>{if(t!==void 0)try{await dP(t)}catch{}},uP=async t=>{await K3(t,{cleanup:!0,readable:!1,writable:!0})},dP=async t=>{await K3(t,{cleanup:!0,readable:!0,writable:!1})},Av=async(t,e)=>{if(await t,e)throw e},Tv=(t,e,r)=>{r&&!$v(r)?t.destroy(r):e&&t.destroy()}});import{Readable as Fke}from"node:stream";import{callbackify as Lke}from"node:util";var Y3,pP,mP,hP,zke,gP,yP,X3,_P=y(()=>{ja();hs();xv();jl();Ev();fP();Y3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=pP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=mP(a,s),{read:f,onStdoutDataDone:p}=hP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Fke({read:f,destroy:Lke(yP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return gP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},pP=(t,e,r)=>{let n=Ml(t,e),i=_p(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},mP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:rP},hP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=wv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){zke(this,s,o)},onStdoutDataDone:o}},zke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},gP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await dP(t),await n,await lP(i),await e,r.readable&&r.push(null)}catch(o){await lP(i),X3(r,o)}},yP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(X3(t,n),await Av(e,n))},X3=(t,e)=>{Tv(t,t.readable,e)}});import{Writable as Uke}from"node:stream";import{callbackify as Q3}from"node:util";var eJ,bP,vP,qke,Hke,SP,wP,tJ,xP=y(()=>{hs();Ev();fP();eJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=bP(t,r,e),s=new Uke({...vP(n,t,i),destroy:Q3(wP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return SP(n,s),s},bP=(t,e,r)=>{let n=Eb(t,e),i=_p(r,n,"writableFinal"),o=_p(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},vP=(t,e,r)=>({write:qke.bind(void 0,t),final:Q3(Hke.bind(void 0,t,e,r))}),qke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Hke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},SP=async(t,e,r)=>{try{await uP(t),e.writable&&e.end()}catch(n){await J3(r),tJ(e,n)}},wP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(tJ(t,i),await Av(e,i))},tJ=(t,e)=>{Tv(t,t.writable,e)}});import{Duplex as Bke}from"node:stream";import{callbackify as Gke}from"node:util";var rJ,Zke,nJ=y(()=>{ja();_P();xP();rJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||cn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=pP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=bP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=mP(c,a),{read:g,onStdoutDataDone:b}=hP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Bke({read:g,...vP(u,t,d),destroy:Gke(Zke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return gP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),SP(u,_,c),_},Zke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([yP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),wP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var $P,Vke,iJ=y(()=>{ja();hs();xv();$P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Ml(t,r),a=wv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Vke(a,s,t)},Vke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var oJ,sJ=y(()=>{Ev();_P();xP();nJ();iJ();oJ=(t,{encoding:e})=>{let r=W3();t.readable=Y3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=eJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=rJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=$P.bind(void 0,t,e),t[Symbol.asyncIterator]=$P.bind(void 0,t,e,{})}});var aJ,Wke,Kke,cJ=y(()=>{aJ=(t,e)=>{for(let[r,n]of Kke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Wke=(async()=>{})().constructor.prototype,Kke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Wke,t)])});import{setMaxListeners as Jke}from"node:events";import{spawn as Yke}from"node:child_process";var lJ,Xke,Qke,eEe,tEe,rEe,uJ=y(()=>{Xb();PR();sI();hs();aI();UI();dp();tv();QK();i3();fp();m3();wb();b3();I3();cP();V3();sJ();jl();cJ();lJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Xke(t,e,r),{subprocess:f,promise:p}=eEe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Sv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),aJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Xke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=hb(t,e,r),{file:a,commandArguments:c,options:l}=qb(t,e,r),u=Qke(l),d=n3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Qke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},eEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Yke(...Hb(t,e,r))}catch(m){return XK({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Jke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];p3(c,a,l),_3(c,r,l);let d={},f=Di();c.kill=XV.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=F3(c,r),oJ(c,r),KK(c,r);let p=tEe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},tEe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await Z3({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>ko(x,e,w)),_=ko(h,e,"all"),S=rEe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ul(S,n,e)},rEe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?up({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):ev({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Ov,nEe,iEe,dJ=y(()=>{bo();xo();Ov=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,nEe(n,t[n],i)]));return{...t,...r}},nEe=(t,e,r)=>iEe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,iEe=new Set(["env",...AR])});var _s,oEe,sEe,fJ=y(()=>{bo();wR();pZ();qK();uJ();dJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>oEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},oEe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Ov(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=sEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?UK(a,c,l):lJ(a,c,l,i)},sEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=dZ(e)?fZ(e,r):[e,...r],[s,a,c]=rb(...o),l=Ov(Ov(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var pJ,mJ,hJ,aEe,cEe,gJ=y(()=>{pJ=({file:t,commandArguments:e})=>hJ(t,e),mJ=({file:t,commandArguments:e})=>({...hJ(t,e),isSync:!0}),hJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=aEe(t);return{file:r,commandArguments:n}},aEe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(cEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},cEe=/ +/g});var yJ,_J,lEe,bJ,uEe,vJ,SJ=y(()=>{yJ=(t,e,r)=>{t.sync=e(lEe,r),t.s=t.sync},_J=({options:t})=>bJ(t),lEe=({options:t})=>({...bJ(t),isSync:!0}),bJ=t=>({options:{...uEe(t),...t}}),uEe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},vJ={preferLocal:!0}});var xdt,Ke,$dt,kdt,Edt,Adt,Tdt,Odt,Rdt,Idt,zr=y(()=>{fJ();gJ();rI();SJ();UI();xdt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),$dt=_s(pJ),kdt=_s(mJ),Edt=_s(j9),Adt=_s(_J,{},vJ,yJ),{sendMessage:Tdt,getOneMessage:Odt,getEachMessage:Rdt,getCancelSignal:Idt}=JK()});import{existsSync as Rv,statSync as dEe}from"node:fs";import{dirname as kP,extname as fEe,isAbsolute as wJ,join as EP,relative as AP,resolve as Iv,sep as pEe}from"node:path";function Pv(t){return t==="./gradlew"||t==="gradle"}function mEe(t){return(Rv(EP(t,"build.gradle.kts"))||Rv(EP(t,"build.gradle")))&&Rv(EP(t,"gradle.properties"))}function hEe(t,e){let n=AP(t,e).split(pEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function gEe(t,e){let r=Iv(t,e),n=r;Rv(r)?dEe(r).isFile()&&(n=kP(r)):fEe(r)!==""&&(n=kP(r));let i=AP(t,n);if(i.startsWith("..")||wJ(i))return null;let o=n;for(;;){if(mEe(o))return o;if(Iv(o)===Iv(t))return null;let s=kP(o);if(s===o)return null;let a=AP(t,s);if(a.startsWith("..")||wJ(a))return null;o=s}}function Cv(t,e){let r=Iv(t),n=new Map,i=[];for(let o of e){let s=gEe(r,o);if(!s){i.push(o);continue}let a=hEe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Dv=y(()=>{"use strict"});import{existsSync as OP,readFileSync as yEe}from"node:fs";import{join as Gl}from"node:path";function Zl(t="."){let e=Gl(t,".cladding","config.yaml");if(!OP(e))return TP;try{let n=(0,xJ.parse)(yEe(e,"utf8"))?.gate;if(!n)return TP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of _Ee){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return TP}}function $J(t="."){let e=Zl(t).testReport,r=e?[e,...RP]:RP;return[...new Set(r.map(n=>Gl(t,n)))]}function kJ(t="."){let e=Zl(t).testReport;if(e){let r=Gl(t,e);return OP(r)?r:null}return RP.map(r=>Gl(t,r)).find(r=>OP(r))??null}function EJ(t,e){let r=[],n=!1;for(let i of t){let o=bEe.exec(i);if(o){n=!0;for(let s of e)r.push(bs(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var xJ,_Ee,TP,RP,bEe,bp=y(()=>{"use strict";xJ=wt(tr(),1);Dv();_Ee=["type","lint","test","coverage"],TP={scope:"feature"},RP=["test-report.junit.xml",Gl("coverage","junit.xml"),Gl(".cladding","test-report.junit.xml")];bEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as PP,readFileSync as AJ,readdirSync as vEe,statSync as SEe}from"node:fs";import{join as Nv}from"node:path";function NP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Nv(t,e);if(PP(r))try{if(TJ.test(AJ(r,"utf8")))return!0}catch{}}return!1}function OJ(t){try{return PP(t)&&TJ.test(AJ(t,"utf8"))}catch{return!1}}function RJ(t,e=0){if(e>4||!PP(t))return!1;let r;try{r=vEe(t)}catch{return!1}for(let n of r){let i=Nv(t,n),o=!1;try{o=SEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(RJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&OJ(i))return!0}return!1}function $Ee(t){if(NP(t))return!0;for(let e of wEe)if(OJ(Nv(t,e)))return!0;for(let e of xEe)if(RJ(Nv(t,e)))return!0;return!1}function IJ(t="."){let e=Zl(t).coverage;return e||($Ee(t)?"kover":"jacoco")}function PJ(t="."){return CP[IJ(t)]}function CJ(t="."){return IP[IJ(t)]}var CP,IP,DP,TJ,wEe,xEe,jv=y(()=>{"use strict";bp();CP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},IP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},DP=[IP.kover,IP.jacoco],TJ=/kover/i;wEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],xEe=["buildSrc","build-logic"]});import{existsSync as Sp,readFileSync as MP,readdirSync as NJ,statSync as kEe}from"node:fs";import{dirname as EEe,join as kr,resolve as AEe}from"node:path";import Vl from"node:process";function FP(t){return Sp(kr(t,"gradlew"))?"./gradlew":"gradle"}function TEe(t){let e=FP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[PJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function OEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(MP(kr(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function IEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function DEe(t,e){for(let r of e)if(Sp(kr(t,r)))return r}function NEe(t,e){try{return NJ(t).find(n=>n.endsWith(e))}catch{return}}function LEe(t){let e=[],r=Vl.platform==="win32";r||e.push(kr("/etc","madge","config"),kr("/etc","madgerc"));let n=r?Vl.env.USERPROFILE:Vl.env.HOME;n&&e.push(kr(n,".config","madge","config"),kr(n,".config","madge"),kr(n,".madge","config"),kr(n,".madgerc"));for(let o=AEe(t);;){e.push(kr(o,".madgerc"));let s=EEe(o);if(s===o)break;o=s}let i=Vl.env.MADGE_config??Vl.env.madge_config;return i&&e.push(i),e}function zEe(){for(let[t,e]of Object.entries(Vl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function jJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function qEe(t){try{return kEe(t).isFile()}catch{return!1}}function HEe(t){let e;try{e=MP(t,"utf8")}catch{return!0}try{return jJ(JSON.parse(e).excludeRegExp)}catch{return UEe.test(e)}}function BEe(t,e){let r=e.madge;return r&&typeof r=="object"&&jJ(r.excludeRegExp)||zEe()?!0:LEe(t).some(n=>qEe(n)&&HEe(n))}function GEe(t){try{return JSON.parse(MP(kr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function vp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function DJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function ZEe(t,e,r){if(BEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",FEe),{...e,args:n}}function VEe(t,e,r){if(vp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of jEe)if(n.configs.some(i=>Sp(kr(t,i))))return n.gate;if(MEe.some(n=>Sp(kr(t,n)))||r.eslintConfig!==void 0)return e}function KEe(t,e){return WEe.some(r=>Sp(kr(t,r)))?!0:e.jest!==void 0}function JEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function jP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function YEe(t,e){let r=GEe(t),n=e.lint?VEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:ZEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:jP(i,"lint"),s=vp(r,"test"),a=s?JEe(s):void 0;return s&&!a?(o=jP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...vp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&KEe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!vp(r,"coverage")&&!DJ(r,"@vitest/coverage-v8")&&!DJ(r,"@vitest/coverage-istanbul")?o=jP(o,"coverage"):a==="vitest"&&vp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function ft(t="."){for(let e of PEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=NEe(t,o):r=DEe(t,[o]),r)break;if(!r||e.requiresSource&&!IEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?YEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return CEe}var Fi,REe,PEe,CEe,jEe,MEe,FEe,UEe,WEe,ln=y(()=>{"use strict";jv();Fi=["--offline","--no-install"];REe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);PEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:TEe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:OEe}],CEe={language:"unknown",manifest:"",gates:{}};jEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],MEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],FEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";UEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;WEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as XEe,readFileSync as QEe}from"node:fs";import{join as eAe}from"node:path";function Ba(t){return t.code==="ENOENT"}function Mv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=[s,o].filter(c=>c.length>0).join(` -`).slice(0,2e3)||`exit ${i}`;return MJ.test(o)||MJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(Ba(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} + if (condition) { yield value; }`)}});import{Buffer as O$e}from"node:buffer";import{StringDecoder as R$e}from"node:string_decoder";var uv,I$e,P$e,C$e,OI=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:I$e.bind(void 0,new TextEncoder)};let n=new R$e(e);return{transform:P$e.bind(void 0,n),final:C$e.bind(void 0,n)}},I$e=function*(t,e){O$e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},P$e=function*(t,e){yield qt(e)?t.write(e):e},C$e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as vK}from"node:util";var RI,dv,SK,D$e,wK,N$e,xK=y(()=>{RI=vK(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),dv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=N$e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},SK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*D$e(r,Number(e),t)},D$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},wK=vK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),N$e=function*(t){yield t}});var II,$K,qa,hp,j$e,M$e,PI=y(()=>{II=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},$K=(t,e)=>[...e.flatMap(r=>[...qa(r,t,0)]),...hp(t)],qa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=M$e}=e[r];for(let i of n(t))yield*qa(i,e,r+1)},hp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*j$e(r,Number(e),t)},j$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*qa(n,r,e+1)},M$e=function*(t){yield t}});import{Transform as F$e,getDefaultHighWaterMark as kK}from"node:stream";var CI,fv,EK,pv=y(()=>{$r();lv();bK();OI();xK();PI();CI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=EK(t,s,o),l=Ua(e),u=Ua(r),d=l?RI.bind(void 0,dv,a):II.bind(void 0,qa),f=l||u?RI.bind(void 0,SK,a):II.bind(void 0,hp),p=l||u?wK.bind(void 0,a):void 0;return{stream:new F$e({writableObjectMode:n,writableHighWaterMark:kK(n),readableObjectMode:i,readableHighWaterMark:kK(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},fv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=EK(s,r,a);t=$K(c,t)}return t},EK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:gK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:yK(i,a)},hK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var AK,L$e,z$e,U$e,q$e,TK=y(()=>{pv();an();$r();AK=(t,e)=>{for(let r of L$e(t))z$e(t,r,e)},L$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),z$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${ys[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>U$e(a,n));r.input=Qf(s)},U$e=(t,e)=>{let r=fv(t,e,"utf8",!0);return q$e(r),Qf(r)},q$e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var mv,H$e,B$e,OK,RK,G$e,IK,DI=y(()=>{Ma();$r();Il();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Rl(r,n)&&!cn.has(e)&&H$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&B$e.has(o))||t.every(({type:i})=>Dn.has(i))),H$e=t=>t===1||t===2,B$e=new Set(["pipe","overlapped"]),OK=async(t,e,r,n)=>{for await(let i of t)G$e(e)||IK(i,r,n)},RK=(t,e,r)=>{for(let n of t)IK(n,e,r)},G$e=t=>t._readableState.pipes.length>0,IK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Z$e,appendFileSync as V$e}from"node:fs";var PK,W$e,K$e,J$e,Y$e,X$e,CK=y(()=>{DI();pv();lv();an();$r();za();PK=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>W$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},W$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=yW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=K$e([p],m,c,n),{serializedResult:b,finalResult:_=b}=J$e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Y$e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&X$e(b,m,i),S}catch(x){return n.error=x,S}},K$e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},J$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Qf(t)};let s=aZ(t,r);return n[o]?{serializedResult:s,finalResult:TI(s,!i[o],e)}:{serializedResult:s}},Y$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!mv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=TI(t,!1,s);try{RK(a,e,n)}catch(c){r.error??=c}},X$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>ov.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?V$e(n,t):(r.add(o),Z$e(n,t))}}});var DK,NK=y(()=>{an();mp();DK=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ko(e,r,"all")]:Array.isArray(e)?[ko(t,r,"all"),...e]:qt(t)&&qt(e)?xR([t,e]):`${t}${e}`}});import{once as NI}from"node:events";var jK,Q$e,MK,FK,e0e,jI,MI=y(()=>{Na();jK=async(t,e)=>{let[r,n]=await Q$e(t);return e.isForcefullyTerminated??=!1,[r,n]},Q$e=async t=>{let[e,r]=await Promise.allSettled([NI(t,"spawn"),NI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?MK(t):r.value},MK=async t=>{try{return await NI(t,"exit")}catch{return MK(t)}},FK=async t=>{let[e,r]=await t;if(!e0e(e,r)&&jI(e,r))throw new ni;return[e,r]},e0e=(t,e)=>t===void 0&&e===void 0,jI=(t,e)=>t!==0||e!==null});var LK,t0e,zK=y(()=>{Na();za();MI();LK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=t0e(t,e,r),s=o?.code==="ETIMEDOUT",a=gW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},t0e=(t,e,r)=>t!==void 0?t:jI(e,r)?new ni:void 0});import{spawnSync as r0e}from"node:child_process";var UK,n0e,i0e,o0e,hv,s0e,a0e,c0e,l0e,qK=y(()=>{PR();sI();aI();pp();rv();fK();mp();TK();CK();za();NK();zK();UK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=n0e(t,e,r),d=s0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return ql(d,c,l)},n0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=i0e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);o0e(u);let d=uK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},i0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,o0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&hv("ipcInput"),t&&hv("ipc: true"),r&&hv("detached: true"),n&&hv("cancelSignal")},hv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},s0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=a0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=LK(c,r),{output:m,error:h=l}=PK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(DK(m,r),r,"all");return l0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},a0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{AK(o,r);let a=c0e(r);return r0e(...Bb(t,e,a))}catch(a){return Ul({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},c0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),l0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?tv({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):fp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as FI,on as u0e}from"node:events";var HK,d0e,f0e,p0e,m0e,BK=y(()=>{jl();ap();sp();HK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Dl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),d0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),d0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Ob(e,i);let o=gs(t,e,r),s=new AbortController;try{return await Promise.race([f0e(o,n,s),p0e(o,r,s),m0e(o,r,s)])}catch(a){throw Nl(t),a}finally{s.abort(),Rb(e,i)}},f0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await FI(t,"message",{signal:r});return n}for await(let[n]of u0e(t,"message",{signal:r}))if(e(n))return n},p0e=async(t,e,{signal:r})=>{await FI(t,"disconnect",{signal:r}),t9(e)},m0e=async(t,e,{signal:r})=>{let[n]=await FI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as ZK,on as h0e}from"node:events";var VK,LI,g0e,y0e,_0e,GK,zI=y(()=>{jl();ap();sp();VK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>LI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),LI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Dl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),Ob(e,o);let s=gs(t,e,r),a=new AbortController,c={};return g0e(t,s,a),y0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),_0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},g0e=async(t,e,r)=>{try{await ZK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},y0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await ZK(t,"strict:error",{signal:r.signal});n.error=kb(i,e),r.abort()}catch{}},_0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of h0e(r,"message",{signal:o.signal}))GK(s),yield c}catch{GK(s)}finally{o.abort(),Rb(e,a),n||Nl(t),i&&await t}},GK=({error:t})=>{if(t)throw t}});import WK from"node:process";var KK,JK,YK,UI=y(()=>{Ub();BK();zI();Db();KK=(t,{ipc:e})=>{Object.assign(t,YK(t,!1,e))},JK=()=>{let t=WK,e=!0,r=WK.channel!==void 0;return{...YK(t,e,r),getCancelSignal:O9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},YK=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:HK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:VK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as b0e}from"node:child_process";import{PassThrough as v0e,Readable as S0e,Writable as w0e,Duplex as x0e}from"node:stream";var XK,$0e,gp,k0e,E0e,A0e,T0e,QK=y(()=>{av();pp();rv();XK=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{kI(n);let a=new b0e;$0e(a,n),Object.assign(a,{readable:k0e,writable:E0e,duplex:A0e});let c=Ul({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=T0e(c,s,i);return{subprocess:a,promise:l}},$0e=(t,e)=>{let r=gp(),n=gp(),i=gp(),o=Array.from({length:e.length-3},gp),s=gp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},gp=()=>{let t=new v0e;return t.end(),t},k0e=()=>new S0e({read(){}}),E0e=()=>new w0e({write(){}}),A0e=()=>new x0e({read(){},write(){}}),T0e=async(t,e,r)=>ql(t,e,r)});import{createReadStream as e3,createWriteStream as t3}from"node:fs";import{Buffer as O0e}from"node:buffer";import{Readable as yp,Writable as R0e,Duplex as I0e}from"node:stream";var n3,_p,r3,P0e,i3=y(()=>{pv();av();$r();n3=(t,e)=>sv(P0e,t,e,!1),_p=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},r3={fileNumber:_p,generator:CI,asyncGenerator:CI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:I0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},P0e={input:{...r3,fileUrl:({value:t})=>({stream:e3(t)}),filePath:({value:{file:t}})=>({stream:e3(t)}),webStream:({value:t})=>({stream:yp.fromWeb(t)}),iterable:({value:t})=>({stream:yp.from(t)}),asyncIterable:({value:t})=>({stream:yp.from(t)}),string:({value:t})=>({stream:yp.from(t)}),uint8Array:({value:t})=>({stream:yp.from(O0e.from(t))})},output:{...r3,fileUrl:({value:t})=>({stream:t3(t)}),filePath:({value:{file:t,append:e}})=>({stream:t3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:R0e.fromWeb(t)}),iterable:_p,asyncIterable:_p,string:_p,uint8Array:_p}}});import{on as C0e,once as o3}from"node:events";import{PassThrough as D0e,getDefaultHighWaterMark as N0e}from"node:stream";import{finished as c3}from"node:stream/promises";function Ha(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)HI(i);let e=t.some(({readableObjectMode:i})=>i),r=j0e(t,e),n=new qI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var j0e,qI,M0e,F0e,L0e,HI,z0e,U0e,q0e,H0e,B0e,l3,u3,BI,d3,G0e,gv,s3,a3,yv=y(()=>{j0e=(t,e)=>{if(t.length===0)return N0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},qI=class extends D0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(HI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=M0e(this,this.#t,this.#o);let r=z0e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(HI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},M0e=async(t,e,r)=>{gv(t,s3);let n=new AbortController;try{await Promise.race([F0e(t,n),L0e(t,e,r,n)])}finally{n.abort(),gv(t,-s3)}},F0e=async(t,{signal:e})=>{try{await c3(t,{signal:e,cleanup:!0})}catch(r){throw l3(t,r),r}},L0e=async(t,e,r,{signal:n})=>{for await(let[i]of C0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},HI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},z0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{gv(t,a3);let a=new AbortController;try{await Promise.race([U0e(o,e,a),q0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),H0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-a3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?BI(t):B0e(t))},U0e=async(t,e,{signal:r})=>{try{await t,r.aborted||BI(e)}catch(n){r.aborted||l3(e,n)}},q0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await c3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;u3(s)?i.add(e):d3(t,s)}},H0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await o3(t,i,{signal:o}),!t.readable)return o3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},B0e=t=>{t.writable&&t.end()},l3=(t,e)=>{u3(e)?BI(t):d3(t,e)},u3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",BI=t=>{(t.readable||t.writable)&&t.destroy()},d3=(t,e)=>{t.destroyed||(t.once("error",G0e),t.destroy(e))},G0e=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},s3=2,a3=1});import{finished as f3}from"node:stream/promises";var Bl,Z0e,GI,V0e,ZI,_v=y(()=>{So();Bl=(t,e)=>{t.pipe(e),Z0e(t,e),V0e(t,e)},Z0e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await f3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}GI(e)}},GI=t=>{t.writable&&t.end()},V0e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await f3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}ZI(t)}},ZI=t=>{t.readable&&t.destroy()}});var p3,W0e,K0e,J0e,Y0e,X0e,m3=y(()=>{yv();So();Tb();$r();_v();p3=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Dn.has(c)))W0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Dn.has(c)))J0e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Ha(o);Bl(s,i)}},W0e=(t,e,r,n)=>{r==="output"?Bl(t.stdio[n],e):Bl(e,t.stdio[n]);let i=K0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},K0e=["stdin","stdout","stderr"],J0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Y0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Y0e=(t,{signal:e})=>{ri(t)&&ja(t,X0e,e)},X0e=2});var Ba,h3=y(()=>{Ba=[];Ba.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ba.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ba.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var bv,VI,WI,Q0e,KI,vv,eke,JI,YI,XI,g3,Cct,Dct,y3=y(()=>{h3();bv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",VI=Symbol.for("signal-exit emitter"),WI=globalThis,Q0e=Object.defineProperty.bind(Object),KI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(WI[VI])return WI[VI];Q0e(WI,VI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},vv=class{},eke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),JI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},YI=class extends vv{#t=XI.platform==="win32"?"SIGINT":"SIGHUP";#r=new KI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ba)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!bv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ba)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ba.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return bv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&bv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},XI=globalThis.process,{onExit:g3,load:Cct,unload:Dct}=eke(bv(XI)?new YI(XI):new JI)});import{addAbortListener as tke}from"node:events";var _3,b3=y(()=>{y3();_3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=g3(()=>{t.kill()});tke(n,()=>{i()})}});var S3,rke,nke,v3,ike,w3=y(()=>{wR();hb();hs();Tl();S3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=rke(r,n,i),{sourceStream:d,sourceError:f}=ike(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},rke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=nke(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},nke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(v3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||vR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=nb(r,...n);return{destination:e(v3)(i,o,s),pipeOptions:s}}if(Ni.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},v3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ike=(t,e)=>{try{return{sourceStream:Fl(t,e)}}catch(r){return{sourceError:r}}}});var $3,oke,QI,x3,eP=y(()=>{pp();_v();$3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=oke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw QI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},oke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return ZI(t),n;if(e!==void 0)return GI(r),e},QI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ul({error:t,command:x3,escapedCommand:x3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),x3="source.pipe(destination)"});var k3,E3=y(()=>{k3=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as ske}from"node:stream/promises";var A3,ake,cke,lke,Sv,uke,dke,T3=y(()=>{yv();Tb();_v();A3=(t,e,r)=>{let n=Sv.has(e)?cke(t,e):ake(t,e);return ja(t,uke,r.signal),ja(e,dke,r.signal),lke(e),n},ake=(t,e)=>{let r=Ha([t]);return Bl(r,e),Sv.set(e,r),r},cke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},lke=async t=>{try{await ske(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,uke=2,dke=1});import{aborted as fke}from"node:util";var O3,pke,R3=y(()=>{eP();O3=(t,e)=>t===void 0?[]:[pke(t,e)],pke=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await fke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw QI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,mke,hke,I3=y(()=>{bo();w3();eP();E3();T3();R3();wv=(t,...e)=>{if(Ot(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=S3(t,...e),i=mke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},mke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=hke(t,i);$3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=A3(e,o,d);return await Promise.race([k3(u),...O3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},hke=(t,e)=>Promise.allSettled([t,e])});import{on as gke}from"node:events";import{getDefaultHighWaterMark as yke}from"node:stream";var xv,_ke,tP,bke,C3,rP,P3,vke,Ske,$v=y(()=>{OI();lv();PI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return _ke(e,s),C3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},_ke=async(t,e)=>{try{await t}catch{}finally{e.abort()}},tP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;bke(e,s,t);let a=t.readableObjectMode&&!o;return C3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},bke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},C3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=gke(t,"data",{signal:e.signal,highWaterMark:P3,highWatermark:P3});return vke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},rP=yke(!0),P3=rP,vke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Ske({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*qa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*hp(a)}},Ske=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as wke}from"node:timers/promises";var D3,xke,$ke,kke,nP,N3,iP=y(()=>{Qb();an();DI();$v();za();mp();D3=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=xke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([$ke(t),d]);return}let f=EI(c,r),p=tP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([kke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},xke=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!mv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=tP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await OK(a,t,r,o)},$ke=async t=>{await wke(),t.readableFlowing===null&&t.resume()},kke=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Kb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Jb(r,{maxBuffer:o})):await Xb(r,{maxBuffer:o})}catch(a){return N3(pW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},nP=async t=>{try{return await t}catch(e){return N3(e)}},N3=({bufferedData:t})=>oZ(t)?new Uint8Array(t):t});import{finished as Eke}from"node:stream/promises";var bp,Ake,Tke,Oke,Rke,Ike,oP,kv,j3,Ev=y(()=>{bp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Ake(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Eke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Rke(a,e,r,n)}finally{s.abort()}},Ake=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Tke(t,r,n),n},Tke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Oke(e,r),n.call(t,...i)}},Oke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Rke=(t,e,r,n)=>{if(!Ike(t,e,r,n))throw t},Ike=(t,e,r,n=!0)=>r.propagating?j3(t)||kv(t):(r.propagating=!0,oP(r,e)===n?j3(t):kv(t)),oP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",j3=t=>t?.code==="EPIPE"});var M3,sP,aP=y(()=>{iP();Ev();M3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>sP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),sP=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=bp(t,e,l);if(oP(l,e)){await u;return}let[d]=await Promise.all([D3({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var F3,L3,Pke,Cke,cP=y(()=>{yv();aP();F3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ha([t,e].filter(Boolean)):void 0,L3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>sP({...Pke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Cke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Pke=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Cke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var z3,U3,q3=y(()=>{Il();ps();z3=t=>Rl(t,"ipc"),U3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var H3,B3,G3=y(()=>{za();q3();xo();zI();H3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=z3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of LI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(mW(t,i,c),i.push(l)),s&&U3(l,o);return i},B3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Dke}from"node:events";var Z3,Nke,jke,Mke,V3=y(()=>{La();tI();ZR();eI();So();$r();iP();G3();nI();cP();aP();MI();Ev();Z3=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=jK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=M3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=L3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=H3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Nke(h,t,S),D=jke(m,S);try{return await Promise.race([Promise.all([{},FK(_),Promise.all(x),w,A,L9(t,d),...T,...D]),g,Mke(t,b),...D9(t,o,f,b),...e9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...P9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(E){return f.terminationReason??="other",Promise.all([{error:E},_,Promise.all(x.map(ae=>nP(ae))),nP(w),B3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Nke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:bp(n,i,r)),jke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>oi(o,{checkOpen:!1})&&!ri(o)).map(({type:i,value:o,stream:s=o})=>bp(s,n,e,{isSameDirection:Dn.has(i),stopOnExit:i==="native"}))),Mke=async(t,{signal:e})=>{let[r]=await Dke(t,"error",{signal:e});throw r}});var W3,vp,Gl,Av=y(()=>{Ml();W3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),vp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Gl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as K3}from"node:stream/promises";var lP,J3,uP,dP,Tv,Ov,fP=y(()=>{Ev();lP=async t=>{if(t!==void 0)try{await uP(t)}catch{}},J3=async t=>{if(t!==void 0)try{await dP(t)}catch{}},uP=async t=>{await K3(t,{cleanup:!0,readable:!1,writable:!0})},dP=async t=>{await K3(t,{cleanup:!0,readable:!0,writable:!1})},Tv=async(t,e)=>{if(await t,e)throw e},Ov=(t,e,r)=>{r&&!kv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as Fke}from"node:stream";import{callbackify as Lke}from"node:util";var Y3,pP,mP,hP,zke,gP,yP,X3,_P=y(()=>{Ma();hs();$v();Ml();Av();fP();Y3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=pP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=mP(a,s),{read:f,onStdoutDataDone:p}=hP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Fke({read:f,destroy:Lke(yP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return gP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},pP=(t,e,r)=>{let n=Fl(t,e),i=vp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},mP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:rP},hP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=xv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){zke(this,s,o)},onStdoutDataDone:o}},zke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},gP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await dP(t),await n,await lP(i),await e,r.readable&&r.push(null)}catch(o){await lP(i),X3(r,o)}},yP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Gl(r,e)&&(X3(t,n),await Tv(e,n))},X3=(t,e)=>{Ov(t,t.readable,e)}});import{Writable as Uke}from"node:stream";import{callbackify as Q3}from"node:util";var eJ,bP,vP,qke,Hke,SP,wP,tJ,xP=y(()=>{hs();Av();fP();eJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=bP(t,r,e),s=new Uke({...vP(n,t,i),destroy:Q3(wP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return SP(n,s),s},bP=(t,e,r)=>{let n=Ab(t,e),i=vp(r,n,"writableFinal"),o=vp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},vP=(t,e,r)=>({write:qke.bind(void 0,t),final:Q3(Hke.bind(void 0,t,e,r))}),qke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Hke=async(t,e,r)=>{await Gl(r,e)&&(t.writable&&t.end(),await e)},SP=async(t,e,r)=>{try{await uP(t),e.writable&&e.end()}catch(n){await J3(r),tJ(e,n)}},wP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Gl(r,e),await Gl(n,e)&&(tJ(t,i),await Tv(e,i))},tJ=(t,e)=>{Ov(t,t.writable,e)}});import{Duplex as Bke}from"node:stream";import{callbackify as Gke}from"node:util";var rJ,Zke,nJ=y(()=>{Ma();_P();xP();rJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||cn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=pP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=bP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=mP(c,a),{read:g,onStdoutDataDone:b}=hP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Bke({read:g,...vP(u,t,d),destroy:Gke(Zke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return gP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),SP(u,_,c),_},Zke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([yP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),wP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var $P,Vke,iJ=y(()=>{Ma();hs();$v();$P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Fl(t,r),a=xv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Vke(a,s,t)},Vke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var oJ,sJ=y(()=>{Av();_P();xP();nJ();iJ();oJ=(t,{encoding:e})=>{let r=W3();t.readable=Y3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=eJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=rJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=$P.bind(void 0,t,e),t[Symbol.asyncIterator]=$P.bind(void 0,t,e,{})}});var aJ,Wke,Kke,cJ=y(()=>{aJ=(t,e)=>{for(let[r,n]of Kke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Wke=(async()=>{})().constructor.prototype,Kke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Wke,t)])});import{setMaxListeners as Jke}from"node:events";import{spawn as Yke}from"node:child_process";var lJ,Xke,Qke,eEe,tEe,rEe,uJ=y(()=>{Qb();PR();sI();hs();aI();UI();pp();rv();QK();i3();mp();m3();xb();b3();I3();cP();V3();sJ();Ml();cJ();lJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Xke(t,e,r),{subprocess:f,promise:p}=eEe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=wv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),aJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Xke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),{file:a,commandArguments:c,options:l}=Hb(t,e,r),u=Qke(l),d=n3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Qke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},eEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Yke(...Bb(t,e,r))}catch(m){return XK({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Jke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];p3(c,a,l),_3(c,r,l);let d={},f=Di();c.kill=XV.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=F3(c,r),oJ(c,r),KK(c,r);let p=tEe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},tEe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await Z3({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>ko(x,e,w)),_=ko(h,e,"all"),S=rEe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return ql(S,n,e)},rEe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?fp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):tv({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Rv,nEe,iEe,dJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,nEe(n,t[n],i)]));return{...t,...r}},nEe=(t,e,r)=>iEe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,iEe=new Set(["env",...AR])});var _s,oEe,sEe,fJ=y(()=>{bo();wR();pZ();qK();uJ();dJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>oEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},oEe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Rv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=sEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?UK(a,c,l):lJ(a,c,l,i)},sEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=dZ(e)?fZ(e,r):[e,...r],[s,a,c]=nb(...o),l=Rv(Rv(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var pJ,mJ,hJ,aEe,cEe,gJ=y(()=>{pJ=({file:t,commandArguments:e})=>hJ(t,e),mJ=({file:t,commandArguments:e})=>({...hJ(t,e),isSync:!0}),hJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=aEe(t);return{file:r,commandArguments:n}},aEe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(cEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},cEe=/ +/g});var yJ,_J,lEe,bJ,uEe,vJ,SJ=y(()=>{yJ=(t,e,r)=>{t.sync=e(lEe,r),t.s=t.sync},_J=({options:t})=>bJ(t),lEe=({options:t})=>({...bJ(t),isSync:!0}),bJ=t=>({options:{...uEe(t),...t}}),uEe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},vJ={preferLocal:!0}});var xdt,Ke,$dt,kdt,Edt,Adt,Tdt,Odt,Rdt,Idt,zr=y(()=>{fJ();gJ();rI();SJ();UI();xdt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),$dt=_s(pJ),kdt=_s(mJ),Edt=_s(j9),Adt=_s(_J,{},vJ,yJ),{sendMessage:Tdt,getOneMessage:Odt,getEachMessage:Rdt,getCancelSignal:Idt}=JK()});import{existsSync as Iv,statSync as dEe}from"node:fs";import{dirname as kP,extname as fEe,isAbsolute as wJ,join as EP,relative as AP,resolve as Pv,sep as pEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function mEe(t){return(Iv(EP(t,"build.gradle.kts"))||Iv(EP(t,"build.gradle")))&&Iv(EP(t,"gradle.properties"))}function hEe(t,e){let n=AP(t,e).split(pEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function gEe(t,e){let r=Pv(t,e),n=r;Iv(r)?dEe(r).isFile()&&(n=kP(r)):fEe(r)!==""&&(n=kP(r));let i=AP(t,n);if(i.startsWith("..")||wJ(i))return null;let o=n;for(;;){if(mEe(o))return o;if(Pv(o)===Pv(t))return null;let s=kP(o);if(s===o)return null;let a=AP(t,s);if(a.startsWith("..")||wJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=gEe(r,o);if(!s){i.push(o);continue}let a=hEe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Nv=y(()=>{"use strict"});import{existsSync as OP,readFileSync as yEe}from"node:fs";import{join as Zl}from"node:path";function vs(t="."){let e=Zl(t,".cladding","config.yaml");if(!OP(e))return TP;try{let n=(0,xJ.parse)(yEe(e,"utf8"))?.gate;if(!n)return TP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a=typeof n.language=="string"&&n.language.trim()!==""?n.language.trim():void 0,c={};if(n.commands&&typeof n.commands=="object")for(let u of _Ee){let d=n.commands[u];Array.isArray(d)&&d.every(f=>typeof f=="string")&&(c[u]=d)}let l={scope:i};return Object.keys(c).length>0&&(l.commands=c),o&&(l.coverage=o),s&&(l.testReport=s),a&&(l.language=a),l}catch{return TP}}function $J(t="."){let e=vs(t).testReport,r=e?[e,...RP]:RP;return[...new Set(r.map(n=>Zl(t,n)))]}function kJ(t="."){let e=vs(t).testReport;if(e){let r=Zl(t,e);return OP(r)?r:null}return RP.map(r=>Zl(t,r)).find(r=>OP(r))??null}function EJ(t,e){let r=[],n=!1;for(let i of t){let o=bEe.exec(i);if(o){n=!0;for(let s of e)r.push(bs(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var xJ,_Ee,TP,RP,bEe,Vl=y(()=>{"use strict";xJ=wt(tr(),1);Nv();_Ee=["type","lint","test","coverage"],TP={scope:"feature"},RP=["test-report.junit.xml",Zl("coverage","junit.xml"),Zl(".cladding","test-report.junit.xml")];bEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as PP,readFileSync as AJ,readdirSync as vEe,statSync as SEe}from"node:fs";import{join as jv}from"node:path";function NP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(PP(r))try{if(TJ.test(AJ(r,"utf8")))return!0}catch{}}return!1}function OJ(t){try{return PP(t)&&TJ.test(AJ(t,"utf8"))}catch{return!1}}function RJ(t,e=0){if(e>4||!PP(t))return!1;let r;try{r=vEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=SEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(RJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&OJ(i))return!0}return!1}function $Ee(t){if(NP(t))return!0;for(let e of wEe)if(OJ(jv(t,e)))return!0;for(let e of xEe)if(RJ(jv(t,e)))return!0;return!1}function IJ(t="."){let e=vs(t).coverage;return e||($Ee(t)?"kover":"jacoco")}function PJ(t="."){return CP[IJ(t)]}function CJ(t="."){return IP[IJ(t)]}var CP,IP,DP,TJ,wEe,xEe,Mv=y(()=>{"use strict";Vl();CP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},IP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},DP=[IP.kover,IP.jacoco],TJ=/kover/i;wEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],xEe=["buildSrc","build-logic"]});import{existsSync as wp,readFileSync as MP,readdirSync as NJ,statSync as kEe}from"node:fs";import{dirname as EEe,join as kr,resolve as AEe}from"node:path";import Wl from"node:process";function FP(t){return wp(kr(t,"gradlew"))?"./gradlew":"gradle"}function TEe(t){let e=FP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[PJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function OEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(MP(kr(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function IEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function DEe(t,e){for(let r of e)if(wp(kr(t,r)))return r}function NEe(t,e){try{return NJ(t).find(n=>n.endsWith(e))}catch{return}}function LEe(t){let e=[],r=Wl.platform==="win32";r||e.push(kr("/etc","madge","config"),kr("/etc","madgerc"));let n=r?Wl.env.USERPROFILE:Wl.env.HOME;n&&e.push(kr(n,".config","madge","config"),kr(n,".config","madge"),kr(n,".madge","config"),kr(n,".madgerc"));for(let o=AEe(t);;){e.push(kr(o,".madgerc"));let s=EEe(o);if(s===o)break;o=s}let i=Wl.env.MADGE_config??Wl.env.madge_config;return i&&e.push(i),e}function zEe(){for(let[t,e]of Object.entries(Wl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function jJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function qEe(t){try{return kEe(t).isFile()}catch{return!1}}function HEe(t){let e;try{e=MP(t,"utf8")}catch{return!0}try{return jJ(JSON.parse(e).excludeRegExp)}catch{return UEe.test(e)}}function BEe(t,e){let r=e.madge;return r&&typeof r=="object"&&jJ(r.excludeRegExp)||zEe()?!0:LEe(t).some(n=>qEe(n)&&HEe(n))}function GEe(t){try{return JSON.parse(MP(kr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function Sp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function DJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function ZEe(t,e,r){if(BEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",FEe),{...e,args:n}}function VEe(t,e,r){if(Sp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of jEe)if(n.configs.some(i=>wp(kr(t,i))))return n.gate;if(MEe.some(n=>wp(kr(t,n)))||r.eslintConfig!==void 0)return e}function KEe(t,e){return WEe.some(r=>wp(kr(t,r)))?!0:e.jest!==void 0}function JEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function jP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function YEe(t,e){let r=GEe(t),n=e.lint?VEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:ZEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:jP(i,"lint"),s=Sp(r,"test"),a=s?JEe(s):void 0;return s&&!a?(o=jP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...Sp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&KEe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!Sp(r,"coverage")&&!DJ(r,"@vitest/coverage-v8")&&!DJ(r,"@vitest/coverage-istanbul")?o=jP(o,"coverage"):a==="vitest"&&Sp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function ft(t="."){for(let e of PEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=NEe(t,o):r=DEe(t,[o]),r)break;if(!r||e.requiresSource&&!IEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?YEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return CEe}var Fi,REe,PEe,CEe,jEe,MEe,FEe,UEe,WEe,ln=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];REe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);PEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:TEe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:OEe}],CEe={language:"unknown",manifest:"",gates:{}};jEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],MEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],FEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";UEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;WEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as XEe,readFileSync as QEe}from"node:fs";import{join as eAe}from"node:path";function Ga(t){return t.code==="ENOENT"}function Fv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=[s,o].filter(c=>c.length>0).join(` +`).slice(0,2e3)||`exit ${i}`;return MJ.test(o)||MJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(Ga(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} ${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Xt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=[String(e.stdout??"").trim(),String(e.stderr??"").trim()].filter(i=>i.length>0).join(` -`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Wl(t,e){let r=eAe(t,"package.json");if(!XEe(r))return!1;try{return!!JSON.parse(QEe(r,"utf8")).scripts?.[e]}catch{return!1}}var MJ,Nn=y(()=>{"use strict";MJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function tAe(t){let{cwd:e="."}=t,r=ft(e),n=r.gates.arch;if(!n)return[{detector:Fv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ke(n.cmd,[...n.args],{cwd:e,reject:!1});return Ba(i)?[{detector:Fv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Mv(i,Fv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Fv,Ga,Lv=y(()=>{"use strict";zr();ln();Nn();Fv="ARCHITECTURE_VIOLATION";Ga={name:Fv,subprocess:!0,run:tAe}});function rAe(t){let{cwd:e="."}=t,r=ft(e),n=r.gates.secret;if(!n)return[{detector:zv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ke(n.cmd,[...n.args],{cwd:e,reject:!1});return Ba(i)?[{detector:zv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Mv(i,zv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var zv,Za,Uv=y(()=>{"use strict";zr();ln();Nn();zv="HARDCODED_SECRET";Za={name:zv,subprocess:!0,run:rAe}});import{existsSync as LP,readdirSync as FJ}from"node:fs";import{join as qv}from"node:path";function iAe(t,e){let r=qv(t,e.path);if(!LP(r))return!0;if(e.isDirectory)try{return FJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function oAe(t){let{cwd:e="."}=t,r=[];for(let i of nAe)iAe(e,i)&&r.push({detector:wp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=qv(e,"spec.yaml");if(LP(n)){let i=cAe(n),o=i?null:sAe(e);if(i)r.push({detector:wp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:wp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=aAe(e);s&&r.push({detector:wp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function sAe(t){for(let e of["spec/features","spec/scenarios"]){let r=qv(t,e);if(!LP(r))continue;let n;try{n=FJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(qv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function aAe(t){try{return q(t),null}catch(e){return e.message}}function cAe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var wp,nAe,LJ,zJ=y(()=>{"use strict";Ue();Z_();wp="ABSENCE_OF_GOVERNANCE",nAe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];LJ={name:wp,run:oAe}});function Hv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function zP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Hv(r)==="while",o=uAe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Hv(r)}'`}let n=lAe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Hv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Hv(r)}'`:null}function dAe(t,e){let r=zP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function UJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...dAe(r,n));return e}var lAe,uAe,UP=y(()=>{"use strict";lAe={event:"when",state:"while",optional:"where",unwanted:"if"},uAe=/\bwhen\b/i});function ye(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var xt=y(()=>{"use strict";Ue()});function fAe(t){let{cwd:e="."}=t;return ye(e,Bv,pAe)}function pAe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:Bv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of UJ(t.features))e.push({detector:Bv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Bv,qJ,HJ=y(()=>{"use strict";UP();xt();Bv="AC_DRIFT";qJ={name:Bv,run:fAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||ft(t).language;return GJ[n]??BJ}var mAe,hAe,gAe,BJ,yAe,_Ae,GJ,bAe,ZJ,Va=y(()=>{"use strict";ln();mAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,hAe=/^[ \t]*import\s+([\w.]+)/gm,gAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,BJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:mAe,importStyle:"relative"},yAe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:hAe,importStyle:"dotted"},_Ae={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:gAe,importStyle:"dotted"},GJ={typescript:BJ,kotlin:yAe,python:_Ae},bAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],ZJ=new Set([...Object.values(GJ).flatMap(t=>t?.extensions??[]),...bAe].map(t=>t.toLowerCase()))});import{existsSync as vAe,readFileSync as SAe,readdirSync as wAe,statSync as xAe}from"node:fs";import{join as WJ,relative as VJ}from"node:path";function $Ae(t,e){if(!vAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=wAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=WJ(i,s),c;try{c=xAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function kAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function AAe(t){return EAe.test(t)}function TAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>$Ae(WJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=SAe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Va();KJ="AI_HINTS_FORBIDDEN_PATTERN";EAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;JJ={name:KJ,run:TAe}});function OAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:XJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var XJ,QJ,e8=y(()=>{"use strict";Ue();XJ="AC_DUPLICATE_WITHIN_FEATURE";QJ={name:XJ,run:OAe}});import{createRequire as RAe}from"module";import{basename as IAe,dirname as HP,normalize as PAe,relative as CAe,resolve as DAe,sep as n8}from"path";import*as NAe from"fs";function jAe(t){let e=PAe(t);return e.length>1&&e[e.length-1]===n8&&(e=e.substring(0,e.length-1)),e}function i8(t,e){return t.replace(MAe,e)}function LAe(t){return t==="/"||FAe.test(t)}function qP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=DAe(t)),(n||o)&&(t=jAe(t)),t===".")return"";let s=t[t.length-1]!==i;return i8(s?t+i:t,i)}function o8(t,e){return e+t}function zAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:i8(CAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function UAe(t){return t}function qAe(t,e,r){return e+t+r}function HAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?zAe(t,e):n?o8:UAe}function BAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function GAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function KAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?GAe(t):BAe(t):n&&n.length?VAe:ZAe:WAe}function tTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?eTe:r&&r.length?n?JAe:YAe:n?XAe:QAe}function iTe(t){return t.group?nTe:rTe}function aTe(t){return t.group?oTe:sTe}function uTe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?lTe:cTe}function s8(t,e,r){if(r.options.useRealPaths)return dTe(e,r);let n=HP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=HP(n)}return r.symlinks.set(t,e),i>1}function dTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Gv(t,e,r,n){e(t&&!n?t:null,r)}function vTe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?fTe:gTe:n?e?pTe:bTe:i?e?hTe:_Te:e?mTe:yTe}function xTe(t){return t?wTe:STe}function ATe(t,e){return new Promise((r,n)=>{l8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function l8(t,e,r){new c8(t,e,r).start()}function TTe(t,e){return new c8(t,e).start()}var t8,MAe,FAe,ZAe,VAe,WAe,JAe,YAe,XAe,QAe,eTe,rTe,nTe,oTe,sTe,cTe,lTe,fTe,pTe,mTe,hTe,gTe,yTe,_Te,bTe,a8,STe,wTe,$Te,kTe,ETe,c8,r8,u8,d8,f8=y(()=>{t8=RAe(import.meta.url);MAe=/[\\/]/g;FAe=/^[a-z]:[\\/]$/i;ZAe=(t,e)=>{e.push(t||".")},VAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},WAe=()=>{};JAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},YAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},XAe=(t,e,r,n)=>{r.files++},QAe=(t,e)=>{e.push(t)},eTe=()=>{};rTe=t=>t,nTe=()=>[""].slice(0,0);oTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},sTe=()=>{};cTe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&s8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},lTe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&s8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};fTe=t=>t.counts,pTe=t=>t.groups,mTe=t=>t.paths,hTe=t=>t.paths.slice(0,t.options.maxFiles),gTe=(t,e,r)=>(Gv(e,r,t.counts,t.options.suppressErrors),null),yTe=(t,e,r)=>(Gv(e,r,t.paths,t.options.suppressErrors),null),_Te=(t,e,r)=>(Gv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),bTe=(t,e,r)=>(Gv(e,r,t.groups,t.options.suppressErrors),null);a8={withFileTypes:!0},STe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",a8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},wTe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",a8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};$Te=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},kTe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},ETe=class{aborted=!1;abort(){this.aborted=!0}},c8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=vTe(e,this.isSynchronous),this.root=qP(t,e),this.state={root:LAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new kTe,options:e,queue:new $Te((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new ETe,fs:e.fs||NAe},this.joinPath=HAe(this.root,e),this.pushDirectory=KAe(this.root,e),this.pushFile=tTe(e),this.getArray=iTe(e),this.groupFiles=aTe(e),this.resolveSymlink=uTe(e,this.isSynchronous),this.walkDirectory=xTe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=qP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=IAe(_),x=qP(HP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};r8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return ATe(this.root,this.options)}withCallback(t){l8(this.root,this.options,t)}sync(){return TTe(this.root,this.options)}},u8=null;try{t8.resolve("picomatch"),u8=t8("picomatch")}catch{}d8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:n8,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new r8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new r8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||u8;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var xp=v((Nft,y8)=>{"use strict";var p8="[^\\\\/]",OTe="(?=.)",m8="[^/]",BP="(?:\\/|$)",h8="(?:^|\\/)",GP=`\\.{1,2}${BP}`,RTe="(?!\\.)",ITe=`(?!${h8}${GP})`,PTe=`(?!\\.{0,1}${BP})`,CTe=`(?!${GP})`,DTe="[^.\\/]",NTe=`${m8}*?`,jTe="/",g8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:OTe,QMARK:m8,END_ANCHOR:BP,DOTS_SLASH:GP,NO_DOT:RTe,NO_DOTS:ITe,NO_DOT_SLASH:PTe,NO_DOTS_SLASH:CTe,QMARK_NO_DOT:DTe,STAR:NTe,START_ANCHOR:h8,SEP:jTe},MTe={...g8,SLASH_LITERAL:"[\\\\/]",QMARK:p8,STAR:`${p8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},FTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};y8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:FTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?MTe:g8}}});var $p=v(Ur=>{"use strict";var{REGEX_BACKSLASH:LTe,REGEX_REMOVE_BACKSLASH:zTe,REGEX_SPECIAL_CHARS:UTe,REGEX_SPECIAL_CHARS_GLOBAL:qTe}=xp();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>UTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(qTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(LTe,"/");Ur.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Ur.removeBackslashes=t=>t.replace(zTe,e=>e==="\\"?"":e);Ur.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ur.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ur.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ur.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Ur.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var k8=v((Mft,$8)=>{"use strict";var _8=$p(),{CHAR_ASTERISK:ZP,CHAR_AT:HTe,CHAR_BACKWARD_SLASH:kp,CHAR_COMMA:BTe,CHAR_DOT:VP,CHAR_EXCLAMATION_MARK:WP,CHAR_FORWARD_SLASH:x8,CHAR_LEFT_CURLY_BRACE:KP,CHAR_LEFT_PARENTHESES:JP,CHAR_LEFT_SQUARE_BRACKET:GTe,CHAR_PLUS:ZTe,CHAR_QUESTION_MARK:b8,CHAR_RIGHT_CURLY_BRACE:VTe,CHAR_RIGHT_PARENTHESES:v8,CHAR_RIGHT_SQUARE_BRACKET:WTe}=xp(),S8=t=>t===x8||t===kp,w8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},KTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,R=0,A,T,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,ae=()=>c.charCodeAt(l+1),X=()=>(A=T,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),J&&m===!0&&d>0?(J=c.slice(0,d),C=c.slice(d)):m===!0?(J="",C=c):J=c,J&&J!==""&&J!=="/"&&J!==c&&S8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=_8.removeBackslashes(C)),J&&_===!0&&(J=_8.removeBackslashes(J)));let dr={prefix:P,input:t,start:u,base:J,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(dr.maxDepth=0,S8(T)||s.push(D),dr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var Ep=xp(),un=$p(),{MAX_LENGTH:Zv,POSIX_REGEX_SOURCE:JTe,REGEX_NON_SPECIAL_CHARS:YTe,REGEX_SPECIAL_CHARS_BACKREF:XTe,REPLACEMENTS:E8}=Ep,QTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>un.escapeRegex(i)).join("..")}return r},Kl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,A8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},eOe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},XP=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(eOe(e))return e.replace(/\\(.)/g,"$1")},tOe=t=>{let e=t.map(XP).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},rOe=t=>`${t.length===1?un.escapeRegex(t[0]):`[${t.map(r=>un.escapeRegex(r)).join("")}]`}*`,nOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=XP(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},iOe=t=>{let e=0,r=t.trim(),n=YP(r);for(;n;)e++,r=n.body.trim(),n=YP(r);return e},oOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Ep.DEFAULT_MAX_EXTGLOB_RECURSION,n=A8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||tOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=nOe(a);if(c){o=!0,i.push(...c);continue}let l=XP(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,iOe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:rOe([...new Set(i)])}:{risky:!0}:{risky:!1}},QP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=E8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Zv,r.maxLength):Zv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Ep.globChars(r.windows),l=Ep.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,R=G=>`(${a}(?:(?!${w}${G.dot?m:u}).)*?)`,A=r.dot?"":h,T=r.dot?_:S,D=r.bash===!0?R(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let E={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=un.removePrefix(t,E),i=t.length;let ae=[],X=[],J=[],P=o,C,dr=()=>E.index===i-1,se=E.peek=(G=1)=>t[E.index+G],Ce=E.advance=()=>t[++E.index]||"",Kt=()=>t.slice(E.index+1),fr=(G="",gt=0)=>{E.consumed+=G,E.index+=gt},Qt=G=>{E.output+=G.output!=null?G.output:G.value,fr(G.value)},fo=()=>{let G=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),E.start++,G++;return G%2===0?!1:(E.negated=!0,E.start++,!0)},ki=G=>{E[G]++,J.push(G)},tn=G=>{E[G]--,J.pop()},fe=G=>{if(P.type==="globstar"){let gt=E.braces>0&&(G.type==="comma"||G.type==="brace"),B=G.extglob===!0||ae.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!gt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(ae.length&&G.type!=="paren"&&(ae[ae.length-1].inner+=G.value),(G.value||G.output)&&Qt(G),P&&P.type==="text"&&G.type==="text"){P.output=(P.output||P.value)+G.value,P.value+=G.value;return}G.prev=P,s.push(G),P=G},po=(G,gt)=>{let B={...l[gt],conditions:1,inner:""};B.prev=P,B.parens=E.parens,B.output=E.output,B.startIndex=E.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;ki("parens"),fe({type:G,value:gt,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},Sfe=G=>{let gt=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=oOe(B,r);if((G.type==="plus"||G.type==="star")&&Oe.risky){let ut=Oe.safeOutput?(G.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[G.tokensIndex];Ei.type="text",Ei.value=gt,Ei.output=ut||un.escapeRegex(gt);for(let Ai=G.tokensIndex+1;Ai1&&G.inner.includes("/")&&(ut=R(r)),(ut!==D||dr()||/^\)+$/.test(Kt()))&&(dt=G.close=`)$))${ut}`),G.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=QP(zt,{...e,fastpaths:!1}).output;dt=G.close=`)${Ei})${ut})`}G.prev.type==="bos"&&(E.negatedExtglob=!0)}fe({type:"paren",extglob:!0,value:C,output:dt}),tn("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,gt=t.replace(XTe,(B,Oe,dt,zt,ut,Ei)=>zt==="\\"?(G=!0,B):zt==="?"?Oe?Oe+zt+(ut?_.repeat(ut.length):""):Ei===0?T+(ut?_.repeat(ut.length):""):_.repeat(dt.length):zt==="."?u.repeat(dt.length):zt==="*"?Oe?Oe+zt+(ut?D:""):D:Oe?B:`\\${B}`);return G===!0&&(r.unescape===!0?gt=gt.replace(/\\/g,""):gt=gt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),gt===t&&r.contains===!0?(E.output=t,E):(E.output=un.wrapOutput(gt,E,e),E)}for(;!dr();){if(C=Ce(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",fe({type:"text",value:C});continue}let Oe=/^\\+/.exec(Kt()),dt=0;if(Oe&&Oe[0].length>2&&(dt=Oe[0].length,E.index+=dt,dt%2!==0&&(C+="\\")),r.unescape===!0?C=Ce():C+=Ce(),E.brackets===0){fe({type:"text",value:C});continue}}if(E.brackets>0&&(C!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&C===":"){let B=P.value.slice(1);if(B.includes("[")&&(P.posix=!0,B.includes(":"))){let Oe=P.value.lastIndexOf("["),dt=P.value.slice(0,Oe),zt=P.value.slice(Oe+2),ut=JTe[zt];if(ut){P.value=dt+ut,E.backtrack=!0,Ce(),!o.output&&s.indexOf(P)===1&&(o.output=p);continue}}}(C==="["&&se()!==":"||C==="-"&&se()==="]")&&(C=`\\${C}`),C==="]"&&(P.value==="["||P.value==="[^")&&(C=`\\${C}`),r.posix===!0&&C==="!"&&P.value==="["&&(C="^"),P.value+=C,Qt({value:C});continue}if(E.quotes===1&&C!=='"'){C=un.escapeRegex(C),P.value+=C,Qt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&fe({type:"text",value:C});continue}if(C==="("){ki("parens"),fe({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Kl("opening","("));let B=ae[ae.length-1];if(B&&E.parens===B.parens+1){Sfe(ae.pop());continue}fe({type:"paren",value:C,output:E.parens?")":"\\)"}),tn("parens");continue}if(C==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Kl("closing","]"));C=`\\${C}`}else ki("brackets");fe({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){fe({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Kl("opening","["));fe({type:"text",value:C,output:`\\${C}`});continue}tn("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Qt({value:C}),r.literalBrackets===!1||un.hasRegexChars(B))continue;let Oe=un.escapeRegex(P.value);if(E.output=E.output.slice(0,-P.value.length),r.literalBrackets===!0){E.output+=Oe,P.value=Oe;continue}P.value=`(${a}${Oe}|${P.value})`,E.output+=P.value;continue}if(C==="{"&&r.nobrace!==!0){ki("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};X.push(B),fe(B);continue}if(C==="}"){let B=X[X.length-1];if(r.nobrace===!0||!B){fe({type:"text",value:C,output:C});continue}let Oe=")";if(B.dots===!0){let dt=s.slice(),zt=[];for(let ut=dt.length-1;ut>=0&&(s.pop(),dt[ut].type!=="brace");ut--)dt[ut].type!=="dots"&&zt.unshift(dt[ut].value);Oe=QTe(zt,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let dt=E.output.slice(0,B.outputIndex),zt=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Oe="\\}",E.output=dt;for(let ut of zt)E.output+=ut.output||ut.value}fe({type:"brace",value:C,output:Oe}),tn("braces"),X.pop();continue}if(C==="|"){ae.length>0&&ae[ae.length-1].conditions++,fe({type:"text",value:C});continue}if(C===","){let B=C,Oe=X[X.length-1];Oe&&J[J.length-1]==="braces"&&(Oe.comma=!0,B="|"),fe({type:"comma",value:C,output:B});continue}if(C==="/"){if(P.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",s.pop(),P=o;continue}fe({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=X[X.length-1];P.type="dots",P.output+=C,P.value+=C,B.dots=!0;continue}if(E.braces+E.parens===0&&P.type!=="bos"&&P.type!=="slash"){fe({type:"text",value:C,output:u});continue}fe({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){po("qmark",C);continue}if(P&&P.type==="paren"){let Oe=se(),dt=C;(P.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(dt=`\\${C}`),fe({type:"text",value:C,output:dt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){fe({type:"qmark",value:C,output:S});continue}fe({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){po("negate",C);continue}if(r.nonegate!==!0&&E.index===0){fo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){po("plus",C);continue}if(P&&P.value==="("||r.regex===!1){fe({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){fe({type:"plus",value:C});continue}fe({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fe({type:"at",extglob:!0,value:C,output:""});continue}fe({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=YTe.exec(Kt());B&&(C+=B[0],E.index+=B[0].length),fe({type:"text",value:C});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=C,P.output=D,E.backtrack=!0,E.globstar=!0,fr(C);continue}let G=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(G)){po("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){fr(C);continue}let B=P.prev,Oe=B.prev,dt=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!dt||G[0]&&G[0]!=="/")){fe({type:"star",value:C,output:""});continue}let ut=E.braces>0&&(B.type==="comma"||B.type==="brace"),Ei=ae.length&&(B.type==="pipe"||B.type==="paren");if(!dt&&B.type!=="paren"&&!ut&&!Ei){fe({type:"star",value:C,output:""});continue}for(;G.slice(0,3)==="/**";){let Ai=t[E.index+4];if(Ai&&Ai!=="/")break;G=G.slice(3),fr("/**",3)}if(B.type==="bos"&&dr()){P.type="globstar",P.value+=C,P.output=R(r),E.output=P.output,E.globstar=!0,fr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&dr()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=R(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,fr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&G[0]==="/"){let Ai=G[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${R(r)}${f}|${f}${Ai})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,fr(C+Ce()),fe({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&G[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${R(r)}${f})`,E.output=P.output,E.globstar=!0,fr(C+Ce()),fe({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=R(r),P.value+=C,E.output+=P.output,E.globstar=!0,fr(C);continue}let gt={type:"star",value:C,output:D};if(r.bash===!0){gt.output=".*?",(P.type==="bos"||P.type==="slash")&&(gt.output=A+gt.output),fe(gt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){gt.output=C,fe(gt);continue}(E.index===E.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(E.output+=g,P.output+=g):r.dot===!0?(E.output+=b,P.output+=b):(E.output+=A,P.output+=A),se()!=="*"&&(E.output+=p,P.output+=p)),fe(gt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing","]"));E.output=un.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing",")"));E.output=un.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing","}"));E.output=un.escapeLast(E.output,"{"),tn("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&fe({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let G of E.tokens)E.output+=G.output!=null?G.output:G.value,G.suffix&&(E.output+=G.suffix)}return E};QP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Zv,r.maxLength):Zv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=E8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=Ep.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=A=>A.noglobstar===!0?_:`(${g}(?:(?!${p}${A.dot?c:o}).)*?)`,x=A=>{switch(A){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let T=/^(.*?)\.(\w+)$/.exec(A);if(!T)return;let D=x(T[1]);return D?D+o+T[2]:void 0}}},w=un.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};T8.exports=QP});var P8=v((Lft,I8)=>{"use strict";var sOe=k8(),eC=O8(),R8=$p(),aOe=xp(),cOe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=cOe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?R8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r,n=r&&r.windows)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(R8.basename(t,{windows:n}));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):eC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>sOe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=eC.fastpaths(t,e)),i.output||(i=eC(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=aOe;I8.exports=Rt});var j8=v((zft,N8)=>{"use strict";var C8=P8(),lOe=$p();function D8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:lOe.isWindows()}),C8(t,e,r)}Object.assign(D8,C8);N8.exports=D8});import{readdir as uOe,readdirSync as dOe,realpath as fOe,realpathSync as pOe,stat as mOe,statSync as hOe}from"fs";import{isAbsolute as gOe,posix as Wa,resolve as yOe}from"path";import{fileURLToPath as _Oe}from"url";function wOe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&SOe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Wa.relative(t,n)||".":n=>Wa.relative(t,`${e}/${n}`)||"."}function kOe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Wa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function F8(t){return t.replace(vOe,e=>`${e}/`)}function q8(t){var e;let r=Jl.default.scan(t,EOe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function POe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Jl.default.scan(t);return r.isGlob||r.negated}function Ap(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function H8(t){return typeof t=="string"?[t]:t??[]}function tC(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=IOe(o);s=gOe(s.replace(DOe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=COe.exec(s))===null||i===void 0?void 0:i[0],l=q8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=F8(m),r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Wa.join(o,...d):o)}return s}function NOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(tC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(tC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(tC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function jOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=NOe(t,e,n);t.debug&&Ap("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(z8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Jl.default)(i.match,f),m=(0,Jl.default)(i.ignore,f),h=wOe(i.match,f),g=M8(r,d,o),b=o?g:M8(r,d,!0),_=(w,R)=>{let A=b(R,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new d8({filters:[a?(w,R)=>{let A=g(w,R),T=p(A)&&!m(A);return T&&Ap(`matched ${A}`),T}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return Ap(`${A?"skipped":"crawling"} ${R}`),A}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Ap("internal properties:",{...n,root:d}),[x,r!==d&&!o&&kOe(r,d)]}function MOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function FOe(t){let e=Object.assign({},t);for(let r in L8)e[r]===void 0&&Object.assign(e,{[r]:L8[r]});return e.cwd=(e.cwd instanceof URL?_Oe(e.cwd):yOe(e.cwd||process.cwd())).replace(z8,"/"),e.ignore=H8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||uOe,readdirSync:e.fs.readdirSync||dOe,realpath:e.fs.realpath||fOe,realpathSync:e.fs.realpathSync||pOe,stat:e.fs.stat||mOe,statSync:e.fs.statSync||hOe}),e.debug&&Ap("globbing with options:",e),e}function LOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=bOe(t)||typeof t=="string",i=H8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=FOe(n?e:t);return i.length>0?jOe(o,i):[]}function vs(t,e){let[r,n]=LOe(t,e);return r?MOe(r.sync(),n):[]}var Jl,bOe,z8,vOe,U8,SOe,xOe,$Oe,EOe,AOe,TOe,OOe,ROe,IOe,COe,DOe,L8,Tp=y(()=>{f8();Jl=wt(j8(),1),bOe=Array.isArray,z8=/\\/g,vOe=/^[A-Za-z]:$/,U8=process.platform==="win32",SOe=/^(\/?\.\.)+$/;xOe=/^[A-Z]:\/$/i,$Oe=U8?t=>xOe.test(t):t=>t==="/";EOe={parts:!0};AOe=/(?t.replace(AOe,"\\$&"),ROe=t=>t.replace(TOe,"\\$&"),IOe=U8?ROe:OOe;COe=/^(\/?\.\.)+/,DOe=/\\(?=[()[\]{}!*+?@|])/g;L8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Op,readFileSync as zOe,readdirSync as UOe,statSync as B8}from"node:fs";import{join as Ka}from"node:path";function qOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Li(e,n),o=[],{layers:s,forbiddenImports:a}=rC(r);return(s.size>0||a.length>0)&&!Op(Ka(e,i.mainRoot))?[{detector:Rp,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(HOe(e,i,s,o),BOe(e,i,s,o)),a.length>0&&GOe(e,i,a,o),o)}function rC(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function HOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Op(o))for(let s of UOe(o)){let a=Ka(o,s);B8(a).isDirectory()&&(r.has(s)||n.push({detector:Rp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function BOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Op(o))for(let s of r){let a=Ka(o,s);Op(a)&&B8(a).isDirectory()||n.push({detector:Rp,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function GOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Op(a))continue;let c=vs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ka(a,l),d;try{d=zOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];ZOe(p,s.to,e.importStyle)&&n.push({detector:Rp,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function ZOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Rp,G8,nC=y(()=>{"use strict";Tp();Ue();Va();Rp="ARCHITECTURE_FROM_SPEC";G8={name:Rp,run:qOe}});import{existsSync as VOe,readFileSync as WOe}from"node:fs";import{join as KOe}from"node:path";function YOe(t){let{cwd:e="."}=t,r=KOe(e,"spec/capabilities.yaml");if(!VOe(r))return[];let n;try{let u=WOe(r,"utf8"),d=Z8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";Z8=wt(tr(),1);Ue();Vv="CAPABILITIES_FEATURE_MAPPING",JOe=8;V8={name:Vv,run:YOe}});import{existsSync as XOe,readFileSync as QOe}from"node:fs";import{join as eRe}from"node:path";function tRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function rRe(t){let{cwd:e="."}=t;return ye(e,iC,r=>nRe(r,e))}function nRe(t,e){let r=Li(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=eRe(e,o);if(!XOe(s))continue;let a=QOe(s,"utf8");tRe(a)||n.push({detector:iC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var iC,K8,J8=y(()=>{"use strict";Va();xt();iC="CONVENTION_DRIFT";K8={name:iC,run:rRe}});import{existsSync as oC,readFileSync as Y8}from"node:fs";import{join as Wv}from"node:path";function iRe(t){return JSON.parse(t).total?.lines?.pct??0}function X8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function aRe(t,e){if(!Pv(ft(t).gates.coverage?.cmd))return null;let r;try{r=Cv(t,e)}catch(c){return[{detector:Eo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=DP.find(d=>oC(Wv(c.dir,d)));if(!l){s.push(c.path);continue}let u=X8(Y8(Wv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:Eo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=Q8(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function cRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=aRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=ft(e).language==="kotlin"?DP.find(a=>oC(Wv(e,a)))??CJ(e):n.coverageSummary,o=Wv(e,i);if(!oC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=Y8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?oRe(a):n.coverageFormat==="cobertura-xml"?sRe(a):iRe(a)}catch(a){return[{detector:Eo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:Eo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Kv?[]:[{detector:Eo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Kv}%`}]}var Eo,Kv,e5,t5=y(()=>{"use strict";Ue();jv();Va();Dv();ln();Eo="COVERAGE_DROP",Kv=70;e5={name:Eo,run:cRe}});import{existsSync as lRe}from"node:fs";import{join as uRe}from"node:path";function fRe(t){let{cwd:e="."}=t;return ye(e,Jv,r=>pRe(r,e))}function pRe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";xt();Jv="DELIVERABLE_INTEGRITY",dRe=8;r5={name:Jv,run:fRe}});function mRe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Yv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function hRe(t){let e=mRe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Yv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function gRe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>hRe(r))}var Yv,i5,o5=y(()=>{"use strict";xt();Yv="SMOKE_PROBE_DEMAND";i5={name:Yv,run:gRe}});function yRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>_Re(r,e))}function _Re(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ds(e);if(n===null)return[{detector:Xv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=X_(n,e,o);s.state!=="fresh"&&i.push({detector:Xv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Xv,Qv,sC=y(()=>{"use strict";$l();xt();Xv="STALE_ATTESTATION";Qv={name:Xv,run:yRe}});function bRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return vRe(r)}function vRe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:s5,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var s5,eS,aC=y(()=>{"use strict";Ue();s5="DEPENDENCY_CYCLE";eS={name:s5,run:bRe}});import{appendFileSync as SRe,existsSync as a5,mkdirSync as wRe,readFileSync as xRe}from"node:fs";import{dirname as $Re,join as kRe}from"node:path";function c5(t){return kRe(t,ERe,ARe)}function l5(t){return cC.add(t),()=>cC.delete(t)}function Ja(t,e){let r=c5(t),n=$Re(r);a5(n)||wRe(n,{recursive:!0}),SRe(r,`${JSON.stringify(e)} +`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Kl(t,e){let r=eAe(t,"package.json");if(!XEe(r))return!1;try{return!!JSON.parse(QEe(r,"utf8")).scripts?.[e]}catch{return!1}}var MJ,Nn=y(()=>{"use strict";MJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function tAe(t){let{cwd:e="."}=t,r=ft(e),n=r.gates.arch;if(!n)return[{detector:Lv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ke(n.cmd,[...n.args],{cwd:e,reject:!1});return Ga(i)?[{detector:Lv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Fv(i,Lv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Lv,Za,zv=y(()=>{"use strict";zr();ln();Nn();Lv="ARCHITECTURE_VIOLATION";Za={name:Lv,subprocess:!0,run:tAe}});function rAe(t){let{cwd:e="."}=t,r=ft(e),n=r.gates.secret;if(!n)return[{detector:Uv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ke(n.cmd,[...n.args],{cwd:e,reject:!1});return Ga(i)?[{detector:Uv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Fv(i,Uv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Uv,Va,qv=y(()=>{"use strict";zr();ln();Nn();Uv="HARDCODED_SECRET";Va={name:Uv,subprocess:!0,run:rAe}});import{existsSync as LP,readdirSync as FJ}from"node:fs";import{join as Hv}from"node:path";function iAe(t,e){let r=Hv(t,e.path);if(!LP(r))return!0;if(e.isDirectory)try{return FJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function oAe(t){let{cwd:e="."}=t,r=[];for(let i of nAe)iAe(e,i)&&r.push({detector:xp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=Hv(e,"spec.yaml");if(LP(n)){let i=cAe(n),o=i?null:sAe(e);if(i)r.push({detector:xp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:xp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=aAe(e);s&&r.push({detector:xp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function sAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!LP(r))continue;let n;try{n=FJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(Hv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function aAe(t){try{return q(t),null}catch(e){return e.message}}function cAe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var xp,nAe,LJ,zJ=y(()=>{"use strict";Ue();V_();xp="ABSENCE_OF_GOVERNANCE",nAe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];LJ={name:xp,run:oAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function zP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Bv(r)==="while",o=uAe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Bv(r)}'`}let n=lAe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Bv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Bv(r)}'`:null}function dAe(t,e){let r=zP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function UJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...dAe(r,n));return e}var lAe,uAe,UP=y(()=>{"use strict";lAe={event:"when",state:"while",optional:"where",unwanted:"if"},uAe=/\bwhen\b/i});function ye(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var xt=y(()=>{"use strict";Ue()});function fAe(t){let{cwd:e="."}=t;return ye(e,Gv,pAe)}function pAe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:Gv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of UJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,qJ,HJ=y(()=>{"use strict";UP();xt();Gv="AC_DRIFT";qJ={name:Gv,run:fAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||ft(t).language;return GJ[n]??BJ}var mAe,hAe,gAe,BJ,yAe,_Ae,GJ,bAe,ZJ,Wa=y(()=>{"use strict";ln();mAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,hAe=/^[ \t]*import\s+([\w.]+)/gm,gAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,BJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:mAe,importStyle:"relative"},yAe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:hAe,importStyle:"dotted"},_Ae={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:gAe,importStyle:"dotted"},GJ={typescript:BJ,kotlin:yAe,python:_Ae},bAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],ZJ=new Set([...Object.values(GJ).flatMap(t=>t?.extensions??[]),...bAe].map(t=>t.toLowerCase()))});import{existsSync as vAe,readFileSync as SAe,readdirSync as wAe,statSync as xAe}from"node:fs";import{join as WJ,relative as VJ}from"node:path";function $Ae(t,e){if(!vAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=wAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=WJ(i,s),c;try{c=xAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function kAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function AAe(t){return EAe.test(t)}function TAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>$Ae(WJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=SAe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Wa();KJ="AI_HINTS_FORBIDDEN_PATTERN";EAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;JJ={name:KJ,run:TAe}});function OAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:XJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var XJ,QJ,e8=y(()=>{"use strict";Ue();XJ="AC_DUPLICATE_WITHIN_FEATURE";QJ={name:XJ,run:OAe}});import{createRequire as RAe}from"module";import{basename as IAe,dirname as HP,normalize as PAe,relative as CAe,resolve as DAe,sep as n8}from"path";import*as NAe from"fs";function jAe(t){let e=PAe(t);return e.length>1&&e[e.length-1]===n8&&(e=e.substring(0,e.length-1)),e}function i8(t,e){return t.replace(MAe,e)}function LAe(t){return t==="/"||FAe.test(t)}function qP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=DAe(t)),(n||o)&&(t=jAe(t)),t===".")return"";let s=t[t.length-1]!==i;return i8(s?t+i:t,i)}function o8(t,e){return e+t}function zAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:i8(CAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function UAe(t){return t}function qAe(t,e,r){return e+t+r}function HAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?zAe(t,e):n?o8:UAe}function BAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function GAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function KAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?GAe(t):BAe(t):n&&n.length?VAe:ZAe:WAe}function tTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?eTe:r&&r.length?n?JAe:YAe:n?XAe:QAe}function iTe(t){return t.group?nTe:rTe}function aTe(t){return t.group?oTe:sTe}function uTe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?lTe:cTe}function s8(t,e,r){if(r.options.useRealPaths)return dTe(e,r);let n=HP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=HP(n)}return r.symlinks.set(t,e),i>1}function dTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function vTe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?fTe:gTe:n?e?pTe:bTe:i?e?hTe:_Te:e?mTe:yTe}function xTe(t){return t?wTe:STe}function ATe(t,e){return new Promise((r,n)=>{l8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function l8(t,e,r){new c8(t,e,r).start()}function TTe(t,e){return new c8(t,e).start()}var t8,MAe,FAe,ZAe,VAe,WAe,JAe,YAe,XAe,QAe,eTe,rTe,nTe,oTe,sTe,cTe,lTe,fTe,pTe,mTe,hTe,gTe,yTe,_Te,bTe,a8,STe,wTe,$Te,kTe,ETe,c8,r8,u8,d8,f8=y(()=>{t8=RAe(import.meta.url);MAe=/[\\/]/g;FAe=/^[a-z]:[\\/]$/i;ZAe=(t,e)=>{e.push(t||".")},VAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},WAe=()=>{};JAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},YAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},XAe=(t,e,r,n)=>{r.files++},QAe=(t,e)=>{e.push(t)},eTe=()=>{};rTe=t=>t,nTe=()=>[""].slice(0,0);oTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},sTe=()=>{};cTe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&s8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},lTe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&s8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};fTe=t=>t.counts,pTe=t=>t.groups,mTe=t=>t.paths,hTe=t=>t.paths.slice(0,t.options.maxFiles),gTe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),yTe=(t,e,r)=>(Zv(e,r,t.paths,t.options.suppressErrors),null),_Te=(t,e,r)=>(Zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),bTe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);a8={withFileTypes:!0},STe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",a8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},wTe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",a8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};$Te=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},kTe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},ETe=class{aborted=!1;abort(){this.aborted=!0}},c8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=vTe(e,this.isSynchronous),this.root=qP(t,e),this.state={root:LAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new kTe,options:e,queue:new $Te((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new ETe,fs:e.fs||NAe},this.joinPath=HAe(this.root,e),this.pushDirectory=KAe(this.root,e),this.pushFile=tTe(e),this.getArray=iTe(e),this.groupFiles=aTe(e),this.resolveSymlink=uTe(e,this.isSynchronous),this.walkDirectory=xTe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=qP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=IAe(_),x=qP(HP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};r8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return ATe(this.root,this.options)}withCallback(t){l8(this.root,this.options,t)}sync(){return TTe(this.root,this.options)}},u8=null;try{t8.resolve("picomatch"),u8=t8("picomatch")}catch{}d8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:n8,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new r8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new r8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||u8;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var $p=v((Nft,y8)=>{"use strict";var p8="[^\\\\/]",OTe="(?=.)",m8="[^/]",BP="(?:\\/|$)",h8="(?:^|\\/)",GP=`\\.{1,2}${BP}`,RTe="(?!\\.)",ITe=`(?!${h8}${GP})`,PTe=`(?!\\.{0,1}${BP})`,CTe=`(?!${GP})`,DTe="[^.\\/]",NTe=`${m8}*?`,jTe="/",g8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:OTe,QMARK:m8,END_ANCHOR:BP,DOTS_SLASH:GP,NO_DOT:RTe,NO_DOTS:ITe,NO_DOT_SLASH:PTe,NO_DOTS_SLASH:CTe,QMARK_NO_DOT:DTe,STAR:NTe,START_ANCHOR:h8,SEP:jTe},MTe={...g8,SLASH_LITERAL:"[\\\\/]",QMARK:p8,STAR:`${p8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},FTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};y8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:FTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?MTe:g8}}});var kp=v(Ur=>{"use strict";var{REGEX_BACKSLASH:LTe,REGEX_REMOVE_BACKSLASH:zTe,REGEX_SPECIAL_CHARS:UTe,REGEX_SPECIAL_CHARS_GLOBAL:qTe}=$p();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>UTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(qTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(LTe,"/");Ur.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Ur.removeBackslashes=t=>t.replace(zTe,e=>e==="\\"?"":e);Ur.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ur.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ur.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ur.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Ur.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var k8=v((Mft,$8)=>{"use strict";var _8=kp(),{CHAR_ASTERISK:ZP,CHAR_AT:HTe,CHAR_BACKWARD_SLASH:Ep,CHAR_COMMA:BTe,CHAR_DOT:VP,CHAR_EXCLAMATION_MARK:WP,CHAR_FORWARD_SLASH:x8,CHAR_LEFT_CURLY_BRACE:KP,CHAR_LEFT_PARENTHESES:JP,CHAR_LEFT_SQUARE_BRACKET:GTe,CHAR_PLUS:ZTe,CHAR_QUESTION_MARK:b8,CHAR_RIGHT_CURLY_BRACE:VTe,CHAR_RIGHT_PARENTHESES:v8,CHAR_RIGHT_SQUARE_BRACKET:WTe}=$p(),S8=t=>t===x8||t===Ep,w8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},KTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,R=0,A,T,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,ae=()=>c.charCodeAt(l+1),X=()=>(A=T,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),J&&m===!0&&d>0?(J=c.slice(0,d),C=c.slice(d)):m===!0?(J="",C=c):J=c,J&&J!==""&&J!=="/"&&J!==c&&S8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=_8.removeBackslashes(C)),J&&_===!0&&(J=_8.removeBackslashes(J)));let dr={prefix:P,input:t,start:u,base:J,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(dr.maxDepth=0,S8(T)||s.push(D),dr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var Ap=$p(),un=kp(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:JTe,REGEX_NON_SPECIAL_CHARS:YTe,REGEX_SPECIAL_CHARS_BACKREF:XTe,REPLACEMENTS:E8}=Ap,QTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>un.escapeRegex(i)).join("..")}return r},Jl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,A8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},eOe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},XP=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(eOe(e))return e.replace(/\\(.)/g,"$1")},tOe=t=>{let e=t.map(XP).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},rOe=t=>`${t.length===1?un.escapeRegex(t[0]):`[${t.map(r=>un.escapeRegex(r)).join("")}]`}*`,nOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=XP(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},iOe=t=>{let e=0,r=t.trim(),n=YP(r);for(;n;)e++,r=n.body.trim(),n=YP(r);return e},oOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=A8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||tOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=nOe(a);if(c){o=!0,i.push(...c);continue}let l=XP(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,iOe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:rOe([...new Set(i)])}:{risky:!0}:{risky:!1}},QP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=E8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Vv,r.maxLength):Vv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Ap.globChars(r.windows),l=Ap.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,R=G=>`(${a}(?:(?!${w}${G.dot?m:u}).)*?)`,A=r.dot?"":h,T=r.dot?_:S,D=r.bash===!0?R(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let E={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=un.removePrefix(t,E),i=t.length;let ae=[],X=[],J=[],P=o,C,dr=()=>E.index===i-1,se=E.peek=(G=1)=>t[E.index+G],Ce=E.advance=()=>t[++E.index]||"",Kt=()=>t.slice(E.index+1),fr=(G="",gt=0)=>{E.consumed+=G,E.index+=gt},Qt=G=>{E.output+=G.output!=null?G.output:G.value,fr(G.value)},fo=()=>{let G=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),E.start++,G++;return G%2===0?!1:(E.negated=!0,E.start++,!0)},ki=G=>{E[G]++,J.push(G)},tn=G=>{E[G]--,J.pop()},fe=G=>{if(P.type==="globstar"){let gt=E.braces>0&&(G.type==="comma"||G.type==="brace"),B=G.extglob===!0||ae.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!gt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(ae.length&&G.type!=="paren"&&(ae[ae.length-1].inner+=G.value),(G.value||G.output)&&Qt(G),P&&P.type==="text"&&G.type==="text"){P.output=(P.output||P.value)+G.value,P.value+=G.value;return}G.prev=P,s.push(G),P=G},po=(G,gt)=>{let B={...l[gt],conditions:1,inner:""};B.prev=P,B.parens=E.parens,B.output=E.output,B.startIndex=E.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;ki("parens"),fe({type:G,value:gt,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},Sfe=G=>{let gt=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=oOe(B,r);if((G.type==="plus"||G.type==="star")&&Oe.risky){let ut=Oe.safeOutput?(G.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[G.tokensIndex];Ei.type="text",Ei.value=gt,Ei.output=ut||un.escapeRegex(gt);for(let Ai=G.tokensIndex+1;Ai1&&G.inner.includes("/")&&(ut=R(r)),(ut!==D||dr()||/^\)+$/.test(Kt()))&&(dt=G.close=`)$))${ut}`),G.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=QP(zt,{...e,fastpaths:!1}).output;dt=G.close=`)${Ei})${ut})`}G.prev.type==="bos"&&(E.negatedExtglob=!0)}fe({type:"paren",extglob:!0,value:C,output:dt}),tn("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,gt=t.replace(XTe,(B,Oe,dt,zt,ut,Ei)=>zt==="\\"?(G=!0,B):zt==="?"?Oe?Oe+zt+(ut?_.repeat(ut.length):""):Ei===0?T+(ut?_.repeat(ut.length):""):_.repeat(dt.length):zt==="."?u.repeat(dt.length):zt==="*"?Oe?Oe+zt+(ut?D:""):D:Oe?B:`\\${B}`);return G===!0&&(r.unescape===!0?gt=gt.replace(/\\/g,""):gt=gt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),gt===t&&r.contains===!0?(E.output=t,E):(E.output=un.wrapOutput(gt,E,e),E)}for(;!dr();){if(C=Ce(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",fe({type:"text",value:C});continue}let Oe=/^\\+/.exec(Kt()),dt=0;if(Oe&&Oe[0].length>2&&(dt=Oe[0].length,E.index+=dt,dt%2!==0&&(C+="\\")),r.unescape===!0?C=Ce():C+=Ce(),E.brackets===0){fe({type:"text",value:C});continue}}if(E.brackets>0&&(C!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&C===":"){let B=P.value.slice(1);if(B.includes("[")&&(P.posix=!0,B.includes(":"))){let Oe=P.value.lastIndexOf("["),dt=P.value.slice(0,Oe),zt=P.value.slice(Oe+2),ut=JTe[zt];if(ut){P.value=dt+ut,E.backtrack=!0,Ce(),!o.output&&s.indexOf(P)===1&&(o.output=p);continue}}}(C==="["&&se()!==":"||C==="-"&&se()==="]")&&(C=`\\${C}`),C==="]"&&(P.value==="["||P.value==="[^")&&(C=`\\${C}`),r.posix===!0&&C==="!"&&P.value==="["&&(C="^"),P.value+=C,Qt({value:C});continue}if(E.quotes===1&&C!=='"'){C=un.escapeRegex(C),P.value+=C,Qt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&fe({type:"text",value:C});continue}if(C==="("){ki("parens"),fe({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Jl("opening","("));let B=ae[ae.length-1];if(B&&E.parens===B.parens+1){Sfe(ae.pop());continue}fe({type:"paren",value:C,output:E.parens?")":"\\)"}),tn("parens");continue}if(C==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Jl("closing","]"));C=`\\${C}`}else ki("brackets");fe({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){fe({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Jl("opening","["));fe({type:"text",value:C,output:`\\${C}`});continue}tn("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Qt({value:C}),r.literalBrackets===!1||un.hasRegexChars(B))continue;let Oe=un.escapeRegex(P.value);if(E.output=E.output.slice(0,-P.value.length),r.literalBrackets===!0){E.output+=Oe,P.value=Oe;continue}P.value=`(${a}${Oe}|${P.value})`,E.output+=P.value;continue}if(C==="{"&&r.nobrace!==!0){ki("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};X.push(B),fe(B);continue}if(C==="}"){let B=X[X.length-1];if(r.nobrace===!0||!B){fe({type:"text",value:C,output:C});continue}let Oe=")";if(B.dots===!0){let dt=s.slice(),zt=[];for(let ut=dt.length-1;ut>=0&&(s.pop(),dt[ut].type!=="brace");ut--)dt[ut].type!=="dots"&&zt.unshift(dt[ut].value);Oe=QTe(zt,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let dt=E.output.slice(0,B.outputIndex),zt=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Oe="\\}",E.output=dt;for(let ut of zt)E.output+=ut.output||ut.value}fe({type:"brace",value:C,output:Oe}),tn("braces"),X.pop();continue}if(C==="|"){ae.length>0&&ae[ae.length-1].conditions++,fe({type:"text",value:C});continue}if(C===","){let B=C,Oe=X[X.length-1];Oe&&J[J.length-1]==="braces"&&(Oe.comma=!0,B="|"),fe({type:"comma",value:C,output:B});continue}if(C==="/"){if(P.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",s.pop(),P=o;continue}fe({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=X[X.length-1];P.type="dots",P.output+=C,P.value+=C,B.dots=!0;continue}if(E.braces+E.parens===0&&P.type!=="bos"&&P.type!=="slash"){fe({type:"text",value:C,output:u});continue}fe({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){po("qmark",C);continue}if(P&&P.type==="paren"){let Oe=se(),dt=C;(P.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(dt=`\\${C}`),fe({type:"text",value:C,output:dt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){fe({type:"qmark",value:C,output:S});continue}fe({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){po("negate",C);continue}if(r.nonegate!==!0&&E.index===0){fo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){po("plus",C);continue}if(P&&P.value==="("||r.regex===!1){fe({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){fe({type:"plus",value:C});continue}fe({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fe({type:"at",extglob:!0,value:C,output:""});continue}fe({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=YTe.exec(Kt());B&&(C+=B[0],E.index+=B[0].length),fe({type:"text",value:C});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=C,P.output=D,E.backtrack=!0,E.globstar=!0,fr(C);continue}let G=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(G)){po("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){fr(C);continue}let B=P.prev,Oe=B.prev,dt=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!dt||G[0]&&G[0]!=="/")){fe({type:"star",value:C,output:""});continue}let ut=E.braces>0&&(B.type==="comma"||B.type==="brace"),Ei=ae.length&&(B.type==="pipe"||B.type==="paren");if(!dt&&B.type!=="paren"&&!ut&&!Ei){fe({type:"star",value:C,output:""});continue}for(;G.slice(0,3)==="/**";){let Ai=t[E.index+4];if(Ai&&Ai!=="/")break;G=G.slice(3),fr("/**",3)}if(B.type==="bos"&&dr()){P.type="globstar",P.value+=C,P.output=R(r),E.output=P.output,E.globstar=!0,fr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&dr()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=R(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,fr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&G[0]==="/"){let Ai=G[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${R(r)}${f}|${f}${Ai})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,fr(C+Ce()),fe({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&G[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${R(r)}${f})`,E.output=P.output,E.globstar=!0,fr(C+Ce()),fe({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=R(r),P.value+=C,E.output+=P.output,E.globstar=!0,fr(C);continue}let gt={type:"star",value:C,output:D};if(r.bash===!0){gt.output=".*?",(P.type==="bos"||P.type==="slash")&&(gt.output=A+gt.output),fe(gt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){gt.output=C,fe(gt);continue}(E.index===E.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(E.output+=g,P.output+=g):r.dot===!0?(E.output+=b,P.output+=b):(E.output+=A,P.output+=A),se()!=="*"&&(E.output+=p,P.output+=p)),fe(gt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing","]"));E.output=un.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing",")"));E.output=un.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing","}"));E.output=un.escapeLast(E.output,"{"),tn("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&fe({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let G of E.tokens)E.output+=G.output!=null?G.output:G.value,G.suffix&&(E.output+=G.suffix)}return E};QP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Vv,r.maxLength):Vv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=E8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=Ap.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=A=>A.noglobstar===!0?_:`(${g}(?:(?!${p}${A.dot?c:o}).)*?)`,x=A=>{switch(A){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let T=/^(.*?)\.(\w+)$/.exec(A);if(!T)return;let D=x(T[1]);return D?D+o+T[2]:void 0}}},w=un.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};T8.exports=QP});var P8=v((Lft,I8)=>{"use strict";var sOe=k8(),eC=O8(),R8=kp(),aOe=$p(),cOe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=cOe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?R8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r,n=r&&r.windows)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(R8.basename(t,{windows:n}));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):eC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>sOe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=eC.fastpaths(t,e)),i.output||(i=eC(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=aOe;I8.exports=Rt});var j8=v((zft,N8)=>{"use strict";var C8=P8(),lOe=kp();function D8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:lOe.isWindows()}),C8(t,e,r)}Object.assign(D8,C8);N8.exports=D8});import{readdir as uOe,readdirSync as dOe,realpath as fOe,realpathSync as pOe,stat as mOe,statSync as hOe}from"fs";import{isAbsolute as gOe,posix as Ka,resolve as yOe}from"path";import{fileURLToPath as _Oe}from"url";function wOe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&SOe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ka.relative(t,n)||".":n=>Ka.relative(t,`${e}/${n}`)||"."}function kOe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ka.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function F8(t){return t.replace(vOe,e=>`${e}/`)}function q8(t){var e;let r=Yl.default.scan(t,EOe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function POe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Yl.default.scan(t);return r.isGlob||r.negated}function Tp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function H8(t){return typeof t=="string"?[t]:t??[]}function tC(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=IOe(o);s=gOe(s.replace(DOe,""))?Ka.relative(a,s):Ka.normalize(s);let c=(i=COe.exec(s))===null||i===void 0?void 0:i[0],l=q8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=F8(m),r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ka.join(o,...d):o)}return s}function NOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(tC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(tC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(tC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function jOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=NOe(t,e,n);t.debug&&Tp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(z8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Yl.default)(i.match,f),m=(0,Yl.default)(i.ignore,f),h=wOe(i.match,f),g=M8(r,d,o),b=o?g:M8(r,d,!0),_=(w,R)=>{let A=b(R,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new d8({filters:[a?(w,R)=>{let A=g(w,R),T=p(A)&&!m(A);return T&&Tp(`matched ${A}`),T}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return Tp(`${A?"skipped":"crawling"} ${R}`),A}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Tp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&kOe(r,d)]}function MOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function FOe(t){let e=Object.assign({},t);for(let r in L8)e[r]===void 0&&Object.assign(e,{[r]:L8[r]});return e.cwd=(e.cwd instanceof URL?_Oe(e.cwd):yOe(e.cwd||process.cwd())).replace(z8,"/"),e.ignore=H8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||uOe,readdirSync:e.fs.readdirSync||dOe,realpath:e.fs.realpath||fOe,realpathSync:e.fs.realpathSync||pOe,stat:e.fs.stat||mOe,statSync:e.fs.statSync||hOe}),e.debug&&Tp("globbing with options:",e),e}function LOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=bOe(t)||typeof t=="string",i=H8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=FOe(n?e:t);return i.length>0?jOe(o,i):[]}function Ss(t,e){let[r,n]=LOe(t,e);return r?MOe(r.sync(),n):[]}var Yl,bOe,z8,vOe,U8,SOe,xOe,$Oe,EOe,AOe,TOe,OOe,ROe,IOe,COe,DOe,L8,Op=y(()=>{f8();Yl=wt(j8(),1),bOe=Array.isArray,z8=/\\/g,vOe=/^[A-Za-z]:$/,U8=process.platform==="win32",SOe=/^(\/?\.\.)+$/;xOe=/^[A-Z]:\/$/i,$Oe=U8?t=>xOe.test(t):t=>t==="/";EOe={parts:!0};AOe=/(?t.replace(AOe,"\\$&"),ROe=t=>t.replace(TOe,"\\$&"),IOe=U8?ROe:OOe;COe=/^(\/?\.\.)+/,DOe=/\\(?=[()[\]{}!*+?@|])/g;L8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Rp,readFileSync as zOe,readdirSync as UOe,statSync as B8}from"node:fs";import{join as Ja}from"node:path";function qOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Li(e,n),o=[],{layers:s,forbiddenImports:a}=rC(r);return(s.size>0||a.length>0)&&!Rp(Ja(e,i.mainRoot))?[{detector:Ip,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(HOe(e,i,s,o),BOe(e,i,s,o)),a.length>0&&GOe(e,i,a,o),o)}function rC(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function HOe(t,e,r,n){let i=e.mainRoot,o=Ja(t,i);if(Rp(o))for(let s of UOe(o)){let a=Ja(o,s);B8(a).isDirectory()&&(r.has(s)||n.push({detector:Ip,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function BOe(t,e,r,n){let i=e.mainRoot,o=Ja(t,i);if(Rp(o))for(let s of r){let a=Ja(o,s);Rp(a)&&B8(a).isDirectory()||n.push({detector:Ip,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function GOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ja(t,i,s.from);if(!Rp(a))continue;let c=Ss([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ja(a,l),d;try{d=zOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];ZOe(p,s.to,e.importStyle)&&n.push({detector:Ip,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function ZOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ip,G8,nC=y(()=>{"use strict";Op();Ue();Wa();Ip="ARCHITECTURE_FROM_SPEC";G8={name:Ip,run:qOe}});import{existsSync as VOe,readFileSync as WOe}from"node:fs";import{join as KOe}from"node:path";function YOe(t){let{cwd:e="."}=t,r=KOe(e,"spec/capabilities.yaml");if(!VOe(r))return[];let n;try{let u=WOe(r,"utf8"),d=Z8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";Z8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",JOe=8;V8={name:Wv,run:YOe}});import{existsSync as XOe,readFileSync as QOe}from"node:fs";import{join as eRe}from"node:path";function tRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function rRe(t){let{cwd:e="."}=t;return ye(e,iC,r=>nRe(r,e))}function nRe(t,e){let r=Li(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=eRe(e,o);if(!XOe(s))continue;let a=QOe(s,"utf8");tRe(a)||n.push({detector:iC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var iC,K8,J8=y(()=>{"use strict";Wa();xt();iC="CONVENTION_DRIFT";K8={name:iC,run:rRe}});import{existsSync as oC,readFileSync as Y8}from"node:fs";import{join as Kv}from"node:path";function iRe(t){return JSON.parse(t).total?.lines?.pct??0}function X8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function aRe(t,e){if(!Cv(ft(t).gates.coverage?.cmd))return null;let r;try{r=Dv(t,e)}catch(c){return[{detector:Eo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=DP.find(d=>oC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=X8(Y8(Kv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:Eo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=Q8(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function cRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=aRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=ft(e).language==="kotlin"?DP.find(a=>oC(Kv(e,a)))??CJ(e):n.coverageSummary,o=Kv(e,i);if(!oC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=Y8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?oRe(a):n.coverageFormat==="cobertura-xml"?sRe(a):iRe(a)}catch(a){return[{detector:Eo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:Eo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Jv?[]:[{detector:Eo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Jv}%`}]}var Eo,Jv,e5,t5=y(()=>{"use strict";Ue();Mv();Wa();Nv();ln();Eo="COVERAGE_DROP",Jv=70;e5={name:Eo,run:cRe}});import{existsSync as lRe}from"node:fs";import{join as uRe}from"node:path";function fRe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>pRe(r,e))}function pRe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";xt();Yv="DELIVERABLE_INTEGRITY",dRe=8;r5={name:Yv,run:fRe}});function mRe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Xv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function hRe(t){let e=mRe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Xv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function gRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>hRe(r))}var Xv,i5,o5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";i5={name:Xv,run:gRe}});function yRe(t){let{cwd:e="."}=t;return ye(e,Qv,r=>_Re(r,e))}function _Re(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ds(e);if(n===null)return[{detector:Qv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=Q_(n,e,o);s.state!=="fresh"&&i.push({detector:Qv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Qv,eS,sC=y(()=>{"use strict";kl();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:yRe}});function bRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return vRe(r)}function vRe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:s5,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var s5,tS,aC=y(()=>{"use strict";Ue();s5="DEPENDENCY_CYCLE";tS={name:s5,run:bRe}});import{appendFileSync as SRe,existsSync as a5,mkdirSync as wRe,readFileSync as xRe}from"node:fs";import{dirname as $Re,join as kRe}from"node:path";function c5(t){return kRe(t,ERe,ARe)}function l5(t){return cC.add(t),()=>cC.delete(t)}function Ya(t,e){let r=c5(t),n=$Re(r);a5(n)||wRe(n,{recursive:!0}),SRe(r,`${JSON.stringify(e)} `,"utf8");for(let i of cC)try{i(t,e)}catch{}}function pr(t){let e=c5(t);if(!a5(e))return[];let r=xRe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var ERe,ARe,cC,dn=y(()=>{"use strict";ERe=".cladding",ARe="audit.log.jsonl";cC=new Set});import{existsSync as TRe}from"node:fs";import{join as ORe}from"node:path";function RRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:lC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(TRe(ORe(e,i.artifact))||n.push({detector:lC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var lC,u5,d5=y(()=>{"use strict";dn();lC="EVIDENCE_MISMATCH";u5={name:lC,run:RRe}});import{existsSync as IRe,readFileSync as PRe}from"node:fs";import{join as CRe}from"node:path";function DRe(t){let e=CRe(t,h5);if(!IRe(e))return null;try{let n=((0,m5.parse)(PRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*p5(t,e){for(let r of t??[])r.startsWith(f5)&&(yield{ref:r,name:r.slice(f5.length),field:e})}function NRe(t){let{cwd:e="."}=t,r=DRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:uC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...p5(s.evidence_refs,"evidence_refs"),...p5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:uC,severity:"warn",path:h5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var m5,uC,f5,h5,g5,y5=y(()=>{"use strict";m5=wt(tr(),1);Ue();uC="FIXTURE_REFERENCE_INVALID",f5="fixture:",h5="conformance/fixtures.yaml";g5={name:uC,run:NRe}});import{existsSync as Yl,readFileSync as dC}from"node:fs";import{join as Ya}from"node:path";function jRe(t){return vs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Ip(t){if(!Yl(t))return null;try{return JSON.parse(dC(t,"utf8"))}catch{return null}}function MRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(dC(r,"utf8"))}catch(c){e.push({detector:Ao,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Ao,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=jRe(t);s!==a&&e.push({detector:Ao,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function FRe(t,e){for(let r of _5){let n=Ya(t,r.path);if(!Yl(n))continue;let i=Ip(n);if(!i){e.push({detector:Ao,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Ao,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function LRe(t,e){let r=Ip(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of _5){let s=Ya(t,o.path);if(!Yl(s))continue;let a=Ip(s);a?.version&&a.version!==n&&e.push({detector:Ao,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ya(t,".claude-plugin","marketplace.json");if(Yl(i)){let o=Ip(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Ao,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function zRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function URe(t,e){let r=Ya(t,"src","cli","clad.ts"),n=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Yl(r)||!Yl(n))return;let i=zRe(dC(r,"utf8"));if(i.length===0)return;let s=Ip(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Ao,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function qRe(t){let{cwd:e="."}=t,r=[];return MRe(e,r),URe(e,r),FRe(e,r),LRe(e,r),r}var Ao,_5,b5,v5=y(()=>{"use strict";Tp();Ao="HARNESS_INTEGRITY",_5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];b5={name:Ao,run:qRe}});import{existsSync as HRe,readFileSync as BRe}from"node:fs";import{join as GRe}from"node:path";function VRe(t){let{cwd:e="."}=t;return ye(e,tS,r=>KRe(r,e))}function WRe(t){let e=GRe(t,"spec/capabilities.yaml");if(!HRe(e))return!1;try{let r=S5.default.parse(BRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function KRe(t,e){let r=t.features.length;if(r{"use strict";S5=wt(tr(),1);xt();tS="HOLLOW_GOVERNANCE",ZRe=8;w5={name:tS,run:VRe}});function JRe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function YRe(t,e,r){let n=t.split(/\r\n|\n|\r/g),i="",o=(Math.log10(e+1)|0)+1;for(let s=e-1;s<=e+1;s++){let a=n[s-1];a&&(i+=s.toString().padEnd(o," "),i+=": ",i+=a,i+=` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var ERe,ARe,cC,dn=y(()=>{"use strict";ERe=".cladding",ARe="audit.log.jsonl";cC=new Set});import{existsSync as TRe}from"node:fs";import{join as ORe}from"node:path";function RRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:lC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(TRe(ORe(e,i.artifact))||n.push({detector:lC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var lC,u5,d5=y(()=>{"use strict";dn();lC="EVIDENCE_MISMATCH";u5={name:lC,run:RRe}});import{existsSync as IRe,readFileSync as PRe}from"node:fs";import{join as CRe}from"node:path";function DRe(t){let e=CRe(t,h5);if(!IRe(e))return null;try{let n=((0,m5.parse)(PRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*p5(t,e){for(let r of t??[])r.startsWith(f5)&&(yield{ref:r,name:r.slice(f5.length),field:e})}function NRe(t){let{cwd:e="."}=t,r=DRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:uC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...p5(s.evidence_refs,"evidence_refs"),...p5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:uC,severity:"warn",path:h5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var m5,uC,f5,h5,g5,y5=y(()=>{"use strict";m5=wt(tr(),1);Ue();uC="FIXTURE_REFERENCE_INVALID",f5="fixture:",h5="conformance/fixtures.yaml";g5={name:uC,run:NRe}});import{existsSync as Xl,readFileSync as dC}from"node:fs";import{join as Xa}from"node:path";function jRe(t){return Ss(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Pp(t){if(!Xl(t))return null;try{return JSON.parse(dC(t,"utf8"))}catch{return null}}function MRe(t,e){let r=Xa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(dC(r,"utf8"))}catch(c){e.push({detector:Ao,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Ao,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=jRe(t);s!==a&&e.push({detector:Ao,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function FRe(t,e){for(let r of _5){let n=Xa(t,r.path);if(!Xl(n))continue;let i=Pp(n);if(!i){e.push({detector:Ao,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Ao,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function LRe(t,e){let r=Pp(Xa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of _5){let s=Xa(t,o.path);if(!Xl(s))continue;let a=Pp(s);a?.version&&a.version!==n&&e.push({detector:Ao,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Xa(t,".claude-plugin","marketplace.json");if(Xl(i)){let o=Pp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Ao,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function zRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function URe(t,e){let r=Xa(t,"src","cli","clad.ts"),n=Xa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Xl(r)||!Xl(n))return;let i=zRe(dC(r,"utf8"));if(i.length===0)return;let s=Pp(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Ao,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function qRe(t){let{cwd:e="."}=t,r=[];return MRe(e,r),URe(e,r),FRe(e,r),LRe(e,r),r}var Ao,_5,b5,v5=y(()=>{"use strict";Op();Ao="HARNESS_INTEGRITY",_5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];b5={name:Ao,run:qRe}});import{existsSync as HRe,readFileSync as BRe}from"node:fs";import{join as GRe}from"node:path";function VRe(t){let{cwd:e="."}=t;return ye(e,rS,r=>KRe(r,e))}function WRe(t){let e=GRe(t,"spec/capabilities.yaml");if(!HRe(e))return!1;try{let r=S5.default.parse(BRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function KRe(t,e){let r=t.features.length;if(r{"use strict";S5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",ZRe=8;w5={name:rS,run:VRe}});function JRe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function YRe(t,e,r){let n=t.split(/\r\n|\n|\r/g),i="",o=(Math.log10(e+1)|0)+1;for(let s=e-1;s<=e+1;s++){let a=n[s-1];a&&(i+=s.toString().padEnd(o," "),i+=": ",i+=a,i+=` `,s===e&&(i+=" ".repeat(o+r+2),i+=`^ -`))}return i}var ge,Xa=y(()=>{ge=class extends Error{line;column;codeblock;constructor(e,r){let[n,i]=JRe(r.toml,r.ptr),o=YRe(r.toml,n,i);super(`Invalid TOML document: ${e} +`))}return i}var ge,Qa=y(()=>{ge=class extends Error{line;column;codeblock;constructor(e,r){let[n,i]=JRe(r.toml,r.ptr),o=YRe(r.toml,n,i);super(`Invalid TOML document: ${e} -${o}`,r),this.line=n,this.column=i,this.codeblock=o}}});function XRe(t,e){let r=0;for(;t[e-++r]==="\\";);return--r&&r%2}function rS(t,e=0,r=t.length){let n=t.indexOf(` -`,e);return t[n-1]==="\r"&&n--,n<=r?n:-1}function Xl(t,e){for(let r=e;r-1&&r!=="'"&&XRe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Pp=y(()=>{Xa();});var QRe,Qa,fC=y(()=>{QRe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Qa=class t extends Date{#t=!1;#r=!1;#e=null;constructor(e){let r=!0,n=!0,i="Z";if(typeof e=="string"){let o=e.match(QRe);o?(o[1]||(r=!1,e=`0000-01-01T${e}`),n=!!o[2],n&&e[10]===" "&&(e=e.replace(" ","T")),o[2]&&+o[2]>23?e="":(i=o[3]||null,e=e.toUpperCase(),!i&&n&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=r,this.#r=n,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,r="Z"){let n=new t(e);return n.#e=r,n}static wrapAsLocalDateTime(e){let r=new t(e);return r.#e=null,r}static wrapAsLocalDate(e){let r=new t(e);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(e){let r=new t(e);return r.#t=!1,r.#e=null,r}}});function iS(t,e=0,r=t.length){let n=t[e]==="'",i=t[e++]===t[e]&&t[e]===t[e+1];i&&(r-=2,t[e+=2]==="\r"&&e++,t[e]===` +`))return o}}throw new ge("cannot find end of structure",{toml:t,ptr:e})}function iS(t,e){let r=t[e],n=r===t[e+1]&&t[e+1]===t[e+2]?t.slice(e,e+3):r;e+=n.length-1;do e=t.indexOf(n,++e);while(e>-1&&r!=="'"&&XRe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Cp=y(()=>{Qa();});var QRe,ec,fC=y(()=>{QRe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,ec=class t extends Date{#t=!1;#r=!1;#e=null;constructor(e){let r=!0,n=!0,i="Z";if(typeof e=="string"){let o=e.match(QRe);o?(o[1]||(r=!1,e=`0000-01-01T${e}`),n=!!o[2],n&&e[10]===" "&&(e=e.replace(" ","T")),o[2]&&+o[2]>23?e="":(i=o[3]||null,e=e.toUpperCase(),!i&&n&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=r,this.#r=n,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,r="Z"){let n=new t(e);return n.#e=r,n}static wrapAsLocalDateTime(e){let r=new t(e);return r.#e=null,r}static wrapAsLocalDate(e){let r=new t(e);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(e){let r=new t(e);return r.#t=!1,r.#e=null,r}}});function oS(t,e=0,r=t.length){let n=t[e]==="'",i=t[e++]===t[e]&&t[e]===t[e+1];i&&(r-=2,t[e+=2]==="\r"&&e++,t[e]===` `&&e++);let o=0,s,a="",c=e;for(;e{Pp();fC();Xa();eIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,tIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,rIe=/^[+-]?0[0-9_]/,nIe=/^[0-9a-f]{2,8}$/i,k5={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function iIe(t,e,r){let n=t.slice(e,r),i=n.indexOf("#");return i>-1&&(Xl(t,i),n=n.slice(0,i)),[n.trimEnd(),i]}function Cp(t,e,r,n,i){if(n===0)throw new ge("document contains excessively nested structures. aborting.",{toml:t,ptr:e});let o=t[e];if(o==="["||o==="{"){let[c,l]=o==="["?T5(t,e,n,i):A5(t,e,n,i);if(r){if(l=fn(t,l),t[l]===",")l++;else if(t[l]!==r)throw new ge("expected comma or end of structure",{toml:t,ptr:l})}return[c,l]}let s;if(o==='"'||o==="'"){s=nS(t,e);let c=iS(t,e,s);if(r){if(s=fn(t,s),t[s]&&t[s]!==","&&t[s]!==r&&t[s]!==` -`&&t[s]!=="\r")throw new ge("unexpected character encountered",{toml:t,ptr:s});s+=+(t[s]===",")}return[c,s]}s=$5(t,e,",",r);let a=iIe(t,e,s-+(t[s-1]===","));if(!a[0])throw new ge("incomplete key-value declaration: no value specified",{toml:t,ptr:e});return r&&a[1]>-1&&(s=fn(t,e+a[1]),s+=+(t[s]===",")),[E5(a[0],t,e,i),s]}var mC=y(()=>{pC();hC();Pp();Xa();});function oS(t,e,r="="){let n=e-1,i=[],o=t.indexOf(r,e);if(o<0)throw new ge("incomplete key-value: cannot find end of key",{toml:t,ptr:e});do{let s=t[e=++n];if(s!==" "&&s!==" ")if(s==='"'||s==="'"){if(s===t[e+1]&&s===t[e+2])throw new ge("multiline strings are not allowed in keys",{toml:t,ptr:e});let a=nS(t,e);if(a<0)throw new ge("unfinished string encountered",{toml:t,ptr:e});n=t.indexOf(".",a);let c=t.slice(a,n<0||n>o?o:n),l=rS(c);if(l>-1)throw new ge("newlines are not allowed in keys",{toml:t,ptr:e+n+l});if(c.trimStart())throw new ge("found extra tokens after the string part",{toml:t,ptr:a});if(oo?o:n);if(!oIe.test(a))throw new ge("only letter, numbers, dashes and underscores are allowed in keys",{toml:t,ptr:e});i.push(a.trimEnd())}}while(n+1&&n{pC();mC();Pp();Xa();oIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function O5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{hC();mC();Pp();Xa();});function Dp(t){let e=typeof t;if(e==="object"){if(Array.isArray(t))return"array";if(t instanceof Date)return"date"}return e}function sIe(t){for(let e=0;e{Cp();fC();Qa();eIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,tIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,rIe=/^[+-]?0[0-9_]/,nIe=/^[0-9a-f]{2,8}$/i,k5={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function iIe(t,e,r){let n=t.slice(e,r),i=n.indexOf("#");return i>-1&&(Ql(t,i),n=n.slice(0,i)),[n.trimEnd(),i]}function Dp(t,e,r,n,i){if(n===0)throw new ge("document contains excessively nested structures. aborting.",{toml:t,ptr:e});let o=t[e];if(o==="["||o==="{"){let[c,l]=o==="["?T5(t,e,n,i):A5(t,e,n,i);if(r){if(l=fn(t,l),t[l]===",")l++;else if(t[l]!==r)throw new ge("expected comma or end of structure",{toml:t,ptr:l})}return[c,l]}let s;if(o==='"'||o==="'"){s=iS(t,e);let c=oS(t,e,s);if(r){if(s=fn(t,s),t[s]&&t[s]!==","&&t[s]!==r&&t[s]!==` +`&&t[s]!=="\r")throw new ge("unexpected character encountered",{toml:t,ptr:s});s+=+(t[s]===",")}return[c,s]}s=$5(t,e,",",r);let a=iIe(t,e,s-+(t[s-1]===","));if(!a[0])throw new ge("incomplete key-value declaration: no value specified",{toml:t,ptr:e});return r&&a[1]>-1&&(s=fn(t,e+a[1]),s+=+(t[s]===",")),[E5(a[0],t,e,i),s]}var mC=y(()=>{pC();hC();Cp();Qa();});function sS(t,e,r="="){let n=e-1,i=[],o=t.indexOf(r,e);if(o<0)throw new ge("incomplete key-value: cannot find end of key",{toml:t,ptr:e});do{let s=t[e=++n];if(s!==" "&&s!==" ")if(s==='"'||s==="'"){if(s===t[e+1]&&s===t[e+2])throw new ge("multiline strings are not allowed in keys",{toml:t,ptr:e});let a=iS(t,e);if(a<0)throw new ge("unfinished string encountered",{toml:t,ptr:e});n=t.indexOf(".",a);let c=t.slice(a,n<0||n>o?o:n),l=nS(c);if(l>-1)throw new ge("newlines are not allowed in keys",{toml:t,ptr:e+n+l});if(c.trimStart())throw new ge("found extra tokens after the string part",{toml:t,ptr:a});if(oo?o:n);if(!oIe.test(a))throw new ge("only letter, numbers, dashes and underscores are allowed in keys",{toml:t,ptr:e});i.push(a.trimEnd())}}while(n+1&&n{pC();mC();Cp();Qa();oIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function O5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{hC();mC();Cp();Qa();});function Np(t){let e=typeof t;if(e==="object"){if(Array.isArray(t))return"array";if(t instanceof Date)return"date"}return e}function sIe(t){for(let e=0;e{I5=/^[a-z0-9-_]+$/i});var SC={};Nr(SC,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>uIe,parse:()=>gC,stringify:()=>vC});var uIe,wC=y(()=>{R5();P5();fC();Xa();uIe={parse:gC,stringify:vC,TomlDate:Qa,TomlError:ge}});import{cpSync as dIe,existsSync as jn,lstatSync as fIe,mkdirSync as pIe,readFileSync as lS,readlinkSync as mIe,readdirSync as hIe,rmSync as D5,writeFileSync as ec}from"node:fs";import{homedir as N5,platform as j5}from"node:os";import{basename as gIe,dirname as Ss,isAbsolute as yIe,join as he,relative as _Ie,resolve as ws}from"node:path";import{fileURLToPath as bIe}from"node:url";import{spawnSync as M5}from"node:child_process";function sS(t){pIe(t,{recursive:!0})}function si(t){try{return lS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(sS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function aS(t){try{return fIe(t).isSymbolicLink()}catch{return!1}}function wIe(t){try{return ws(Ss(t),mIe(t))}catch{return null}}function F5(t,e){let r=_Ie(ws(e),ws(t));return r===""||!r.startsWith("..")&&!yIe(r)}function xIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",$C));if(n)try{let i=JSON.parse(n);typeof i.cladding_root=="string"&&r.push(ws(i.cladding_root))}catch{}return[...new Set(r)]}function cS(t,e){if(!jn(t)&&!aS(t))return"unchanged";if(!aS(t))return"skipped-different";let r=wIe(t);if(!r||!e.some(n=>F5(r,n)))return"skipped-different";try{return D5(t,{force:!0}),"removed"}catch{return"failed"}}function $Ie(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of hIe(r)){if(!o.startsWith("cladding-"))continue;let s=cS(he(r,o),e);s==="removed"&&n++,s==="skipped-different"&&i++}return i>0?"skipped-different":n>0?"removed":"unchanged"}function Mp(t,e){if(!t||typeof t!="object")return!1;let r=t,n=Array.isArray(r.args)?r.args:[];return r.command==="clad"&&n[0]==="serve"||typeof r.description=="string"&&r.description.includes("wired by `clad setup`")||typeof r.description=="string"&&r.description.includes("project-scoped by `clad setup`")||r.command==="node"&&n[0]===kC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>F5(n[0],i))}function kIe(t,e){let r=t.split(` +`:n}var I5,P5=y(()=>{I5=/^[a-z0-9-_]+$/i});var SC={};Nr(SC,{TomlDate:()=>ec,TomlError:()=>ge,default:()=>uIe,parse:()=>gC,stringify:()=>vC});var uIe,wC=y(()=>{R5();P5();fC();Qa();uIe={parse:gC,stringify:vC,TomlDate:ec,TomlError:ge}});import{cpSync as dIe,existsSync as jn,lstatSync as fIe,mkdirSync as pIe,readFileSync as uS,readlinkSync as mIe,readdirSync as hIe,rmSync as D5,writeFileSync as tc}from"node:fs";import{homedir as N5,platform as j5}from"node:os";import{basename as gIe,dirname as ws,isAbsolute as yIe,join as he,relative as _Ie,resolve as xs}from"node:path";import{fileURLToPath as bIe}from"node:url";import{spawnSync as M5}from"node:child_process";function aS(t){pIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function rc(t,e){let r=si(t);return r===e?"unchanged":(aS(ws(t)),tc(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return fIe(t).isSymbolicLink()}catch{return!1}}function wIe(t){try{return xs(ws(t),mIe(t))}catch{return null}}function F5(t,e){let r=_Ie(xs(e),xs(t));return r===""||!r.startsWith("..")&&!yIe(r)}function xIe(t,e){let r=[xs(e)],n=si(he(t,".cladding",$C));if(n)try{let i=JSON.parse(n);typeof i.cladding_root=="string"&&r.push(xs(i.cladding_root))}catch{}return[...new Set(r)]}function lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=wIe(t);if(!r||!e.some(n=>F5(r,n)))return"skipped-different";try{return D5(t,{force:!0}),"removed"}catch{return"failed"}}function $Ie(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of hIe(r)){if(!o.startsWith("cladding-"))continue;let s=lS(he(r,o),e);s==="removed"&&n++,s==="skipped-different"&&i++}return i>0?"skipped-different":n>0?"removed":"unchanged"}function Fp(t,e){if(!t||typeof t!="object")return!1;let r=t,n=Array.isArray(r.args)?r.args:[];return r.command==="clad"&&n[0]==="serve"||typeof r.description=="string"&&r.description.includes("wired by `clad setup`")||typeof r.description=="string"&&r.description.includes("project-scoped by `clad setup`")||r.command==="node"&&n[0]===kC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>F5(n[0],i))}function kIe(t,e){let r=t.split(` `),n=r.findIndex(s=>s.trim()===e);if(n===-1)return null;let i=r.length;for(let s=n+1;s0&&r[o-1].trim()==="";)o--;return[...r.slice(0,o),...r.slice(i)].join(` -`)}async function EIe(t,e){let r=he(t,".codex","config.toml"),n=si(r);if(n==null)return"unchanged";try{let{parse:i,stringify:o}=await Promise.resolve().then(()=>(wC(),SC)),s=i(n),a=s.mcp_servers;if(!a?.cladding)return"unchanged";if(!Mp(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete s.mcp_servers;let c=kIe(n,"[mcp_servers.cladding]");if(c!=null)try{if(JSON.stringify(i(c))===JSON.stringify(s))return ec(r,c,"utf8"),"removed"}catch{}return ec(r,o(s),"utf8"),"removed"}catch{return"failed"}}function AIe(t,e){let r=he(t,".cursor","mcp.json"),n=si(r);if(n==null)return"unchanged";try{let i=JSON.parse(n),o=i.mcpServers;return o?.cladding?Mp(o.cladding,e)?(delete o.cladding,Object.keys(o).length===0&&delete i.mcpServers,ec(r,`${JSON.stringify(i,null,2)} -`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function TIe(t,e,r){let n=he(t,".gemini","config","plugins","cladding");if(aS(n))return"skipped-different";let i={command:"node",args:[he(e,"dist","clad.js"),"serve"]},o=jp(he(n,"mcp_config.json"),i,r);if(o==="skipped-different"||o==="failed")return o;let s=`${JSON.stringify({$schema:"https://antigravity.google/schemas/v1/plugin.json",name:"cladding",description:"Spec-driven verification and onboarding for Antigravity CLI (machine-wide MCP wire; the project is resolved from each session\u2019s working directory)."},null,2)} -`;return Ql([o,tc(he(n,"plugin.json"),s)])}function OIe(t,e){let r=he(t,".gemini","config","plugins","cladding");if(aS(r))return cS(r,e);let n=si(he(r,"mcp_config.json"));if(n==null)return"unchanged";try{let i=JSON.parse(n).mcpServers;return i?.cladding&&!Mp(i.cladding,e)?"skipped-different":"unchanged"}catch{return"skipped-different"}}function RIe(t){let e=j5()==="win32"?"where":"which";return M5(e,[t],{stdio:"ignore"}).status===0}function IIe(t){if(!t||!RIe("claude"))return"manual-required";let e=M5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:j5()==="win32"});if(e.status===0)return"removed";let r=`${e.stdout??""} +`)}async function EIe(t,e){let r=he(t,".codex","config.toml"),n=si(r);if(n==null)return"unchanged";try{let{parse:i,stringify:o}=await Promise.resolve().then(()=>(wC(),SC)),s=i(n),a=s.mcp_servers;if(!a?.cladding)return"unchanged";if(!Fp(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete s.mcp_servers;let c=kIe(n,"[mcp_servers.cladding]");if(c!=null)try{if(JSON.stringify(i(c))===JSON.stringify(s))return tc(r,c,"utf8"),"removed"}catch{}return tc(r,o(s),"utf8"),"removed"}catch{return"failed"}}function AIe(t,e){let r=he(t,".cursor","mcp.json"),n=si(r);if(n==null)return"unchanged";try{let i=JSON.parse(n),o=i.mcpServers;return o?.cladding?Fp(o.cladding,e)?(delete o.cladding,Object.keys(o).length===0&&delete i.mcpServers,tc(r,`${JSON.stringify(i,null,2)} +`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function TIe(t,e,r){let n=he(t,".gemini","config","plugins","cladding");if(cS(n))return"skipped-different";let i={command:"node",args:[he(e,"dist","clad.js"),"serve"]},o=Mp(he(n,"mcp_config.json"),i,r);if(o==="skipped-different"||o==="failed")return o;let s=`${JSON.stringify({$schema:"https://antigravity.google/schemas/v1/plugin.json",name:"cladding",description:"Spec-driven verification and onboarding for Antigravity CLI (machine-wide MCP wire; the project is resolved from each session\u2019s working directory)."},null,2)} +`;return eu([o,rc(he(n,"plugin.json"),s)])}function OIe(t,e){let r=he(t,".gemini","config","plugins","cladding");if(cS(r))return lS(r,e);let n=si(he(r,"mcp_config.json"));if(n==null)return"unchanged";try{let i=JSON.parse(n).mcpServers;return i?.cladding&&!Fp(i.cladding,e)?"skipped-different":"unchanged"}catch{return"skipped-different"}}function RIe(t){let e=j5()==="win32"?"where":"which";return M5(e,[t],{stdio:"ignore"}).status===0}function IIe(t){if(!t||!RIe("claude"))return"manual-required";let e=M5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:j5()==="win32"});if(e.status===0)return"removed";let r=`${e.stdout??""} ${e.stderr??""}`;return/not installed|not found/i.test(r)?"unchanged":"manual-required"}function PIe(t){let e=he(t,"dist","clad.js");return["'use strict';","const {spawn} = require('node:child_process');",`const engine = ${JSON.stringify(e)};`,"const requested = process.argv.slice(2);","const args = requested.length > 0 ? requested : ['serve'];","const child = spawn(process.execPath, [engine, ...args], {cwd: process.cwd(), stdio: 'inherit'});","for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => child.kill(signal));","child.on('error', (error) => { console.error(`cladding project launcher: ${error.message}`); process.exitCode = 1; });","child.on('exit', (code, signal) => { process.exitCode = code ?? (signal ? 1 : 0); });",""].join(` `)}function CIe(){return["[[rule]]",'mcpName = "cladding"','toolName = "*"','decision = "deny"',"priority = 100",'modes = ["plan"]',"interactive = false","","[[rule]]",'mcpName = "cladding"','toolName = ["clad_list_features", "clad_get_feature", "clad_run_check"]',"toolAnnotations = { readOnlyHint = true }",'decision = "allow"',"priority = 200",'modes = ["plan"]',"interactive = false","","[[rule]]",'toolName = "exit_plan_mode"','decision = "deny"',"priority = 200",'modes = ["plan"]',"interactive = false",""].join(` -`)}function DIe(t){let e=he(t,".git","info","exclude");if(!jn(Ss(e)))return;let r=["/.cladding/host/","/.cladding/setup-status.json"],n=si(e)??"",i=n.split(/\r?\n/),o=r.filter(a=>!i.includes(a));if(o.length===0)return;let s=n.length>0&&!n.endsWith(` +`)}function DIe(t){let e=he(t,".git","info","exclude");if(!jn(ws(e)))return;let r=["/.cladding/host/","/.cladding/setup-status.json"],n=si(e)??"",i=n.split(/\r?\n/),o=r.filter(a=>!i.includes(a));if(o.length===0)return;let s=n.length>0&&!n.endsWith(` `)?` -`:"";ec(e,`${n}${s}${o.join(` +`:"";tc(e,`${n}${s}${o.join(` `)} `,"utf8")}function NIe(){return{command:"node",args:[kC]}}function xC(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- `))return"failed";let i=gIe(e),o=/^name:\s*.*$/m.test(n)?n.replace(/^name:\s*.*$/m,`name: ${i}`):n.replace(/^---\n/,`--- name: ${i} -`);if(jn(e)){let s=si(he(e,"SKILL.md"));if(s===o)return"unchanged";if(!r&&s!=null&&!s.includes("# Cladding init"))return"skipped-different";D5(e,{recursive:!0,force:!0})}return sS(Ss(e)),dIe(t,e,{recursive:!0,dereference:!0}),ec(he(e,"SKILL.md"),o,"utf8"),"created"}function jp(t,e,r){try{let n=si(t),i=n==null?{}:JSON.parse(n);(!i.mcpServers||typeof i.mcpServers!="object")&&(i.mcpServers={});let o=i.mcpServers,s=o.cladding,a={command:e.command,args:e.args};return JSON.stringify(s)===JSON.stringify(a)?"unchanged":s&&!r&&!Mp(s,[])?"skipped-different":(o.cladding=a,tc(t,`${JSON.stringify(i,null,2)} -`))}catch{return"failed"}}function jIe(t){try{let e=si(t),r=e==null?{}:JSON.parse(e),n=r.permissions;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))return"skipped-different";let i=n??{},o=i.allow;if(o!==void 0&&(!Array.isArray(o)||o.some(u=>typeof u!="string")))return"skipped-different";let s=i.deny;if(s!==void 0&&(!Array.isArray(s)||s.some(u=>typeof u!="string")))return"skipped-different";let a=o??[],c=s??[],l=[...a];for(let u of SIe)l.includes(u)||l.push(u);return l.length===a.length&&s!==void 0?"unchanged":(i.allow=l,i.deny=c,r.permissions=i,tc(t,`${JSON.stringify(r,null,2)} -`))}catch{return"failed"}}async function MIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(wC(),SC)),o=si(t),s=o==null?{}:n(o);(!s.mcp_servers||typeof s.mcp_servers!="object")&&(s.mcp_servers={});let a=s.mcp_servers,c=a.cladding,l={command:e.command,args:e.args,description:"cladding MCP server (project-scoped by `clad setup`)",default_tools_approval_mode:"writes"};return JSON.stringify(c)===JSON.stringify(l)?"unchanged":c&&!r&&!Mp(c,[])?"skipped-different":(a.cladding=l,tc(t,i(s)))}catch{return"failed"}}function FIe(t){let e=["---","description: Cladding bootstrap boundary","alwaysApply: true","---","","Cladding is available only in this project. Do not initialize or invoke Cladding for ordinary work.","Use the cladding-init skill only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it.",""].join(` -`);return tc(he(t,".cursor","rules","cladding-bootstrap.mdc"),e)}function Ql(t){return t.includes("failed")?"failed":t.includes("skipped-different")?"skipped-different":t.includes("manual-required")?"manual-required":t.includes("removed")?"removed":t.includes("rewired")?"rewired":t.includes("created")?"created":"unchanged"}function L5(t){try{return JSON.parse(lS(t,"utf8")).cladding_version??null}catch{return null}}function C5(t,e,r,n){t==="failed"&&r.push({step:e,message:"project wiring failed"}),t==="skipped-different"&&n.push({step:e,message:"existing non-Cladding configuration was preserved; use --force to replace only the cladding entry"}),t==="manual-required"&&n.push({step:e,message:"run `claude plugin uninstall claude-code@cladding --scope user --keep-data` to remove the legacy user plugin"})}async function AC(t={}){let e=t.home??N5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??z5(),i=t.version??U5(n),o=zIe(e),s=new Set(t.hosts??vIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",$C),l=L5(c),u=[],d=[];sS(r),DIe(r);let f=[tc(he(r,kC),PIe(n))];s.has("gemini")&&f.push(tc(he(r,EC),CIe()));let p=Ql(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?xC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=NIe(),b=xIe(e,n),_=cS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?IIe(t.activate??!0):"unchanged",x={claude_plugin:Ql([_,S]),gemini_extension:cS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:OIe(e,b),codex_skills:$Ie(e,b),codex_mcp:await EIe(e,b),cursor_mcp:AIe(e,b)},w=s.has("codex")?await MIe(he(r,".codex","config.toml"),g,a):"skipped-not-selected",R=s.has("gemini")?jp(he(r,".gemini","settings.json"),g,a):"skipped-not-selected",A=s.has("antigravity")?Ql([jp(he(r,".agents","mcp_config.json"),g,a),TIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?Ql([xC(m,he(r,".claude","skills","cladding-init"),a),jp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?Ql([xC(m,he(r,".cursor","skills","cladding-init"),a),jp(he(r,".cursor","mcp.json"),g,a),jIe(he(r,".cursor","cli.json")),FIe(r)]):"skipped-not-selected",E={runtime:p,shared_init_skill:h,claude:T,codex:w,gemini:R,antigravity:A,cursor:D};s.size===0&&d.push({step:"hosts",message:"no supported AI host detected on this machine \u2014 only the shared runtime was written; use `clad setup --host ` to wire explicitly"});for(let[X,J]of Object.entries(E))C5(J,X,u,d);for(let[X,J]of Object.entries(x))C5(J,`legacy:${X}`,u,d);sS(Ss(c)),ec(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} +`);if(jn(e)){let s=si(he(e,"SKILL.md"));if(s===o)return"unchanged";if(!r&&s!=null&&!s.includes("# Cladding init"))return"skipped-different";D5(e,{recursive:!0,force:!0})}return aS(ws(e)),dIe(t,e,{recursive:!0,dereference:!0}),tc(he(e,"SKILL.md"),o,"utf8"),"created"}function Mp(t,e,r){try{let n=si(t),i=n==null?{}:JSON.parse(n);(!i.mcpServers||typeof i.mcpServers!="object")&&(i.mcpServers={});let o=i.mcpServers,s=o.cladding,a={command:e.command,args:e.args};return JSON.stringify(s)===JSON.stringify(a)?"unchanged":s&&!r&&!Fp(s,[])?"skipped-different":(o.cladding=a,rc(t,`${JSON.stringify(i,null,2)} +`))}catch{return"failed"}}function jIe(t){try{let e=si(t),r=e==null?{}:JSON.parse(e),n=r.permissions;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))return"skipped-different";let i=n??{},o=i.allow;if(o!==void 0&&(!Array.isArray(o)||o.some(u=>typeof u!="string")))return"skipped-different";let s=i.deny;if(s!==void 0&&(!Array.isArray(s)||s.some(u=>typeof u!="string")))return"skipped-different";let a=o??[],c=s??[],l=[...a];for(let u of SIe)l.includes(u)||l.push(u);return l.length===a.length&&s!==void 0?"unchanged":(i.allow=l,i.deny=c,r.permissions=i,rc(t,`${JSON.stringify(r,null,2)} +`))}catch{return"failed"}}async function MIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(wC(),SC)),o=si(t),s=o==null?{}:n(o);(!s.mcp_servers||typeof s.mcp_servers!="object")&&(s.mcp_servers={});let a=s.mcp_servers,c=a.cladding,l={command:e.command,args:e.args,description:"cladding MCP server (project-scoped by `clad setup`)",default_tools_approval_mode:"writes"};return JSON.stringify(c)===JSON.stringify(l)?"unchanged":c&&!r&&!Fp(c,[])?"skipped-different":(a.cladding=l,rc(t,i(s)))}catch{return"failed"}}function FIe(t){let e=["---","description: Cladding bootstrap boundary","alwaysApply: true","---","","Cladding is available only in this project. Do not initialize or invoke Cladding for ordinary work.","Use the cladding-init skill only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it.",""].join(` +`);return rc(he(t,".cursor","rules","cladding-bootstrap.mdc"),e)}function eu(t){return t.includes("failed")?"failed":t.includes("skipped-different")?"skipped-different":t.includes("manual-required")?"manual-required":t.includes("removed")?"removed":t.includes("rewired")?"rewired":t.includes("created")?"created":"unchanged"}function L5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function C5(t,e,r,n){t==="failed"&&r.push({step:e,message:"project wiring failed"}),t==="skipped-different"&&n.push({step:e,message:"existing non-Cladding configuration was preserved; use --force to replace only the cladding entry"}),t==="manual-required"&&n.push({step:e,message:"run `claude plugin uninstall claude-code@cladding --scope user --keep-data` to remove the legacy user plugin"})}async function AC(t={}){let e=t.home??N5(),r=xs(t.projectRoot??process.cwd()),n=t.pkgRoot??z5(),i=t.version??U5(n),o=zIe(e),s=new Set(t.hosts??vIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",$C),l=L5(c),u=[],d=[];aS(r),DIe(r);let f=[rc(he(r,kC),PIe(n))];s.has("gemini")&&f.push(rc(he(r,EC),CIe()));let p=eu(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?xC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=NIe(),b=xIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?IIe(t.activate??!0):"unchanged",x={claude_plugin:eu([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:OIe(e,b),codex_skills:$Ie(e,b),codex_mcp:await EIe(e,b),cursor_mcp:AIe(e,b)},w=s.has("codex")?await MIe(he(r,".codex","config.toml"),g,a):"skipped-not-selected",R=s.has("gemini")?Mp(he(r,".gemini","settings.json"),g,a):"skipped-not-selected",A=s.has("antigravity")?eu([Mp(he(r,".agents","mcp_config.json"),g,a),TIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?eu([xC(m,he(r,".claude","skills","cladding-init"),a),Mp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?eu([xC(m,he(r,".cursor","skills","cladding-init"),a),Mp(he(r,".cursor","mcp.json"),g,a),jIe(he(r,".cursor","cli.json")),FIe(r)]):"skipped-not-selected",E={runtime:p,shared_init_skill:h,claude:T,codex:w,gemini:R,antigravity:A,cursor:D};s.size===0&&d.push({step:"hosts",message:"no supported AI host detected on this machine \u2014 only the shared runtime was written; use `clad setup --host ` to wire explicitly"});for(let[X,J]of Object.entries(E))C5(J,X,u,d);for(let[X,J]of Object.entries(x))C5(J,`legacy:${X}`,u,d);aS(ws(c)),tc(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} `,"utf8");let ae={projectRoot:r,wiring:E,legacyCleanup:x,errors:u,warnings:d,statusFile:c,cladding_root:n,cladding_version:i,last_setup_version:l};return t.quiet||process.stdout.write(`${LIe(ae)} -`),ae}function Np(t){switch(t){case"created":return"wired";case"rewired":return"updated";case"unchanged":return"already ready";case"removed":return"legacy global removed";case"skipped-not-selected":return"not selected";case"skipped-different":return"preserved conflict";case"manual-required":return"manual cleanup required";default:return"failed"}}function LIe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${Np(t.wiring.claude)}`,` Codex \u2192 ${Np(t.wiring.codex)}`,` Gemini CLI \u2192 ${Np(t.wiring.gemini)}`,` Antigravity \u2192 ${Np(t.wiring.antigravity)}`,` Cursor \u2192 ${Np(t.wiring.cursor)}`];(t.wiring.antigravity==="created"||t.wiring.antigravity==="rewired")&&r.push(""," Note: Antigravity reads MCP config machine-wide only, so its wire lives in ~/.gemini/config/plugins/cladding (each session still resolves the project from its working directory).");let n=Object.values(t.legacyCleanup).filter(i=>i==="removed").length;n>0&&r.push("",`Removed ${n} legacy global Cladding wire(s).`);for(let i of t.warnings)r.push(` ! ${i.step}: ${i.message}`);return r.push("","Next steps:"," 1. Start a new AI session in this project directory",' 2. Ask: "Apply Cladding to this project"'," 3. Review the preview and reply with its exact approval phrase"," 4. After initialization, develop normally in natural language"),r.join(` -`)}function z5(){let t=bIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(lS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function U5(t){for(let e of["package.json",he(".claude-plugin","plugin.json")])try{let r=JSON.parse(lS(he(t,e),"utf8")).version;if(typeof r=="string"&&r.length>0)return r}catch{}return"unknown"}function pn(t=z5()){let e=U5(t);return e==="unknown"?null:e}function q5(t=process.cwd()){return L5(he(ws(t),".cladding",$C))}function zIe(t=N5()){return{claude:jn(he(t,".claude")),gemini:jn(he(t,".gemini")),antigravity:jn(he(t,".gemini","config"))||jn(he(t,".gemini","antigravity-cli")),codex:jn(he(t,".codex")),agents:jn(he(t,".agents")),cursor:jn(he(t,".cursor"))}}var $C,kC,EC,vIe,SIe,eu=y(()=>{"use strict";$C="setup-status.json",kC=he(".cladding","host","serve.cjs"),EC=".cladding/host/gemini-doctor-policy.toml",vIe=["claude","codex","gemini","antigravity","cursor"],SIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as H5,readFileSync as B5}from"node:fs";import{join as G5}from"node:path";function Z5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function ZIe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function V5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function W5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function VIe(t,e){let r=W5(t),n=W5(e);if(!r||!n)return!1;for(let i=0;iGIe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(HIe)?.[1],s=pn();return o!==void 0&&s!==null&&VIe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function KIe(t){let e=G5(t,"README.md"),r=G5(t,"docs","dogfood","matrix.md");if(!H5(e)||!H5(r))return[];let n=B5(e,"utf8"),i=B5(r,"utf8"),o=Z5(n,UIe),s=Z5(i,qIe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=V5(d);if(f===null)continue;let p=s[u]??"not-run",m=ZIe(p);m!==null&&f>m&&a.push({detector:TC,severity:"warn",path:"README.md",message:`README host-claims: '${u}' claims '${d}' but the newest matrix evidence is '${p}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${u}'.`})}let l=Object.values(o).some(u=>V5(u)!==null)?WIe(i,Date.now()):[];return l.length>0&&a.push({detector:TC,severity:"info",path:"docs/dogfood/matrix.md",message:`Host support evidence needs a fresh receipt: ${l.join("; ")}. Re-run \`clad doctor --hosts\` with consent; existing contradictory-claim warnings are unchanged.`}),a}function JIe(t){let{cwd:e="."}=t;return KIe(e)}var TC,UIe,qIe,HIe,BIe,GIe,K5,J5=y(()=>{"use strict";eu();TC="HOST_CLAIM_DRIFT",UIe=//,qIe=//,HIe=/^- Cladding version:\s*`([^`]+)`\s*$/m,BIe=/^- Generated:\s*(\S+)\s*$/m,GIe=720*60*60*1e3;K5={name:TC,run:JIe}});function YIe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return Y5(r.features.map(i=>i.id),"feature","spec/features/",n),Y5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function Y5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:X5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var X5,Q5,eY=y(()=>{"use strict";Ue();X5="ID_COLLISION";Q5={name:X5,run:YIe}});import{existsSync as Fp,readFileSync as OC,readdirSync as RC,statSync as XIe,writeFileSync as rY}from"node:fs";import{join as To}from"node:path";function tY(t){if(!Fp(t))return 0;try{return RC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function QIe(t){if(!Fp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=RC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=To(n,o),a;try{a=XIe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function ePe(t){let e=To(t,"spec","capabilities.yaml");if(!Fp(e))return 0;try{let r=uS.default.parse(OC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=tY(To(t,"spec","features")),r=tY(To(t,"spec","scenarios")),n=ePe(t),i=QIe(To(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function tu(t,e){let r=To(t,"spec.yaml");if(!Fp(r))return;let n=OC(r,"utf8"),i=tPe(n,e);i!==n&&rY(r,i)}function tPe(t,e){let r=t.includes(`\r +`),ae}function jp(t){switch(t){case"created":return"wired";case"rewired":return"updated";case"unchanged":return"already ready";case"removed":return"legacy global removed";case"skipped-not-selected":return"not selected";case"skipped-different":return"preserved conflict";case"manual-required":return"manual cleanup required";default:return"failed"}}function LIe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${jp(t.wiring.claude)}`,` Codex \u2192 ${jp(t.wiring.codex)}`,` Gemini CLI \u2192 ${jp(t.wiring.gemini)}`,` Antigravity \u2192 ${jp(t.wiring.antigravity)}`,` Cursor \u2192 ${jp(t.wiring.cursor)}`];(t.wiring.antigravity==="created"||t.wiring.antigravity==="rewired")&&r.push(""," Note: Antigravity reads MCP config machine-wide only, so its wire lives in ~/.gemini/config/plugins/cladding (each session still resolves the project from its working directory).");let n=Object.values(t.legacyCleanup).filter(i=>i==="removed").length;n>0&&r.push("",`Removed ${n} legacy global Cladding wire(s).`);for(let i of t.warnings)r.push(` ! ${i.step}: ${i.message}`);return r.push("","Next steps:"," 1. Start a new AI session in this project directory",' 2. Ask: "Apply Cladding to this project"'," 3. Review the preview and reply with its exact approval phrase"," 4. After initialization, develop normally in natural language"),r.join(` +`)}function z5(){let t=bIe(import.meta.url),e=ws(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=ws(e)}return xs(ws(t),"..")}function U5(t){for(let e of["package.json",he(".claude-plugin","plugin.json")])try{let r=JSON.parse(uS(he(t,e),"utf8")).version;if(typeof r=="string"&&r.length>0)return r}catch{}return"unknown"}function pn(t=z5()){let e=U5(t);return e==="unknown"?null:e}function q5(t=process.cwd()){return L5(he(xs(t),".cladding",$C))}function zIe(t=N5()){return{claude:jn(he(t,".claude")),gemini:jn(he(t,".gemini")),antigravity:jn(he(t,".gemini","config"))||jn(he(t,".gemini","antigravity-cli")),codex:jn(he(t,".codex")),agents:jn(he(t,".agents")),cursor:jn(he(t,".cursor"))}}var $C,kC,EC,vIe,SIe,tu=y(()=>{"use strict";$C="setup-status.json",kC=he(".cladding","host","serve.cjs"),EC=".cladding/host/gemini-doctor-policy.toml",vIe=["claude","codex","gemini","antigravity","cursor"],SIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as H5,readFileSync as B5}from"node:fs";import{join as G5}from"node:path";function Z5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function ZIe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function V5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function W5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function VIe(t,e){let r=W5(t),n=W5(e);if(!r||!n)return!1;for(let i=0;iGIe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(HIe)?.[1],s=pn();return o!==void 0&&s!==null&&VIe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function KIe(t){let e=G5(t,"README.md"),r=G5(t,"docs","dogfood","matrix.md");if(!H5(e)||!H5(r))return[];let n=B5(e,"utf8"),i=B5(r,"utf8"),o=Z5(n,UIe),s=Z5(i,qIe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=V5(d);if(f===null)continue;let p=s[u]??"not-run",m=ZIe(p);m!==null&&f>m&&a.push({detector:TC,severity:"warn",path:"README.md",message:`README host-claims: '${u}' claims '${d}' but the newest matrix evidence is '${p}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${u}'.`})}let l=Object.values(o).some(u=>V5(u)!==null)?WIe(i,Date.now()):[];return l.length>0&&a.push({detector:TC,severity:"info",path:"docs/dogfood/matrix.md",message:`Host support evidence needs a fresh receipt: ${l.join("; ")}. Re-run \`clad doctor --hosts\` with consent; existing contradictory-claim warnings are unchanged.`}),a}function JIe(t){let{cwd:e="."}=t;return KIe(e)}var TC,UIe,qIe,HIe,BIe,GIe,K5,J5=y(()=>{"use strict";tu();TC="HOST_CLAIM_DRIFT",UIe=//,qIe=//,HIe=/^- Cladding version:\s*`([^`]+)`\s*$/m,BIe=/^- Generated:\s*(\S+)\s*$/m,GIe=720*60*60*1e3;K5={name:TC,run:JIe}});function YIe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return Y5(r.features.map(i=>i.id),"feature","spec/features/",n),Y5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function Y5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:X5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var X5,Q5,eY=y(()=>{"use strict";Ue();X5="ID_COLLISION";Q5={name:X5,run:YIe}});import{existsSync as Lp,readFileSync as OC,readdirSync as RC,statSync as XIe,writeFileSync as rY}from"node:fs";import{join as To}from"node:path";function tY(t){if(!Lp(t))return 0;try{return RC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function QIe(t){if(!Lp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=RC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=To(n,o),a;try{a=XIe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function ePe(t){let e=To(t,"spec","capabilities.yaml");if(!Lp(e))return 0;try{let r=dS.default.parse(OC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function $s(t="."){let e=tY(To(t,"spec","features")),r=tY(To(t,"spec","scenarios")),n=ePe(t),i=QIe(To(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function ru(t,e){let r=To(t,"spec.yaml");if(!Lp(r))return;let n=OC(r,"utf8"),i=tPe(n,e);i!==n&&rY(r,i)}function tPe(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`],s=d=>r===`\r @@ -330,21 +330,21 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function rc(t="."){let e=To(t,"spec","features");if(!Fp(e))return!1;let r=[];for(let i of RC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,uS.parse)(OC(To(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function nc(t="."){let e=To(t,"spec","features");if(!Lp(e))return!1;let r=[];for(let i of RC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(OC(To(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return rY(To(t,"spec","index.yaml"),n,"utf8"),!0}var uS,Lp=y(()=>{"use strict";uS=wt(tr(),1)});import{existsSync as nY,readFileSync as iY,readdirSync as rPe}from"node:fs";import{join as IC}from"node:path";function nPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=oY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return PC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...PC(e),{detector:zp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of oY){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:zp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...PC(e)),o}function PC(t){let e=IC(t,"spec","index.yaml"),r=IC(t,"spec","features");if(!nY(e)||!nY(r))return[];let n=new Map;try{for(let l of iY(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of rPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=iY(IC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:zp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:zp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var zp,oY,sY,aY=y(()=>{"use strict";Lp();Ue();zp="INVENTORY_DRIFT",oY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];sY={name:zp,run:nPe}});import{existsSync as iPe,readFileSync as oPe}from"node:fs";import{join as sPe}from"node:path";function cPe(t){let{cwd:e="."}=t,r=sPe(e,"src","spec","schema.json"),n=[];if(iPe(r)){let i;try{i=JSON.parse(oPe(r,"utf8"))}catch(o){n.push({detector:Up,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of aPe)i.required?.includes(o)||n.push({detector:Up,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Up,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==cY&&n.push({detector:Up,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${cY}'`})}catch{}return n}var Up,aPe,cY,lY,uY=y(()=>{"use strict";Ue();Up="META_INTEGRITY",aPe=["schema","project","features"],cY="0.1";lY={name:Up,run:cPe}});function lPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return dY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),dY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function dY(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:fY,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var fY,pY,mY=y(()=>{"use strict";Ue();fY="SLUG_CONFLICT";pY={name:fY,run:lPe}});function ru(t){return t==="planned"||t==="in_progress"}var dS=y(()=>{"use strict"});import{existsSync as uPe}from"node:fs";import{join as dPe}from"node:path";function fPe(t){let{cwd:e="."}=t;return ye(e,fS,r=>pPe(r,e))}function pPe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=dPe(e,i);uPe(o)||r.push(mPe(n.id,i,n.status))}return r}function mPe(t,e,r){return ru(r)?{detector:fS,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:fS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var fS,pS,CC=y(()=>{"use strict";dS();xt();fS="MISSING_IMPLEMENTATION";pS={name:fS,run:fPe}});function hPe(t){let{cwd:e="."}=t;return ye(e,DC,gPe)}function gPe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:DC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var DC,mS,NC=y(()=>{"use strict";xt();DC="MISSING_TESTS";mS={name:DC,run:hPe}});import{existsSync as yPe,readFileSync as _Pe}from"node:fs";import{join as hY}from"node:path";function gY(t){if(yPe(t))try{return JSON.parse(_Pe(t,"utf8"))}catch{return}}function wPe(t){let{cwd:e="."}=t,r=gY(hY(e,bPe)),n=gY(hY(e,vPe));if(!r||!n)return[{detector:jC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>SPe&&i.push({detector:jC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var jC,bPe,vPe,SPe,yY,_Y=y(()=>{"use strict";jC="PERFORMANCE_DRIFT",bPe="perf/baseline.json",vPe="perf/current.json",SPe=10;yY={name:jC,run:wPe}});import{existsSync as xPe}from"node:fs";import{join as $Pe}from"node:path";function EPe(t){let{cwd:e="."}=t;return ye(e,MC,r=>TPe(r,e))}function APe(t,e){return(t.modules??[]).some(r=>xPe($Pe(e,r)))}function TPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||APe(s,e)||r.push(s.id);let n=kPe;if(r.length<=n)return[];let i=r.slice(0,bY).join(", "),o=r.length>bY?", \u2026":"";return[{detector:MC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var MC,kPe,bY,vY,SY=y(()=>{"use strict";xt();MC="PLANNED_BACKLOG",kPe=5,bY=8;vY={name:MC,run:EPe}});import{existsSync as OPe,readFileSync as RPe}from"node:fs";import{join as IPe}from"node:path";function DPe(t){let{cwd:e="."}=t;return ye(e,FC,r=>NPe(r,e))}function NPe(t,e){if(t.features.lengthn.includes(i))?[{detector:FC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var FC,PPe,CPe,wY,xY=y(()=>{"use strict";xt();FC="PROJECT_CONTEXT_DRIFT",PPe=8,CPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];wY={name:FC,run:DPe}});function $Y(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:hS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function jPe(t){let{cwd:e="."}=t;return ye(e,hS,MPe)}function MPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...$Y(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:hS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...$Y(e,n.features,`scenario ${n.id}.features`));return r}var hS,gS,LC=y(()=>{"use strict";xt();hS="REFERENCE_INTEGRITY";gS={name:hS,run:jPe}});function qp(t=""){return new RegExp(FPe,t)}var FPe,zC=y(()=>{"use strict";FPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as LPe,readdirSync as zPe,readFileSync as UPe,statSync as qPe,writeFileSync as HPe}from"node:fs";import{dirname as BPe,join as Hp,normalize as GPe,relative as ZPe}from"node:path";function YPe(t){let e=[];for(let r of t.matchAll(JPe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(qp("g"))??[])e.push(n);return[...new Set(e)].sort()}function XPe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function kY(t){return t.split("\\").join("/")}function QPe(t){return VPe.some(e=>t===e||t.startsWith(`${e}/`))}function eCe(t){let e=Hp(t,"docs");if(!LPe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=zPe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Hp(i,s),c;try{c=qPe(a)}catch{continue}let l=kY(ZPe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function tCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=GPe(Hp(BPe(t),e));return kY(r)}function Bp(t="."){let e=[];for(let r of eCe(t)){let n;try{n=UPe(Hp(t,r),"utf8")}catch{continue}let i=XPe(n),o=YPe(i);if(QPe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(WPe)?[]:i.match(qp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(KPe)){let d=tCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function EY(t="."){let e=Bp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return HPe(Hp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return rY(To(t,"spec","index.yaml"),n,"utf8"),!0}var dS,zp=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as nY,readFileSync as iY,readdirSync as rPe}from"node:fs";import{join as IC}from"node:path";function nPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=$s(e),i=r.inventory;if(!i){let s=oY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return PC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...PC(e),{detector:Up,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of oY){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Up,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...PC(e)),o}function PC(t){let e=IC(t,"spec","index.yaml"),r=IC(t,"spec","features");if(!nY(e)||!nY(r))return[];let n=new Map;try{for(let l of iY(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of rPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=iY(IC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Up,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Up,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Up,oY,sY,aY=y(()=>{"use strict";zp();Ue();Up="INVENTORY_DRIFT",oY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];sY={name:Up,run:nPe}});import{existsSync as iPe,readFileSync as oPe}from"node:fs";import{join as sPe}from"node:path";function cPe(t){let{cwd:e="."}=t,r=sPe(e,"src","spec","schema.json"),n=[];if(iPe(r)){let i;try{i=JSON.parse(oPe(r,"utf8"))}catch(o){n.push({detector:qp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of aPe)i.required?.includes(o)||n.push({detector:qp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:qp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==cY&&n.push({detector:qp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${cY}'`})}catch{}return n}var qp,aPe,cY,lY,uY=y(()=>{"use strict";Ue();qp="META_INTEGRITY",aPe=["schema","project","features"],cY="0.1";lY={name:qp,run:cPe}});function lPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return dY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),dY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function dY(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:fY,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var fY,pY,mY=y(()=>{"use strict";Ue();fY="SLUG_CONFLICT";pY={name:fY,run:lPe}});function nu(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as uPe}from"node:fs";import{join as dPe}from"node:path";function fPe(t){let{cwd:e="."}=t;return ye(e,pS,r=>pPe(r,e))}function pPe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=dPe(e,i);uPe(o)||r.push(mPe(n.id,i,n.status))}return r}function mPe(t,e,r){return nu(r)?{detector:pS,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:pS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var pS,mS,CC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:fPe}});function hPe(t){let{cwd:e="."}=t;return ye(e,DC,gPe)}function gPe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:DC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var DC,hS,NC=y(()=>{"use strict";xt();DC="MISSING_TESTS";hS={name:DC,run:hPe}});import{existsSync as yPe,readFileSync as _Pe}from"node:fs";import{join as hY}from"node:path";function gY(t){if(yPe(t))try{return JSON.parse(_Pe(t,"utf8"))}catch{return}}function wPe(t){let{cwd:e="."}=t,r=gY(hY(e,bPe)),n=gY(hY(e,vPe));if(!r||!n)return[{detector:jC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>SPe&&i.push({detector:jC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var jC,bPe,vPe,SPe,yY,_Y=y(()=>{"use strict";jC="PERFORMANCE_DRIFT",bPe="perf/baseline.json",vPe="perf/current.json",SPe=10;yY={name:jC,run:wPe}});import{existsSync as xPe}from"node:fs";import{join as $Pe}from"node:path";function EPe(t){let{cwd:e="."}=t;return ye(e,MC,r=>TPe(r,e))}function APe(t,e){return(t.modules??[]).some(r=>xPe($Pe(e,r)))}function TPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||APe(s,e)||r.push(s.id);let n=kPe;if(r.length<=n)return[];let i=r.slice(0,bY).join(", "),o=r.length>bY?", \u2026":"";return[{detector:MC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var MC,kPe,bY,vY,SY=y(()=>{"use strict";xt();MC="PLANNED_BACKLOG",kPe=5,bY=8;vY={name:MC,run:EPe}});import{existsSync as OPe,readFileSync as RPe}from"node:fs";import{join as IPe}from"node:path";function DPe(t){let{cwd:e="."}=t;return ye(e,FC,r=>NPe(r,e))}function NPe(t,e){if(t.features.lengthn.includes(i))?[{detector:FC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var FC,PPe,CPe,wY,xY=y(()=>{"use strict";xt();FC="PROJECT_CONTEXT_DRIFT",PPe=8,CPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];wY={name:FC,run:DPe}});function $Y(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:gS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function jPe(t){let{cwd:e="."}=t;return ye(e,gS,MPe)}function MPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...$Y(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:gS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...$Y(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,LC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:jPe}});function Hp(t=""){return new RegExp(FPe,t)}var FPe,zC=y(()=>{"use strict";FPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as LPe,readdirSync as zPe,readFileSync as UPe,statSync as qPe,writeFileSync as HPe}from"node:fs";import{dirname as BPe,join as Bp,normalize as GPe,relative as ZPe}from"node:path";function YPe(t){let e=[];for(let r of t.matchAll(JPe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Hp("g"))??[])e.push(n);return[...new Set(e)].sort()}function XPe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function kY(t){return t.split("\\").join("/")}function QPe(t){return VPe.some(e=>t===e||t.startsWith(`${e}/`))}function eCe(t){let e=Bp(t,"docs");if(!LPe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=zPe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Bp(i,s),c;try{c=qPe(a)}catch{continue}let l=kY(ZPe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function tCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=GPe(Bp(BPe(t),e));return kY(r)}function Gp(t="."){let e=[];for(let r of eCe(t)){let n;try{n=UPe(Bp(t,r),"utf8")}catch{continue}let i=XPe(n),o=YPe(i);if(QPe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(WPe)?[]:i.match(Hp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(KPe)){let d=tCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function EY(t="."){let e=Gp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return HPe(Bp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var VPe,WPe,KPe,JPe,yS=y(()=>{"use strict";zC();VPe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],WPe="clad-doc-links: ignore",KPe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,JPe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as rCe}from"node:fs";import{join as nCe}from"node:path";function iCe(t){let{cwd:e="."}=t;return ye(e,_S,r=>oCe(r,e))}function oCe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Bp(e).docs){for(let o of i.doc_links)rCe(nCe(e,o))||n.push({detector:_S,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:_S,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var _S,bS,UC=y(()=>{"use strict";yS();xt();_S="DOC_LINK_INTEGRITY";bS={name:_S,run:iCe}});function sCe(t){let{cwd:e="."}=t;return ye(e,Gp,r=>aCe(r))}function aCe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=AY,o=t.project.onboarding_seeded===!0&&!i;r>=AY&&n.length===0&&e.push({detector:Gp,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let a of n)(a.features??[]).length===0&&e.push({detector:Gp,severity:o?"info":"warn",path:"spec/scenarios/",message:o?`scenario ${a.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`:`scenario ${a.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let s=new Map(t.features.filter(a=>typeof a.slug=="string"&&a.slug.length>0).map(a=>[a.slug,a.id]));for(let a of n){if(!a.flow)continue;let c=new Set(a.features??[]),l=new Map;for(let u of a.flow.matchAll(/\(([^)]+)\)/g))for(let d of u[1].split(/[,/·]/)){let f=d.trim(),p=s.get(f);p&&!c.has(p)&&l.set(f,p)}if(l.size>0){let u=[...l].map(([d,f])=>`${d} (${f})`).join(", ");e.push({detector:Gp,severity:"warn",path:"spec/scenarios/",message:`scenario ${a.id} flow references ${u} but features[] does not bind ${l.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var Gp,AY,TY,OY=y(()=>{"use strict";xt();Gp="SCENARIO_COVERAGE",AY=8;TY={name:Gp,run:sCe}});import{createHash as cCe}from"node:crypto";function lCe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Zp(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??RY),sample:lCe(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(RY),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Vp(t){return(t.features??[]).filter(e=>e.status==="done").length}function uCe(t,e){return e<=0?!1:e>=1?!0:parseInt(cCe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var RY,vS=y(()=>{"use strict";RY=["unwanted"]});import{chmodSync as dCe,existsSync as PY,readFileSync as fCe,readdirSync as pCe,statSync as CY,unlinkSync as mCe,utimesSync as hCe,writeFileSync as gCe}from"node:fs";import{join as DY}from"node:path";import NY from"node:process";function yCe(t){return $J(t).map(e=>{try{let r=CY(e);return r.isFile()?{path:e,body:fCe(e),mode:r.mode,atime:r.atime,mtime:r.mtime}:{path:e,nonFile:!0}}catch(r){if(r.code==="ENOENT")return{path:e};throw r}})}function _Ce(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!PY(r.path))continue;if(!CY(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}mCe(r.path);continue}gCe(r.path,r.body),r.mode!==void 0&&dCe(r.path,r.mode),r.atime&&r.mtime&&hCe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function bCe(t){let e=!1,r=n=>{for(let i of pCe(n,{withFileTypes:!0})){if(e)return;let o=DY(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function qC(t={}){let{cwd:e="."}=t,r=DY(e,$s);if(!PY(r)||!bCe(r))return{stage:nc,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${$s}/ \u2014 skipped`};let n=ft(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:nc,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=yCe(e)}catch(d){return{stage:nc,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let s,a,c=[...i.args,$s];try{s=Ke(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=_Ce(o);if(l.length>0)return{stage:nc,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:nc,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=Nt(nc,i.cmd,s,c);return u||Xt(nc,s)}var nc,$s,vCe,HC=y(()=>{"use strict";zr();ln();bp();Nn();nc="stage_2.3",$s="tests/oracle";vCe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${NY.argv[1]}`;if(vCe){let t=qC();console.log(JSON.stringify(t)),NY.exit(t.exitCode)}});import{existsSync as SCe}from"node:fs";import{join as wCe}from"node:path";function xCe(t){let{cwd:e="."}=t;return ye(e,ai,r=>$Ce(r,e))}function $Ce(t,e){let r=[],n=Zp(t.project,Vp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?pr(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(Wp(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:ai,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${$s}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!SCe(wCe(e,f))){r.push({detector:ai,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${$s}/`)||r.push({detector:ai,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${$s}/ \u2014 stage_2.3 only runs ${$s}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:ai,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:ai,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ai,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad run history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:ai,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:ai,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:ai,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var ai,jY,MY=y(()=>{"use strict";dn();vS();HC();xt();ai="SPEC_CONFORMANCE";jY={name:ai,run:xCe}});function kCe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:BC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>FY&&i.push({detector:BC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${FY})`})}return i}var BC,FY,LY,zY=y(()=>{"use strict";dn();BC="STALE_EVIDENCE",FY=90;LY={name:BC,run:kCe}});import{existsSync as UY}from"node:fs";import{join as qY}from"node:path";function ECe(t){let{cwd:e="."}=t;return ye(e,nu,r=>ACe(r,e))}function ACe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:nu,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:nu,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>UY(qY(e,o)));i.length>0&&r.push({detector:nu,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}ru(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>UY(qY(e,i)))&&r.push({detector:nu,severity:"info",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) that aren't built yet \u2014 the normal state while implementing (not stale)`})}return r}var nu,SS,GC=y(()=>{"use strict";dS();xt();nu="STALE_SPECIFICATION";SS={name:nu,run:ECe}});import{existsSync as HY,statSync as BY}from"node:fs";import{join as GY}from"node:path";function OCe(t,e){let r=0;for(let n of e){let i=GY(t,n);if(!HY(i))continue;let o=BY(i).mtimeMs;o>r&&(r=o)}return r}function RCe(t){let{cwd:e="."}=t;return ye(e,ZC,r=>ICe(r,e))}function ICe(t,e){let r=Li(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=OCe(e,n);if(i===0)return[];let o=vs([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=GY(e,a);if(!HY(c))continue;let l=BY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>TCe&&s.push({detector:ZC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var ZC,TCe,wS,VC=y(()=>{"use strict";Tp();Va();xt();ZC="STALE_TESTS",TCe=30;wS={name:ZC,run:RCe}});import{existsSync as PCe}from"node:fs";import{join as CCe}from"node:path";function DCe(t){let{cwd:e="."}=t;return ye(e,Kp,r=>NCe(r,e))}function NCe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:Kp,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!PCe(CCe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Kp,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:Kp,severity:ru(n.status)?"info":"warn",message:`feature ${n.id} is in progress and none of its declared modules are built yet \u2014 the normal state while implementing`}))}return r}var Kp,xS,WC=y(()=>{"use strict";dS();xt();Kp="STATUS_DRIFT";xS={name:Kp,run:DCe}});function jCe(t){let{cwd:e="."}=t;return ye(e,$S,r=>MCe(r,e))}function MCe(t,e){let r=ft(e).language;return r==="unknown"?[{detector:$S,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:$S,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var $S,ZY,VY=y(()=>{"use strict";ln();xt();$S="TECH_STACK_MISMATCH";ZY={name:$S,run:jCe}});function UCe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function qCe(t){let{cwd:e="."}=t;return ye(e,KC,r=>HCe(r,e))}function HCe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=vs([...UCe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:KC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var KC,WY,FCe,LCe,zCe,kS,JC=y(()=>{"use strict";Tp();nC();xt();KC="UNMAPPED_ARTIFACT",WY=["src/stages/**/*.ts","src/spec/**/*.ts"],FCe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},LCe={kotlin:"src/main/kotlin"},zCe=8;kS={name:KC,run:qCe}});import{existsSync as KY}from"node:fs";import{join as JY}from"node:path";function GCe(t){return BCe.some(e=>t.startsWith(e))}function ZCe(t){let{cwd:e="."}=t;return ye(e,YC,r=>VCe(r,e))}function VCe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(GCe(o))continue;let s=o.split("#",1)[0];KY(JY(e,o))||s&&KY(JY(e,s))||r.push({detector:YC,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: -`}aC();UC();CC();NC();LC();sC();VC();WC();JC();XC();ih();zC();Ue();var _4e=[mS,ES,pS,kS,gS,bS,eS,xS,wS,Qv];function b4e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=qp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Wx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ta(e,q(e))}catch{}try{for(let o of _4e){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of b4e(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ta(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Bj();Ue();Pi();var S4e=new Set(["mermaid","dot","json","obsidian","html"]);function Wte(t={}){try{let e=t.format??"mermaid";if(!S4e.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=kc(n,".");if(t.focus){let s=qx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Ux(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Bte(i);for(let[c,l]of a){let u=v4e(s,c);Gj(Vj(u),{recursive:!0}),Zj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Vx(i,Wx(i,"."));Gj(Vj(t.out),{recursive:!0}),Zj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?Hte(i):r==="json"?Zx(i):qte(i);t.out?(Gj(Vj(t.out),{recursive:!0}),Zj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function Kte(){try{let t=kc(q(),".");process.stdout.write(Vte(Kx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}ih();import{createServer as w4e}from"node:http";import{existsSync as x4e,watch as $4e}from"node:fs";import{join as k4e}from"node:path";Ue();Pi();function E4e(t={}){let e=t.cwd??".",r=new Set,n=()=>kc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}aC();UC();CC();NC();LC();sC();VC();WC();JC();XC();oh();zC();Ue();var _4e=[hS,ES,mS,kS,yS,vS,tS,$S,xS,eS];function b4e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Hp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Wx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Oa(e,q(e))}catch{}try{for(let o of _4e){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of b4e(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Oa(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Bj();Ue();Pi();var S4e=new Set(["mermaid","dot","json","obsidian","html"]);function Wte(t={}){try{let e=t.format??"mermaid";if(!S4e.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=Ec(n,".");if(t.focus){let s=qx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Ux(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Bte(i);for(let[c,l]of a){let u=v4e(s,c);Gj(Vj(u),{recursive:!0}),Zj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Vx(i,Wx(i,"."));Gj(Vj(t.out),{recursive:!0}),Zj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?Hte(i):r==="json"?Zx(i):qte(i);t.out?(Gj(Vj(t.out),{recursive:!0}),Zj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function Kte(){try{let t=Ec(q(),".");process.stdout.write(Vte(Kx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as w4e}from"node:http";import{existsSync as x4e,watch as $4e}from"node:fs";import{join as k4e}from"node:path";Ue();Pi();function E4e(t={}){let e=t.cwd??".",r=new Set,n=()=>Ec(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh `)}catch{r.delete(u)}},o=w4e((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=Zx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Wx(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected `),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Vx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=k4e(e,u);if(x4e(d))try{let f=$4e(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function Jte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await E4e({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var A4e=["stage_1.1","stage_2.1","stage_2.3"];function T4e(t){return(t.features??[]).filter(e=>e.status==="done")}function O4e(t,e){let r=T4e(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function Yte(t,e){let r=[];for(let n of A4e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=O4e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}PS();import Xte from"node:process";function R4e(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Jx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=R4e(n,t);i.pass||r.push(i)}return r}dn();var Wj="stage_4.1";function Kj(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Wj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Jx(r);if(n.length===0)return{stage:Wj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Wj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var I4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xte.argv[1]}`;if(I4e){let t=Kj();console.log(JSON.stringify(t)),Xte.exit(t.exitCode)}kl();import{randomBytes as P4e}from"node:crypto";import{unlinkSync as C4e}from"node:fs";import{tmpdir as D4e}from"node:os";import{join as N4e,resolve as Jj}from"node:path";import j4e from"node:process";var Gr=null;function Qte(t){Gr={cwd:Jj(t),run:null,jsonFile:null}}function Yj(){return Gr!==null}function Xj(t,e){if(!Gr||Gr.cwd!==Jj(t))return null;if(Gr.run)return Gr.run;let r=N4e(D4e(),`clad-shared-vitest-${j4e.pid}-${P4e(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function ere(t){return!Gr||Gr.cwd!==Jj(t)?null:Gr.run}function Qj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function tre(){let t=Gr?.jsonFile;if(Gr=null,t)try{C4e(t)}catch{}}zr();import rre from"node:process";var Yx="stage_1.4";function eM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Yx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Yx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Yx,pass:!0,exitCode:0}:{stage:Yx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var M4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${rre.argv[1]}`;if(M4e){let t=eM();console.log(JSON.stringify(t)),rre.exit(t.exitCode)}zr();import nre from"node:process";oh();Nn();var Xx="stage_2.2";function tM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Xx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Xx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ere(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(Xx,r,s,n);return a||Xt(Xx,s)}var z4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${nre.argv[1]}`;if(z4e){let t=tM();console.log(JSON.stringify(t)),nre.exit(t.exitCode)}Yp();oD();rM();zr();ln();Nn();import ore from"node:process";var t0="stage_3.2";function nM(t={}){let{cwd:e="."}=t,r=ft(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:t0,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Wl(e,o[o.length-1]))return{stage:t0,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(t0,i,s,o);return a||Xt(t0,s)}var sHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ore.argv[1]}`;if(sHe){let t=nM();console.log(JSON.stringify(t)),ore.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as aHe}from"node:fs";import{resolve as are}from"node:path";import cre from"node:process";var fi="stage_2.4",iM=5e3,cHe=3e4;function oM(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return uHe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=are(e,r.path);if(!aHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??iM,c;try{c=Ke(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var sre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},lHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function uHe(t,e,r){let n=Math.min(e.length*iM,cHe),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(dHe(t,s,r))}return fHe(o)}function dHe(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?are(t,a):a,u=iM,d;try{d=Ke(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ba(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function fHe(t){let e="skip";for(let o of t)sre[o.disposition]>sre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${lHe[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` -`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var pHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cre.argv[1]}`;if(pHe){let t=oM();console.log(JSON.stringify(t)),cre.exit(t.exitCode)}zr();ln();Nn();import lre from"node:process";var r0="stage_3.1";function sM(t={}){let{cwd:e="."}=t,r=ft(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:r0,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Wl(e,o[o.length-1]))return{stage:r0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(r0,i,s,o);return a||Xt(r0,s)}var mHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lre.argv[1]}`;if(mHe){let t=sM();console.log(JSON.stringify(t)),lre.exit(t.exitCode)}HC();aM();cM();zr();Qx();import{randomBytes as SHe}from"node:crypto";import{unlinkSync as wHe}from"node:fs";import{tmpdir as xHe}from"node:os";import{join as $He}from"node:path";import uM from"node:process";oh();Nn();Ue();import{readFileSync as yHe}from"node:fs";import{resolve as fre}from"node:path";function _He(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=fre(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function bHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function vHe(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=bHe(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(fre(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function lM(t,e){try{let r=_He(yHe(t,"utf8"));return r?vHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function pre(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function mre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function hre(t){let e=`${String(t.stdout??"")} -${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function kHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!pre(n,i))return null;let o=n,s=i,a=Xj(e,d=>Ke(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Zr,n,c,s))return null;let u=Xt(Zr,c);if(Qj(u)==="fallback")return null;if(r){let d=lM(l,e);if(d.length>0)return{stage:Zr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Zr,pass:!0,exitCode:0}}function EHe(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!mre(n,i))return null;let o=n,s=i,a=Xj(e,()=>Ke(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Zr,o,a.proc,s))return null;let c=Xt(Zr,a.proc);if(Qj(c)==="fallback")return null;if(r&&hre(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Zr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Zr,pass:!0,exitCode:0}}function dM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Zr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Zr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=pre(n,i),a=mre(n,i),c=r&&s;if(Yj()&&s){let d=kHe(t,e,c);if(d)return d}if(Yj()&&a){let d=EHe(t,e);if(d)return d}let l,u=i;c&&(l=$He(xHe(),`clad-vitest-${uM.pid}-${SHe(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=Ke(n,[...u],{cwd:e,reject:!1}),f=Nt(Zr,n,d,u);if(f)return f;let p=Mu("unit",Xt(Zr,d),d);if(r&&p.pass&&hre(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Zr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=lM(l,e);if(m.length>0)return{stage:Zr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{wHe(l)}catch{}}}var AHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${uM.argv[1]}`;if(AHe){let t=dM();console.log(JSON.stringify(t)),uM.exit(t.exitCode)}zr();ln();Nn();import gre from"node:process";var o0="stage_3.3";function fM(t={}){let{cwd:e="."}=t,r=ft(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:o0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Wl(e,o[o.length-1]))return{stage:o0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(o0,i,s,o);return a||Xt(o0,s)}var THe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gre.argv[1]}`;if(THe){let t=fM();console.log(JSON.stringify(t)),gre.exit(t.exitCode)}GC();Bf();wa();mM();Lp();yS();var xre=wt(tr(),1);import{existsSync as hM,readFileSync as LHe,readdirSync as wre,statSync as zHe,writeFileSync as UHe}from"node:fs";import{basename as uh,join as dh,relative as Sre}from"node:path";var qHe=["self-dogfood:","fixture:","derived:"],$re=/\.(test|spec)\.[jt]sx?$/;function kre(t,e=t,r=[]){let n;try{n=wre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=dh(e,i);try{zHe(o).isDirectory()?kre(t,o,r):$re.test(i)&&r.push(o)}catch{continue}}return r}function Ere(t="."){let e=dh(t,"spec","features"),r=dh(t,"tests"),n=[],i=[];if(!hM(e)||!hM(r))return{repaired:n,suggested:i};let o=kre(r),s=new Map;for(let a of o){let c=Sre(t,a).split("\\").join("/"),l=s.get(uh(a))??[];l.push(c),s.set(uh(a),l)}for(let a of wre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=dh(e,a),l,u;try{l=LHe(c,"utf8"),u=(0,xre.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(qHe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(hM(dh(t,b)))continue;let _=s.get(uh(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>uh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Sre(t,h).split("\\").join("/")).find(h=>{let g=uh(h).replace($re,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function Jte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await E4e({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var A4e=["stage_1.1","stage_2.1","stage_2.3"];function T4e(t){return(t.features??[]).filter(e=>e.status==="done")}function O4e(t,e){let r=T4e(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function Yte(t,e){let r=[];for(let n of A4e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=O4e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}PS();import Xte from"node:process";function R4e(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Jx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=R4e(n,t);i.pass||r.push(i)}return r}dn();var Wj="stage_4.1";function Kj(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Wj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Jx(r);if(n.length===0)return{stage:Wj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Wj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var I4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xte.argv[1]}`;if(I4e){let t=Kj();console.log(JSON.stringify(t)),Xte.exit(t.exitCode)}El();import{randomBytes as P4e}from"node:crypto";import{unlinkSync as C4e}from"node:fs";import{tmpdir as D4e}from"node:os";import{join as N4e,resolve as Jj}from"node:path";import j4e from"node:process";var Gr=null;function Qte(t){Gr={cwd:Jj(t),run:null,jsonFile:null}}function Yj(){return Gr!==null}function Xj(t,e){if(!Gr||Gr.cwd!==Jj(t))return null;if(Gr.run)return Gr.run;let r=N4e(D4e(),`clad-shared-vitest-${j4e.pid}-${P4e(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function ere(t){return!Gr||Gr.cwd!==Jj(t)?null:Gr.run}function Qj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function tre(){let t=Gr?.jsonFile;if(Gr=null,t)try{C4e(t)}catch{}}zr();import rre from"node:process";var Yx="stage_1.4";function eM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Yx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Yx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Yx,pass:!0,exitCode:0}:{stage:Yx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var M4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${rre.argv[1]}`;if(M4e){let t=eM();console.log(JSON.stringify(t)),rre.exit(t.exitCode)}zr();import nre from"node:process";sh();Nn();var Xx="stage_2.2";function tM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Xx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Xx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ere(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(Xx,r,s,n);return a||Xt(Xx,s)}var z4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${nre.argv[1]}`;if(z4e){let t=tM();console.log(JSON.stringify(t)),nre.exit(t.exitCode)}Xp();oD();rM();zr();ln();Nn();import ore from"node:process";var t$="stage_3.2";function nM(t={}){let{cwd:e="."}=t,r=ft(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:t$,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Kl(e,o[o.length-1]))return{stage:t$,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(t$,i,s,o);return a||Xt(t$,s)}var sHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ore.argv[1]}`;if(sHe){let t=nM();console.log(JSON.stringify(t)),ore.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as aHe}from"node:fs";import{resolve as are}from"node:path";import cre from"node:process";var fi="stage_2.4",iM=5e3,cHe=3e4;function oM(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return uHe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=are(e,r.path);if(!aHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??iM,c;try{c=Ke(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var sre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},lHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function uHe(t,e,r){let n=Math.min(e.length*iM,cHe),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(dHe(t,s,r))}return fHe(o)}function dHe(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?are(t,a):a,u=iM,d;try{d=Ke(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ga(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function fHe(t){let e="skip";for(let o of t)sre[o.disposition]>sre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${lHe[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` +`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var pHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cre.argv[1]}`;if(pHe){let t=oM();console.log(JSON.stringify(t)),cre.exit(t.exitCode)}zr();ln();Nn();import lre from"node:process";var r$="stage_3.1";function sM(t={}){let{cwd:e="."}=t,r=ft(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:r$,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Kl(e,o[o.length-1]))return{stage:r$,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(r$,i,s,o);return a||Xt(r$,s)}var mHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lre.argv[1]}`;if(mHe){let t=sM();console.log(JSON.stringify(t)),lre.exit(t.exitCode)}HC();aM();cM();zr();Qx();import{randomBytes as SHe}from"node:crypto";import{unlinkSync as wHe}from"node:fs";import{tmpdir as xHe}from"node:os";import{join as $He}from"node:path";import uM from"node:process";sh();Nn();Ue();import{readFileSync as yHe}from"node:fs";import{resolve as fre}from"node:path";function _He(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=fre(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function bHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function vHe(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=bHe(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(fre(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function lM(t,e){try{let r=_He(yHe(t,"utf8"));return r?vHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function pre(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function mre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function hre(t){let e=`${String(t.stdout??"")} +${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function kHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!pre(n,i))return null;let o=n,s=i,a=Xj(e,d=>Ke(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Zr,n,c,s))return null;let u=Xt(Zr,c);if(Qj(u)==="fallback")return null;if(r){let d=lM(l,e);if(d.length>0)return{stage:Zr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Zr,pass:!0,exitCode:0}}function EHe(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!mre(n,i))return null;let o=n,s=i,a=Xj(e,()=>Ke(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Zr,o,a.proc,s))return null;let c=Xt(Zr,a.proc);if(Qj(c)==="fallback")return null;if(r&&hre(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Zr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Zr,pass:!0,exitCode:0}}function dM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Zr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Zr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=pre(n,i),a=mre(n,i),c=r&&s;if(Yj()&&s){let d=kHe(t,e,c);if(d)return d}if(Yj()&&a){let d=EHe(t,e);if(d)return d}let l,u=i;c&&(l=$He(xHe(),`clad-vitest-${uM.pid}-${SHe(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=Ke(n,[...u],{cwd:e,reject:!1}),f=Nt(Zr,n,d,u);if(f)return f;let p=Lu("unit",Xt(Zr,d),d);if(r&&p.pass&&hre(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Zr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=lM(l,e);if(m.length>0)return{stage:Zr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{wHe(l)}catch{}}}var AHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${uM.argv[1]}`;if(AHe){let t=dM();console.log(JSON.stringify(t)),uM.exit(t.exitCode)}zr();ln();Nn();import gre from"node:process";var o$="stage_3.3";function fM(t={}){let{cwd:e="."}=t,r=ft(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:o$,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Kl(e,o[o.length-1]))return{stage:o$,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(o$,i,s,o);return a||Xt(o$,s)}var THe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gre.argv[1]}`;if(THe){let t=fM();console.log(JSON.stringify(t)),gre.exit(t.exitCode)}GC();Zf();xa();mM();zp();_S();var xre=wt(tr(),1);import{existsSync as hM,readFileSync as LHe,readdirSync as wre,statSync as zHe,writeFileSync as UHe}from"node:fs";import{basename as dh,join as fh,relative as Sre}from"node:path";var qHe=["self-dogfood:","fixture:","derived:"],$re=/\.(test|spec)\.[jt]sx?$/;function kre(t,e=t,r=[]){let n;try{n=wre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{zHe(o).isDirectory()?kre(t,o,r):$re.test(i)&&r.push(o)}catch{continue}}return r}function Ere(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!hM(e)||!hM(r))return{repaired:n,suggested:i};let o=kre(r),s=new Map;for(let a of o){let c=Sre(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of wre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=LHe(c,"utf8"),u=(0,xre.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(qHe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(hM(fh(t,b)))continue;let _=s.get(dh(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>dh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Sre(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace($re,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&UHe(c,l,"utf8")}return{repaired:n,suggested:i}}$l();import{existsSync as HHe,readFileSync as BHe}from"node:fs";import{join as GHe}from"node:path";function ZHe(t,e){let r=GHe(t,e);if(!HHe(r))return[];let n=[];for(let i of BHe(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Are(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>ZHe(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function Tre(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}vS();Ue();dn();Pi();dn();$l();var gM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],VHe=[...gM,"att"];function WHe(t,e,r){if(e.startsWith("stage_4")){let n=pr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Jx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function KHe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":X_(e,r,t).state==="fresh"?"\u2713":"!"}function l0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...gM.map(o=>WHe(i,o,e)),KHe(i,r,e)]}));return{columns:VHe,rows:n}}function Ore(t,e=".",r={}){let n=r.internal??!1,i=l0(t,e),o=[...gM.map(c=>n?c.replace("stage_",""):JHe(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` -`)}function JHe(t){return Ra(t).slice(0,3)}async function AYe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Hde(),qde)),Promise.resolve().then(()=>(Wde(),Vde)),Promise.resolve().then(()=>(am(),iQ))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Dte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Pte(s,a,c),initialize:Ij,prepareClarify:(s,{cwd:a})=>Cte(a,s),clarify:Nj,resolveReview:(s,{cwd:a})=>Tte(s,{cwd:a})}});n(i.server);let o=new r;H.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&UHe(c,l,"utf8")}return{repaired:n,suggested:i}}kl();import{existsSync as HHe,readFileSync as BHe}from"node:fs";import{join as GHe}from"node:path";function ZHe(t,e){let r=GHe(t,e);if(!HHe(r))return[];let n=[];for(let i of BHe(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Are(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>ZHe(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function Tre(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}SS();Ue();dn();Pi();dn();kl();var gM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],VHe=[...gM,"att"];function WHe(t,e,r){if(e.startsWith("stage_4")){let n=pr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Jx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function KHe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":Q_(e,r,t).state==="fresh"?"\u2713":"!"}function l$(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...gM.map(o=>WHe(i,o,e)),KHe(i,r,e)]}));return{columns:VHe,rows:n}}function Ore(t,e=".",r={}){let n=r.internal??!1,i=l$(t,e),o=[...gM.map(c=>n?c.replace("stage_",""):JHe(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` +`)}function JHe(t){return Ia(t).slice(0,3)}async function AYe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Hde(),qde)),Promise.resolve().then(()=>(Wde(),Vde)),Promise.resolve().then(()=>(cm(),iQ))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Dte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Pte(s,a,c),initialize:Ij,prepareClarify:(s,{cwd:a})=>Cte(a,s),clarify:Nj,resolveReview:(s,{cwd:a})=>Tte(s,{cwd:a})}});n(i.server);let o=new r;H.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} `),await i.connect(o)}async function TYe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Ij({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){H.stdout.write(`${JSON.stringify(n,null,2)} `),H.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){H.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: @@ -949,27 +949,27 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&UHe(c,l,"u `));H.exit(0)}async function OYe(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(bfe(),_fe)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),H.stdout.write(`${JSON.stringify(n,null,2)} `);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>hR(l,s)),c=`${PG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&H.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),H.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function RYe(t={}){try{let e=q();if(Sa("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=xs(".");tu(".",r),rc("."),EY(".");let n=au(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Ere(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=c0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=SS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),H.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),H.exit(0);return}L("pass","sync",`${e.features.length} features valid`),H.exit(0)}catch(e){L("fail","sync",e.message),H.exit(1)}}function IYe(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),H.exit(2);return}let e=N_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),H.exit(0)}function PYe(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),H.exit(2);return}let r=j_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),H.exit(1);return}M_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?H.stdout.write(`Run: git checkout ${r.gitHead} +`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),H.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function RYe(t={}){try{let e=q();if(wa("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=$s(".");ru(".",r),nc("."),EY(".");let n=lu(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Ere(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=c$(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=wS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),H.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),H.exit(0);return}L("pass","sync",`${e.features.length} features valid`),H.exit(0)}catch(e){L("fail","sync",e.message),H.exit(1)}}function IYe(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),H.exit(2);return}let e=j_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),H.exit(0)}function PYe(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),H.exit(2);return}let r=M_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),H.exit(1);return}F_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?H.stdout.write(`Run: git checkout ${r.gitHead} `):H.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. `),H.exit(0)}async function CYe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await AC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function DYe(){L("note","update","reconciling the current project after the engine upgrade");let t=await T7(".",{wireHosts:async()=>(await AC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),H.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);H.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): `),jA({tier:"pre-commit",strict:!0}).anyFailed?H.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),H.exit(t.code)}var NYe={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function jA(t){let e=t.tier??"all",r=t.silent===!0,n=NYe[e];if(!n)return t.json&&!r?H.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>ch(i)],["stage_1.2",()=>ah(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",eM],["stage_1.5",sc],["stage_1.6",tm],["stage_2.1",()=>dM({...i,strict:t.strict})],["stage_2.2",()=>tM(i)],["stage_2.3",qC],["stage_2.4",oM],["stage_3.1",sM],["stage_3.2",nM],["stage_3.3",fM],["stage_4.1",Kj],["stage_4.2",lh]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":mr(d)?"fail":"skip",u=[];Q_("."),Qte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=dX(p);mr(h)&&(c=!0,a=Math.max(a,fX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),mr(h)&&HYe(p))}}finally{tb(),tre()}if(t.strict)try{let d=q();for(let f of Yte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!mr(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>mr(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(Sa("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{rZ(".",q(),{cladding:pn()??"unknown",blocking:"strict",detectorsSha256:eZ(TS)})&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?H.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&H.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),Jt(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c,blockers:OS(u),stopFingerprint:pX(u)}),{worst:a,anyFailed:c,stages:u}}function jYe(t){try{let e=q(),r=yl(e,t);H.stdout.write(`${JSON.stringify(r,null,2)} +`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",eM],["stage_1.5",ac],["stage_1.6",rm],["stage_2.1",()=>dM({...i,strict:t.strict})],["stage_2.2",()=>tM(i)],["stage_2.3",qC],["stage_2.4",oM],["stage_3.1",sM],["stage_3.2",nM],["stage_3.3",fM],["stage_4.1",Kj],["stage_4.2",uh]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":mr(d)?"fail":"skip",u=[];eb("."),Qte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ia(d),h=dX(p);mr(h)&&(c=!0,a=Math.max(a,fX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),mr(h)&&HYe(p))}}finally{rb(),tre()}if(t.strict)try{let d=q();for(let f of Yte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!mr(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>mr(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(wa("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{rZ(".",q(),{cladding:pn()??"unknown",blocking:"strict",detectorsSha256:eZ(TS)})&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?H.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&H.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),Jt(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c,blockers:OS(u),stopFingerprint:pX(u)}),{worst:a,anyFailed:c,stages:u}}function jYe(t){try{let e=q(),r=_l(e,t);H.stdout.write(`${JSON.stringify(r,null,2)} `),H.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),H.exit(1)}}function MYe(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=xr(r,t,{depth:n});H.stdout.write(`${JSON.stringify(i,null,2)} `),H.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),H.exit(1)}}function FYe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=AS(e,o=>{try{return vfe(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});H.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} `),H.exit(0)}catch(e){L("fail","infer-deps",e.message),H.exit(1)}}function LYe(t={}){try{if(t.sessions){Mte(t);return}if(t.trend!==void 0&&t.trend!==!1){Fte(t);return}let e=q(),n=YB(e,o=>{try{return vfe(o,"utf8")}catch{return null}},"."),i=QB(".",n);if(t.json)H.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${_l}`];H.stdout.write(`${c.join(` +`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${bl}`];H.stdout.write(`${c.join(` `)} `),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}H.exit(0)}catch(e){L("fail","measure",e.message),H.exit(1)}}function zYe(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),H.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),H.exit(1)}let r=jA({...t,focusModules:e});if(!t.json){let n=JX(".");n&&H.stdout.write(`\u2139 ${n} -`)}H.exitCode=r.worst}function UYe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=zX(".",t,{checkStages:jA,onIndex:rc,gitOpInProgress:MO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}H.exit(r.code)}function qYe(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),H.exit(1);return}if(e.required){t&&H.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`)}H.exitCode=r.worst}function UYe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=zX(".",t,{checkStages:jA,onIndex:nc,gitOpInProgress:MO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}H.exit(r.code)}function qYe(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),H.exit(1);return}if(e.required){t&&H.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') `);let o=IY(n);if(o.length===0){H.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),H.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";H.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}H.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. `),H.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),H.exit(1);return}let i=Are(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),H.exit(1);return}H.stdout.write(`${Tre(i)} -`),H.exit(0)}function HYe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=A4(Ia(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(H.stdout.write(` ${o}${s} [${i.detector}] -`),Ia(i.detector,i.message)!==i.message){let c=i.message.split(` +`),H.exit(0)}function HYe(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=A4(Pa(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(H.stdout.write(` ${o}${s} [${i.detector}] +`),Pa(i.detector,i.message)!==i.message){let c=i.message.split(` `).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))H.stdout.write(` ${A4(l,160)} `);c.length>4&&H.stdout.write(` \u2026 and ${c.length-4} more line(s) \u2014 see \`clad check --json\` `)}}n.length>3&&H.stdout.write(` \u2026 and ${n.length-3} more finding(s) @@ -977,6 +977,6 @@ ${o.length} AC(s) required, ${s.length} missing an oracle. `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` `).map(r=>r.trim()).filter(r=>r.length>0);for(let r of e.slice(0,5))H.stdout.write(` ${A4(r,160)} `);e.length>5&&H.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` -`)}}function A4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function BYe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(l0(e,"."),null,2)} +`)}}function A4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function BYe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(l$(e,"."),null,2)} `),H.exitCode=0;return}H.stdout.write(`${Ore(e,".",{internal:t.internal})} -`),H.exit(0)}function GYe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function ZYe(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),H.exit(1);return}let n;try{let i=q(e),o=l0(i,e),s={gitHead:xa(e),version:pn(),generatedAt:t.now??new Date().toISOString()},a=Sl(i),c;try{let l=t.since??is(e),u=os(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:bl(u),auditMarkdown:vl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=GG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{EYe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${GYe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function VYe(t){let e=tT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function WYe(){let t=new U4;t.name("clad").description("Reference Ironclad CLI").version("0.9.4"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(TYe),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(OYe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(RYe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(CYe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(DYe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(zYe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(IYe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(UYe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>qYe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(PYe),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(BYe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(jYe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>MYe(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>x7(r,{checkStages:jA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>FYe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>LYe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>Wte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Kte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Jte(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>IG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>uX(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>ZYe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(VYe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(g7),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(AYe),t.command("doctor").description("Diagnose Claude Code hook liveness/version, lifecycle governance, and LLM dispatcher sentinel misses").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){jX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}AX(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(Ite),t}var KYe=!!globalThis.__CLADDING_BUNDLED,JYe=KYe||import.meta.url===`file://${H.argv[1]}`;JYe&&WYe().parse();export{NYe as TIER_STAGES,WYe as createProgram,ZYe as runBundleCommand,zYe as runCheckCommand,jA as runCheckStages,IYe as runCheckpointCommand,jYe as runContextCommand,UYe as runDoneCommand,MYe as runImpactCommand,FYe as runInferDepsCommand,TYe as runInitCommand,LYe as runMeasureCommand,qYe as runOracleCommand,PYe as runRollbackCommand,VYe as runRouteCommand,OYe as runRunCommand,AYe as runServeCommand,CYe as runSetupCommand,BYe as runStatusCommand,RYe as runSyncCommand,DYe as runUpdateCommand}; +`),H.exit(0)}function GYe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function ZYe(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),H.exit(1);return}let n;try{let i=q(e),o=l$(i,e),s={gitHead:$a(e),version:pn(),generatedAt:t.now??new Date().toISOString()},a=wl(i),c;try{let l=t.since??is(e),u=os(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:vl(u),auditMarkdown:Sl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=GG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{EYe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${GYe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function VYe(t){let e=tT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function WYe(){let t=new U4;t.name("clad").description("Reference Ironclad CLI").version("0.9.4"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(TYe),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(OYe),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(RYe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(CYe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(DYe),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(zYe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(IYe),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(UYe),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>qYe(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(PYe),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(BYe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(jYe),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>MYe(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>x7(r,{checkStages:jA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>FYe(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>LYe(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>Wte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Kte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Jte(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>IG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>uX(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>ZYe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(VYe),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(g7),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(AYe),t.command("doctor").description("Diagnose Claude Code hook liveness/version, lifecycle governance, and LLM dispatcher sentinel misses").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){jX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}AX(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(Ite),t}var KYe=!!globalThis.__CLADDING_BUNDLED,JYe=KYe||import.meta.url===`file://${H.argv[1]}`;JYe&&WYe().parse();export{NYe as TIER_STAGES,WYe as createProgram,ZYe as runBundleCommand,zYe as runCheckCommand,jA as runCheckStages,IYe as runCheckpointCommand,jYe as runContextCommand,UYe as runDoneCommand,MYe as runImpactCommand,FYe as runInferDepsCommand,TYe as runInitCommand,LYe as runMeasureCommand,qYe as runOracleCommand,PYe as runRollbackCommand,VYe as runRouteCommand,OYe as runRunCommand,AYe as runServeCommand,CYe as runSetupCommand,BYe as runStatusCommand,RYe as runSyncCommand,DYe as runUpdateCommand}; diff --git a/spec.yaml b/spec.yaml index 45b1ce8a..90ebe0b3 100644 --- a/spec.yaml +++ b/spec.yaml @@ -54,7 +54,7 @@ project: # Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand. inventory: - features: 277 + features: 278 scenarios: 2 capabilities: 6 test_files: 253 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index b5c5abbb..2f11a3f2 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -23,15 +23,15 @@ attested_modules: .claude/settings.json: 08a64351770badf4 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: 78288e943090a029 + CHANGELOG.md: 5fa4601f2c98f803 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 5bb751c77de5ac88 - README.ja.md: ecf7d1ebd578e4e5 - README.ko.html: 42dc2fcf72f94544 - README.ko.md: 8a62482670d51611 - README.md: e5787c39863c55a5 - README.zh.md: acd6f2f6a8d22e36 + README.html: a546de3f4e35e8d9 + README.ja.md: 95995c411c5398d7 + README.ko.html: 911b09d7ebf78c50 + README.ko.md: 5aa07b8586a93f7f + README.md: 2f370e18113f49f4 + README.zh.md: af1a12b1cd1a88ba SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -123,7 +123,7 @@ attested_modules: skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: 8300d2bb766876b2 + spec.yaml: 9cde342c979d6bc7 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -308,7 +308,7 @@ attested_modules: src/stages/detectors/stale-specification.ts: 0fe84db592fd406d src/stages/detectors/stale-tests.ts: caf59404d1282201 src/stages/detectors/status-drift.ts: 9cc5cf3f9b62ea00 - src/stages/detectors/tech-stack-mismatch.ts: 099162aff2c2966b + src/stages/detectors/tech-stack-mismatch.ts: 2963e9c52507f3c5 src/stages/detectors/unmapped-artifact.ts: b29f7e277d8187ae src/stages/detectors/untested-ac.ts: 90725ef1fc9245d8 src/stages/detectors/unverified-ac.ts: 6887c4d699afaad5 @@ -327,7 +327,7 @@ attested_modules: src/stages/test-run-cache.ts: 462a5ef1d30eb766 src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e src/stages/toolchain/detect.ts: e50845a8aa69c765 - src/stages/toolchain/gate-config.ts: 818a0a549d875581 + src/stages/toolchain/gate-config.ts: feb40547df921fba src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 src/stages/toolchain/scoped-command.ts: f2dd6410c063279f @@ -433,9 +433,9 @@ attested_modules: tests/stages/stale-specification.test.ts: 09bd06db377d890c tests/stages/stale-tests.test.ts: 1467ceedb8019e86 tests/stages/status-drift.test.ts: cff1092eeb23c268 - tests/stages/tech-stack-mismatch.test.ts: 878436ffd2f94c97 + tests/stages/tech-stack-mismatch.test.ts: 54fab0c842daafb5 tests/stages/toolchain.test.ts: 200184f572abcf88 - tests/stages/toolchain/gate-config.test.ts: aef5813a6591b153 + tests/stages/toolchain/gate-config.test.ts: 97b2b75488b327af tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 tests/stages/unit.test.ts: 97781210eb81bb25 @@ -684,6 +684,7 @@ attested_features: F-cd0415: ok F-cfba0c: ok F-d12edf: ok + F-d14f3cb0: ok F-d25041ac: ok F-d2c806: ok F-d3bde4: ok diff --git a/spec/features/F-013.yaml b/spec/features/F-013.yaml index 29b51abc..e0365b9a 100644 --- a/spec/features/F-013.yaml +++ b/spec/features/F-013.yaml @@ -10,9 +10,11 @@ depends_on: acceptance_criteria: - id: AC-021 ears: event - condition: when spec.project.language differs from the toolchain-detected language + condition: when spec.project.language differs from the toolchain-detected + language and no gate.language declaration is in force action: emit a warn finding response: stage_1.3 surfaces but does not fail on this finding alone text: When spec.project.language differs from the language resolved by the - toolchain manifest chain, the detector shall emit a warn-severity finding. + toolchain manifest chain, and no `.cladding/config.yaml::gate.language` + declaration is in force, the detector shall emit a warn-severity finding. evidence_refs: [fixture:F-013_AC-021] diff --git a/spec/features/toolchain-language-declaration-d14f3cb0.yaml b/spec/features/toolchain-language-declaration-d14f3cb0.yaml new file mode 100644 index 00000000..c754508c --- /dev/null +++ b/spec/features/toolchain-language-declaration-d14f3cb0.yaml @@ -0,0 +1,61 @@ +id: F-d14f3cb0 +slug: toolchain-language-declaration +title: "Declared toolchain language for the spec cross-check" +status: done +modules: + - src/stages/toolchain/gate-config.ts + - src/stages/detectors/tech-stack-mismatch.ts +acceptance_criteria: + - id: AC-14be8bf4 + ears: event + condition: "when .cladding/config.yaml declares a non-empty string gate.language" + action: "cross-check spec.project.language against that declaration instead of the manifest chain verdict" + response: "a repository whose product language differs from its build host keeps a truthful spec.project.language without rewriting it to adopt the manifest's label" + text: "When .cladding/config.yaml declares gate.language, the system shall anchor the TECH_STACK_MISMATCH cross-check on the declaration rather than the manifest chain." + notes: | + ## Why + The manifest chain reads build orchestration, not product language. An + Android RASP SDK whose products are C++ resolves to java because the root + manifest is build.gradle, so the only way to green the check was rewriting + spec.yaml to adopt the mislabel — the "rewrite the claim to match the + check" anti-pattern the harness warns about elsewhere. + test_refs: + - "tests/stages/tech-stack-mismatch.test.ts#a matching gate.language declaration overrides the manifest, and says so at info" + - "tests/stages/toolchain/gate-config.test.ts#parses gate.language as a trimmed string" + - id: AC-0a6c8766 + ears: unwanted + condition: "if the declaration and spec.project.language disagree" + action: "emit a warn finding naming both values" + response: "the declaration cannot silence the check by itself — the two hand-authored strings must agree" + text: "If gate.language disagrees with spec.project.language, the system shall emit a warn-severity finding naming both values." + test_refs: + - "tests/stages/tech-stack-mismatch.test.ts#a gate.language declaration differing from the spec still warns" + - id: AC-87986d21 + ears: event + condition: "when a declaration in force overrides a differing manifest verdict" + action: "emit one info finding naming the declaration, the manifest verdict, and that the declaration is in force" + response: "the waiver is legible in every gate log and never fails the gate, including under --strict" + text: "When a declaration overrides a differing manifest verdict, the system shall disclose the override at info severity rather than returning no finding." + notes: | + ## Why + Nothing mechanical separates a legitimate build-host mismatch from a + declaration that went stale after a real port, so the override is a + waiver. A silent waiver and a forgotten one are indistinguishable in a + gate log; info keeps it readable without giving it blocking power. + test_refs: + - "tests/stages/tech-stack-mismatch.test.ts#a matching gate.language declaration overrides the manifest, and says so at info" + - "tests/stages/tech-stack-mismatch.test.ts#the override disclosure never fails a strict gate" + - id: AC-af254938 + ears: unwanted + condition: "if gate.language is absent, not a string, or empty after trimming" + action: "ignore the key and keep the manifest-chain behaviour unchanged" + response: "existing projects are unaffected and a malformed declaration cannot anchor the cross-check" + text: "If gate.language is absent, non-string, or empty, the system shall ignore it and preserve the existing manifest-chain cross-check." + test_refs: + - "tests/stages/toolchain/gate-config.test.ts#ignores a non-string or empty gate.language" + - "tests/stages/tech-stack-mismatch.test.ts#flags a spec/toolchain language mismatch" +design_impact: + classification: none + rationale: "Adds an optional gate-config key and one disclosure finding; it does not change architecture, capability taxonomy, or which severities block a gate." + status: resolved + artifacts: [] diff --git a/spec/index.yaml b/spec/index.yaml index 8313f253..4e866f15 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -244,6 +244,7 @@ features: F-cd0415: {slug: spec-load-once, status: done, modules: 2} F-cfba0c: {slug: scenarios-deprecate, status: done, modules: 3} F-d12edf: {slug: ssot-governance, status: done, modules: 19} + F-d14f3cb0: {slug: toolchain-language-declaration, status: done, modules: 2} F-d25041ac: {slug: overdue-alias-removal, status: done, modules: 2} F-d2c806: {slug: get-context-slice, status: done, modules: 3} F-d3bde4: {slug: capabilities-yaml-llm-extract, status: done, modules: 3} diff --git a/src/stages/detectors/tech-stack-mismatch.ts b/src/stages/detectors/tech-stack-mismatch.ts index aa18fc22..8a1fb347 100644 --- a/src/stages/detectors/tech-stack-mismatch.ts +++ b/src/stages/detectors/tech-stack-mismatch.ts @@ -14,6 +14,14 @@ // With a declaration the spec stays truthful: the detector cross-checks the // spec against the declaration instead of the heuristic, and still warns when // the two disagree, so the check keeps its teeth. +// +// A declaration overrides the manifest for the pass/fail decision, which is +// exactly what makes it a waiver — nothing mechanical can tell a legitimate +// build-host mismatch from a declaration that went stale after a real port. +// So the override is never silent: when the declaration and the manifest +// disagree, the detector says so at info severity (never gate-failing, even +// under --strict) rather than returning nothing. An invisible waiver and a +// forgotten one look identical in a gate log; this one is readable. import {detectToolchain} from '../toolchain/detect.js'; import {readGateConfig} from '../toolchain/gate-config.js'; @@ -30,21 +38,37 @@ function runTechStackMismatch(opts: CommandStageOptions): readonly DriftFinding[ function detect(spec: Spec, cwd: string): readonly DriftFinding[] { const declared = readGateConfig(cwd).language; + const detected = detectToolchain(cwd).language; if (declared !== undefined) { - // A declaration replaces the manifest heuristic entirely — including the - // no-manifest case, where the declaration IS the cross-check anchor. - if (spec.project.language === declared) return []; - return [ - { - detector: NAME, - severity: 'warn', - message: - `spec.project.language='${spec.project.language}' but` + - ` .cladding/config.yaml::gate.language declares '${declared}'`, - }, - ]; + // Spec vs declaration is the cross-check that keeps its teeth: two + // hand-authored strings that must agree, including the no-manifest case + // where the declaration IS the anchor. + if (spec.project.language !== declared) { + return [ + { + detector: NAME, + severity: 'warn', + message: + `spec.project.language='${spec.project.language}' but` + + ` .cladding/config.yaml::gate.language declares '${declared}'`, + }, + ]; + } + // Declaration in force. Report the override it performed, so a stale + // declaration stays legible instead of silently absorbing a real port. + if (detected !== 'unknown' && detected !== declared) { + return [ + { + detector: NAME, + severity: 'info', + message: + `.cladding/config.yaml::gate.language declares '${declared}' and the` + + ` manifest chain detects '${detected}' — the declaration is in force`, + }, + ]; + } + return []; } - const detected = detectToolchain(cwd).language; if (detected === 'unknown') { return [ { diff --git a/tests/stages/tech-stack-mismatch.test.ts b/tests/stages/tech-stack-mismatch.test.ts index 3638978d..0697d51e 100644 --- a/tests/stages/tech-stack-mismatch.test.ts +++ b/tests/stages/tech-stack-mismatch.test.ts @@ -9,6 +9,14 @@ // - manifest chain returns // 'unknown' (no manifest) → info finding (cannot cross-check) // +// A `.cladding/config.yaml::gate.language` declaration replaces the manifest +// as the pass/fail anchor, so it adds two more: +// +// - spec disagrees with the +// declaration → warn finding (the cross-check keeps teeth) +// - declaration overrides a +// differing manifest → info finding (the waiver is disclosed) +// // The detector relies on the manifest priority chain in // stages/toolchain/detect.ts: package.json (TypeScript) beats // pyproject.toml (Python) in priority order. These tests exercise that @@ -21,6 +29,7 @@ import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; import {techStackMismatch} from '../../src/stages/detectors/tech-stack-mismatch.js'; +import {runDrift} from '../../src/stages/drift.js'; function writeSpec(dir: string, language: string): void { writeFileSync( @@ -91,12 +100,27 @@ describe('TECH_STACK_MISMATCH detector', () => { writeFileSync(join(dir, '.cladding', 'config.yaml'), `gate:\n language: ${language}\n`); } - test('a matching gate.language declaration silences the manifest mismatch', () => { + test('a matching gate.language declaration overrides the manifest, and says so at info', () => { // The manifest chain would say typescript (package.json), but the product // language is declared — the exact repo shape the escape hatch exists for. + // The override must not fail the gate, and must not be silent either. writeSpec(dir, 'cpp'); writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); declareLanguage('cpp'); + const findings = techStackMismatch.run({cwd: dir}); + expect(findings).toHaveLength(1); + expect(findings[0].severity).toBe('info'); + expect(findings[0].message).toContain("declares 'cpp'"); + expect(findings[0].message).toContain("detects 'typescript'"); + expect(findings[0].message).toContain('in force'); + }); + + test('a declaration agreeing with the manifest emits nothing at all', () => { + // Nothing was overridden, so there is nothing to disclose — the info line + // marks a real override, not merely the presence of a declaration. + writeSpec(dir, 'typescript'); + writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + declareLanguage('typescript'); expect(techStackMismatch.run({cwd: dir})).toEqual([]); }); @@ -114,9 +138,22 @@ describe('TECH_STACK_MISMATCH detector', () => { test('a matching declaration also covers the no-manifest case (no info fallback)', () => { // With a declaration the cross-check has an anchor even when no manifest - // matches, so the "cannot be cross-checked" info is not emitted. + // matches, so neither the "cannot be cross-checked" info nor an override + // disclosure is emitted — there is no manifest verdict to contradict. writeSpec(dir, 'cpp'); declareLanguage('cpp'); expect(techStackMismatch.run({cwd: dir})).toEqual([]); }); + + test('the override disclosure never fails a strict gate', () => { + // info is the whole point: a waiver that blocks is not a waiver, and a + // waiver nobody can see is indistinguishable from a forgotten one. + writeSpec(dir, 'cpp'); + writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + declareLanguage('cpp'); + const report = runDrift({cwd: dir, strict: true}); + const mine = report.findings.filter((f) => f.detector === 'TECH_STACK_MISMATCH'); + expect(mine).toHaveLength(1); + expect(mine[0].severity).toBe('info'); + }); }); From 24e69ae350a88a0eb9e13861f5c8612c41a509fc Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 12:25:18 +0900 Subject: [PATCH 3/3] docs(toolchain): state the override disclosure's real reach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A simulation against both versions showed the claim was wrong, not the code. The gate's terminal renderer surfaces errors, else warns — info is never in that set — and SARIF excludes info by contract, so "legible in every gate log" described a line that never appears in one. The record reaches `clad check --json` and clad_run_check(verbose), which is an auditor's surface, not the developer's screen. Measured, not assumed: with a declaration in force over a differing manifest, the pre-change detector returns nothing at all and this one returns the info finding, in JSON, in both the legitimate build-host case and the stale-declaration case — it records that an override happened, and deliberately does not claim to tell those two apart. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 2 +- spec/attestation.yaml | 6 +++--- .../toolchain-language-declaration-d14f3cb0.yaml | 8 +++++--- src/stages/detectors/tech-stack-mismatch.ts | 11 +++++++---- tests/stages/tech-stack-mismatch.test.ts | 6 ++++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23eaafcd..2c29df58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ### Added -- **`gate.language` in `.cladding/config.yaml` — a declared language label for the spec cross-check.** The manifest chain reads build orchestration, so a repository whose product language differs from its build host — a C++ SDK driven by Gradle, a Rust core shipped through npm — is mislabelled by construction, and the only way to green `TECH_STACK_MISMATCH` used to be rewriting `spec.yaml` to adopt the mislabel. Declaring the language keeps the spec truthful: the detector cross-checks `spec.project.language` against the declaration instead of the heuristic, and still warns when those two disagree, so the check keeps its teeth. Because nothing mechanical separates a legitimate build-host mismatch from a declaration left behind by a real port, the override is never silent — when the declaration and the manifest disagree, the gate log says which label is in force and what the manifest saw, at a severity that never blocks. +- **`gate.language` in `.cladding/config.yaml` — a declared language label for the spec cross-check.** The manifest chain reads build orchestration, so a repository whose product language differs from its build host — a C++ SDK driven by Gradle, a Rust core shipped through npm — is mislabelled by construction, and the only way to green `TECH_STACK_MISMATCH` used to be rewriting `spec.yaml` to adopt the mislabel. Declaring the language keeps the spec truthful: the detector cross-checks `spec.project.language` against the declaration instead of the heuristic, and still warns when those two disagree, so the check keeps its teeth. Because nothing mechanical separates a legitimate build-host mismatch from a declaration left behind by a real port, the override records what it did: when the declaration and the manifest disagree, `clad check --json` reports which label is in force and what the manifest saw. It is deliberately an info-severity finding, so it never blocks the gate — and it does not appear in the gate's terminal output either, which renders only error and warn. It is there for whoever audits why a repository is green, not for the terminal. ## [0.9.4] — Live host health and reproducible verification (2026-08-10) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 2f11a3f2..a9c17dad 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -23,7 +23,7 @@ attested_modules: .claude/settings.json: 08a64351770badf4 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: 5fa4601f2c98f803 + CHANGELOG.md: ea89859acf7a5c8e CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 README.html: a546de3f4e35e8d9 @@ -308,7 +308,7 @@ attested_modules: src/stages/detectors/stale-specification.ts: 0fe84db592fd406d src/stages/detectors/stale-tests.ts: caf59404d1282201 src/stages/detectors/status-drift.ts: 9cc5cf3f9b62ea00 - src/stages/detectors/tech-stack-mismatch.ts: 2963e9c52507f3c5 + src/stages/detectors/tech-stack-mismatch.ts: 4d30536083bc0b23 src/stages/detectors/unmapped-artifact.ts: b29f7e277d8187ae src/stages/detectors/untested-ac.ts: 90725ef1fc9245d8 src/stages/detectors/unverified-ac.ts: 6887c4d699afaad5 @@ -433,7 +433,7 @@ attested_modules: tests/stages/stale-specification.test.ts: 09bd06db377d890c tests/stages/stale-tests.test.ts: 1467ceedb8019e86 tests/stages/status-drift.test.ts: cff1092eeb23c268 - tests/stages/tech-stack-mismatch.test.ts: 54fab0c842daafb5 + tests/stages/tech-stack-mismatch.test.ts: 5d74729c79fc9a40 tests/stages/toolchain.test.ts: 200184f572abcf88 tests/stages/toolchain/gate-config.test.ts: 97b2b75488b327af tests/stages/type.test.ts: b57cf7455cae3b32 diff --git a/spec/features/toolchain-language-declaration-d14f3cb0.yaml b/spec/features/toolchain-language-declaration-d14f3cb0.yaml index c754508c..a6302f1b 100644 --- a/spec/features/toolchain-language-declaration-d14f3cb0.yaml +++ b/spec/features/toolchain-language-declaration-d14f3cb0.yaml @@ -34,14 +34,16 @@ acceptance_criteria: ears: event condition: "when a declaration in force overrides a differing manifest verdict" action: "emit one info finding naming the declaration, the manifest verdict, and that the declaration is in force" - response: "the waiver is legible in every gate log and never fails the gate, including under --strict" + response: "the override is recoverable from the machine-readable surfaces (`clad check --json`, clad_run_check verbose) and never fails the gate, including under --strict" text: "When a declaration overrides a differing manifest verdict, the system shall disclose the override at info severity rather than returning no finding." notes: | ## Why Nothing mechanical separates a legitimate build-host mismatch from a declaration that went stale after a real port, so the override is a - waiver. A silent waiver and a forgotten one are indistinguishable in a - gate log; info keeps it readable without giving it blocking power. + waiver. Without a finding it leaves no trace at all. Info is the + machine-readable channel only — the gate's terminal output renders + error and warn, and SARIF excludes info by contract — so this buys an + auditor a record, not a prompt to the developer at the terminal. test_refs: - "tests/stages/tech-stack-mismatch.test.ts#a matching gate.language declaration overrides the manifest, and says so at info" - "tests/stages/tech-stack-mismatch.test.ts#the override disclosure never fails a strict gate" diff --git a/src/stages/detectors/tech-stack-mismatch.ts b/src/stages/detectors/tech-stack-mismatch.ts index 8a1fb347..d70e626a 100644 --- a/src/stages/detectors/tech-stack-mismatch.ts +++ b/src/stages/detectors/tech-stack-mismatch.ts @@ -18,10 +18,13 @@ // A declaration overrides the manifest for the pass/fail decision, which is // exactly what makes it a waiver — nothing mechanical can tell a legitimate // build-host mismatch from a declaration that went stale after a real port. -// So the override is never silent: when the declaration and the manifest -// disagree, the detector says so at info severity (never gate-failing, even -// under --strict) rather than returning nothing. An invisible waiver and a -// forgotten one look identical in a gate log; this one is readable. +// So the override leaves a record: when the declaration and the manifest +// disagree, the detector says so at info severity rather than returning +// nothing. Info is the machine-readable channel — `clad check --json` and +// clad_run_check(verbose) carry it; the gate's terminal output renders only +// error and warn, and SARIF drops info by contract. That is the intended +// reach: a waiver should cost an auditor one flag to find, not block the +// gate and not add a line every developer reads past. import {detectToolchain} from '../toolchain/detect.js'; import {readGateConfig} from '../toolchain/gate-config.js'; diff --git a/tests/stages/tech-stack-mismatch.test.ts b/tests/stages/tech-stack-mismatch.test.ts index 0697d51e..58c055dc 100644 --- a/tests/stages/tech-stack-mismatch.test.ts +++ b/tests/stages/tech-stack-mismatch.test.ts @@ -146,8 +146,10 @@ describe('TECH_STACK_MISMATCH detector', () => { }); test('the override disclosure never fails a strict gate', () => { - // info is the whole point: a waiver that blocks is not a waiver, and a - // waiver nobody can see is indistinguishable from a forgotten one. + // info is the whole point: a waiver that blocks is not a waiver. Info is + // also the reach limit — the gate's terminal output renders only error + // and warn, so this record is for --json / verbose consumers, not the + // developer's screen. Asserting through runDrift keeps that honest. writeSpec(dir, 'cpp'); writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); declareLanguage('cpp');